Compare commits
144 Commits
f13ce7886d
...
release-20
| Author | SHA1 | Date | |
|---|---|---|---|
| 37d92b9dea | |||
| 6d85686270 | |||
| 0656cabe4a | |||
| d3e09b1cb9 | |||
|
|
72a8a318cf | ||
|
|
943aa3842a | ||
|
|
25da381c4e | ||
|
|
0e06403528 | ||
| 88a0a5616b | |||
| 9a086b86cd | |||
| f5746394fa | |||
|
|
d4e2bed039 | ||
| 16a9bcfbd8 | |||
| 9674374fad | |||
|
|
8be8964eff | ||
|
|
2af46a38b1 | ||
|
|
e2e9b18503 | ||
| e1105dae89 | |||
|
|
f5a9d171e0 | ||
| a3752fe7b9 | |||
|
|
5ef97c4da7 | ||
|
|
d82d91aec5 | ||
|
|
a123ea05e8 | ||
|
|
7a429deb99 | ||
|
|
8530f424c9 | ||
|
|
667dc58dc1 | ||
|
|
884075d3f2 | ||
|
|
5857fe4171 | ||
|
|
9436ea8942 | ||
|
|
bd58fd716a | ||
|
|
0a2d1a1f32 | ||
| 7fc365ce4c | |||
| 54a61ec5d5 | |||
| c3e3139100 | |||
| 2536dc9528 | |||
| 81db304e16 | |||
|
|
4582db201a | ||
|
|
90928754d9 | ||
|
|
8ba9609276 | ||
| 2bccdd7177 | |||
| eddfc26a45 | |||
|
|
b2839ed1d5 | ||
|
|
a1ebf5b065 | ||
|
|
df88450bab | ||
| a8693e77cc | |||
| 0b6e90acb7 | |||
| c3bbf9073a | |||
|
|
64ad185fc4 | ||
| 28f13a5db3 | |||
| a6782b4fa1 | |||
|
|
5344c76cac | ||
| b92b1eaf2c | |||
|
|
7f941fab86 | ||
| bb7ddf9779 | |||
| 64f73ae06b | |||
| 213da81bc8 | |||
|
|
3cf4edd7a9 | ||
|
|
e4c72ce901 | ||
| 7bbb0c1026 | |||
| 5145ba52cb | |||
| 3c7331ffa0 | |||
| 5bc82c1f5c | |||
| 094b8774e3 | |||
| cd4d535d74 | |||
| add23214ac | |||
| 3e4256ada0 | |||
|
|
b31ed69e15 | ||
|
|
85a1032c55 | ||
|
|
3bf191ed3f | ||
| 6ad8d9730e | |||
| f03c5a9cf8 | |||
| 86ee8461b5 | |||
| 40b8931ee2 | |||
| 63fed8b70b | |||
| bd6dcedc0f | |||
|
|
08ca5c48f0 | ||
| 2b6da03ab6 | |||
|
|
9d9054a75d | ||
| e8b8ce0e9a | |||
| 04437369c1 | |||
| 3c2f46b008 | |||
|
|
f392e43ae7 | ||
| deefdeba9d | |||
| 87c7c8b0d2 | |||
|
|
93935285cf | ||
|
|
3ead9b1806 | ||
|
|
d25f9e29aa | ||
|
|
68546551e0 | ||
|
|
6d6654fa93 | ||
|
|
afe7b1fa6b | ||
|
|
d5d108db26 | ||
| d29ca3f02a | |||
| 233ca2115b | |||
| cc812cf1d3 | |||
| 4d18d698df | |||
| ddf504fa25 | |||
| efce3f5efb | |||
| d3211af9ae | |||
| c4bd46747a | |||
| 801ddb0a20 | |||
|
|
b444ecdbe0 | ||
|
|
c822959a24 | ||
| a389a7c5cd | |||
| 444c07cb1d | |||
|
|
468d48609f | ||
|
|
7cb90dfee8 | ||
|
|
e43757c4a1 | ||
| 23e0017055 | |||
|
|
2a73036bc1 | ||
| 381c29794c | |||
| 8cf6ff1b2e | |||
| 909de11633 | |||
|
|
1c87c592b6 | ||
|
|
8fcc86bd94 | ||
|
|
95e5d01849 | ||
|
|
704e8d38a4 | ||
|
|
071390df34 | ||
| 0cf0643205 | |||
| 8b6e866129 | |||
|
|
a4321e6a1c | ||
| 166be502a5 | |||
| 463f58b69e | |||
|
|
b4a3443c4c | ||
| 80826ea6dc | |||
| 6299928120 | |||
| cb6b757c38 | |||
| dd20dd53eb | |||
| 149857442d | |||
| 89d95daa2e | |||
| f77da89aaa | |||
| 80f670065e | |||
| c95046c600 | |||
| 7d48faca11 | |||
|
|
c0acba8180 | ||
|
|
d53e286b7e | ||
|
|
b0fd44e8e1 | ||
|
|
2aa351e43c | ||
| a22f698620 | |||
| 9a4fb743a7 | |||
|
|
84b0c166f2 | ||
|
|
e4dfe062d5 | ||
|
|
849cf4c03e | ||
|
|
8efaf2e92f | ||
|
|
cd88956a43 |
@@ -1,6 +0,0 @@
|
||||
BLADE_PROFILES_ACTIVE=test
|
||||
BLADE_OAUTH2_PUBLIC_KEY=国密公钥需自行填写
|
||||
BLADE_OAUTH2_PRIVATE_KEY=国密私钥需自行填写
|
||||
BLADE_TOKEN_SIGN_KEY=令牌密钥需自行填写
|
||||
HOST_IP=宿主机IP需自行填写
|
||||
MYSQL_ROOT_PASSWORD=MYSQL的ROOT密码需自行填写
|
||||
@@ -1,6 +0,0 @@
|
||||
## 一键部署流程
|
||||
1. 将开发完毕的数据库脚本放入`database`目录下,重命名为`init.sql`, 提前修改好`admin`的密码。
|
||||
2. 将`.env`文件内所需的内容填充完整,注意`publicKey`需要与前端配置保持一致。
|
||||
3. 将前端工程配置好`publicKey`后打包,将打包后的文件放入`nginx/html`目录下。
|
||||
4. 生产环境需采用`prod`模式启动,将会强制校验弱密码,未修改`admin`密码将会无法登陆。
|
||||
5. 执行`docker compose up -d`命令启动容器即可。
|
||||
File diff suppressed because one or more lines are too long
@@ -1,114 +0,0 @@
|
||||
# 定义网络配置
|
||||
networks:
|
||||
blade_net:
|
||||
driver: bridge # 使用 bridge 驱动,创建一个桥接网络
|
||||
ipam: # IP 地址管理配置
|
||||
config:
|
||||
- subnet: 172.30.0.0/16 # 定义子网,IP 范围从 172.30.0.0 到 172.30.255.255
|
||||
|
||||
# 定义服务配置
|
||||
services:
|
||||
# BladeX 后端 服务,提供BladeX平台业务功能
|
||||
blade-api:
|
||||
image: blade/blade-api:4.8.0.RELEASE
|
||||
container_name: blade-api
|
||||
restart: unless-stopped
|
||||
environment:
|
||||
# OAuth2 公钥,用于身份验证
|
||||
- BLADE_OAUTH2_PUBLIC_KEY=${BLADE_OAUTH2_PUBLIC_KEY}
|
||||
# OAuth2 私钥,用于验签解码
|
||||
- BLADE_OAUTH2_PRIVATE_KEY=${BLADE_OAUTH2_PRIVATE_KEY}
|
||||
# BladeX 密钥,用于Token签名
|
||||
- BLADE_TOKEN_SIGN_KEY=${BLADE_TOKEN_SIGN_KEY}
|
||||
# 时区设置
|
||||
- TZ=Asia/Shanghai
|
||||
ports:
|
||||
- 8000:80 # 映射 80 端口到主机的 8000 端口
|
||||
command:
|
||||
- --spring.profiles.active=${BLADE_PROFILES_ACTIVE} # 设置系统启动模式
|
||||
- --social.domain=http://${HOST_IP}:2888 # 设置第三方登录跳转域名
|
||||
depends_on:
|
||||
- blade-db # 依赖数据库
|
||||
- blade-oss # 依赖对象存储
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.80
|
||||
|
||||
# MySQL 数据库服务
|
||||
blade-db:
|
||||
image: mysql:8.3.0
|
||||
container_name: blade-db
|
||||
restart: unless-stopped
|
||||
security_opt:
|
||||
- seccomp:unconfined # 禁用 seccomp 安全配置,允许更多操作
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 时区设置
|
||||
- MYSQL_CHARSET=utf8mb4 # 设置字符集为 utf8mb4
|
||||
- MYSQL_COLLATION=utf8mb4_unicode_ci # 设置排序规则为 utf8mb4_unicode_ci
|
||||
- MYSQL_ROOT_PASSWORD=${MYSQL_ROOT_PASSWORD} # 数据库 root 密码
|
||||
- MYSQL_USER=bladexadmin
|
||||
- MYSQL_PASSWORD=bladexadmin
|
||||
- MYSQL_DATABASE=bladex_boot
|
||||
ports:
|
||||
- 13306:3306 # 映射 MySQL 服务端口
|
||||
volumes:
|
||||
- ./data/mysql:/var/lib/mysql # 持久化 MySQL 数据
|
||||
- ./database/init.sql:/docker-entrypoint-initdb.d/init.sql # 挂载 SQL 初始化脚本
|
||||
command: --lower_case_table_names=1 # 添加忽略大小写配置
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.33
|
||||
|
||||
# Redis 服务,用于缓存
|
||||
blade-redis:
|
||||
image: redis:7.2.5
|
||||
container_name: blade-redis
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 时区设置
|
||||
ports:
|
||||
- 16379:6379 # 映射 Redis 默认端口
|
||||
command: redis-server --appendonly yes --requirepass bladexadmin # 配置密码和持久化
|
||||
privileged: true
|
||||
restart: always
|
||||
volumes:
|
||||
- ./data/redis/data:/data # 持久化 Redis 数据
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.63
|
||||
|
||||
# MinIO 对象存储服务
|
||||
blade-oss:
|
||||
image: minio/minio:RELEASE.2021-04-22T15-44-28Z.hotfix.56647434e
|
||||
container_name: blade-oss
|
||||
restart: unless-stopped
|
||||
security_opt:
|
||||
- seccomp:unconfined
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 时区设置
|
||||
- MINIO_ACCESS_KEY=bladexadmin # 存储访问密钥
|
||||
- MINIO_SECRET_KEY=bladexadmin # 存储密钥
|
||||
ports:
|
||||
- 9000:9000 # 映射 MinIO 服务端口
|
||||
command: server /data --address '0.0.0.0:9000' # 启动 MinIO
|
||||
volumes:
|
||||
- ./data/minio/data:/data # 持久化数据
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.90
|
||||
|
||||
# Nginx 服务,用于反向代理和负载均衡
|
||||
blade-nginx:
|
||||
image: nginx:stable-alpine-perl
|
||||
container_name: blade-nginx
|
||||
environment:
|
||||
- TZ=Asia/Shanghai # 时区设置
|
||||
ports:
|
||||
- 2888:2888 # 映射端口
|
||||
volumes:
|
||||
- ./nginx/html:/usr/share/nginx/html # 持久化 Nginx 网页数据
|
||||
- ./nginx/nginx.conf:/etc/nginx/nginx.conf # 持久化 Nginx 配置
|
||||
privileged: true
|
||||
restart: always
|
||||
networks:
|
||||
blade_net:
|
||||
ipv4_address: 172.30.0.18
|
||||
@@ -1,46 +0,0 @@
|
||||
<!DOCTYPE html>
|
||||
<html lang='en'>
|
||||
|
||||
<head>
|
||||
<meta charset='UTF-8' />
|
||||
<meta http-equiv='Content-Type' content='text/html; charset=utf-8'>
|
||||
<meta http-equiv='X-UA-Compatible' content='IE=edge'>
|
||||
<meta http-equiv='X-UA-Compatible' content='chrome=1' />
|
||||
<meta name='renderer' content='webkit'>
|
||||
<meta name='viewport' content='width=device-width,initial-scale=1.0,maximum-scale=1.0,user-scalable=0'>
|
||||
<meta name='apple-mobile-web-app-capable' content='yes'>
|
||||
<meta name='apple-mobile-web-app-status-bar-style' content='black'>
|
||||
<meta name='format-detection' content='telephone=no'>
|
||||
<link rel='icon' href='/favicon.png' />
|
||||
<link rel='stylesheet' href='/iconfont/index.css'>
|
||||
<link rel='stylesheet' href='/iconfont/avue/iconfont.css'>
|
||||
<link rel='stylesheet' href='/iconfont/saber/iconfont.css'>
|
||||
<link rel='stylesheet' href='/iconfont/common/iconfont.css'>
|
||||
<link rel='stylesheet' href='/css/loading.css'>
|
||||
<link rel='stylesheet' href='/css/saber.css'>
|
||||
<title>BladeX微服务开发平台</title>
|
||||
<script type="module" crossorigin src="/assets/index-DpW_RhWM.js"></script>
|
||||
<link rel="modulepreload" crossorigin href="/assets/element-plus-BIeOjcXi.js">
|
||||
<link rel="modulepreload" crossorigin href="/assets/@smallwei/avue-vR-k9VHw.js">
|
||||
<link rel="stylesheet" crossorigin href="/assets/index-BsjWj5lr.css">
|
||||
</head>
|
||||
|
||||
<body>
|
||||
<div id='app'>
|
||||
<div id='loader-wrapper'>
|
||||
<div class='loader-box'>
|
||||
<span>BladeX</span>
|
||||
<span>微</span>
|
||||
<span>服</span>
|
||||
<span>务</span>
|
||||
<span>开</span>
|
||||
<span>发</span>
|
||||
<span>平</span>
|
||||
<span>台</span>
|
||||
</div>
|
||||
<div class='loader-title'>系统加载中</div>
|
||||
</div>
|
||||
</div>
|
||||
</body>
|
||||
|
||||
</html>
|
||||
@@ -1,77 +0,0 @@
|
||||
|
||||
user root;
|
||||
worker_processes 1;
|
||||
|
||||
error_log /var/log/nginx/error.log warn;
|
||||
pid /var/run/nginx.pid;
|
||||
|
||||
|
||||
events {
|
||||
worker_connections 1024;
|
||||
}
|
||||
|
||||
|
||||
http {
|
||||
include /etc/nginx/mime.types;
|
||||
default_type application/octet-stream;
|
||||
|
||||
log_format main '$remote_addr - $remote_user [$time_local] "$request" '
|
||||
'$status $body_bytes_sent "$http_referer" '
|
||||
'"$http_user_agent" "$http_x_forwarded_for"';
|
||||
|
||||
access_log /var/log/nginx/access.log main;
|
||||
|
||||
sendfile on;
|
||||
#tcp_nopush on;
|
||||
|
||||
keepalive_timeout 65;
|
||||
|
||||
#gzip on;
|
||||
|
||||
#include /etc/nginx/conf.d/*.conf;
|
||||
|
||||
upstream gateway {
|
||||
server blade-api;
|
||||
}
|
||||
|
||||
server {
|
||||
listen 2888;
|
||||
server_name web;
|
||||
root /usr/share/nginx/html;
|
||||
|
||||
gzip on;
|
||||
gzip_min_length 1k;
|
||||
gzip_buffers 4 16k;
|
||||
gzip_http_version 1.1;
|
||||
gzip_comp_level 2;
|
||||
gzip_types text/plain application/javascript application/x-javascript text/javascript text/css application/xml;
|
||||
gzip_vary on;
|
||||
gzip_proxied expired no-cache no-store private auth;
|
||||
gzip_disable "MSIE [1-6]\.";
|
||||
|
||||
location /{
|
||||
index index.html;
|
||||
error_page 404 /index.html;
|
||||
}
|
||||
|
||||
location ~ ^/(api/)?actuator {
|
||||
return 403;
|
||||
}
|
||||
|
||||
location ^~ /oauth/redirect {
|
||||
try_files $uri /index.html;
|
||||
}
|
||||
|
||||
location ^~ /api/ {
|
||||
proxy_redirect off;
|
||||
proxy_set_header Host $host;
|
||||
proxy_set_header X-Real-IP $remote_addr;
|
||||
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
|
||||
proxy_buffering off;
|
||||
rewrite ^/api/(.*)$ /$1 break;
|
||||
proxy_pass http://gateway/;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
## 一、调整内存:max virtual memory areas vm.max_map_count [65530] is too low, increase to at least [262144](elasticsearch用户拥有的内存权限太小,至少需要262144)
|
||||
|
||||
#### 1.修改配置sysctl.conf
|
||||
[root@localhost ~]# vi /etc/sysctl.conf
|
||||
#### 2.添加下面配置:
|
||||
vm.max_map_count=262144
|
||||
#### 3.重新加载:
|
||||
[root@localhost ~]# sysctl -p
|
||||
#### 4.最后重新启动elasticsearch,即可启动成功。
|
||||
|
||||
|
||||
## 二、Docker 命令自动补全
|
||||
#### 1.安装依赖工具bash-complete
|
||||
[root@localhost ~]# yum install -y bash-completion
|
||||
|
||||
[root@localhost ~]# source /usr/share/bash-completion/completions/docker
|
||||
|
||||
[root@localhost ~]# source /usr/share/bash-completion/bash_completion
|
||||
|
||||
## 三、将本文件夹内的文件拷贝至服务器
|
||||
#### 1.对sh脚本赋予执行权限
|
||||
|
||||
#### 2.执行 ./deploy.sh
|
||||
|
||||
#### 3.等待服务启动完毕即可
|
||||
|
||||
#### 4.卸载执行 ./undeploy.sh
|
||||
@@ -1,88 +0,0 @@
|
||||
#./bin/bash
|
||||
# 定义颜色
|
||||
BLUE_COLOR="\033[36m"
|
||||
RED_COLOR="\033[31m"
|
||||
GREEN_COLOR="\033[32m"
|
||||
VIOLET_COLOR="\033[35m"
|
||||
RES="\033[0m"
|
||||
|
||||
echo -e "${BLUE_COLOR}# ######################################################################${RES}"
|
||||
echo -e "${BLUE_COLOR}# Docker ELK Deploy Script #${RES}"
|
||||
echo -e "${BLUE_COLOR}# ######################################################################${RES}"
|
||||
|
||||
# 创建目录
|
||||
echo -e "${BLUE_COLOR}---> create [elasticsearch]directory start.${RES}"
|
||||
if [ ! -d "./elasticsearch/" ]; then
|
||||
mkdir -p ./elasticsearch/master/conf ./elasticsearch/master/data ./elasticsearch/master/logs \
|
||||
./elasticsearch/slave1/conf ./elasticsearch/slave1/data ./elasticsearch/slave1/logs \
|
||||
./elasticsearch/slave2/conf ./elasticsearch/slave2/data ./elasticsearch/slave2/logs
|
||||
fi
|
||||
|
||||
echo -e "${RED_COLOR}---> create [kibana]directory start.${RES}"
|
||||
if [ ! -d "./kibana/" ]; then
|
||||
mkdir -p ./kibana/conf ./kibana/logs
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}---> create [logstash]directory start.${RES}"
|
||||
if [ ! -d "./logstash/" ]; then
|
||||
mkdir -p ./logstash/conf ./logstash/logs
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}---> create [filebeat]directory start.${RES}"
|
||||
if [ ! -d "./filebeat/" ]; then
|
||||
mkdir -p ./filebeat/conf ./filebeat/logs ./filebeat/data
|
||||
fi
|
||||
|
||||
echo -e "${VIOLET_COLOR}---> create [nginx]directory start.${RES}"
|
||||
if [ ! -d "./nginx/" ]; then
|
||||
mkdir -p ./nginx/conf ./nginx/logs ./nginx/www
|
||||
fi
|
||||
echo -e "${BLUE_COLOR}===> create directory success.${RES}"
|
||||
|
||||
# 目录授权(data/logs 都要授读/写权限)
|
||||
echo -e "${BLUE_COLOR}---> directory authorize start.${RES}"
|
||||
if [ -d "./elasticsearch/" ]; then
|
||||
chmod 777 ./elasticsearch/master/data/ ./elasticsearch/master/logs/ \
|
||||
./elasticsearch/slave1/data/ ./elasticsearch/slave1/logs/ \
|
||||
./elasticsearch/slave2/data/ ./elasticsearch/slave2/logs
|
||||
fi
|
||||
|
||||
if [ -d "./filebeat/" ]; then
|
||||
chmod 777 ./filebeat/data/ ./filebeat/logs/
|
||||
fi
|
||||
echo -e "${BLUE_COLOR}===> directory authorize success.${RES}"
|
||||
|
||||
# 移动配置文件
|
||||
echo -e "${BLUE_COLOR}---> move [elasticsearch]config file start.${RES}"
|
||||
if [ -f "./es-master.yml" ] && [ -f "./es-slave1.yml" ] && [ -f "./es-slave2.yml" ]; then
|
||||
mv ./es-master.yml ./elasticsearch/master/conf
|
||||
mv ./es-slave1.yml ./elasticsearch/slave1/conf
|
||||
mv ./es-slave2.yml ./elasticsearch/slave2/conf
|
||||
fi
|
||||
|
||||
echo -e "${RED_COLOR}---> move [kibana]config file start.${RES}"
|
||||
if [ -f "./kibana.yml" ]; then
|
||||
mv ./kibana.yml ./kibana/conf
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}---> move [logstash]config file start.${RES}"
|
||||
if [ -f "./logstash.yml" ] && [ -f "./logstash-filebeat.conf" ]; then
|
||||
mv ./logstash-filebeat.conf ./logstash/conf
|
||||
mv ./logstash.yml ./logstash/conf
|
||||
fi
|
||||
|
||||
echo -e "${GREEN_COLOR}---> move [filebeat]config file start.${RES}"
|
||||
if [ -f "./filebeat.yml" ]; then
|
||||
mv ./filebeat.yml ./filebeat/conf
|
||||
fi
|
||||
|
||||
echo -e "${VIOLET_COLOR}---> move [nginx]config file start.${RES}"
|
||||
if [ -f "./nginx.conf" ]; then
|
||||
mv ./nginx.conf ./nginx/conf
|
||||
fi
|
||||
echo -e "${BLUE_COLOR}===> move config files success.${RES}"
|
||||
echo -e "${GREEN_COLOR}>>>>>>>>>>>>>>>>>> The End <<<<<<<<<<<<<<<<<<${RES}"
|
||||
|
||||
# 部署项目
|
||||
echo -e "${BLUE_COLOR}==================> Docker deploy Start <==================${RES}"
|
||||
docker-compose up --build -d
|
||||
@@ -1,115 +0,0 @@
|
||||
version: "3"
|
||||
services:
|
||||
es-master:
|
||||
container_name: es-master
|
||||
hostname: es-master
|
||||
image: elasticsearch:7.1.1
|
||||
restart: always
|
||||
ports:
|
||||
- 9200:9200
|
||||
- 9300:9300
|
||||
volumes:
|
||||
- ./elasticsearch/master/conf/es-master.yml:/usr/share/elasticsearch/config/elasticsearch.yml
|
||||
- ./elasticsearch/master/data:/usr/share/elasticsearch/data
|
||||
- ./elasticsearch/master/logs:/usr/share/elasticsearch/logs
|
||||
environment:
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
|
||||
es-slave1:
|
||||
container_name: es-slave1
|
||||
image: elasticsearch:7.1.1
|
||||
restart: always
|
||||
ports:
|
||||
- 9201:9200
|
||||
- 9301:9300
|
||||
volumes:
|
||||
- ./elasticsearch/slave1/conf/es-slave1.yml:/usr/share/elasticsearch/config/elasticsearch.yml
|
||||
- ./elasticsearch/slave1/data:/usr/share/elasticsearch/data
|
||||
- ./elasticsearch/slave1/logs:/usr/share/elasticsearch/logs
|
||||
environment:
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
|
||||
es-slave2:
|
||||
container_name: es-slave2
|
||||
image: elasticsearch:7.1.1
|
||||
restart: always
|
||||
ports:
|
||||
- 9202:9200
|
||||
- 9302:9300
|
||||
volumes:
|
||||
- ./elasticsearch/slave2/conf/es-slave2.yml:/usr/share/elasticsearch/config/elasticsearch.yml
|
||||
- ./elasticsearch/slave2/data:/usr/share/elasticsearch/data
|
||||
- ./elasticsearch/slave2/logs:/usr/share/elasticsearch/logs
|
||||
environment:
|
||||
- "ES_JAVA_OPTS=-Xms512m -Xmx512m"
|
||||
|
||||
es-head:
|
||||
container_name: es-head
|
||||
image: mobz/elasticsearch-head:5
|
||||
restart: always
|
||||
ports:
|
||||
- 9100:9100
|
||||
depends_on:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
|
||||
kibana:
|
||||
container_name: kibana
|
||||
hostname: kibana
|
||||
image: kibana:7.1.1
|
||||
restart: always
|
||||
ports:
|
||||
- 5601:5601
|
||||
volumes:
|
||||
- ./kibana/conf/kibana.yml:/usr/share/kibana/config/kibana.yml
|
||||
environment:
|
||||
- elasticsearch.hosts=http://es-master:9200
|
||||
depends_on:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
|
||||
filebeat:
|
||||
# 容器名称
|
||||
container_name: filebeat
|
||||
# 主机名称
|
||||
hostname: filebeat
|
||||
# 镜像
|
||||
image: docker.elastic.co/beats/filebeat:7.1.1
|
||||
# 重启机制
|
||||
restart: always
|
||||
# 持久化挂载
|
||||
volumes:
|
||||
- ./filebeat/conf/filebeat.yml:/usr/share/filebeat/filebeat.yml
|
||||
# 映射到容器中[作为数据源]
|
||||
- ./logs:/home/project/elk/logs
|
||||
- ./filebeat/logs:/usr/share/filebeat/logs
|
||||
- ./filebeat/data:/usr/share/filebeat/data
|
||||
# 将指定容器连接到当前连接,可以设置别名,避免ip方式导致的容器重启动态改变的无法连接情况
|
||||
links:
|
||||
- logstash
|
||||
ports:
|
||||
- 9000:9000
|
||||
# 依赖服务[可无]
|
||||
depends_on:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
|
||||
logstash:
|
||||
container_name: logstash
|
||||
hostname: logstash
|
||||
image: logstash:7.1.1
|
||||
command: logstash -f ./conf/logstash-filebeat.conf
|
||||
restart: always
|
||||
volumes:
|
||||
# 映射到容器中
|
||||
- ./logstash/conf/logstash-filebeat.conf:/usr/share/logstash/conf/logstash-filebeat.conf
|
||||
- ./logstash/conf/logstash.yml:/usr/share/logstash/config/logstash.yml
|
||||
ports:
|
||||
- 5044:5044
|
||||
depends_on:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
@@ -1,28 +0,0 @@
|
||||
# 集群名称
|
||||
cluster.name: es-cluster
|
||||
# 节点名称
|
||||
node.name: es-master
|
||||
# 是否可以成为master节点
|
||||
node.master: true
|
||||
# 是否允许该节点存储数据,默认开启
|
||||
node.data: false
|
||||
# 网络绑定
|
||||
network.host: 0.0.0.0
|
||||
# 设置对外服务的http端口
|
||||
http.port: 9200
|
||||
# 设置节点间交互的tcp端口
|
||||
transport.port: 9300
|
||||
# 集群发现
|
||||
discovery.seed_hosts:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
# 手动指定可以成为 mater 的所有节点的 name 或者 ip,这些配置将会在第一次选举中进行计算
|
||||
cluster.initial_master_nodes:
|
||||
- es-master
|
||||
# 支持跨域访问
|
||||
http.cors.enabled: true
|
||||
http.cors.allow-origin: "*"
|
||||
# 安全认证
|
||||
xpack.security.enabled: false
|
||||
#http.cors.allow-headers: "Authorization"
|
||||
@@ -1,28 +0,0 @@
|
||||
# 集群名称
|
||||
cluster.name: es-cluster
|
||||
# 节点名称
|
||||
node.name: es-slave1
|
||||
# 是否可以成为master节点
|
||||
node.master: true
|
||||
# 是否允许该节点存储数据,默认开启
|
||||
node.data: true
|
||||
# 网络绑定
|
||||
network.host: 0.0.0.0
|
||||
# 设置对外服务的http端口
|
||||
http.port: 9201
|
||||
# 设置节点间交互的tcp端口
|
||||
#transport.port: 9301
|
||||
# 集群发现
|
||||
discovery.seed_hosts:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
# 手动指定可以成为 mater 的所有节点的 name 或者 ip,这些配置将会在第一次选举中进行计算
|
||||
cluster.initial_master_nodes:
|
||||
- es-master
|
||||
# 支持跨域访问
|
||||
http.cors.enabled: true
|
||||
http.cors.allow-origin: "*"
|
||||
# 安全认证
|
||||
xpack.security.enabled: false
|
||||
#http.cors.allow-headers: "Authorization"
|
||||
@@ -1,28 +0,0 @@
|
||||
# 集群名称
|
||||
cluster.name: es-cluster
|
||||
# 节点名称
|
||||
node.name: es-slave2
|
||||
# 是否可以成为master节点
|
||||
node.master: true
|
||||
# 是否允许该节点存储数据,默认开启
|
||||
node.data: true
|
||||
# 网络绑定
|
||||
network.host: 0.0.0.0
|
||||
# 设置对外服务的http端口
|
||||
http.port: 9202
|
||||
# 设置节点间交互的tcp端口
|
||||
#transport.port: 9302
|
||||
# 集群发现
|
||||
discovery.seed_hosts:
|
||||
- es-master
|
||||
- es-slave1
|
||||
- es-slave2
|
||||
# 手动指定可以成为 mater 的所有节点的 name 或者 ip,这些配置将会在第一次选举中进行计算
|
||||
cluster.initial_master_nodes:
|
||||
- es-master
|
||||
# 支持跨域访问
|
||||
http.cors.enabled: true
|
||||
http.cors.allow-origin: "*"
|
||||
# 安全认证
|
||||
xpack.security.enabled: false
|
||||
#http.cors.allow-headers: "Authorization"
|
||||
@@ -1,37 +0,0 @@
|
||||
filebeat.inputs:
|
||||
- type: log
|
||||
enabled: true
|
||||
paths:
|
||||
# 当前目录下的所有.log文件
|
||||
- /home/project/elk/logs/*.log
|
||||
multiline.pattern: ^\[
|
||||
multiline.negate: true
|
||||
multiline.match: after
|
||||
- type: tcp
|
||||
enabled: true
|
||||
max_message_size: 10MiB
|
||||
host: "0.0.0.0:9000"
|
||||
|
||||
filebeat.config.modules:
|
||||
path: ${path.config}/modules.d/*.yml
|
||||
reload.enabled: false
|
||||
|
||||
setup.template.settings:
|
||||
index.number_of_shards: 1
|
||||
|
||||
setup.dashboards.enabled: false
|
||||
|
||||
setup.kibana:
|
||||
host: "http://kibana:5601"
|
||||
|
||||
# 不直接传输至ES
|
||||
#output.elasticsearch:
|
||||
# hosts: ["http://es-master:9200"]
|
||||
# index: "filebeat-%{[beat.version]}-%{+yyyy.MM.dd}"
|
||||
|
||||
output.logstash:
|
||||
hosts: ["logstash:5044"]
|
||||
|
||||
processors:
|
||||
- add_host_metadata: ~
|
||||
- add_cloud_metadata: ~
|
||||
@@ -1,8 +0,0 @@
|
||||
# 服务端口
|
||||
server.port: 5601
|
||||
# 服务IP
|
||||
server.host: "0.0.0.0"
|
||||
# ES
|
||||
elasticsearch.hosts: ["http://es-master:9200"]
|
||||
# 汉化
|
||||
i18n.locale: "zh-CN"
|
||||
@@ -1,23 +0,0 @@
|
||||
input {
|
||||
# 来源beats
|
||||
beats {
|
||||
# 端口
|
||||
port => "5044"
|
||||
}
|
||||
}
|
||||
# 分析、过滤插件,可以多个
|
||||
filter {
|
||||
grok {
|
||||
match => { "message" => "%{COMBINEDAPACHELOG}"}
|
||||
}
|
||||
geoip {
|
||||
source => "clientip"
|
||||
}
|
||||
}
|
||||
output {
|
||||
# 选择elasticsearch
|
||||
elasticsearch {
|
||||
hosts => ["http://es-master:9200"]
|
||||
index => "%{[@metadata][beat]}-%{[@metadata][version]}-%{+YYYY.MM.dd}"
|
||||
}
|
||||
}
|
||||
@@ -1,8 +0,0 @@
|
||||
# 服务IP
|
||||
http.host: "0.0.0.0"
|
||||
# ES
|
||||
xpack.monitoring.elasticsearch.hosts: [ "http://es-master:9200" ]
|
||||
|
||||
xpack.monitoring.enabled: true
|
||||
|
||||
xpack.management.enabled: false
|
||||
@@ -1,16 +0,0 @@
|
||||
#./bin/bash
|
||||
# 定义颜色
|
||||
BLUE_COLOR="\033[36m"
|
||||
RED_COLOR="\033[31m"
|
||||
GREEN_COLOR="\033[32m"
|
||||
VIOLET_COLOR="\033[35m"
|
||||
RES="\033[0m"
|
||||
|
||||
echo -e "${BLUE_COLOR}# ######################################################################${RES}"
|
||||
echo -e "${BLUE_COLOR}# Docker ELK UnDeploy Script #${RES}"
|
||||
echo -e "${BLUE_COLOR}# ######################################################################${RES}"
|
||||
|
||||
# 部署项目
|
||||
echo -e "${BLUE_COLOR}==================> Docker UnDeploy Start <==================${RES}"
|
||||
docker-compose stop
|
||||
docker-compose rm
|
||||
165
doc/sql/1_user_genealogy_post.sql
Normal file
165
doc/sql/1_user_genealogy_post.sql
Normal file
@@ -0,0 +1,165 @@
|
||||
create table user_market_genealogy
|
||||
(
|
||||
id int8 not null primary key, -- user_id
|
||||
level int4 default 1, --当前层数
|
||||
pid int8,
|
||||
root_id int8, --遍历当前树
|
||||
group_id int8, --树内最近团队长的id
|
||||
genealogy_list int8[], -- 往上所有父级
|
||||
user_child_number int, --用户下线总人数
|
||||
user_direct_number int, --用户直推总人数
|
||||
user_direct_list int8[], --直推列表
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1, -- 1: active -- 2: revoked (注销) -- 3: frozen (冻结)
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
CREATE INDEX idx_ug_pid ON user_market_genealogy (pid) WHERE status = 1;
|
||||
CREATE INDEX idx_ug_root ON user_market_genealogy (root_id) WHERE status = 1;
|
||||
CREATE INDEX idx_ug_root_level ON user_market_genealogy (root_id, level) WHERE status = 1;
|
||||
CREATE INDEX idx_ug_path ON user_market_genealogy USING gin (genealogy_list);
|
||||
CREATE INDEX idx_ug_direct ON user_market_genealogy USING gin (user_direct_list);
|
||||
|
||||
comment on table user_market_genealogy is '用户族谱表';
|
||||
comment on column user_market_genealogy.id is '主键';
|
||||
comment on column user_market_genealogy.pid is '上级id';
|
||||
comment on column user_market_genealogy.level is '层级';
|
||||
comment on column user_market_genealogy.root_id is '根节点id';
|
||||
comment on column user_market_genealogy.group_id is '团队长id';
|
||||
comment on column user_market_genealogy.genealogy_list is '族谱列表';
|
||||
comment on column user_market_genealogy.user_child_number is '用户下线总人数';
|
||||
comment on column user_market_genealogy.user_direct_number is '用户直推总人数';
|
||||
comment on column user_market_genealogy.user_direct_list is '直推列表';
|
||||
comment on column user_market_genealogy.create_user is '创建人';
|
||||
comment on column user_market_genealogy.create_dept is '创建部门';
|
||||
comment on column user_market_genealogy.create_time is '创建时间';
|
||||
comment on column user_market_genealogy.update_user is '修改人';
|
||||
comment on column user_market_genealogy.update_time is '修改时间';
|
||||
comment on column user_market_genealogy.status is '状态 -- 1: active -- 2: revoked (注销) -- 3: frozen (冻结)';
|
||||
comment on column user_market_genealogy.is_deleted is '是否已删除';
|
||||
alter table user_market_genealogy
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
|
||||
create table user_market_tree
|
||||
(
|
||||
id int8 not null primary key, --user_id
|
||||
level int4 default 1,
|
||||
pid int8,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1, -- 1: active -- 2: revoked (注销) -- 3: frozen (冻结)
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
CREATE INDEX idx_user_tree_pid ON user_market_tree (pid) WHERE status = 1;
|
||||
CREATE INDEX idx_user_tree_level ON user_market_tree (level) WHERE status = 1;
|
||||
|
||||
comment on table user_market_tree is '用户树结构表';
|
||||
comment on column user_market_tree.id is '主键';
|
||||
comment on column user_market_tree.pid is '上级id';
|
||||
comment on column user_market_tree.level is '层级';
|
||||
|
||||
comment on column user_market_tree.create_user is '创建人';
|
||||
comment on column user_market_tree.create_dept is '创建部门';
|
||||
comment on column user_market_tree.create_time is '创建时间';
|
||||
comment on column user_market_tree.update_user is '修改人';
|
||||
comment on column user_market_tree.update_time is '修改时间';
|
||||
comment on column user_market_tree.status is '状态';
|
||||
comment on column user_market_tree.is_deleted is '是否已删除';
|
||||
alter table user_market_tree
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
|
||||
create table user_market_info
|
||||
(
|
||||
id int8 not null primary key, --user_id
|
||||
pid int8,
|
||||
synchronized int4 default 0, --是否同步
|
||||
vendor int4 default 0, -- 是否成为服务商 0-否 1-是
|
||||
e_signed int4 default 0, -- 是否已经签署电子合同 0-否 1-是
|
||||
e_signed_url text, -- 电子合同地址
|
||||
verified int4 default 0, -- 是否实名用户 0-否 1-是
|
||||
verified_date timestamp(6), -- 实名时间
|
||||
real_name varchar(128), -- 实名姓名
|
||||
id_card varchar(128), -- 实名身份证
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1, -- 1: active -- 2: revoked (注销) -- 3: frozen (冻结)
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
|
||||
CREATE INDEX idx_user_market_pid ON user_market_info (pid) WHERE status = 1;
|
||||
|
||||
|
||||
comment on table user_market_info is '用户拓展信息表';
|
||||
|
||||
comment on column user_market_info.id is '主键';
|
||||
comment on column user_market_info.pid is '邀请人';
|
||||
comment on column user_market_info.synchronized is '是否同步族谱 0-否 1-是';
|
||||
comment on column user_market_info.vendor is '是否成为服务商 0-否 1-是';
|
||||
comment on column user_market_info.e_signed is '是否签署法大大协议 0-否 1-是';
|
||||
comment on column user_market_info.e_signed_url is '电子合同地址';
|
||||
comment on column user_market_info.verified is '是否实名用户 0-否 1-是';
|
||||
comment on column user_market_info.verified_date is '实名时间';
|
||||
comment on column user_market_info.real_name is '实名姓名';
|
||||
comment on column user_market_info.id_card is '实名身份证';
|
||||
comment on column user_market_info.create_user is '创建人';
|
||||
comment on column user_market_info.create_dept is '创建部门';
|
||||
comment on column user_market_info.create_time is '创建时间';
|
||||
comment on column user_market_info.update_user is '修改人';
|
||||
comment on column user_market_info.update_time is '修改时间';
|
||||
comment on column user_market_info.status is '状态';
|
||||
comment on column user_market_info.is_deleted is '是否已删除';
|
||||
alter table user_market_info owner to yicha1lu;
|
||||
|
||||
|
||||
|
||||
create table user_market_level_info
|
||||
(
|
||||
id int8 not null primary key, --user_id
|
||||
current_vip_id int4, --用户当前等级
|
||||
current_vip_name varchar(12), --用户当前等级
|
||||
pid int8,
|
||||
p_vip int4 default 1,
|
||||
version int4 default 1,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1, -- 1: active -- 2: revoked (注销) -- 3: frozen (冻结)
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
|
||||
CREATE INDEX idx_user_level_pid ON user_market_level_info (pid) WHERE status = 1;
|
||||
|
||||
comment on table user_market_level_info is '用户等级信息表';
|
||||
|
||||
comment on column user_market_level_info.id is '主键';
|
||||
comment on column user_market_level_info.current_vip_id is '用户当前升级id';
|
||||
comment on column user_market_level_info.current_vip_name is '用户当前升级名称';
|
||||
comment on column user_market_level_info.pid is '父级id';
|
||||
comment on column user_market_level_info.p_vip is '父级升级升级';
|
||||
comment on column user_market_level_info.version is '版本号';
|
||||
comment on column user_market_level_info.create_user is '创建人';
|
||||
comment on column user_market_level_info.create_dept is '创建部门';
|
||||
comment on column user_market_level_info.create_time is '创建时间';
|
||||
comment on column user_market_level_info.update_user is '修改人';
|
||||
comment on column user_market_level_info.update_time is '修改时间';
|
||||
comment on column user_market_level_info.status is '状态';
|
||||
comment on column user_market_level_info.is_deleted is '是否已删除';
|
||||
alter table user_market_level_info
|
||||
owner to yicha1lu;
|
||||
|
||||
254
doc/sql/2_package_info_postgres.sql
Normal file
254
doc/sql/2_package_info_postgres.sql
Normal file
@@ -0,0 +1,254 @@
|
||||
--- 用户积分 = user_point
|
||||
--- 现金券 = cash_coupon
|
||||
--- 福利包 = benefit_package
|
||||
--- 福利积分 = benefit_point
|
||||
--- 福利值 = benefit_value
|
||||
|
||||
CREATE TABLE user_market_benefit_package_template --积分包信息模板表
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
package_name VARCHAR(128) NULL,
|
||||
user_limit int4 default 0, -- 最大购买数量
|
||||
max_limit int4 default 0, -- 全网最大兑换数量
|
||||
day_limit int4 default 0, -- 产出总天数
|
||||
benefit_point_amount decimal(14, 2) default 0, -- 总产出福利积分
|
||||
benefit_value_amount decimal(14, 2) default 0, -- 购买赠与福利值
|
||||
benefit_point_price decimal(14, 2) default 0, --兑换包需要的福利积分
|
||||
cash_coupon_price decimal(14, 2) default 0, --兑换包需要的现金券
|
||||
exchanged_quantity int4 default 0, -- 已兑换数量
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1,
|
||||
is_deleted int4 default 0
|
||||
|
||||
);
|
||||
|
||||
COMMENT ON TABLE user_market_benefit_package_template IS '积分包信息表';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.id IS '主键';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.package_name IS '积分包名称';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.user_limit IS '最大购买数量';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.day_limit IS '产出总天数';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.benefit_point_amount IS '总产出福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.benefit_value_amount IS '购买赠与福利值';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.benefit_point_price IS '兑换包需要的福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.cash_coupon_price IS '兑换包需要的现金券';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.max_limit IS '全网最大兑换数量';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.exchanged_quantity IS '已兑换数量';
|
||||
comment on column user_market_benefit_package_template.create_user is '创建人';
|
||||
comment on column user_market_benefit_package_template.create_dept is '创建部门';
|
||||
comment on column user_market_benefit_package_template.create_time is '创建时间';
|
||||
comment on column user_market_benefit_package_template.update_user is '修改人';
|
||||
comment on column user_market_benefit_package_template.update_time is '修改时间';
|
||||
comment on column user_market_benefit_package_template.status is '状态';
|
||||
comment on column user_market_benefit_package_template.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_market_benefit_package_template
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
create table user_market_benefit_package --用户福利积分包表
|
||||
(
|
||||
id int8 not null primary key,
|
||||
statistical_date timestamp(6),
|
||||
user_id int8,
|
||||
phone int8,
|
||||
user_name varchar(128),
|
||||
package_id int8,
|
||||
package_name varchar(128),
|
||||
type int4 default 1, -- 1-积分兑换 2-后台划拨
|
||||
user_benefit decimal(14, 2) default 0, --兑换包需要的福利积分
|
||||
user_cash decimal(14, 2) default 0, --兑换包需要的现金券
|
||||
give_amount decimal(14, 2) default 0, -- 购买赠与福利值
|
||||
day_total int4 default 0, -- 产出总天数
|
||||
amount_total decimal(14, 2) default 0, -- 总产出福利积分
|
||||
amount_day decimal(14, 2) default 0, -- 每日产出福利积分 = 总产出 / 总产出
|
||||
amount_out decimal(16, 4) default 0, -- 已产出福利积分
|
||||
out_day int4 default 0, -- 已产出天数
|
||||
is_complete integer default 0, -- 是否完成 0未完成 1完成
|
||||
expired_date timestamp(6),
|
||||
is_expired int4 default 0,
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1,
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
|
||||
|
||||
|
||||
create index upi_complete_index
|
||||
on user_market_benefit_package (is_deleted, user_id, is_complete, is_expired);
|
||||
|
||||
create index upi_date_index
|
||||
on user_market_benefit_package (is_deleted, statistical_date, user_id);
|
||||
|
||||
create index upi_expired_index
|
||||
on user_market_benefit_package (is_deleted, expired_date, is_expired);
|
||||
|
||||
COMMENT ON TABLE user_market_benefit_package IS '用户积分包信息表';
|
||||
COMMENT ON COLUMN user_market_benefit_package.id IS '主键';
|
||||
COMMENT ON COLUMN user_market_benefit_package.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_market_benefit_package.phone IS '用户手机号';
|
||||
COMMENT ON COLUMN user_market_benefit_package.user_name IS '用户名';
|
||||
COMMENT ON COLUMN user_market_benefit_package.package_id IS '积分包id';
|
||||
COMMENT ON COLUMN user_market_benefit_package.package_name IS '积分包名称';
|
||||
COMMENT ON COLUMN user_market_benefit_package.type IS '1-积分兑换 2-后台划拨';
|
||||
COMMENT ON COLUMN user_market_benefit_package.user_benefit IS '兑换包需要的福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package.user_cash IS '兑换包需要的现金券';
|
||||
COMMENT ON COLUMN user_market_benefit_package.give_amount IS '购买赠与福利值';
|
||||
COMMENT ON COLUMN user_market_benefit_package.day_total IS '产出总天数';
|
||||
COMMENT ON COLUMN user_market_benefit_package.amount_total IS '总产出福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package.amount_day IS '每日产出福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package.amount_out IS '已产出福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package.out_day IS '已产出天数';
|
||||
COMMENT ON COLUMN user_market_benefit_package.is_complete IS '是否完成 0-未完成 1-完成';
|
||||
COMMENT ON COLUMN user_market_benefit_package.expired_date IS '过期时间';
|
||||
COMMENT ON COLUMN user_market_benefit_package.is_expired IS '是否过期 0-未过期 1-已过期';
|
||||
COMMENT ON COLUMN user_market_benefit_package.remark IS '备注';
|
||||
comment on column user_market_benefit_package.create_user is '创建人';
|
||||
comment on column user_market_benefit_package.create_dept is '创建部门';
|
||||
comment on column user_market_benefit_package.create_time is '创建时间';
|
||||
comment on column user_market_benefit_package.update_user is '修改人';
|
||||
comment on column user_market_benefit_package.update_time is '修改时间';
|
||||
comment on column user_market_benefit_package.status is '状态';
|
||||
comment on column user_market_benefit_package.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_market_benefit_package
|
||||
owner to yicha1lu;
|
||||
|
||||
create table user_market_benefit_package_log
|
||||
(
|
||||
id int8 not null primary key,
|
||||
statistical_date timestamp(6),
|
||||
user_id int8,
|
||||
phone int8,
|
||||
user_name varchar(128),
|
||||
type int4 default 1, -- 1-积分兑换 2-后台划拨
|
||||
user_package_id int8,
|
||||
package_name varchar(128),
|
||||
package_detail text,
|
||||
give_number int4 default 1,
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1,
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
|
||||
|
||||
create index gpl_date_index
|
||||
on user_market_benefit_package_log (is_deleted, statistical_date, user_id);
|
||||
|
||||
|
||||
COMMENT ON TABLE user_market_benefit_package_log IS '划拨积分记录';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.id IS '主键';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.statistical_date IS '统计日期';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.phone IS '用户手机号';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.user_name IS '用户名';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.type IS '1-积分兑换 2-后台划拨';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.user_package_id IS '积分包id';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.package_name IS '积分包名称';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.package_detail IS '积分包信息快照';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.give_number IS '赠送数量';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.remark IS '备注';
|
||||
comment on column user_market_benefit_package_log.create_user is '创建人';
|
||||
comment on column user_market_benefit_package_log.create_dept is '创建部门';
|
||||
comment on column user_market_benefit_package_log.create_time is '创建时间';
|
||||
comment on column user_market_benefit_package_log.update_user is '修改人';
|
||||
comment on column user_market_benefit_package_log.update_time is '修改时间';
|
||||
comment on column user_market_benefit_package_log.status is '状态';
|
||||
comment on column user_market_benefit_package_log.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_market_benefit_package_log
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
|
||||
create table user_benefit_point
|
||||
(
|
||||
id int8 not null primary key,
|
||||
amount decimal(14, 2) default 0,
|
||||
version int4 default 1,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1,
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
|
||||
|
||||
comment on table user_benefit_point is '用户福利值表';
|
||||
comment on column user_benefit_point.id is '主键';
|
||||
comment on column user_benefit_point.amount is '金额';
|
||||
comment on column user_benefit_point.version is '版本号';
|
||||
comment on column user_benefit_point.create_user is '创建人';
|
||||
comment on column user_benefit_point.create_dept is '创建部门';
|
||||
comment on column user_benefit_point.create_time is '创建时间';
|
||||
comment on column user_benefit_point.update_user is '修改人';
|
||||
comment on column user_benefit_point.update_time is '修改时间';
|
||||
comment on column user_benefit_point.status is '状态';
|
||||
comment on column user_benefit_point.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_benefit_point
|
||||
owner to yicha1lu;
|
||||
|
||||
create table user_benefit_point_log
|
||||
(
|
||||
id int8 not null primary key,
|
||||
user_id int8,
|
||||
user_phone int8,
|
||||
user_name varchar(128),
|
||||
amount decimal(14, 2) default 0,
|
||||
source_id int8,
|
||||
user_pack_id int8,
|
||||
source_detail text,
|
||||
order_id int8,
|
||||
type int4 default 1,
|
||||
statistical_date timestamp(6),
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1,
|
||||
is_deleted int4 default 0
|
||||
|
||||
);
|
||||
create index ub_log_date_index
|
||||
on user_benefit_point_log (is_deleted, user_id, statistical_date, type);
|
||||
|
||||
comment on table user_benefit_point_log is '用户福利值流水表';
|
||||
comment on column user_benefit_point_log.id is '主键';
|
||||
comment on column user_benefit_point_log.user_id is '用户id';
|
||||
comment on column user_benefit_point_log.user_phone is '用户手机号';
|
||||
comment on column user_benefit_point_log.user_name is '用户名称';
|
||||
comment on column user_benefit_point_log.amount is '金额';
|
||||
comment on column user_benefit_point_log.source_id is '来源id';
|
||||
comment on column user_benefit_point_log.user_pack_id is '用户积分包id';
|
||||
comment on column user_benefit_point_log.source_detail is '来源详情';
|
||||
comment on column user_benefit_point_log.order_id is '订单id';
|
||||
comment on column user_benefit_point_log.type is '消费类型 1-收入 2-支出';
|
||||
comment on column user_benefit_point_log.statistical_date is '统计时间';
|
||||
comment on column user_benefit_point_log.remark is '备注';
|
||||
comment on column user_benefit_point_log.create_user is '创建人';
|
||||
comment on column user_benefit_point_log.create_dept is '创建部门';
|
||||
comment on column user_benefit_point_log.create_time is '创建时间';
|
||||
comment on column user_benefit_point_log.update_user is '修改人';
|
||||
comment on column user_benefit_point_log.update_time is '修改时间';
|
||||
comment on column user_benefit_point_log.status is '状态';
|
||||
comment on column user_benefit_point_log.is_deleted is '是否已删除';
|
||||
alter table user_benefit_point_log
|
||||
owner to yicha1lu;
|
||||
193
doc/sql/3_mall_postgres.sql
Normal file
193
doc/sql/3_mall_postgres.sql
Normal file
@@ -0,0 +1,193 @@
|
||||
CREATE TABLE mall_product
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
serial_number VARCHAR(100) DEFAULT '' NOT NULL,
|
||||
product_name VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
main_image_urls text[] DEFAULT '{}' NOT NULL,
|
||||
detail_image_urls text[] DEFAULT '{}' NULL,
|
||||
thumb_image_url text NULL,
|
||||
specs JSONB DEFAULT '[]',
|
||||
unit VARCHAR(12),
|
||||
category_id int8 DEFAULT 0 NOT NULL,
|
||||
category_path int8[] DEFAULT '{}' NOT NULL,
|
||||
original_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
retail_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
freight DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
sales int4 DEFAULT 0 NOT NULL,
|
||||
stock int4 DEFAULT 0 NOT NULL,
|
||||
tags JSONB DEFAULT '[]' NOT NULL,
|
||||
status int4 DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE mall_product IS '商城商品';
|
||||
COMMENT ON COLUMN mall_product.id IS '主键';
|
||||
COMMENT ON COLUMN mall_product.serial_number IS '商品编码';
|
||||
COMMENT ON COLUMN mall_product.product_name IS '商品名称';
|
||||
COMMENT ON COLUMN mall_product.main_image_urls IS '主图';
|
||||
COMMENT ON COLUMN mall_product.detail_image_urls IS '详情图';
|
||||
COMMENT ON COLUMN mall_product.thumb_image_url IS '缩略图';
|
||||
COMMENT ON COLUMN mall_product.specs IS '规格详情,JSONB数组 [{"attr":"颜色","value":"红"}]';
|
||||
COMMENT ON COLUMN mall_product.unit IS '单位';
|
||||
COMMENT ON COLUMN mall_product.category_id IS '分类';
|
||||
COMMENT ON COLUMN mall_product.category_path IS '分类路径ID数组,如 [1,5,23]';
|
||||
COMMENT ON COLUMN mall_product.original_price IS '原价';
|
||||
COMMENT ON COLUMN mall_product.retail_price IS '销售价';
|
||||
COMMENT ON COLUMN mall_product.freight IS '运费';
|
||||
COMMENT ON COLUMN mall_product.sales IS '销量';
|
||||
COMMENT ON COLUMN mall_product.stock IS '库存';
|
||||
COMMENT ON COLUMN mall_product.tags IS '标签列表,JSONB数组格式,如 ["热销","包邮"]';
|
||||
COMMENT ON COLUMN mall_product.status IS '状态(0=下架,1=上架)';
|
||||
COMMENT ON COLUMN mall_product.create_user IS '创建人';
|
||||
COMMENT ON COLUMN mall_product.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN mall_product.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN mall_product.update_user IS '修改人';
|
||||
COMMENT ON COLUMN mall_product.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN mall_product.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX idx_product_category ON mall_product (category_id);
|
||||
CREATE INDEX idx_product_status ON mall_product (status) WHERE is_deleted = 0;
|
||||
CREATE INDEX idx_product_tags ON mall_product USING GIN (tags);
|
||||
|
||||
alter table mall_product
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
CREATE TABLE mall_category
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
category_name VARCHAR(100) DEFAULT '' NOT NULL,
|
||||
image_url VARCHAR(200) NULL,
|
||||
pid int8 NULL,
|
||||
level int4 DEFAULT 0 NOT NULL,
|
||||
sort INT4 DEFAULT 0 NOT NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
create_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
status int4 DEFAULT 1 NOT NULL,
|
||||
create_dept int8 NULL
|
||||
);
|
||||
|
||||
|
||||
COMMENT ON TABLE mall_category IS '商品分类(支持三级树形结构)';
|
||||
COMMENT ON COLUMN mall_category.id IS '主键';
|
||||
COMMENT ON COLUMN mall_category.category_name IS '分类名称';
|
||||
COMMENT ON COLUMN mall_category.image_url IS '图片';
|
||||
COMMENT ON COLUMN mall_category.pid IS '父分类ID,NULL 表示顶级分类';
|
||||
COMMENT ON COLUMN mall_category.level IS '层级:1-一级分类,2-二级分类,3-三级分类';
|
||||
COMMENT ON COLUMN mall_category.sort IS '排序值,越小越靠前';
|
||||
COMMENT ON COLUMN mall_category.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN mall_category.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN mall_category.create_user IS '创建人';
|
||||
COMMENT ON COLUMN mall_category.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN mall_category.update_user IS '修改人';
|
||||
COMMENT ON COLUMN mall_category.status IS '状态:1-启用,2-禁用';
|
||||
COMMENT ON COLUMN mall_category.create_dept IS '创建部门';
|
||||
|
||||
CREATE INDEX idx_category_pid ON mall_category (pid);
|
||||
CREATE INDEX idx_category_sort ON mall_category(sort);
|
||||
|
||||
|
||||
alter table mall_category
|
||||
owner to yicha1lu;
|
||||
|
||||
--改成全局购物车
|
||||
CREATE TABLE user_cart
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
service_type int4 DEFAULT 0 NOT NULL,
|
||||
user_id int8 DEFAULT 0 NOT NULL,
|
||||
title VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
spu_id int8 DEFAULT 0 NOT NULL,
|
||||
quantity int4 DEFAULT 0 NOT NULL,
|
||||
original_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
main_img VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
retail_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status int4 NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
|
||||
COMMENT ON TABLE user_cart IS '用户购物车';
|
||||
COMMENT ON COLUMN user_cart.id IS '主键';
|
||||
COMMENT ON COLUMN user_cart.service_type IS '购物车业务类型 1-商城购物车';
|
||||
COMMENT ON COLUMN user_cart.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_cart.title IS '商品名称';
|
||||
COMMENT ON COLUMN user_cart.spu_id IS 'spuId';
|
||||
COMMENT ON COLUMN user_cart.quantity IS '数量';
|
||||
COMMENT ON COLUMN user_cart.original_price IS '原价';
|
||||
COMMENT ON COLUMN user_cart.main_img IS '主图';
|
||||
COMMENT ON COLUMN user_cart.retail_price IS '销售价';
|
||||
COMMENT ON COLUMN user_cart.create_user IS '创建人';
|
||||
COMMENT ON COLUMN user_cart.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN user_cart.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN user_cart.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_cart.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_cart.status IS '状态';
|
||||
COMMENT ON COLUMN user_cart.is_deleted IS '是否已删除';
|
||||
CREATE INDEX idx_user_id ON user_cart (user_id);
|
||||
|
||||
alter table user_cart
|
||||
owner to yicha1lu;
|
||||
|
||||
CREATE TABLE common_user_address
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
user_id int8 NOT NULL,
|
||||
regions_id int8 NOT NULL,
|
||||
province VARCHAR(200) NULL,
|
||||
city VARCHAR(200) NULL,
|
||||
district VARCHAR(200) NULL,
|
||||
street VARCHAR(200) NULL,
|
||||
detail VARCHAR(500) NULL,
|
||||
consignee VARCHAR(200) NOT NULL,
|
||||
phone VARCHAR(20) NOT NULL,
|
||||
is_default int4 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status int4 NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE common_user_address IS '用户地址表';
|
||||
COMMENT ON COLUMN common_user_address.id IS '主键';
|
||||
COMMENT ON COLUMN common_user_address.user_id IS '用户id';
|
||||
COMMENT ON COLUMN common_user_address.regions_id IS '地区信息id';
|
||||
COMMENT ON COLUMN common_user_address.province IS '省份';
|
||||
COMMENT ON COLUMN common_user_address.city IS '城市';
|
||||
COMMENT ON COLUMN common_user_address.district IS '区县';
|
||||
COMMENT ON COLUMN common_user_address.street IS '街道';
|
||||
COMMENT ON COLUMN common_user_address.detail IS '详细地址';
|
||||
COMMENT ON COLUMN common_user_address.consignee IS '收货人';
|
||||
COMMENT ON COLUMN common_user_address.phone IS '联系电话';
|
||||
COMMENT ON COLUMN common_user_address.is_default IS '是否默认地址(0=否,1=是)';
|
||||
COMMENT ON COLUMN common_user_address.create_user IS '创建人';
|
||||
COMMENT ON COLUMN common_user_address.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN common_user_address.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN common_user_address.update_user IS '修改人';
|
||||
COMMENT ON COLUMN common_user_address.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN common_user_address.status IS '状态';
|
||||
COMMENT ON COLUMN common_user_address.is_deleted IS '是否已删除';
|
||||
|
||||
alter table common_user_address
|
||||
owner to yicha1lu;
|
||||
|
||||
CREATE INDEX idx_user_address_user_id ON common_user_address (user_id);
|
||||
CREATE INDEX idx_user_address_regions_id ON common_user_address (regions_id);
|
||||
|
||||
|
||||
271
doc/sql/4_order_postgres.sql
Normal file
271
doc/sql/4_order_postgres.sql
Normal file
@@ -0,0 +1,271 @@
|
||||
CREATE TABLE user_order
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
user_id int8 NOT NULL,
|
||||
consignee_phone varchar(128) NOT NULL,
|
||||
consignee varchar(128) NOT NULL,
|
||||
order_type varchar(128) NOT NULL,
|
||||
item_code varchar(128) NOT NULL,
|
||||
item_name varchar(128) NOT NULL,
|
||||
image_url VARCHAR(512) NULL,
|
||||
quantity int4 DEFAULT 1 NOT NULL,
|
||||
delivery_address text NULL,
|
||||
express_company VARCHAR(100) NULL,
|
||||
express_no VARCHAR(100) NULL,
|
||||
order_status int4 DEFAULT 0 NOT NULL,
|
||||
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
payment_type int4 DEFAULT 0 NOT NULL,
|
||||
payment_time TIMESTAMP NULL,
|
||||
payment_status int4 DEFAULT 0 NOT NULL,
|
||||
payment_track VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status int4 NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE user_order IS '用户订单';
|
||||
COMMENT ON COLUMN user_order.id IS '主键';
|
||||
COMMENT ON COLUMN user_order.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_order.consignee_phone IS '收件人手机号';
|
||||
COMMENT ON COLUMN user_order.consignee IS '收件人';
|
||||
COMMENT ON COLUMN user_order.order_type IS '订单类型';
|
||||
COMMENT ON COLUMN user_order.item_code IS '商品编号';
|
||||
COMMENT ON COLUMN user_order.item_name IS '商品名称';
|
||||
COMMENT ON COLUMN user_order.image_url IS '图片';
|
||||
COMMENT ON COLUMN user_order.quantity IS '数量';
|
||||
COMMENT ON COLUMN user_order.delivery_address IS '收货地址(实物商品必填,虚拟商品可为空)';
|
||||
COMMENT ON COLUMN user_order.order_status IS '订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款';
|
||||
COMMENT ON COLUMN user_order.total_amount IS '订单金额';
|
||||
COMMENT ON COLUMN user_order.actual_amount IS '实际支付金额';
|
||||
COMMENT ON COLUMN user_order.payment_type IS '支付方式';
|
||||
COMMENT ON COLUMN user_order.payment_time IS '支付时间';
|
||||
COMMENT ON COLUMN user_order.payment_track IS '支付凭证编号';
|
||||
COMMENT ON COLUMN user_order.payment_status IS '支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)';
|
||||
COMMENT ON COLUMN user_order.express_company IS '快递公司名称';
|
||||
COMMENT ON COLUMN user_order.express_no IS '快递单号(物流单号)';
|
||||
COMMENT ON COLUMN user_order.create_user IS '创建人';
|
||||
COMMENT ON COLUMN user_order.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN user_order.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN user_order.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_order.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_order.status IS '状态';
|
||||
|
||||
CREATE INDEX idx_user_order_user_status_time ON user_order (user_id, order_status, create_time DESC);
|
||||
CREATE INDEX idx_user_order_status_time ON user_order (order_status, create_time DESC);
|
||||
|
||||
alter table user_order
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
CREATE TABLE mall_summary_order
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
user_id int8 DEFAULT 0 NOT NULL,
|
||||
user_phone int8,
|
||||
user_name varchar(128),
|
||||
products_info text NULL,
|
||||
order_info text NULL,
|
||||
confirm_info text NULL,
|
||||
vendor_regions_id int8 NOT NULL,
|
||||
address_id int8 NOT NULL,
|
||||
delivery_info text NULL,
|
||||
freight_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
order_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
refund_amount DECIMAL(10, 2) DEFAULT 0.00 NULL,
|
||||
payment_type int4 DEFAULT 0 NOT NULL,
|
||||
extra_type int4 DEFAULT 0 NOT NULL,
|
||||
payment_status int4 DEFAULT 0 NOT NULL,
|
||||
order_status int4 DEFAULT 0 NOT NULL,
|
||||
payment_completed_time TIMESTAMP NULL,
|
||||
payment_track VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
expire_time TIMESTAMP NULL,
|
||||
is_recorded int4 DEFAULT 0 NULL,
|
||||
is_statistics int4 DEFAULT 0 NULL,
|
||||
remarks VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
version int8 DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status int4 DEFAULT 0 NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
|
||||
);
|
||||
|
||||
COMMENT ON TABLE mall_summary_order IS '商城汇总订单';
|
||||
COMMENT ON COLUMN mall_summary_order.id IS '主键';
|
||||
COMMENT ON COLUMN mall_summary_order.user_id IS '用户id';
|
||||
COMMENT ON COLUMN mall_summary_order.user_phone IS '用户手机号';
|
||||
COMMENT ON COLUMN mall_summary_order.user_name IS '用户名称';
|
||||
COMMENT ON COLUMN mall_summary_order.products_info IS '商品信息';
|
||||
COMMENT ON COLUMN mall_summary_order.order_info IS '订单信息';
|
||||
COMMENT ON COLUMN mall_summary_order.confirm_info IS '订单确认信息';
|
||||
COMMENT ON COLUMN mall_summary_order.vendor_regions_id IS '地区id';
|
||||
COMMENT ON COLUMN mall_summary_order.address_id IS '地址id';
|
||||
COMMENT ON COLUMN mall_summary_order.delivery_info IS '快递信息';
|
||||
COMMENT ON COLUMN mall_summary_order.freight_amount IS '运费';
|
||||
COMMENT ON COLUMN mall_summary_order.cost_amount IS '订单成本';
|
||||
COMMENT ON COLUMN mall_summary_order.order_amount IS '订单金额';
|
||||
COMMENT ON COLUMN mall_summary_order.total_amount IS '总金额';
|
||||
COMMENT ON COLUMN mall_summary_order.actual_amount IS '实际支付';
|
||||
COMMENT ON COLUMN mall_summary_order.refund_amount IS '退款金额';
|
||||
COMMENT ON COLUMN mall_summary_order.payment_type IS '支付类型';
|
||||
COMMENT ON COLUMN mall_summary_order.extra_type IS '附加支付类型';
|
||||
COMMENT ON COLUMN mall_summary_order.payment_status IS '支付状态';
|
||||
COMMENT ON COLUMN mall_summary_order.extra_type IS '附加支付类型';
|
||||
COMMENT ON COLUMN mall_summary_order.order_status IS '订单状态 1=待确认,2=待发货,3=待收货,4=已完成,5=已取消, 6=已关闭 ,7=售后中,8=已完结';
|
||||
COMMENT ON COLUMN mall_summary_order.payment_completed_time IS '支付完成时间';
|
||||
COMMENT ON COLUMN mall_summary_order.payment_track IS '支付凭证';
|
||||
COMMENT ON COLUMN mall_summary_order.order_status IS '订单状态 1=待确认,2=待发货,3=待收货,4=已完成,5=已取消, 6=已关闭 ,7=售后中,8=已完结';
|
||||
COMMENT ON COLUMN mall_summary_order.payment_completed_time IS '支付完成时间';
|
||||
COMMENT ON COLUMN mall_summary_order.payment_track IS '支付凭证';
|
||||
COMMENT ON COLUMN mall_summary_order.expire_time IS '超时时间';
|
||||
COMMENT ON COLUMN mall_summary_order.is_recorded IS '是否记录资金账户里 0=否,1=是';
|
||||
COMMENT ON COLUMN mall_summary_order.is_statistics IS '是否统计到用户现金业绩里 0=否,1=是';
|
||||
COMMENT ON COLUMN mall_summary_order.remarks IS '备注';
|
||||
COMMENT ON COLUMN mall_summary_order.status IS '状态';
|
||||
COMMENT ON COLUMN mall_summary_order.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
CREATE INDEX mso_index ON mall_summary_order (user_id);
|
||||
CREATE INDEX mso_status_index ON mall_summary_order (payment_status, status);
|
||||
CREATE INDEX mso_recorded_index ON mall_summary_order (payment_status, is_recorded);
|
||||
CREATE INDEX mso_statistics_index ON mall_summary_order (payment_status, is_statistics);
|
||||
|
||||
alter table mall_summary_order
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
CREATE TABLE mall_detail_order
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
user_id int8 DEFAULT 0 NOT NULL,
|
||||
user_phone int8,
|
||||
user_name varchar(128),
|
||||
summary_order_id int8 DEFAULT 0 NOT NULL,
|
||||
spu_id int8 DEFAULT 0 NOT NULL,
|
||||
quantity int4 DEFAULT 0 NOT NULL,
|
||||
sku_snapshot text NULL,
|
||||
freight_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
actual_cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
order_amount DECIMAL(10, 2) NULL,
|
||||
cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
remarks VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
order_status int4 DEFAULT 0 NOT NULL,
|
||||
freight VARCHAR(200) DEFAULT 0.00 NOT NULL,
|
||||
logistics VARCHAR(200) DEFAULT 0.00 NOT NULL,
|
||||
delivery_time timestamp(6),
|
||||
products_info text NULL,
|
||||
version int4 DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status int4 DEFAULT -1 NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE mall_detail_order IS '商城详情订单';
|
||||
COMMENT ON COLUMN mall_detail_order.id IS '主键';
|
||||
COMMENT ON COLUMN mall_detail_order.user_id IS '用户id';
|
||||
COMMENT ON COLUMN mall_detail_order.user_phone IS '用户手机号';
|
||||
COMMENT ON COLUMN mall_detail_order.user_name IS '用户名称';
|
||||
COMMENT ON COLUMN mall_detail_order.summary_order_id IS '主订单id';
|
||||
COMMENT ON COLUMN mall_detail_order.spu_id IS '商品id';
|
||||
COMMENT ON COLUMN mall_detail_order.quantity IS '数量';
|
||||
COMMENT ON COLUMN mall_detail_order.spu_id IS '商品id';
|
||||
COMMENT ON COLUMN mall_detail_order.quantity IS '数量';
|
||||
COMMENT ON COLUMN mall_detail_order.sku_snapshot IS '商品快照';
|
||||
COMMENT ON COLUMN mall_detail_order.actual_cost_amount IS '实际成本';
|
||||
COMMENT ON COLUMN mall_detail_order.order_amount IS '订单金额';
|
||||
COMMENT ON COLUMN mall_detail_order.cost_amount IS '订单成本';
|
||||
COMMENT ON COLUMN mall_detail_order.actual_amount IS '实际支付';
|
||||
COMMENT ON COLUMN mall_detail_order.remarks IS '备注';
|
||||
COMMENT ON COLUMN mall_detail_order.logistics IS '物流';
|
||||
COMMENT ON COLUMN mall_detail_order.products_info IS '商品信息';
|
||||
COMMENT ON COLUMN mall_detail_order.freight IS '运费';
|
||||
COMMENT ON COLUMN mall_detail_order.order_status IS '订单状态 1=待确认,2=待发货,3=待收货,4=已完成,5=已取消, 6=已关闭 ,7=售后中,8=已完结';
|
||||
COMMENT ON COLUMN mall_detail_order.status IS '状态';
|
||||
COMMENT ON COLUMN mall_detail_order.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
CREATE INDEX mdo_index ON mall_detail_order (summary_order_id);
|
||||
CREATE INDEX mdo_uid_index ON mall_detail_order (user_id);
|
||||
|
||||
alter table mall_detail_order
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
CREATE TABLE mall_summary_order_after
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
user_id int8 DEFAULT -1 NOT NULL,
|
||||
user_phone int8,
|
||||
user_name varchar(128),
|
||||
summary_order_id int8 DEFAULT -1 NOT NULL,
|
||||
goods_id int8 DEFAULT -1 NOT NULL,
|
||||
sku_id int8 NOT NULL,
|
||||
goods_name VARCHAR(256) NOT NULL,
|
||||
quantity int4 DEFAULT -1 NULL,
|
||||
apply_type int4 NULL,
|
||||
apply_reason VARCHAR(100) DEFAULT '-1' NULL,
|
||||
apply_pic_urls TEXT NULL,
|
||||
refund_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
refund_status int4 DEFAULT 0 NULL,
|
||||
refund_reason VARCHAR(255) NULL,
|
||||
receiver VARCHAR(125) NULL,
|
||||
receiver_phone VARCHAR(255) NULL,
|
||||
receiver_addr VARCHAR(255) NULL,
|
||||
receiver_delivery_no VARCHAR(255) NULL,
|
||||
remarks VARCHAR(200) DEFAULT '' NULL,
|
||||
version int4 DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status int4 DEFAULT 0 NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL,
|
||||
after_info JSON NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE mall_summary_order_after IS '商品售后订单表';
|
||||
COMMENT ON COLUMN mall_summary_order_after.id IS '售后订单号';
|
||||
COMMENT ON COLUMN mall_summary_order_after.user_id IS '用户id';
|
||||
COMMENT ON COLUMN mall_summary_order_after.user_phone IS '用户手机号';
|
||||
COMMENT ON COLUMN mall_summary_order_after.user_name IS '用户名称';
|
||||
COMMENT ON COLUMN mall_summary_order_after.summary_order_id IS '总订单id';
|
||||
COMMENT ON COLUMN mall_summary_order_after.goods_id IS '商品ID';
|
||||
COMMENT ON COLUMN mall_summary_order_after.sku_id IS '商品订单号';
|
||||
COMMENT ON COLUMN mall_summary_order_after.goods_name IS '商品名称';;
|
||||
COMMENT ON COLUMN mall_summary_order_after.quantity IS '商品数量';
|
||||
COMMENT ON COLUMN mall_summary_order_after.apply_type IS '申请售后类型,1=未收货退款,2=退货退款,3=换货补发,4=不退货仅退款';
|
||||
COMMENT ON COLUMN mall_summary_order_after.apply_reason IS '申请售后原因';
|
||||
COMMENT ON COLUMN mall_summary_order_after.apply_pic_urls IS '图片地址';
|
||||
COMMENT ON COLUMN mall_summary_order_after.refund_amount IS '退款金额';
|
||||
COMMENT ON COLUMN mall_summary_order_after.refund_status IS '处理售后状态';
|
||||
COMMENT ON COLUMN mall_summary_order_after.refund_reason IS '处理回复';
|
||||
COMMENT ON COLUMN mall_summary_order_after.receiver IS '退件收货人姓名';
|
||||
COMMENT ON COLUMN mall_summary_order_after.receiver_phone IS '退件收货人电话';
|
||||
COMMENT ON COLUMN mall_summary_order_after.receiver_addr IS '退件地址';
|
||||
COMMENT ON COLUMN mall_summary_order_after.receiver_delivery_no IS '退货物流单号';
|
||||
COMMENT ON COLUMN mall_summary_order_after.remarks IS '备注';
|
||||
COMMENT ON COLUMN mall_summary_order_after.status IS '状态';
|
||||
COMMENT ON COLUMN mall_summary_order_after.status IS '状态';
|
||||
COMMENT ON COLUMN mall_summary_order_after.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN mall_summary_order_after.after_info IS '售后详情';
|
||||
|
||||
alter table mall_summary_order_after
|
||||
owner to yicha1lu;
|
||||
|
||||
0
doc/sql/5_insert_package_info_postgres.sql
Normal file
0
doc/sql/5_insert_package_info_postgres.sql
Normal file
76
doc/sql/6_regions_info_postgres.sql
Normal file
76
doc/sql/6_regions_info_postgres.sql
Normal file
@@ -0,0 +1,76 @@
|
||||
-- 阔一张业务属性的地理信息
|
||||
CREATE TABLE common_regions_info
|
||||
(
|
||||
id int4 PRIMARY KEY,
|
||||
name VARCHAR(50) NULL,
|
||||
level int4 NULL,
|
||||
pid int4 DEFAULT 0 NULL,
|
||||
coordinates point,
|
||||
region_code VARCHAR(128) NULL,
|
||||
full_name VARCHAR(200) NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
create_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
status int4 NULL,
|
||||
create_dept int8 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE common_regions_info IS '地区详情表';
|
||||
COMMENT ON COLUMN common_regions_info.id IS '主键';
|
||||
COMMENT ON COLUMN common_regions_info.name IS '名称';
|
||||
COMMENT ON COLUMN common_regions_info.level IS '层级';
|
||||
COMMENT ON COLUMN common_regions_info.pid IS '父主键';
|
||||
COMMENT ON COLUMN common_regions_info.coordinates IS '坐标';
|
||||
COMMENT ON COLUMN common_regions_info.region_code IS '地区编码';
|
||||
COMMENT ON COLUMN common_regions_info.full_name IS '全称';
|
||||
COMMENT ON COLUMN common_regions_info.is_deleted IS '是否删除';
|
||||
COMMENT ON COLUMN common_regions_info.create_user IS '创建人';
|
||||
COMMENT ON COLUMN common_regions_info.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN common_regions_info.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN common_regions_info.update_user IS '修改人';
|
||||
COMMENT ON COLUMN common_regions_info.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN common_regions_info.status IS '状态';
|
||||
|
||||
alter table common_regions_info
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
|
||||
CREATE TABLE regions_info_extend
|
||||
(
|
||||
id int4 PRIMARY KEY,
|
||||
vendor_region_id int8 NULL,
|
||||
store_city_id int8 NULL,
|
||||
hotel_city_code VARCHAR(128) NULL,
|
||||
hotel_city_pinyin VARCHAR(128) NULL,
|
||||
hotel_city_initials VARCHAR(4) NULL,
|
||||
sight_city_name VARCHAR(32) NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
create_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
status int4 NULL,
|
||||
create_dept int8 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE regions_info_extend IS '地区详情表';
|
||||
COMMENT ON COLUMN regions_info_extend.id IS '主键';
|
||||
COMMENT ON COLUMN regions_info_extend.vendor_region_id IS '服务商地区表id';
|
||||
COMMENT ON COLUMN regions_info_extend.store_city_id IS '城市店铺id';
|
||||
COMMENT ON COLUMN regions_info_extend.hotel_city_code IS '酒店地区编码';
|
||||
COMMENT ON COLUMN regions_info_extend.hotel_city_pinyin IS '酒店地区拼音';
|
||||
COMMENT ON COLUMN regions_info_extend.hotel_city_initials IS '酒店地区拼音首字母';
|
||||
COMMENT ON COLUMN regions_info_extend.sight_city_name IS '景点城市名';
|
||||
COMMENT ON COLUMN regions_info_extend.is_deleted IS '是否删除';
|
||||
COMMENT ON COLUMN regions_info_extend.create_user IS '创建人';
|
||||
COMMENT ON COLUMN regions_info_extend.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN regions_info_extend.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN regions_info_extend.update_user IS '修改人';
|
||||
COMMENT ON COLUMN regions_info_extend.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN regions_info_extend.status IS '状态';
|
||||
|
||||
alter table regions_info_extend
|
||||
owner to yicha1lu;
|
||||
50855
doc/sql/7_insert_regions_postgres.sql
Normal file
50855
doc/sql/7_insert_regions_postgres.sql
Normal file
File diff suppressed because it is too large
Load Diff
@@ -1,46 +0,0 @@
|
||||
create table aliyun_certify
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint not null,
|
||||
user_phone bigint,
|
||||
name varchar(128) null,
|
||||
id_card varchar(128) null,
|
||||
certify_id varchar(64) null,
|
||||
image text null,
|
||||
message varchar(255) null,
|
||||
is_success integer default 0 not null,
|
||||
is_deleted integer default 0 not null,
|
||||
create_time timestamp not null,
|
||||
create_user int8 null,
|
||||
update_time timestamp null,
|
||||
update_user int8 null,
|
||||
create_dept int8 null,
|
||||
status integer null
|
||||
);
|
||||
|
||||
comment on table aliyun_certify is '阿里云实名记录表';
|
||||
comment on column aliyun_certify.id is 'ID';
|
||||
comment on column aliyun_certify.user_id is '用户ID';
|
||||
comment on column aliyun_certify.user_phone is '用户手机号';
|
||||
comment on column aliyun_certify.name is '实名用户名';
|
||||
comment on column aliyun_certify.id_card is '实名身份证';
|
||||
comment on column aliyun_certify.certify_id is '阿里云实名身份标识';
|
||||
comment on column aliyun_certify.image is '实名照片';
|
||||
comment on column aliyun_certify.message is '阿里云认证消息';
|
||||
comment on column aliyun_certify.is_success is '是否成功';
|
||||
comment on column aliyun_certify.is_deleted is '是否删除';
|
||||
comment on column aliyun_certify.create_time is '创建时间';
|
||||
comment on column aliyun_certify.create_user is '创建人ID';
|
||||
comment on column aliyun_certify.update_time is '修改时间';
|
||||
comment on column aliyun_certify.update_user is '修改人ID';
|
||||
comment on column aliyun_certify.create_dept is '创建部门';
|
||||
comment on column aliyun_certify.status is '状态';
|
||||
|
||||
create index certify_id_index
|
||||
on aliyun_certify (is_deleted, certify_id);
|
||||
|
||||
create index user_certify_id_index
|
||||
on aliyun_certify (is_deleted, user_id, certify_id);
|
||||
|
||||
create index user_id_index
|
||||
on aliyun_certify (is_deleted, user_id, is_success);
|
||||
626
doc/sql/executed/20260205_increase.sql
Normal file
626
doc/sql/executed/20260205_increase.sql
Normal file
@@ -0,0 +1,626 @@
|
||||
------------------user_market_info common_user_address common_regions_info mall_product mall_category-------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS user_market_info;
|
||||
create table user_market_info
|
||||
(
|
||||
id int8 not null primary key, --user_id
|
||||
pid int8,
|
||||
has_synchronized int4 default 0, --是否同步
|
||||
vendor int4 default 0, -- 是否成为服务商 0-否 1-是
|
||||
e_signed int4 default 0, -- 是否已经签署电子合同 0-否 1-是
|
||||
e_signed_url text, -- 电子合同地址
|
||||
verified int4 default 0, -- 是否实名用户 0-否 1-是
|
||||
verified_date timestamp(6), -- 实名时间
|
||||
real_name varchar(128), -- 实名姓名
|
||||
id_card varchar(128), -- 实名身份证
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1, -- 1: active -- 2: revoked (注销) -- 3: frozen (冻结)
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
|
||||
CREATE INDEX idx_user_market_pid ON user_market_info (pid) WHERE status = 1;
|
||||
|
||||
|
||||
comment on table user_market_info is '用户拓展信息表';
|
||||
comment on column user_market_info.id is '主键';
|
||||
comment on column user_market_info.pid is '邀请人';
|
||||
comment on column user_market_info.has_synchronized is '是否同步族谱 0-否 1-是';
|
||||
comment on column user_market_info.vendor is '是否成为服务商 0-否 1-是';
|
||||
comment on column user_market_info.e_signed is '是否签署法大大协议 0-否 1-是';
|
||||
comment on column user_market_info.e_signed_url is '电子合同地址';
|
||||
comment on column user_market_info.verified is '是否实名用户 0-否 1-是';
|
||||
comment on column user_market_info.verified_date is '实名时间';
|
||||
comment on column user_market_info.real_name is '实名姓名';
|
||||
comment on column user_market_info.id_card is '实名身份证';
|
||||
comment on column user_market_info.create_user is '创建人';
|
||||
comment on column user_market_info.create_dept is '创建部门';
|
||||
comment on column user_market_info.create_time is '创建时间';
|
||||
comment on column user_market_info.update_user is '修改人';
|
||||
comment on column user_market_info.update_time is '修改时间';
|
||||
comment on column user_market_info.status is '状态';
|
||||
comment on column user_market_info.is_deleted is '是否已删除';
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019319816467976193', '1123598815738675201', 'marketInfo', '用户拓展信息表', 'menu', '/market/marketInfo',
|
||||
NULL, 1, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019319816467976194', '2019319816467976193', 'marketInfo_add', '新增', 'add', '/market/marketInfo/add', 'plus',
|
||||
1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019319816467976195', '2019319816467976193', 'marketInfo_edit', '修改', 'edit', '/market/marketInfo/edit',
|
||||
'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019319816467976196', '2019319816467976193', 'marketInfo_delete', '删除', 'delete',
|
||||
'/api/blade-marketinfo/marketInfo/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019319816467976197', '2019319816467976193', 'marketInfo_view', '查看', 'view', '/market/marketInfo/view',
|
||||
'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS common_user_address;
|
||||
CREATE TABLE common_user_address
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
user_id int8 NOT NULL,
|
||||
regions_id int8 NOT NULL,
|
||||
province VARCHAR(200) NULL,
|
||||
city VARCHAR(200) NULL,
|
||||
district VARCHAR(200) NULL,
|
||||
street VARCHAR(200) NULL,
|
||||
detail VARCHAR(500) NULL,
|
||||
consignee VARCHAR(200) NOT NULL,
|
||||
phone VARCHAR(20) NOT NULL,
|
||||
is_default int4 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status int4 NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE common_user_address IS '用户地址表';
|
||||
COMMENT ON COLUMN common_user_address.id IS '主键';
|
||||
COMMENT ON COLUMN common_user_address.user_id IS '用户id';
|
||||
COMMENT ON COLUMN common_user_address.regions_id IS '地区信息id';
|
||||
COMMENT ON COLUMN common_user_address.province IS '省份';
|
||||
COMMENT ON COLUMN common_user_address.city IS '城市';
|
||||
COMMENT ON COLUMN common_user_address.district IS '区县';
|
||||
COMMENT ON COLUMN common_user_address.street IS '街道';
|
||||
COMMENT ON COLUMN common_user_address.detail IS '详细地址';
|
||||
COMMENT ON COLUMN common_user_address.consignee IS '收货人';
|
||||
COMMENT ON COLUMN common_user_address.phone IS '联系电话';
|
||||
COMMENT ON COLUMN common_user_address.is_default IS '是否默认地址(0=否,1=是)';
|
||||
COMMENT ON COLUMN common_user_address.create_user IS '创建人';
|
||||
COMMENT ON COLUMN common_user_address.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN common_user_address.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN common_user_address.update_user IS '修改人';
|
||||
COMMENT ON COLUMN common_user_address.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN common_user_address.status IS '状态';
|
||||
COMMENT ON COLUMN common_user_address.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX idx_user_address_user_id ON common_user_address (user_id);
|
||||
CREATE INDEX idx_user_address_regions_id ON common_user_address (regions_id);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS common_regions_info;
|
||||
CREATE TABLE common_regions_info
|
||||
(
|
||||
id int4 PRIMARY KEY,
|
||||
name VARCHAR(50) NULL,
|
||||
level int4 NULL,
|
||||
pid int4 DEFAULT 0 NULL,
|
||||
coordinates point,
|
||||
region_code VARCHAR(128) NULL,
|
||||
full_name VARCHAR(500) NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
create_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
status int4 NULL,
|
||||
create_dept int8 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE common_regions_info IS '地区详情表';
|
||||
COMMENT ON COLUMN common_regions_info.id IS '主键';
|
||||
COMMENT ON COLUMN common_regions_info.name IS '名称';
|
||||
COMMENT ON COLUMN common_regions_info.level IS '层级';
|
||||
COMMENT ON COLUMN common_regions_info.pid IS '父主键';
|
||||
COMMENT ON COLUMN common_regions_info.coordinates IS '坐标';
|
||||
COMMENT ON COLUMN common_regions_info.region_code IS '地区编码';
|
||||
COMMENT ON COLUMN common_regions_info.full_name IS '全称';
|
||||
COMMENT ON COLUMN common_regions_info.is_deleted IS '是否删除';
|
||||
COMMENT ON COLUMN common_regions_info.create_user IS '创建人';
|
||||
COMMENT ON COLUMN common_regions_info.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN common_regions_info.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN common_regions_info.update_user IS '修改人';
|
||||
COMMENT ON COLUMN common_regions_info.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN common_regions_info.status IS '状态';
|
||||
|
||||
CREATE INDEX idx_regions_pid ON common_regions_info (pid);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
DROP TABLE IF EXISTS mall_product;
|
||||
CREATE TABLE mall_product
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
serial_number VARCHAR(100) DEFAULT '' NOT NULL,
|
||||
product_name VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
main_image_urls text[] DEFAULT '{}' NOT NULL,
|
||||
detail_image_urls text[] DEFAULT '{}' NULL,
|
||||
thumb_image_url text NULL,
|
||||
specs JSONB DEFAULT '[]',
|
||||
unit VARCHAR(12),
|
||||
category_id int8 DEFAULT 0 NOT NULL,
|
||||
category_path int8[] DEFAULT '{}' NOT NULL,
|
||||
original_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
retail_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
freight DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
sales int4 DEFAULT 0 NOT NULL,
|
||||
stock int4 DEFAULT 0 NOT NULL,
|
||||
tags JSONB DEFAULT '[]' NOT NULL,
|
||||
status int4 DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE mall_product IS '商城商品';
|
||||
COMMENT ON COLUMN mall_product.id IS '主键';
|
||||
COMMENT ON COLUMN mall_product.serial_number IS '商品编码';
|
||||
COMMENT ON COLUMN mall_product.product_name IS '商品名称';
|
||||
COMMENT ON COLUMN mall_product.main_image_urls IS '主图';
|
||||
COMMENT ON COLUMN mall_product.detail_image_urls IS '详情图';
|
||||
COMMENT ON COLUMN mall_product.thumb_image_url IS '缩略图';
|
||||
COMMENT ON COLUMN mall_product.specs IS '规格详情,JSONB数组 [{"attr":"颜色","value":"红"}]';
|
||||
COMMENT ON COLUMN mall_product.unit IS '单位';
|
||||
COMMENT ON COLUMN mall_product.category_id IS '分类';
|
||||
COMMENT ON COLUMN mall_product.category_path IS '分类路径ID数组,如 [1,5,23]';
|
||||
COMMENT ON COLUMN mall_product.original_price IS '原价';
|
||||
COMMENT ON COLUMN mall_product.retail_price IS '销售价';
|
||||
COMMENT ON COLUMN mall_product.freight IS '运费';
|
||||
COMMENT ON COLUMN mall_product.sales IS '销量';
|
||||
COMMENT ON COLUMN mall_product.stock IS '库存';
|
||||
COMMENT ON COLUMN mall_product.tags IS '标签列表,JSONB数组格式,如 ["热销","包邮"]';
|
||||
COMMENT ON COLUMN mall_product.status IS '状态(0=下架,1=上架)';
|
||||
COMMENT ON COLUMN mall_product.create_user IS '创建人';
|
||||
COMMENT ON COLUMN mall_product.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN mall_product.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN mall_product.update_user IS '修改人';
|
||||
COMMENT ON COLUMN mall_product.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN mall_product.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX idx_product_category ON mall_product (category_id);
|
||||
CREATE INDEX idx_product_status ON mall_product (status) WHERE is_deleted = 0;
|
||||
CREATE INDEX idx_product_tags ON mall_product USING GIN (tags);
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019341061775732737', '2016445919294554113', 'mallProduct', '商城商品', 'menu', '/mall/mallProduct', NULL, 1,
|
||||
1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019341061775732738', '2019341061775732737', 'mallProduct_add', '新增', 'add', '/mall/mallProduct/add', 'plus',
|
||||
1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019341061775732739', '2019341061775732737', 'mallProduct_edit', '修改', 'edit', '/mall/mallProduct/edit',
|
||||
'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019341061775732740', '2019341061775732737', 'mallProduct_delete', '删除', 'delete',
|
||||
'/api/blade-mallproduct/mallProduct/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019341061775732741', '2019341061775732737', 'mallProduct_view', '查看', 'view', '/mall/mallProduct/view',
|
||||
'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS mall_category;
|
||||
CREATE TABLE mall_category
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
category_name VARCHAR(100) DEFAULT '' NOT NULL,
|
||||
image_url VARCHAR(200) NULL,
|
||||
pid int8 NULL,
|
||||
level int4 DEFAULT 0 NOT NULL,
|
||||
sort INT4 DEFAULT 0 NOT NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
create_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
status int4 DEFAULT 1 NOT NULL,
|
||||
create_dept int8 NULL
|
||||
);
|
||||
|
||||
|
||||
COMMENT ON TABLE mall_category IS '商品分类(支持三级树形结构)';
|
||||
COMMENT ON COLUMN mall_category.id IS '主键';
|
||||
COMMENT ON COLUMN mall_category.category_name IS '分类名称';
|
||||
COMMENT ON COLUMN mall_category.image_url IS '图片';
|
||||
COMMENT ON COLUMN mall_category.pid IS '父分类ID,NULL 表示顶级分类';
|
||||
COMMENT ON COLUMN mall_category.level IS '层级:1-一级分类,2-二级分类,3-三级分类';
|
||||
COMMENT ON COLUMN mall_category.sort IS '排序值,越小越靠前';
|
||||
COMMENT ON COLUMN mall_category.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN mall_category.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN mall_category.create_user IS '创建人';
|
||||
COMMENT ON COLUMN mall_category.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN mall_category.update_user IS '修改人';
|
||||
COMMENT ON COLUMN mall_category.status IS '状态:1-启用,2-禁用';
|
||||
COMMENT ON COLUMN mall_category.create_dept IS '创建部门';
|
||||
|
||||
CREATE INDEX idx_category_pid ON mall_category (pid);
|
||||
CREATE INDEX idx_category_sort ON mall_category (sort);
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019341061003980801', '2016445919294554113', 'mallCategory', '商品分类', 'menu', '/mall/mallCategory', NULL, 1,
|
||||
1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019341061003980802', '2019341061003980801', 'mallCategory_add', '新增', 'add', '/mall/mallCategory/add',
|
||||
'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019341061003980803', '2019341061003980801', 'mallCategory_edit', '修改', 'edit', '/mall/mallCategory/edit',
|
||||
'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019341061003980804', '2019341061003980801', 'mallCategory_delete', '删除', 'delete',
|
||||
'/api/blade-mallcategory/mallCategory/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark,
|
||||
is_deleted)
|
||||
VALUES ('2019341061003980805', '2019341061003980801', 'mallCategory_view', '查看', 'view', '/mall/mallCategory/view',
|
||||
'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
DROP TABLE IF EXISTS user_order;
|
||||
CREATE TABLE user_order
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
user_id int8 NOT NULL,
|
||||
consignee_phone varchar(128) NOT NULL,
|
||||
consignee varchar(128) NOT NULL,
|
||||
order_type varchar(128) NOT NULL,
|
||||
item_code varchar(128) NOT NULL,
|
||||
item_name varchar(128) NOT NULL,
|
||||
image_url VARCHAR(512) NULL,
|
||||
quantity int4 DEFAULT 1 NOT NULL,
|
||||
delivery_address text NULL,
|
||||
express_company VARCHAR(100) NULL,
|
||||
express_no VARCHAR(100) NULL,
|
||||
order_status int4 DEFAULT 0 NOT NULL,
|
||||
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
payment_type int4 DEFAULT 0 NOT NULL,
|
||||
payment_time TIMESTAMP NULL,
|
||||
payment_status int4 DEFAULT 0 NOT NULL,
|
||||
payment_track VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status int4 NULL,
|
||||
is_deleted int4 DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE user_order IS '用户订单';
|
||||
COMMENT ON COLUMN user_order.id IS '主键';
|
||||
COMMENT ON COLUMN user_order.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_order.consignee_phone IS '收件人手机号';
|
||||
COMMENT ON COLUMN user_order.consignee IS '收件人';
|
||||
COMMENT ON COLUMN user_order.order_type IS '订单类型';
|
||||
COMMENT ON COLUMN user_order.item_code IS '商品编号';
|
||||
COMMENT ON COLUMN user_order.item_name IS '商品名称';
|
||||
COMMENT ON COLUMN user_order.image_url IS '图片';
|
||||
COMMENT ON COLUMN user_order.quantity IS '数量';
|
||||
COMMENT ON COLUMN user_order.delivery_address IS '收货地址(实物商品必填,虚拟商品可为空)';
|
||||
COMMENT ON COLUMN user_order.order_status IS '订单状态 0=待支付 1=已支付(待发货/待使用)2=已取消 3=已发货/已出票(进行中)4=已完成 5=已关闭(超时未支付)6=退款中 7: 已退款';
|
||||
COMMENT ON COLUMN user_order.total_amount IS '订单金额';
|
||||
COMMENT ON COLUMN user_order.actual_amount IS '实际支付金额';
|
||||
COMMENT ON COLUMN user_order.payment_type IS '支付方式';
|
||||
COMMENT ON COLUMN user_order.payment_time IS '支付时间';
|
||||
COMMENT ON COLUMN user_order.payment_track IS '支付凭证编号';
|
||||
COMMENT ON COLUMN user_order.payment_status IS '支付状态 0=未支付 1=已支付 2=支付失败 3=支付中(如跳转网银)';
|
||||
COMMENT ON COLUMN user_order.express_company IS '快递公司名称';
|
||||
COMMENT ON COLUMN user_order.express_no IS '快递单号(物流单号)';
|
||||
COMMENT ON COLUMN user_order.create_user IS '创建人';
|
||||
COMMENT ON COLUMN user_order.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN user_order.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN user_order.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_order.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_order.status IS '状态';
|
||||
|
||||
CREATE INDEX idx_user_order_user_status_time ON user_order (user_id, order_status, create_time DESC);
|
||||
CREATE INDEX idx_user_order_status_time ON user_order (order_status, create_time DESC);
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019446499472781314', '1123598815738675201', 'order', '用户订单', 'menu', '/common/order', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019446499472781315', '2019446499472781314', 'order_add', '新增', 'add', '/common/order/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019446499472781316', '2019446499472781314', 'order_edit', '修改', 'edit', '/common/order/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019446499472781317', '2019446499472781314', 'order_delete', '删除', 'delete', '/api/user-order/order/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019446499472781318', '2019446499472781314', 'order_view', '查看', 'view', '/common/order/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS user_market_benefit_package_template;
|
||||
CREATE TABLE user_market_benefit_package_template --积分包信息模板表
|
||||
(
|
||||
id int8 NOT NULL PRIMARY KEY,
|
||||
package_name VARCHAR(128) NULL,
|
||||
user_limit int4 default 0, -- 最大购买数量
|
||||
max_limit int4 default 0, -- 全网最大兑换数量
|
||||
day_limit int4 default 0, -- 产出总天数
|
||||
benefit_point_amount decimal(14, 2) default 0, -- 总产出福利积分
|
||||
benefit_value_amount decimal(14, 2) default 0, -- 购买赠与福利值
|
||||
benefit_point_price decimal(14, 2) default 0, --兑换包需要的福利积分
|
||||
cash_coupon_price decimal(14, 2) default 0, --兑换包需要的现金券
|
||||
exchanged_quantity int4 default 0, -- 已兑换数量
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1,
|
||||
is_deleted int4 default 0
|
||||
|
||||
);
|
||||
|
||||
COMMENT ON TABLE user_market_benefit_package_template IS '积分包信息表';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.id IS '主键';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.package_name IS '积分包名称';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.user_limit IS '最大购买数量';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.day_limit IS '产出总天数';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.benefit_point_amount IS '总产出福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.benefit_value_amount IS '购买赠与福利值';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.benefit_point_price IS '兑换包需要的福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.cash_coupon_price IS '兑换包需要的现金券';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.max_limit IS '全网最大兑换数量';
|
||||
COMMENT ON COLUMN user_market_benefit_package_template.exchanged_quantity IS '已兑换数量';
|
||||
comment on column user_market_benefit_package_template.create_user is '创建人';
|
||||
comment on column user_market_benefit_package_template.create_dept is '创建部门';
|
||||
comment on column user_market_benefit_package_template.create_time is '创建时间';
|
||||
comment on column user_market_benefit_package_template.update_user is '修改人';
|
||||
comment on column user_market_benefit_package_template.update_time is '修改时间';
|
||||
comment on column user_market_benefit_package_template.status is '状态';
|
||||
comment on column user_market_benefit_package_template.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_market_benefit_package_template
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
INSERT INTO user_market_benefit_package_template (id, package_name, user_limit, max_limit, day_limit, benefit_point_amount, benefit_value_amount, benefit_point_price, cash_coupon_price, exchanged_quantity, create_user, create_dept, create_time, update_user, update_time, status, is_deleted) VALUES (2019440113307066370, '100福利包', 10, 2000000, 360, 300.00, 100.00, 100.00, 20.00, 0, 1123598821738675201, 1123598813738675201, '2026-02-05 23:56:57.000000', 1123598821738675201, '2026-02-05 23:57:40.162000', 1, 0);
|
||||
INSERT INTO user_market_benefit_package_template (id, package_name, user_limit, max_limit, day_limit, benefit_point_amount, benefit_value_amount, benefit_point_price, cash_coupon_price, exchanged_quantity, create_user, create_dept, create_time, update_user, update_time, status, is_deleted) VALUES (2019440172115402754, '1000福利包', 4, 1000000, 360, 3000.00, 1000.00, 1000.00, 300.00, 0, 1123598821738675201, 1123598813738675201, '2026-02-05 23:57:11.072000', 1123598821738675201, '2026-02-05 23:57:11.072000', 1, 0);
|
||||
INSERT INTO user_market_benefit_package_template (id, package_name, user_limit, max_limit, day_limit, benefit_point_amount, benefit_value_amount, benefit_point_price, cash_coupon_price, exchanged_quantity, create_user, create_dept, create_time, update_user, update_time, status, is_deleted) VALUES (2019440222086340610, '5000福利包', 2, 50000, 360, 15000.00, 5000.00, 5000.00, 1500.00, 0, 1123598821738675201, 1123598813738675201, '2026-02-05 23:57:23.001000', 1123598821738675201, '2026-02-05 23:57:23.001000', 1, 0);
|
||||
INSERT INTO user_market_benefit_package_template (id, package_name, user_limit, max_limit, day_limit, benefit_point_amount, benefit_value_amount, benefit_point_price, cash_coupon_price, exchanged_quantity, create_user, create_dept, create_time, update_user, update_time, status, is_deleted) VALUES (2019440263022747650, '10000福利包', 1, 20000, 360, 40000.00, 10000.00, 10000.00, 4000.00, 0, 1123598821738675201, 1123598813738675201, '2026-02-05 23:57:32.752000', 1123598821738675201, '2026-02-05 23:57:32.752000', 1, 0);
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS user_market_benefit_package;
|
||||
create table user_market_benefit_package --用户福利积分包表
|
||||
(
|
||||
id int8 not null primary key,
|
||||
statistical_date timestamp(6),
|
||||
user_id int8,
|
||||
phone int8,
|
||||
user_name varchar(128),
|
||||
package_id int8,
|
||||
package_name varchar(128),
|
||||
type int4 default 1, -- 1-积分兑换 2-后台划拨
|
||||
user_benefit decimal(14, 2) default 0, --兑换包需要的福利积分
|
||||
user_cash decimal(14, 2) default 0, --兑换包需要的现金券
|
||||
give_amount decimal(14, 2) default 0, -- 购买赠与福利值
|
||||
day_total int4 default 0, -- 产出总天数
|
||||
amount_total decimal(14, 2) default 0, -- 总产出福利积分
|
||||
amount_day decimal(14, 2) default 0, -- 每日产出福利积分 = 总产出 / 总产出
|
||||
amount_out decimal(16, 4) default 0, -- 已产出福利积分
|
||||
out_day int4 default 0, -- 已产出天数
|
||||
active_time timestamp(6), -- 激活时间
|
||||
expired_date timestamp(6), -- 过期时间
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1, -- 1-未激活 2-已激活 3-已完成 4-已过期,
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
|
||||
|
||||
create index upi_status_index
|
||||
on user_market_benefit_package (is_deleted, status);
|
||||
|
||||
COMMENT ON TABLE user_market_benefit_package IS '用户积分包信息表';
|
||||
COMMENT ON COLUMN user_market_benefit_package.id IS '主键';
|
||||
COMMENT ON COLUMN user_market_benefit_package.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_market_benefit_package.phone IS '用户手机号';
|
||||
COMMENT ON COLUMN user_market_benefit_package.user_name IS '用户名';
|
||||
COMMENT ON COLUMN user_market_benefit_package.package_id IS '积分包id';
|
||||
COMMENT ON COLUMN user_market_benefit_package.package_name IS '积分包名称';
|
||||
COMMENT ON COLUMN user_market_benefit_package.type IS '1-积分兑换 2-后台划拨';
|
||||
COMMENT ON COLUMN user_market_benefit_package.user_benefit IS '兑换包需要的福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package.user_cash IS '兑换包需要的现金券';
|
||||
COMMENT ON COLUMN user_market_benefit_package.give_amount IS '购买赠与福利值';
|
||||
COMMENT ON COLUMN user_market_benefit_package.day_total IS '产出总天数';
|
||||
COMMENT ON COLUMN user_market_benefit_package.amount_total IS '总产出福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package.amount_day IS '每日产出福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package.amount_out IS '已产出福利积分';
|
||||
COMMENT ON COLUMN user_market_benefit_package.out_day IS '已产出天数';
|
||||
COMMENT ON COLUMN user_market_benefit_package.expired_date IS '过期时间';
|
||||
COMMENT ON COLUMN user_market_benefit_package.active_time IS '激活时间';
|
||||
COMMENT ON COLUMN user_market_benefit_package.remark IS '备注';
|
||||
comment on column user_market_benefit_package.create_user is '创建人';
|
||||
comment on column user_market_benefit_package.create_dept is '创建部门';
|
||||
comment on column user_market_benefit_package.create_time is '创建时间';
|
||||
comment on column user_market_benefit_package.update_user is '修改人';
|
||||
comment on column user_market_benefit_package.update_time is '修改时间';
|
||||
comment on column user_market_benefit_package.status is '状态 1-未激活 2-已激活 3-已完成 4-已过期';
|
||||
comment on column user_market_benefit_package.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_market_benefit_package
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
DROP TABLE IF EXISTS user_market_benefit_package_log;
|
||||
create table user_market_benefit_package_log
|
||||
(
|
||||
id int8 not null primary key,
|
||||
statistical_date timestamp(6),
|
||||
user_id int8,
|
||||
phone int8,
|
||||
user_name varchar(128),
|
||||
type int4 default 1, -- 1-积分兑换 2-后台划拨
|
||||
user_package_id int8,
|
||||
package_name varchar(128),
|
||||
package_detail text,
|
||||
give_number int4 default 1,
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status int4 default 1,
|
||||
is_deleted int4 default 0
|
||||
);
|
||||
|
||||
|
||||
create index gpl_date_index
|
||||
on user_market_benefit_package_log (is_deleted, statistical_date, user_id);
|
||||
|
||||
COMMENT ON TABLE user_market_benefit_package_log IS '兑换福利包记录';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.id IS '主键';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.statistical_date IS '统计日期';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.phone IS '用户手机号';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.user_name IS '用户名';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.type IS '1-积分兑换 2-后台划拨';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.user_package_id IS '积分包id';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.package_name IS '积分包名称';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.package_detail IS '积分包信息快照';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.give_number IS '赠送数量';
|
||||
COMMENT ON COLUMN user_market_benefit_package_log.remark IS '备注';
|
||||
comment on column user_market_benefit_package_log.create_user is '创建人';
|
||||
comment on column user_market_benefit_package_log.create_dept is '创建部门';
|
||||
comment on column user_market_benefit_package_log.create_time is '创建时间';
|
||||
comment on column user_market_benefit_package_log.update_user is '修改人';
|
||||
comment on column user_market_benefit_package_log.update_time is '修改时间';
|
||||
comment on column user_market_benefit_package_log.status is '状态';
|
||||
comment on column user_market_benefit_package_log.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_market_benefit_package_log
|
||||
owner to yicha1lu;
|
||||
|
||||
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2016446332399943682, 0, 'userPackInfo', '福利包管理', 'menu', '/userPackInfo', 'iconfont iconicon_principal', 13, 1, -1, 1, '', '', 0);
|
||||
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517579878402', '2016446332399943682', 'userMarketBenefitPackage', '用户福利包信息', 'menu', '/userPackage/userMarketBenefitPackage', NULL, 2, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517579878403', '2019438517579878402', 'userMarketBenefitPackage_add', '新增', 'add', '/userPackage/userMarketBenefitPackage/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517579878404', '2019438517579878402', 'userMarketBenefitPackage_edit', '修改', 'edit', '/userPackage/userMarketBenefitPackage/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517579878405', '2019438517579878402', 'userMarketBenefitPackage_delete', '删除', 'delete', '/api/blade-usermarketbenefitpackage/userMarketBenefitPackage/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517579878406', '2019438517579878402', 'userMarketBenefitPackage_view', '查看', 'view', '/userPackage/userMarketBenefitPackage/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517974142978', '2016446332399943682', 'userMarketBenefitPackageLog', '划拨福利包记录', 'menu', '/userPackage/userMarketBenefitPackageLog', NULL, 3, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517974142979', '2019438517974142978', 'userMarketBenefitPackageLog_add', '新增', 'add', '/userPackage/userMarketBenefitPackageLog/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517974142980', '2019438517974142978', 'userMarketBenefitPackageLog_edit', '修改', 'edit', '/userPackage/userMarketBenefitPackageLog/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517974142981', '2019438517974142978', 'userMarketBenefitPackageLog_delete', '删除', 'delete', '/api/blade-usermarketbenefitpackagelog/userMarketBenefitPackageLog/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517974142982', '2019438517974142978', 'userMarketBenefitPackageLog_view', '查看', 'view', '/userPackage/userMarketBenefitPackageLog/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517080756225', '2016446332399943682', 'userMarketBenefitPackageTemplate', '福利包信息', 'menu', '/userPackage/userMarketBenefitPackageTemplate', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517080756226', '2019438517080756225', 'userMarketBenefitPackageTemplate_add', '新增', 'add', '/userPackage/userMarketBenefitPackageTemplate/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517080756227', '2019438517080756225', 'userMarketBenefitPackageTemplate_edit', '修改', 'edit', '/userPackage/userMarketBenefitPackageTemplate/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517080756228', '2019438517080756225', 'userMarketBenefitPackageTemplate_delete', '删除', 'delete', '/api/blade-usermarketbenefitpackagetemplate/userMarketBenefitPackageTemplate/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517080756229', '2019438517080756225', 'userMarketBenefitPackageTemplate_view', '查看', 'view', '/userPackage/userMarketBenefitPackageTemplate/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
|
||||
------------------------------------------------------------------------------------------------------------------------
|
||||
|
||||
|
||||
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017256532300197889, 0, 'app_order_status', '-1', 'app订单状态', 17, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017256701003493378, 2017256532300197889, 'app_order_status', '3', '待收货', 3, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017256735887519745, 2017256532300197889, 'app_order_status', '4', '已完成', 4, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017256766271057921, 2017256532300197889, 'app_order_status', '5', '已取消', 5, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017256798575587330, 2017256532300197889, 'app_order_status', '6', '售后中', 6, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017256831240826882, 2017256532300197889, 'app_order_status', '7', '已完结', 7, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017277351755730945, 0, 'app_yes_no', '-1', 'app是否状态', 18, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017277404973060097, 2017277351755730945, 'app_yes_no', '0', '否', 0, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017277445628448770, 2017277351755730945, 'app_yes_no', '1', '是', 1, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017279052097212417, 0, 'app_pay_status', '-1', 'app支付状态', 19, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017279219479302146, 2017279052097212417, 'app_pay_status', '1', '待支付', 1, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017279260155662338, 2017279052097212417, 'app_pay_status', '2', '已支付', 2, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017279292049149953, 2017279052097212417, 'app_pay_status', '3', '已关闭', 3, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017256666383708162, 2017256532300197889, 'app_order_status', '2', '已支付', 2, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017256633735245825, 2017256532300197889, 'app_order_status', '1', '待支付', 1, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017279326488580097, 2017279052097212417, 'app_pay_status', '4', '退款中', 4, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017279356754677762, 2017279052097212417, 'app_pay_status', '5', '已退款', 5, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017280506669256705, 0, 'app_order_model', '-1', 'app订单类型', 20, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017280559299383297, 2017280506669256705, 'app_order_model', '1', '商城订单', 1, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017448732011200513, 0, 'app_pay_type', '-1', 'app支付类型', 21, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017448799661129730, 2017448732011200513, 'app_pay_type', '1', '支付宝', 1, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017448849464295426, 2017448732011200513, 'app_pay_type', '2', '微信', 2, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017448927499321345, 2017448732011200513, 'app_pay_type', '3', '线下支付', 3, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017256598469537794, 2017256532300197889, 'app_order_status', '0', '待支付', 0, '', 0, 1, 1);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017478580159041538, 0, 'app_point_spending_type', '-1', 'app积分消费类型', 22, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017478672572141569, 2017478580159041538, 'app_point_spending_type', '1', '收入', 1, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017478708412469249, 2017478580159041538, 'app_point_spending_type', '2', '支出', 2, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017517140190855170, 0, 'app_package_type', '-1', 'app福利包类型', 23, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017517209350733826, 2017517140190855170, 'app_package_type', '1', '积分兑换', 1, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2017517264824598530, 2017517140190855170, 'app_package_type', '2', '后台划拨', 2, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2018600540205121537, 0, 'app_banner_type', '-1', 'app轮播图类型', 24, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2018600645536677890, 2018600540205121537, 'app_banner_type', '1', '主banner', 1, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2018600683209916417, 2018600540205121537, 'app_banner_type', '2', '商城banner', 2, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2018607816655708161, 0, 'app_user_notice', '-1', 'app用户通知类型', 25, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2018607875027836929, 2018607816655708161, 'app_user_notice', '0', '系统通知', 0, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2019414847658545153, 0, 'app_product_status', '-1', 'app上下架商品状态', 26, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2019414970329354241, 2019414847658545153, 'app_product_status', '0', '下架', 0, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2019415024934998018, 2019414847658545153, 'app_product_status', '1', '上架', 1, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2019491173300129793, 0, 'app_package_status', '-1', '福利包状态', 27, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2019491225556963329, 2019491173300129793, 'app_package_status', '1', '未激活', 1, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2019491256389292033, 2019491173300129793, 'app_package_status', '2', '已激活', 2, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2019491292992983042, 2019491173300129793, 'app_package_status', '3', '已完成', 3, '', 0, 1, 0);
|
||||
INSERT INTO blade_dict (id, parent_id, code, dict_key, dict_value, sort, remark, is_sealed, status, is_deleted) VALUES (2019491330833993730, 2019491173300129793, 'app_package_status', '4', '已过期', 4, '', 0, 1, 0);
|
||||
5
doc/sql/executed/blade_menu_userNotice.sql
Normal file
5
doc/sql/executed/blade_menu_userNotice.sql
Normal file
@@ -0,0 +1,5 @@
|
||||
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787265, 2019338015981219841, 'userNotice', '用户通知', 'menu', '/common/commonUserNotice', 'iconfont iconicon_voipphone', 1, 1, 0, 1, '', '', 0);
|
||||
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787266, 2020763647899787265, 'userNotice_add', '新增', 'add', '/common/commonUserNotice/add', 'plus', 1, 2, 1, 1, null, null, 0);
|
||||
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787267, 2020763647899787265, 'userNotice_edit', '修改', 'edit', '/common/commonUserNotice/edit', 'form', 2, 2, 2, 1, null, null, 0);
|
||||
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787268, 2020763647899787265, 'userNotice_delete', '删除', 'delete', '/common/notice/remove', 'delete', 3, 2, 3, 1, null, null, 0);
|
||||
--INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2020763647899787269, 2020763647899787265, 'userNotice_view', '查看', 'view', '/common/commonUserNotice/view', 'file-text', 4, 2, 2, 1, null, null, 0);
|
||||
2
doc/sql/executed/mall_common.menu.sql
Normal file
2
doc/sql/executed/mall_common.menu.sql
Normal file
@@ -0,0 +1,2 @@
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2016445919294554113, 0, 'mall', '商城', 'menu', '/mall', 'iconfont iconicon_message', 11, 1, null, 1, null, '', 0);
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2019338015981219841, 0, 'common', '公共信息', 'menu', '/common', 'iconfont iconicon_message', 8, 1, null, 1, null, '', 0);
|
||||
10
doc/sql/executed/mallcategory.menu.sql
Normal file
10
doc/sql/executed/mallcategory.menu.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341061003980801', '2016445919294554113', 'mallCategory', '商品分类', 'menu', '/mall/mallCategory', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341061003980802', '2019341061003980801', 'mallCategory_add', '新增', 'add', '/mall/mallCategory/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341061003980803', '2019341061003980801', 'mallCategory_edit', '修改', 'edit', '/mall/mallCategory/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341061003980804', '2019341061003980801', 'mallCategory_delete', '删除', 'delete', '/api/blade-mallcategory/mallCategory/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341061003980805', '2019341061003980801', 'mallCategory_view', '查看', 'view', '/mall/mallCategory/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
10
doc/sql/executed/mallproduct.menu.sql
Normal file
10
doc/sql/executed/mallproduct.menu.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341061775732737', '2016445919294554113', 'mallProduct', '商城商品', 'menu', '/mall/mallProduct', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341061775732738', '2019341061775732737', 'mallProduct_add', '新增', 'add', '/mall/mallProduct/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341061775732739', '2019341061775732737', 'mallProduct_edit', '修改', 'edit', '/mall/mallProduct/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341061775732740', '2019341061775732737', 'mallProduct_delete', '删除', 'delete', '/api/blade-mallproduct/mallProduct/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341061775732741', '2019341061775732737', 'mallProduct_view', '查看', 'view', '/mall/mallProduct/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
38
doc/sql/executed/market_packageInfo_menu.sql
Normal file
38
doc/sql/executed/market_packageInfo_menu.sql
Normal file
@@ -0,0 +1,38 @@
|
||||
INSERT INTO blade_menu (id, parent_id, code, name, alias, path, source, sort, category, action, is_open, component, remark, is_deleted) VALUES (2016446332399943682, 0, 'userPackInfo', '福利包管理', 'menu', '/userPackInfo', 'iconfont iconicon_principal', 13, 1, -1, 1, '', '', 0);
|
||||
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517579878402', '2016446332399943682', 'userMarketBenefitPackage', '用户福利包信息', 'menu', '/userPackage/userMarketBenefitPackage', NULL, 2, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517579878403', '2019438517579878402', 'userMarketBenefitPackage_add', '新增', 'add', '/userPackage/userMarketBenefitPackage/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517579878404', '2019438517579878402', 'userMarketBenefitPackage_edit', '修改', 'edit', '/userPackage/userMarketBenefitPackage/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517579878405', '2019438517579878402', 'userMarketBenefitPackage_delete', '删除', 'delete', '/api/blade-usermarketbenefitpackage/userMarketBenefitPackage/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517579878406', '2019438517579878402', 'userMarketBenefitPackage_view', '查看', 'view', '/userPackage/userMarketBenefitPackage/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517974142978', '2016446332399943682', 'userMarketBenefitPackageLog', '划拨福利包记录', 'menu', '/userPackage/userMarketBenefitPackageLog', NULL, 3, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517974142979', '2019438517974142978', 'userMarketBenefitPackageLog_add', '新增', 'add', '/userPackage/userMarketBenefitPackageLog/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517974142980', '2019438517974142978', 'userMarketBenefitPackageLog_edit', '修改', 'edit', '/userPackage/userMarketBenefitPackageLog/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517974142981', '2019438517974142978', 'userMarketBenefitPackageLog_delete', '删除', 'delete', '/api/blade-usermarketbenefitpackagelog/userMarketBenefitPackageLog/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517974142982', '2019438517974142978', 'userMarketBenefitPackageLog_view', '查看', 'view', '/userPackage/userMarketBenefitPackageLog/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517080756225', '2016446332399943682', 'userMarketBenefitPackageTemplate', '福利包信息', 'menu', '/userPackage/userMarketBenefitPackageTemplate', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517080756226', '2019438517080756225', 'userMarketBenefitPackageTemplate_add', '新增', 'add', '/userPackage/userMarketBenefitPackageTemplate/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517080756227', '2019438517080756225', 'userMarketBenefitPackageTemplate_edit', '修改', 'edit', '/userPackage/userMarketBenefitPackageTemplate/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517080756228', '2019438517080756225', 'userMarketBenefitPackageTemplate_delete', '删除', 'delete', '/api/blade-usermarketbenefitpackagetemplate/userMarketBenefitPackageTemplate/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019438517080756229', '2019438517080756225', 'userMarketBenefitPackageTemplate_view', '查看', 'view', '/userPackage/userMarketBenefitPackageTemplate/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
|
||||
10
doc/sql/executed/marketinfo.menu.sql
Normal file
10
doc/sql/executed/marketinfo.menu.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019329745643835393', '1123598815738675201', 'marketInfo', '用户拓展信息表', 'menu', '/market/marketInfo', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019329745643835394', '2019329745643835393', 'marketInfo_add', '新增', 'add', '/market/marketInfo/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019329745643835395', '2019329745643835393', 'marketInfo_edit', '修改', 'edit', '/market/marketInfo/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019329745643835396', '2019329745643835393', 'marketInfo_delete', '删除', 'delete', '/api/blade-marketinfo/marketInfo/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019329745643835397', '2019329745643835393', 'marketInfo_view', '查看', 'view', '/market/marketInfo/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
10
doc/sql/executed/order.menu.sql
Normal file
10
doc/sql/executed/order.menu.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019446499472781314', '1123598815738675201', 'order', '用户订单', 'menu', '/common/order', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019446499472781315', '2019446499472781314', 'order_add', '新增', 'add', '/common/order/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019446499472781316', '2019446499472781314', 'order_edit', '修改', 'edit', '/common/order/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019446499472781317', '2019446499472781314', 'order_delete', '删除', 'delete', '/api/user-order/order/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019446499472781318', '2019446499472781314', 'order_view', '查看', 'view', '/common/order/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
10
doc/sql/executed/regionsinfo.menu.sql
Normal file
10
doc/sql/executed/regionsinfo.menu.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341060219645953', '2019338015981219841', 'regionsInfo', '省市区信息', 'menu', '/common/commonRegionsInfo', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341060219645954', '2019341060219645953', 'regionsInfo_add', '新增', 'add', '/common/commonRegionsInfo/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341060219645955', '2019341060219645953', 'regionsInfo_edit', '修改', 'edit', '/common/commonRegionsInfo/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341060219645956', '2019341060219645953', 'regionsInfo_delete', '删除', 'delete', '/api/blade-regionsinfo/regionsInfo/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341060219645957', '2019341060219645953', 'regionsInfo_view', '查看', 'view', '/common/regionsInfo/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
10
doc/sql/executed/useraddress.menu.sql
Normal file
10
doc/sql/executed/useraddress.menu.sql
Normal file
@@ -0,0 +1,10 @@
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341062694285314', '2019338015981219841', 'userAddress', '用户收货地址', 'menu', '/common/userAddress', NULL, 1, 1, 0, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341062694285315', '2019341062694285314', 'userAddress_add', '新增', 'add', '/common/userAddress/add', 'plus', 1, 2, 1, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341062694285316', '2019341062694285314', 'userAddress_edit', '修改', 'edit', '/common/userAddress/edit', 'form', 2, 2, 2, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341062694285317', '2019341062694285314', 'userAddress_delete', '删除', 'delete', '/api/blade-useraddress/userAddress/remove', 'delete', 3, 2, 3, 1, NULL, 0);
|
||||
INSERT INTO blade_menu(id, parent_id, code, name, alias, path, source, sort, category, action, is_open, remark, is_deleted)
|
||||
VALUES ('2019341062694285318', '2019341062694285314', 'userAddress_view', '查看', 'view', '/common/userAddress/view', 'file-text', 4, 2, 2, 1, NULL, 0);
|
||||
File diff suppressed because one or more lines are too long
@@ -1,145 +0,0 @@
|
||||
CREATE TABLE mall_spu
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
spu_sn VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
spu_name VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
main_img VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
detail_img text NULL,
|
||||
top_img text NULL,
|
||||
cate_id VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
cate_ids VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
cost_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
original_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
retail_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
profit DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
sales INTEGER DEFAULT 0 NOT NULL,
|
||||
spu_qty INTEGER DEFAULT 0 NOT NULL,
|
||||
tags text DEFAULT '' NOT NULL,
|
||||
status INTEGER DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
|
||||
COMMENT ON TABLE mall_spu IS '商城spu';
|
||||
COMMENT ON COLUMN mall_spu.id IS '主键';
|
||||
COMMENT ON COLUMN mall_spu.spu_sn IS '商品编码';
|
||||
COMMENT ON COLUMN mall_spu.spu_name IS '商品名称';
|
||||
COMMENT ON COLUMN mall_spu.main_img IS '主图';
|
||||
COMMENT ON COLUMN mall_spu.detail_img IS '详情图(多图,逗号分割)';
|
||||
COMMENT ON COLUMN mall_spu.top_img IS '顶图(多图,逗号分割)';
|
||||
COMMENT ON COLUMN mall_spu.cate_id IS 'cate_id分类';
|
||||
COMMENT ON COLUMN mall_spu.cate_ids IS 'cate_id分类';
|
||||
COMMENT ON COLUMN mall_spu.cost_price IS '成本价';
|
||||
COMMENT ON COLUMN mall_spu.original_price IS '原价';
|
||||
COMMENT ON COLUMN mall_spu.retail_price IS '销售价';
|
||||
COMMENT ON COLUMN mall_spu.profit IS '利润';
|
||||
COMMENT ON COLUMN mall_spu.sales IS '销量';
|
||||
COMMENT ON COLUMN mall_spu.spu_qty IS '库存';
|
||||
COMMENT ON COLUMN mall_spu.tags IS '标签(多标签,逗号分割 )';
|
||||
COMMENT ON COLUMN mall_spu.status IS '状态(0=下架,1=上架,3=删除)';
|
||||
COMMENT ON COLUMN mall_spu.create_user IS '创建人';
|
||||
COMMENT ON COLUMN mall_spu.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN mall_spu.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN mall_spu.update_user IS '修改人';
|
||||
COMMENT ON COLUMN mall_spu.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN mall_spu.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE ys_category
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
cname VARCHAR(100) DEFAULT '' NOT NULL,
|
||||
pid BIGINT DEFAULT 0 NOT NULL,
|
||||
level INTEGER DEFAULT 0 NOT NULL
|
||||
);
|
||||
|
||||
|
||||
COMMENT ON TABLE ys_category IS '商品分类';
|
||||
COMMENT ON COLUMN ys_category.id IS '主键';
|
||||
COMMENT ON COLUMN ys_category.cname IS '分类名称';
|
||||
COMMENT ON COLUMN ys_category.pid IS 'pid';
|
||||
COMMENT ON COLUMN ys_category.level IS 'level';
|
||||
|
||||
|
||||
CREATE TABLE mall_cart
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
user_id BIGINT DEFAULT 0 NOT NULL,
|
||||
title VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
spu_id INTEGER DEFAULT 0 NOT NULL,
|
||||
quantity INTEGER DEFAULT 0 NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
|
||||
COMMENT ON TABLE mall_cart IS '商城购物车';
|
||||
COMMENT ON COLUMN mall_cart.id IS '主键';
|
||||
COMMENT ON COLUMN mall_cart.user_id IS '用户id';
|
||||
COMMENT ON COLUMN mall_cart.title IS '商品名称';
|
||||
COMMENT ON COLUMN mall_cart.spu_id IS 'spuId';
|
||||
COMMENT ON COLUMN mall_cart.quantity IS '数量';
|
||||
COMMENT ON COLUMN mall_cart.create_user IS '创建人';
|
||||
COMMENT ON COLUMN mall_cart.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN mall_cart.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN mall_cart.update_user IS '修改人';
|
||||
COMMENT ON COLUMN mall_cart.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN mall_cart.status IS '状态';
|
||||
COMMENT ON COLUMN mall_cart.is_deleted IS '是否已删除';
|
||||
CREATE INDEX idx_user_id ON mall_cart (user_id);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE user_address
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
user_id BIGINT NULL,
|
||||
regions_info_id BIGINT NULL,
|
||||
province VARCHAR(200) NULL,
|
||||
city VARCHAR(200) NULL,
|
||||
district VARCHAR(200) NULL,
|
||||
street VARCHAR(200) NULL,
|
||||
detail VARCHAR(200) NULL,
|
||||
consignee VARCHAR(200) NULL,
|
||||
phone VARCHAR(200) NULL,
|
||||
is_default INTEGER NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
|
||||
COMMENT ON TABLE user_address IS '用户地址表';
|
||||
COMMENT ON COLUMN user_address.id IS '主键';
|
||||
COMMENT ON COLUMN user_address.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_address.regions_info_id IS '地区信息id';
|
||||
COMMENT ON COLUMN user_address.province IS '省份';
|
||||
COMMENT ON COLUMN user_address.city IS '城市';
|
||||
COMMENT ON COLUMN user_address.district IS '区县';
|
||||
COMMENT ON COLUMN user_address.street IS '街道';
|
||||
COMMENT ON COLUMN user_address.detail IS '详细地址';
|
||||
COMMENT ON COLUMN user_address.consignee IS '收货人';
|
||||
COMMENT ON COLUMN user_address.phone IS '联系电话';
|
||||
COMMENT ON COLUMN user_address.is_default IS '是否默认地址(0=否,1=是)';
|
||||
COMMENT ON COLUMN user_address.create_user IS '创建人';
|
||||
COMMENT ON COLUMN user_address.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN user_address.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN user_address.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_address.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_address.status IS '状态';
|
||||
COMMENT ON COLUMN user_address.is_deleted IS '是否已删除';
|
||||
@@ -1,274 +0,0 @@
|
||||
CREATE TABLE user_order
|
||||
(
|
||||
id BIGINT DEFAULT 0 NOT NULL PRIMARY KEY,
|
||||
user_id BIGINT DEFAULT 0 NOT NULL,
|
||||
order_type INTEGER DEFAULT 0 NOT NULL,
|
||||
order_id BIGINT DEFAULT 0 NOT NULL,
|
||||
title VARCHAR(256) DEFAULT '' NOT NULL,
|
||||
images VARCHAR(512) NULL,
|
||||
quantity INTEGER NULL,
|
||||
description VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
order_status INTEGER DEFAULT 0 NOT NULL,
|
||||
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
payment_type INTEGER DEFAULT 0 NOT NULL,
|
||||
payment_time TIMESTAMP NULL,
|
||||
payment_track VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
payment_status INTEGER DEFAULT 1 NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE user_order IS '用户订单';
|
||||
COMMENT ON COLUMN user_order.id IS '主键';
|
||||
COMMENT ON COLUMN user_order.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_order.order_type IS '订单类型';
|
||||
COMMENT ON COLUMN user_order.order_id IS '订单id';
|
||||
COMMENT ON COLUMN user_order.title IS '订单名称';
|
||||
COMMENT ON COLUMN user_order.images IS '图片';
|
||||
COMMENT ON COLUMN user_order.quantity IS '数量';
|
||||
COMMENT ON COLUMN user_order.description IS '订单描述';
|
||||
COMMENT ON COLUMN user_order.order_status IS '订单状态';
|
||||
COMMENT ON COLUMN user_order.total_amount IS '订单金额';
|
||||
COMMENT ON COLUMN user_order.actual_amount IS '实际支付金额';
|
||||
COMMENT ON COLUMN user_order.payment_type IS '支付方式';
|
||||
COMMENT ON COLUMN user_order.payment_time IS '支付时间';
|
||||
COMMENT ON COLUMN user_order.payment_track IS '支付凭证编号';
|
||||
COMMENT ON COLUMN user_order.payment_status IS '支付状态';
|
||||
COMMENT ON COLUMN user_order.create_user IS '创建人';
|
||||
COMMENT ON COLUMN user_order.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN user_order.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN user_order.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_order.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_order.status IS '状态';
|
||||
COMMENT ON COLUMN user_order.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_order.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_order.status IS '状态';
|
||||
COMMENT ON COLUMN user_order.payment_time IS '支付时间';
|
||||
COMMENT ON COLUMN user_order.payment_track IS '支付凭证编号';
|
||||
COMMENT ON COLUMN user_order.payment_status IS '支付状态';
|
||||
COMMENT ON COLUMN user_order.create_user IS '创建人';
|
||||
COMMENT ON COLUMN user_order.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN user_order.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN user_order.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_order.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_order.status IS '状态';
|
||||
COMMENT ON COLUMN user_order.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_order.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_order.status IS '状态';
|
||||
COMMENT ON COLUMN user_order.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_order.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_order.status IS '状态';
|
||||
COMMENT ON COLUMN user_order.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX user_order_index ON user_order (user_id, order_type);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE mall_summary_order
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
user_id BIGINT DEFAULT 0 NOT NULL,
|
||||
products_info text NULL,
|
||||
order_info text NULL,
|
||||
confirm_info text NULL,
|
||||
vendor_regions_id BIGINT NOT NULL,
|
||||
address_id BIGINT NOT NULL,
|
||||
delivery_info text NULL,
|
||||
freight_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
order_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
refund_amount DECIMAL(10, 2) DEFAULT 0.00 NULL,
|
||||
payment_type INTEGER DEFAULT 0 NOT NULL,
|
||||
extra_type INTEGER DEFAULT 0 NOT NULL,
|
||||
payment_status INTEGER DEFAULT 0 NOT NULL,
|
||||
order_status INTEGER DEFAULT 0 NOT NULL,
|
||||
payment_completed_time TIMESTAMP NULL,
|
||||
payment_track VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
expire_time TIMESTAMP NULL,
|
||||
give_token DECIMAL(10, 2) NULL,
|
||||
actual_give_token DECIMAL(10, 2) NULL,
|
||||
is_royalty INTEGER DEFAULT 0 NULL,
|
||||
remarks VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
version BIGINT DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status INTEGER DEFAULT 0 NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
|
||||
);
|
||||
|
||||
COMMENT ON TABLE mall_summary_order IS '商城汇总订单';
|
||||
COMMENT ON COLUMN mall_summary_order.id IS '主键';
|
||||
COMMENT ON COLUMN mall_summary_order.user_id IS '用户id';
|
||||
COMMENT ON COLUMN mall_summary_order.products_info IS '商品信息';
|
||||
COMMENT ON COLUMN mall_summary_order.order_info IS '订单信息';
|
||||
COMMENT ON COLUMN mall_summary_order.confirm_info IS '订单确认信息';
|
||||
COMMENT ON COLUMN mall_summary_order.vendor_regions_id IS '地区id';
|
||||
COMMENT ON COLUMN mall_summary_order.address_id IS '地址id';
|
||||
COMMENT ON COLUMN mall_summary_order.delivery_info IS '快递信息';
|
||||
COMMENT ON COLUMN mall_summary_order.freight_amount IS '运费';
|
||||
COMMENT ON COLUMN mall_summary_order.cost_amount IS '订单成本';
|
||||
COMMENT ON COLUMN mall_summary_order.order_amount IS '订单金额';
|
||||
COMMENT ON COLUMN mall_summary_order.total_amount IS '总金额';
|
||||
COMMENT ON COLUMN mall_summary_order.actual_amount IS '实际支付';
|
||||
COMMENT ON COLUMN mall_summary_order.refund_amount IS '退款金额';
|
||||
COMMENT ON COLUMN mall_summary_order.payment_type IS '支付类型';
|
||||
COMMENT ON COLUMN mall_summary_order.extra_type IS '附加支付类型';
|
||||
COMMENT ON COLUMN mall_summary_order.payment_status IS '支付状态';
|
||||
COMMENT ON COLUMN mall_summary_order.extra_type IS '附加支付类型';
|
||||
COMMENT ON COLUMN mall_summary_order.order_status IS '订单状态 0=失败,1=待确认,2=待发货,3=待收货,4=已完成,5=已取消,6=售后中,7=已完结';
|
||||
COMMENT ON COLUMN mall_summary_order.payment_completed_time IS '支付完成时间';
|
||||
COMMENT ON COLUMN mall_summary_order.payment_track IS '支付凭证';
|
||||
COMMENT ON COLUMN mall_summary_order.order_status IS '订单状态 0=失败,1=待确认,2=待发货,3=待收货,4=已完成,5=已取消,6=售后中,7=已完结';
|
||||
COMMENT ON COLUMN mall_summary_order.payment_completed_time IS '支付完成时间';
|
||||
COMMENT ON COLUMN mall_summary_order.payment_track IS '支付凭证';
|
||||
COMMENT ON COLUMN mall_summary_order.expire_time IS '超时时间';
|
||||
COMMENT ON COLUMN mall_summary_order.give_token IS '赠送积分';
|
||||
COMMENT ON COLUMN mall_summary_order.actual_give_token IS '实际赠送扣分';
|
||||
COMMENT ON COLUMN mall_summary_order.is_royalty IS '是否已经给上级分红';
|
||||
COMMENT ON COLUMN mall_summary_order.remarks IS '备注';
|
||||
COMMENT ON COLUMN mall_summary_order.status IS '状态';
|
||||
COMMENT ON COLUMN mall_summary_order.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
CREATE INDEX mso_index ON mall_summary_order (user_id);
|
||||
CREATE INDEX mso_status_index ON mall_summary_order (payment_status, status);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE mall_detail_order
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
user_id BIGINT DEFAULT 0 NOT NULL,
|
||||
summary_order_id BIGINT DEFAULT 0 NOT NULL,
|
||||
spu_id BIGINT DEFAULT 0 NOT NULL,
|
||||
quantity INTEGER DEFAULT 0 NOT NULL,
|
||||
sku_snapshot text NULL,
|
||||
actual_cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
order_amount DECIMAL(10, 2) NULL,
|
||||
cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
given_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
remarks VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
order_status INTEGER DEFAULT 0 NOT NULL,
|
||||
version integer DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status INTEGER DEFAULT -1 NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE mall_detail_order IS '商城详情订单';
|
||||
COMMENT ON COLUMN mall_detail_order.id IS '主键';
|
||||
COMMENT ON COLUMN mall_detail_order.user_id IS '用户id';
|
||||
COMMENT ON COLUMN mall_detail_order.summary_order_id IS '主订单id';
|
||||
COMMENT ON COLUMN mall_detail_order.spu_id IS '商品id';
|
||||
COMMENT ON COLUMN mall_detail_order.quantity IS '数量';
|
||||
COMMENT ON COLUMN mall_detail_order.summary_order_id IS '主订单id';
|
||||
COMMENT ON COLUMN mall_detail_order.spu_id IS '商品id';
|
||||
COMMENT ON COLUMN mall_detail_order.quantity IS '数量';
|
||||
COMMENT ON COLUMN mall_detail_order.sku_snapshot IS '商品快照';
|
||||
COMMENT ON COLUMN mall_detail_order.actual_cost_amount IS '实际成本';
|
||||
COMMENT ON COLUMN mall_detail_order.order_amount IS '订单金额';
|
||||
COMMENT ON COLUMN mall_detail_order.cost_amount IS '订单成本';
|
||||
COMMENT ON COLUMN mall_detail_order.cost_amount IS '订单成本';
|
||||
COMMENT ON COLUMN mall_detail_order.actual_amount IS '实际支付';
|
||||
COMMENT ON COLUMN mall_detail_order.given_amount IS '赠送积分';
|
||||
COMMENT ON COLUMN mall_detail_order.remarks IS '备注';
|
||||
COMMENT ON COLUMN mall_detail_order.given_amount IS '赠送积分';
|
||||
COMMENT ON COLUMN mall_detail_order.remarks IS '备注';
|
||||
COMMENT ON COLUMN mall_detail_order.remarks IS '备注';
|
||||
COMMENT ON COLUMN mall_detail_order.order_status IS '订单状态 0=失败,1=待确认,2=待发货,3=待收货,4=已完成,5=已取消,6=售后中,7=已完结';
|
||||
COMMENT ON COLUMN mall_detail_order.status IS '状态';
|
||||
COMMENT ON COLUMN mall_detail_order.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN mall_detail_order.status IS '状态';
|
||||
COMMENT ON COLUMN mall_detail_order.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE INDEX mdo_index ON mall_detail_order (summary_order_id);
|
||||
CREATE INDEX mdo_uid_index ON mall_detail_order (user_id);
|
||||
|
||||
|
||||
CREATE TABLE mall_summary_order_after
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
user_id BIGINT DEFAULT -1 NOT NULL,
|
||||
summary_order_id BIGINT DEFAULT -1 NOT NULL,
|
||||
goods_id BIGINT DEFAULT -1 NOT NULL,
|
||||
sku_id BIGINT NOT NULL,
|
||||
goods_name VARCHAR(256) NOT NULL,
|
||||
third_plat_order_no VARCHAR(32) NOT NULL,
|
||||
third_plat_after_no VARCHAR(32) NOT NULL,
|
||||
quantity INTEGER DEFAULT -1 NULL,
|
||||
apply_type INTEGER NULL,
|
||||
apply_reason VARCHAR(100) DEFAULT '-1' NULL,
|
||||
apply_pic_urls TEXT NULL,
|
||||
refund_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
refund_status INTEGER DEFAULT 0 NULL,
|
||||
refund_reason VARCHAR(255) NULL,
|
||||
receiver VARCHAR(125) NULL,
|
||||
receiver_phone VARCHAR(255) NULL,
|
||||
receiver_addr VARCHAR(255) NULL,
|
||||
receiver_delivery_no VARCHAR(255) NULL,
|
||||
remarks VARCHAR(200) DEFAULT '' NULL,
|
||||
version integer DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP NULL,
|
||||
status INTEGER DEFAULT 0 NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL,
|
||||
after_info JSON NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE mall_summary_order_after IS '商品售后订单表';
|
||||
COMMENT ON COLUMN mall_summary_order_after.id IS '售后订单号';
|
||||
COMMENT ON COLUMN mall_summary_order_after.user_id IS '用户id';
|
||||
COMMENT ON COLUMN mall_summary_order_after.summary_order_id IS '总订单id';
|
||||
COMMENT ON COLUMN mall_summary_order_after.goods_id IS '商品ID';
|
||||
COMMENT ON COLUMN mall_summary_order_after.sku_id IS '商品订单号';
|
||||
COMMENT ON COLUMN mall_summary_order_after.goods_name IS '商品名称';
|
||||
COMMENT ON COLUMN mall_summary_order_after.third_plat_order_no IS '第三方订单单号';
|
||||
COMMENT ON COLUMN mall_summary_order_after.third_plat_after_no IS '第三方售后单号';
|
||||
COMMENT ON COLUMN mall_summary_order_after.quantity IS '商品数量';
|
||||
COMMENT ON COLUMN mall_summary_order_after.apply_type IS '申请售后类型,1=未收货退款,2=退货退款,3=换货补发,4=不退货仅退款';
|
||||
COMMENT ON COLUMN mall_summary_order_after.apply_reason IS '申请售后原因';
|
||||
COMMENT ON COLUMN mall_summary_order_after.apply_pic_urls IS '图片地址';
|
||||
COMMENT ON COLUMN mall_summary_order_after.refund_amount IS '退款金额';
|
||||
COMMENT ON COLUMN mall_summary_order_after.refund_status IS '处理售后状态';
|
||||
COMMENT ON COLUMN mall_summary_order_after.refund_reason IS '处理回复';
|
||||
COMMENT ON COLUMN mall_summary_order_after.receiver IS '退件收货人姓名';
|
||||
COMMENT ON COLUMN mall_summary_order_after.receiver_phone IS '退件收货人电话';
|
||||
COMMENT ON COLUMN mall_summary_order_after.receiver_addr IS '退件地址';
|
||||
COMMENT ON COLUMN mall_summary_order_after.receiver_delivery_no IS '退货物流单号';
|
||||
COMMENT ON COLUMN mall_summary_order_after.remarks IS '备注';
|
||||
COMMENT ON COLUMN mall_summary_order_after.status IS '状态';
|
||||
COMMENT ON COLUMN mall_summary_order_after.status IS '状态';
|
||||
COMMENT ON COLUMN mall_summary_order_after.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN mall_summary_order_after.after_info IS '售后详情';
|
||||
COMMENT ON COLUMN mall_summary_order_after.refund_amount IS '退款金额';
|
||||
COMMENT ON COLUMN mall_summary_order_after.refund_status IS '处理售后状态';
|
||||
COMMENT ON COLUMN mall_summary_order_after.refund_reason IS '处理回复';
|
||||
COMMENT ON COLUMN mall_summary_order_after.receiver IS '退件收货人姓名';
|
||||
COMMENT ON COLUMN mall_summary_order_after.receiver_phone IS '退件收货人电话';
|
||||
COMMENT ON COLUMN mall_summary_order_after.receiver_addr IS '退件地址';
|
||||
COMMENT ON COLUMN mall_summary_order_after.receiver_delivery_no IS '退货物流单号';
|
||||
COMMENT ON COLUMN mall_summary_order_after.remarks IS '备注';
|
||||
COMMENT ON COLUMN mall_summary_order_after.status IS '状态';
|
||||
COMMENT ON COLUMN mall_summary_order_after.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN mall_summary_order_after.after_info IS '售后详情';
|
||||
|
||||
@@ -1,250 +0,0 @@
|
||||
CREATE TABLE registration_order
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
spu_id BIGINT NULL,
|
||||
sku_id BIGINT NULL,
|
||||
title VARCHAR(100) NOT NULL,
|
||||
transaction_type INTEGER NOT NULL,
|
||||
thumbnail VARCHAR(500) NOT NULL,
|
||||
thumbnail_height INTEGER NULL,
|
||||
detail TEXT NULL,
|
||||
price DECIMAL(10, 2) NOT NULL,
|
||||
points DECIMAL(10, 2) NOT NULL,
|
||||
quantity INTEGER NOT NULL,
|
||||
remaining INTEGER NOT NULL,
|
||||
user_id BIGINT NOT NULL,
|
||||
user_nickname VARCHAR(100) NULL,
|
||||
in_transaction INTEGER DEFAULT 0 NOT NULL,
|
||||
is_full_package INTEGER DEFAULT 0 NOT NULL,
|
||||
delivery_type INTEGER DEFAULT 1 NULL,
|
||||
region_code VARCHAR(10) NULL,
|
||||
region_name VARCHAR(100) NULL,
|
||||
receiver_address VARCHAR(100) NULL,
|
||||
contact VARCHAR(100) NULL,
|
||||
contact_number VARCHAR(100) NULL,
|
||||
is_virtual INTEGER DEFAULT 0 NOT NULL,
|
||||
is_closed INTEGER DEFAULT 0 NOT NULL,
|
||||
version integer DEFAULT 0 NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL,
|
||||
is_vendor INTEGER DEFAULT 0 NULL,
|
||||
is_priority INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE registration_order IS '挂单表';
|
||||
COMMENT ON COLUMN registration_order.id IS '挂单ID';
|
||||
COMMENT ON COLUMN registration_order.spu_id IS 'spuId';
|
||||
COMMENT ON COLUMN registration_order.sku_id IS 'skuId';
|
||||
COMMENT ON COLUMN registration_order.title IS '规格名称';
|
||||
COMMENT ON COLUMN registration_order.transaction_type IS '交易类型 1-买 2-卖';
|
||||
COMMENT ON COLUMN registration_order.thumbnail IS '商品缩略图';
|
||||
COMMENT ON COLUMN registration_order.thumbnail_height IS '缩略图高度';
|
||||
COMMENT ON COLUMN registration_order.detail IS '详情图';
|
||||
COMMENT ON COLUMN registration_order.price IS '单价';
|
||||
COMMENT ON COLUMN registration_order.points IS '单个赠送积分';
|
||||
COMMENT ON COLUMN registration_order.quantity IS '数量';
|
||||
COMMENT ON COLUMN registration_order.remaining IS '剩余数量';
|
||||
COMMENT ON COLUMN registration_order.user_id IS '用户id';
|
||||
COMMENT ON COLUMN registration_order.user_nickname IS '用户昵称';
|
||||
COMMENT ON COLUMN registration_order.in_transaction IS '是否交易中 1-交易中 0-空闲中';
|
||||
COMMENT ON COLUMN registration_order.is_full_package IS '是否全量交易 1-是 0-否';
|
||||
COMMENT ON COLUMN registration_order.delivery_type IS '配送方式 1-物流快递 2-同城配送 3-上门自提';
|
||||
COMMENT ON COLUMN registration_order.region_code IS '收货地址区域编码';
|
||||
COMMENT ON COLUMN registration_order.region_name IS '行政区域名称';
|
||||
COMMENT ON COLUMN registration_order.receiver_address IS '收货地址';
|
||||
COMMENT ON COLUMN registration_order.contact IS '收货人';
|
||||
COMMENT ON COLUMN registration_order.contact_number IS '收货人联系方式';
|
||||
COMMENT ON COLUMN registration_order.is_virtual IS '是否虚拟商品 1-是 0-否';
|
||||
COMMENT ON COLUMN registration_order.is_closed IS '是否交易完成 1-是 0-否';
|
||||
COMMENT ON COLUMN registration_order.version IS '乐观锁版本号';
|
||||
COMMENT ON COLUMN registration_order.create_user IS '创建人';
|
||||
COMMENT ON COLUMN registration_order.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN registration_order.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN registration_order.update_user IS '修改人';
|
||||
COMMENT ON COLUMN registration_order.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN registration_order.status IS '状态';
|
||||
COMMENT ON COLUMN registration_order.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN registration_order.is_vendor IS '是否服务商订单';
|
||||
COMMENT ON COLUMN registration_order.is_priority IS '是否优先';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE transaction_order
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
registration_id BIGINT NOT NULL,
|
||||
sku_id BIGINT NULL,
|
||||
title VARCHAR(100) NOT NULL,
|
||||
transaction_type INTEGER NOT NULL,
|
||||
thumbnail VARCHAR(500) NOT NULL,
|
||||
price DECIMAL(10, 2) NOT NULL,
|
||||
points DECIMAL(10, 2) NOT NULL,
|
||||
quantity INTEGER NOT NULL,
|
||||
total_amount DECIMAL(10, 2) NOT NULL,
|
||||
total_points DECIMAL(10, 2) NOT NULL,
|
||||
user_id BIGINT NOT NULL,
|
||||
user_nickname VARCHAR(500) NULL,
|
||||
payment_voucher VARCHAR(500) NULL,
|
||||
delivery_voucher VARCHAR(500) NULL,
|
||||
delivery_type INTEGER DEFAULT 1 NOT NULL,
|
||||
region_code VARCHAR(10) NULL,
|
||||
region_name VARCHAR(100) NULL,
|
||||
receiver_address VARCHAR(100) NULL,
|
||||
contact VARCHAR(100) NULL,
|
||||
contact_number VARCHAR(100) NULL,
|
||||
counterparty_order_id BIGINT DEFAULT 0 NOT NULL,
|
||||
is_virtual INTEGER DEFAULT 0 NOT NULL,
|
||||
supplier_order_sn VARCHAR(100) NULL,
|
||||
expire_time TIMESTAMP NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE transaction_order IS '交易单表';
|
||||
COMMENT ON COLUMN transaction_order.id IS '交易单ID';
|
||||
COMMENT ON COLUMN transaction_order.registration_id IS '挂单Id';
|
||||
COMMENT ON COLUMN transaction_order.sku_id IS 'skuId';
|
||||
COMMENT ON COLUMN transaction_order.title IS '规格名称';
|
||||
COMMENT ON COLUMN transaction_order.transaction_type IS '交易类型 1-买 2-卖';
|
||||
COMMENT ON COLUMN transaction_order.thumbnail IS '商品缩略图';
|
||||
COMMENT ON COLUMN transaction_order.price IS '单价';
|
||||
COMMENT ON COLUMN transaction_order.points IS '单个赠送积分';
|
||||
COMMENT ON COLUMN transaction_order.quantity IS '数量';
|
||||
COMMENT ON COLUMN transaction_order.total_amount IS '总金额';
|
||||
COMMENT ON COLUMN transaction_order.total_points IS '总赠送积分';
|
||||
COMMENT ON COLUMN transaction_order.user_id IS '用户id';
|
||||
COMMENT ON COLUMN transaction_order.user_nickname IS '用户昵称';
|
||||
COMMENT ON COLUMN transaction_order.payment_voucher IS '付款凭证';
|
||||
COMMENT ON COLUMN transaction_order.delivery_voucher IS '物流凭证';
|
||||
COMMENT ON COLUMN transaction_order.delivery_type IS '收货方式 1-物流快递 2-同城配送 3-上门自提';
|
||||
COMMENT ON COLUMN transaction_order.region_code IS '收货地址区域编码';
|
||||
COMMENT ON COLUMN transaction_order.region_name IS '行政区域名称';
|
||||
COMMENT ON COLUMN transaction_order.receiver_address IS '收货地址';
|
||||
COMMENT ON COLUMN transaction_order.contact IS '收货联系人';
|
||||
COMMENT ON COLUMN transaction_order.contact_number IS '收货人联系方式';
|
||||
COMMENT ON COLUMN transaction_order.counterparty_order_id IS '对手单单号';
|
||||
COMMENT ON COLUMN transaction_order.is_virtual IS '是否虚拟商品 1-是 0-否';
|
||||
COMMENT ON COLUMN transaction_order.supplier_order_sn IS '三方供应商订单号';
|
||||
COMMENT ON COLUMN transaction_order.expire_time IS '待支付超时时间';
|
||||
COMMENT ON COLUMN transaction_order.create_user IS '创建人';
|
||||
COMMENT ON COLUMN transaction_order.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN transaction_order.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN transaction_order.update_user IS '修改人';
|
||||
COMMENT ON COLUMN transaction_order.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN transaction_order.status IS '状态 1-待支付 2-已支付 3-待发货 4-已发货 5-已完成';
|
||||
COMMENT ON COLUMN transaction_order.is_deleted IS '是否已删除';
|
||||
|
||||
CREATE TABLE user_inventory
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL,
|
||||
sku_id BIGINT NOT NULL,
|
||||
title VARCHAR(100) NOT NULL,
|
||||
thumbnail VARCHAR(500) NOT NULL,
|
||||
price DECIMAL(10, 2) NOT NULL,
|
||||
quantity INTEGER NOT NULL,
|
||||
is_virtual INTEGER DEFAULT 0 NOT NULL,
|
||||
attribute JSON NULL,
|
||||
version BIGINT DEFAULT 0 NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE user_inventory IS '用户库存';
|
||||
COMMENT ON COLUMN user_inventory.id IS '库存ID';
|
||||
COMMENT ON COLUMN user_inventory.user_id IS '用户Id';
|
||||
COMMENT ON COLUMN user_inventory.sku_id IS 'skuId';
|
||||
COMMENT ON COLUMN user_inventory.title IS '规格名称';
|
||||
COMMENT ON COLUMN user_inventory.thumbnail IS '商品缩略图';
|
||||
COMMENT ON COLUMN user_inventory.price IS '单价';
|
||||
COMMENT ON COLUMN user_inventory.quantity IS '数量';
|
||||
COMMENT ON COLUMN user_inventory.is_virtual IS '是否虚拟商品 1-是 0-否';
|
||||
COMMENT ON COLUMN user_inventory.attribute IS '规格';
|
||||
COMMENT ON COLUMN user_inventory.version IS '乐观锁版本号';
|
||||
COMMENT ON COLUMN user_inventory.create_user IS '创建人';
|
||||
COMMENT ON COLUMN user_inventory.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN user_inventory.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN user_inventory.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_inventory.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_inventory.status IS '状态';
|
||||
COMMENT ON COLUMN user_inventory.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
CREATE TABLE calendar_non_working
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
off_date DATE NOT NULL,
|
||||
remark VARCHAR(200) NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE calendar_non_working IS '节假日';
|
||||
COMMENT ON COLUMN calendar_non_working.id IS '主键';
|
||||
COMMENT ON COLUMN calendar_non_working.off_date IS '休息日期';
|
||||
COMMENT ON COLUMN calendar_non_working.remark IS '备忘';
|
||||
COMMENT ON COLUMN calendar_non_working.create_user IS '创建人';
|
||||
COMMENT ON COLUMN calendar_non_working.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN calendar_non_working.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN calendar_non_working.update_user IS '修改人';
|
||||
COMMENT ON COLUMN calendar_non_working.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN calendar_non_working.status IS '状态';
|
||||
COMMENT ON COLUMN calendar_non_working.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE user_otc_info
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
user_id BIGINT NOT NULL,
|
||||
alipay_account VARCHAR(200) NULL,
|
||||
wechat_account VARCHAR(200) NULL,
|
||||
alipay_qr_code VARCHAR(200) NULL,
|
||||
wechat_qr_code VARCHAR(200) NULL,
|
||||
bank_account VARCHAR(200) NULL,
|
||||
branch_info VARCHAR(200) NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE user_otc_info IS 'OTC收款信息';
|
||||
COMMENT ON COLUMN user_otc_info.id IS 'ID';
|
||||
COMMENT ON COLUMN user_otc_info.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN user_otc_info.alipay_account IS '支付宝账号';
|
||||
COMMENT ON COLUMN user_otc_info.wechat_account IS '微信账号';
|
||||
COMMENT ON COLUMN user_otc_info.alipay_qr_code IS '支付宝收款码';
|
||||
COMMENT ON COLUMN user_otc_info.wechat_qr_code IS '微信收款码';
|
||||
COMMENT ON COLUMN user_otc_info.bank_account IS '银行账号';
|
||||
COMMENT ON COLUMN user_otc_info.branch_info IS '银行信息';
|
||||
COMMENT ON COLUMN user_otc_info.create_user IS '创建人';
|
||||
COMMENT ON COLUMN user_otc_info.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN user_otc_info.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN user_otc_info.update_user IS '修改人';
|
||||
COMMENT ON COLUMN user_otc_info.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN user_otc_info.status IS '状态';
|
||||
COMMENT ON COLUMN user_otc_info.is_deleted IS '是否已删除';
|
||||
1025
doc/sql/pending/20260209_increase.sql
Normal file
1025
doc/sql/pending/20260209_increase.sql
Normal file
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@@ -1,34 +0,0 @@
|
||||
CREATE TABLE regions_info
|
||||
(
|
||||
id SERIAL PRIMARY KEY,
|
||||
name VARCHAR(50) NULL,
|
||||
level INTEGER NULL,
|
||||
pid INTEGER DEFAULT 0 NULL,
|
||||
lon DECIMAL(10, 6) NULL,
|
||||
lat DECIMAL(10, 6) NULL,
|
||||
region_code VARCHAR(128) NULL,
|
||||
full_name VARCHAR(200) NULL,
|
||||
vendor_region_id BIGINT NULL,
|
||||
store_city_id BIGINT NULL,
|
||||
hotel_city_code VARCHAR(128) NULL,
|
||||
hotel_city_pinyin VARCHAR(128) NULL,
|
||||
hotel_city_initials VARCHAR(4) NULL,
|
||||
sight_city_name VARCHAR(32) NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE regions_info IS '地区详情表';
|
||||
COMMENT ON COLUMN regions_info.id IS '主键';
|
||||
COMMENT ON COLUMN regions_info.name IS '名称';
|
||||
COMMENT ON COLUMN regions_info.level IS '层级';
|
||||
COMMENT ON COLUMN regions_info.pid IS '父主键';
|
||||
COMMENT ON COLUMN regions_info.lon IS '经度';
|
||||
COMMENT ON COLUMN regions_info.lat IS '纬度';
|
||||
COMMENT ON COLUMN regions_info.region_code IS '地区编码';
|
||||
COMMENT ON COLUMN regions_info.full_name IS '全称';
|
||||
COMMENT ON COLUMN regions_info.vendor_region_id IS '服务商地区表id';
|
||||
COMMENT ON COLUMN regions_info.store_city_id IS '城市店铺id';
|
||||
COMMENT ON COLUMN regions_info.hotel_city_code IS '酒店地区编码';
|
||||
COMMENT ON COLUMN regions_info.hotel_city_pinyin IS '酒店地区拼音';
|
||||
COMMENT ON COLUMN regions_info.hotel_city_initials IS '酒店地区拼音首字母';
|
||||
COMMENT ON COLUMN regions_info.sight_city_name IS '景点城市名';
|
||||
|
||||
@@ -1,68 +0,0 @@
|
||||
CREATE TABLE user_daily_sign
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
user_id BIGINT NULL,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
statistics_date DATE NULL,
|
||||
sign_count INTEGER NULL,
|
||||
type INTEGER DEFAULT 1 NULL,
|
||||
remarks TEXT NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
create_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
status INTEGER NULL,
|
||||
create_dept BIGINT NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE user_daily_sign IS '用户看广告记录表';
|
||||
COMMENT ON COLUMN user_daily_sign.user_id IS '用户id';
|
||||
COMMENT ON COLUMN user_daily_sign.user_phone IS '用户手机号';
|
||||
COMMENT ON COLUMN user_daily_sign.user_name IS '用户名称';
|
||||
COMMENT ON COLUMN user_daily_sign.statistics_date IS '统计日期';
|
||||
COMMENT ON COLUMN user_daily_sign.sign_count IS '看广告统计';
|
||||
COMMENT ON COLUMN user_daily_sign.type IS '广告类型 1-积分分产出';
|
||||
COMMENT ON COLUMN user_daily_sign.remarks IS '备注';
|
||||
comment on column user_daily_sign.create_user is '创建人';
|
||||
comment on column user_daily_sign.create_dept is '创建部门';
|
||||
comment on column user_daily_sign.create_time is '创建时间';
|
||||
comment on column user_daily_sign.update_user is '修改人';
|
||||
comment on column user_daily_sign.update_time is '修改时间';
|
||||
comment on column user_daily_sign.status is '状态';
|
||||
comment on column user_daily_sign.is_deleted is '是否已删除';
|
||||
|
||||
CREATE INDEX uds_date_index
|
||||
ON user_daily_sign (is_deleted, type, statistics_date);
|
||||
|
||||
CREATE INDEX uds_uid_index
|
||||
ON user_daily_sign (is_deleted, type, user_id, statistics_date);
|
||||
|
||||
|
||||
|
||||
CREATE TABLE ads
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
name VARCHAR(255) NULL,
|
||||
url VARCHAR(255) NULL,
|
||||
sort INTEGER DEFAULT 1,
|
||||
type INTEGER DEFAULT 1,
|
||||
ads_time INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
create_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
status INTEGER NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE ads IS '广告表';
|
||||
COMMENT ON COLUMN ads.name IS '视频名称';
|
||||
COMMENT ON COLUMN ads.url IS '视频链接';
|
||||
COMMENT ON COLUMN ads.sort IS '广告序号';
|
||||
COMMENT ON COLUMN ads.type IS '广告类型 1-积分分产出';
|
||||
COMMENT ON COLUMN ads.ads_time IS '视频观看时长';
|
||||
COMMENT ON COLUMN ads.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN ads.status IS '状态';
|
||||
File diff suppressed because it is too large
Load Diff
@@ -1,180 +0,0 @@
|
||||
create table user_performance
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
performance decimal(16, 4) default 0,
|
||||
own_performance decimal(16, 4) default 0,
|
||||
version int default 1,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
create index up_index
|
||||
on user_performance (is_deleted, user_id);
|
||||
COMMENT ON TABLE user_performance IS '用户现金业绩表';
|
||||
COMMENT ON COLUMN user_performance.id IS '主键';
|
||||
COMMENT ON COLUMN user_performance.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN user_performance.user_phone IS '用户手机号';
|
||||
COMMENT ON COLUMN user_performance.user_name IS '用户名称';
|
||||
COMMENT ON COLUMN user_performance.performance IS '总业绩';
|
||||
COMMENT ON COLUMN user_performance.own_performance IS '自身业绩';
|
||||
COMMENT ON COLUMN user_performance.version IS '版本号';
|
||||
comment on column user_performance.create_user is '创建人';
|
||||
comment on column user_performance.create_dept is '创建部门';
|
||||
comment on column user_performance.create_time is '创建时间';
|
||||
comment on column user_performance.update_user is '修改人';
|
||||
comment on column user_performance.update_time is '修改时间';
|
||||
comment on column user_performance.status is '状态';
|
||||
comment on column user_performance.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_performance
|
||||
owner to postgres;
|
||||
|
||||
create table user_performance_log
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
amount decimal(14, 4) default 0,
|
||||
source_id bigint,
|
||||
source_detail text,
|
||||
order_id bigint,
|
||||
type int default 1,
|
||||
statistical_date timestamp(6),
|
||||
channel varchar(64),
|
||||
channel_detail text,
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
|
||||
create index user_performance_log_index
|
||||
on user_performance_log (is_deleted, user_id, statistical_date , type);
|
||||
|
||||
comment on table user_performance_log is '用户现金业绩日志表';
|
||||
comment on column user_performance_log.id is '主键';
|
||||
comment on column user_performance_log.user_id is '用户ID';
|
||||
comment on column user_performance_log.user_phone is '用户手机号';
|
||||
comment on column user_performance_log.user_name is '用户名称';
|
||||
comment on column user_performance_log.amount is '业绩变动金额';
|
||||
comment on column user_performance_log.source_id is '来源ID';
|
||||
comment on column user_performance_log.source_detail is '来源详情';
|
||||
comment on column user_performance_log.order_id is '订单ID';
|
||||
comment on column user_performance_log.type is '类型 1增加 2减少';
|
||||
comment on column user_performance_log.statistical_date is '统计日期';
|
||||
comment on column user_performance_log.channel is '渠道';
|
||||
comment on column user_performance_log.channel_detail is '渠道详情';
|
||||
comment on column user_performance_log.remark is '备注';
|
||||
comment on column user_performance_log.create_user is '创建人';
|
||||
comment on column user_performance_log.create_dept is '创建部门';
|
||||
comment on column user_performance_log.create_time is '创建时间';
|
||||
comment on column user_performance_log.update_user is '修改人';
|
||||
comment on column user_performance_log.update_time is '修改时间';
|
||||
comment on column user_performance_log.status is '状态';
|
||||
comment on column user_performance_log.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_performance_log
|
||||
owner to postgres;
|
||||
|
||||
|
||||
create table user_performance_benefit
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
performance decimal(16, 4) default 0,
|
||||
own_performance decimal(16, 4) default 0,
|
||||
version int default 1,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
create index upb_index
|
||||
on user_performance_benefit (is_deleted, user_id);
|
||||
COMMENT ON TABLE user_performance_benefit IS '用户福利值业绩表';
|
||||
COMMENT ON COLUMN user_performance_benefit.id IS '主键';
|
||||
COMMENT ON COLUMN user_performance_benefit.user_id IS '用户ID';
|
||||
COMMENT ON COLUMN user_performance_benefit.user_phone IS '用户手机号';
|
||||
COMMENT ON COLUMN user_performance_benefit.user_name IS '用户名称';
|
||||
COMMENT ON COLUMN user_performance_benefit.performance IS '总业绩';
|
||||
COMMENT ON COLUMN user_performance_benefit.own_performance IS '自身业绩';
|
||||
COMMENT ON COLUMN user_performance_benefit.version IS '版本号';
|
||||
comment on column user_performance_benefit.create_user is '创建人';
|
||||
comment on column user_performance_benefit.create_dept is '创建部门';
|
||||
comment on column user_performance_benefit.create_time is '创建时间';
|
||||
comment on column user_performance_benefit.update_user is '修改人';
|
||||
comment on column user_performance_benefit.update_time is '修改时间';
|
||||
comment on column user_performance_benefit.status is '状态';
|
||||
comment on column user_performance_benefit.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_performance_benefit
|
||||
owner to postgres;
|
||||
|
||||
create table user_performance_benefit_log
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
amount decimal(14, 4) default 0,
|
||||
source_id bigint,
|
||||
source_detail text,
|
||||
order_id bigint,
|
||||
type int default 1,
|
||||
statistical_date timestamp(6),
|
||||
channel varchar(64),
|
||||
channel_detail text,
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
|
||||
create index upbl_index
|
||||
on user_performance_benefit_log (is_deleted, user_id, statistical_date , type);
|
||||
|
||||
comment on table user_performance_benefit_log is '用户福利值业绩日志表';
|
||||
comment on column user_performance_benefit_log.id is '主键';
|
||||
comment on column user_performance_benefit_log.user_id is '用户ID';
|
||||
comment on column user_performance_benefit_log.user_phone is '用户手机号';
|
||||
comment on column user_performance_benefit_log.user_name is '用户名称';
|
||||
comment on column user_performance_benefit_log.amount is '业绩变动金额';
|
||||
comment on column user_performance_benefit_log.source_id is '来源ID';
|
||||
comment on column user_performance_benefit_log.source_detail is '来源详情';
|
||||
comment on column user_performance_benefit_log.order_id is '订单ID';
|
||||
comment on column user_performance_benefit_log.type is '类型 1增加 2减少';
|
||||
comment on column user_performance_benefit_log.statistical_date is '统计日期';
|
||||
comment on column user_performance_benefit_log.channel is '渠道';
|
||||
comment on column user_performance_benefit_log.channel_detail is '渠道详情';
|
||||
comment on column user_performance_benefit_log.remark is '备注';
|
||||
comment on column user_performance_benefit_log.create_user is '创建人';
|
||||
comment on column user_performance_benefit_log.create_dept is '创建部门';
|
||||
comment on column user_performance_benefit_log.create_time is '创建时间';
|
||||
comment on column user_performance_benefit_log.update_user is '修改人';
|
||||
comment on column user_performance_benefit_log.update_time is '修改时间';
|
||||
comment on column user_performance_benefit_log.status is '状态';
|
||||
comment on column user_performance_benefit_log.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_performance_benefit_log
|
||||
owner to postgres;
|
||||
@@ -1,438 +0,0 @@
|
||||
create table user_benefit
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
amount decimal(14, 4) default 0,
|
||||
version int default 1,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
|
||||
create index user_benefit_index
|
||||
on user_benefit (is_deleted, user_id);
|
||||
|
||||
comment on table user_benefit is '用户福利值表';
|
||||
comment on column user_benefit.id is '主键';
|
||||
comment on column user_benefit.user_id is '用户id';
|
||||
comment on column user_benefit.amount is '金额';
|
||||
comment on column user_benefit.version is '版本号';
|
||||
comment on column user_benefit.create_user is '创建人';
|
||||
comment on column user_benefit.create_dept is '创建部门';
|
||||
comment on column user_benefit.create_time is '创建时间';
|
||||
comment on column user_benefit.update_user is '修改人';
|
||||
comment on column user_benefit.update_time is '修改时间';
|
||||
comment on column user_benefit.status is '状态';
|
||||
comment on column user_benefit.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_benefit
|
||||
owner to postgres;
|
||||
|
||||
create table user_benefit_log
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
amount decimal(14, 4) default 0,
|
||||
source_id bigint,
|
||||
user_pack_id bigint,
|
||||
source_detail text,
|
||||
order_id bigint,
|
||||
type int default 1,
|
||||
statistical_date timestamp(6),
|
||||
channel varchar(64),
|
||||
channel_detail text,
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
|
||||
);
|
||||
create index ub_log_date_index
|
||||
on user_benefit_log (is_deleted, user_id , statistical_date , type);
|
||||
|
||||
comment on table user_benefit_log is '用户福利值流水表';
|
||||
comment on column user_benefit_log.id is '主键';
|
||||
comment on column user_benefit_log.user_id is '用户id';
|
||||
comment on column user_benefit_log.user_phone is '用户手机号';
|
||||
comment on column user_benefit_log.user_name is '用户名称';
|
||||
comment on column user_benefit_log.amount is '金额';
|
||||
comment on column user_benefit_log.source_id is '来源id';
|
||||
comment on column user_benefit_log.user_pack_id is '用户积分包id';
|
||||
comment on column user_benefit_log.source_detail is '来源详情';
|
||||
comment on column user_benefit_log.order_id is '订单id';
|
||||
comment on column user_benefit_log.type is '消费类型 1-收入 2-支出';
|
||||
comment on column user_benefit_log.statistical_date is '统计时间';
|
||||
comment on column user_benefit_log.channel is '消费渠道';
|
||||
comment on column user_benefit_log.channel_detail is '消费渠道详情';
|
||||
comment on column user_benefit_log.remark is '备注';
|
||||
comment on column user_benefit_log.create_user is '创建人';
|
||||
comment on column user_benefit_log.create_dept is '创建部门';
|
||||
comment on column user_benefit_log.create_time is '创建时间';
|
||||
comment on column user_benefit_log.update_user is '修改人';
|
||||
comment on column user_benefit_log.update_time is '修改时间';
|
||||
comment on column user_benefit_log.status is '状态';
|
||||
comment on column user_benefit_log.is_deleted is '是否已删除';
|
||||
alter table user_benefit_log
|
||||
owner to postgres;
|
||||
|
||||
|
||||
|
||||
create table user_commission
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
amount decimal(14, 4) default 0,
|
||||
version int default 1,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
|
||||
create index user_commission_index
|
||||
on user_commission (is_deleted, user_id);
|
||||
|
||||
comment on table user_commission is '用户佣金表';
|
||||
comment on column user_commission.id is '主键';
|
||||
comment on column user_commission.user_id is '用户id';
|
||||
comment on column user_commission.amount is '佣金金额';
|
||||
comment on column user_commission.version is '版本号';
|
||||
comment on column user_commission.create_user is '创建人';
|
||||
comment on column user_commission.create_dept is '创建部门';
|
||||
comment on column user_commission.create_time is '创建时间';
|
||||
comment on column user_commission.update_user is '修改人';
|
||||
comment on column user_commission.update_time is '修改时间';
|
||||
comment on column user_commission.status is '状态';
|
||||
comment on column user_commission.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_commission
|
||||
owner to postgres;
|
||||
|
||||
|
||||
create table user_commission_log
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
amount decimal(14, 4) default 0,
|
||||
source_id bigint,
|
||||
source_detail text,
|
||||
order_id bigint,
|
||||
type int default 1,
|
||||
statistical_date timestamp(6),
|
||||
channel varchar(64),
|
||||
channel_detail text,
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
|
||||
create index user_commission_log_index
|
||||
on user_commission_log (is_deleted, user_id, statistical_date, type);
|
||||
|
||||
comment on table user_commission_log is '用户佣金流水表';
|
||||
comment on column user_commission_log.id is '主键';
|
||||
comment on column user_commission_log.user_id is '用户id';
|
||||
comment on column user_commission_log.user_phone is '用户手机号';
|
||||
comment on column user_commission_log.user_name is '用户名称';
|
||||
comment on column user_commission_log.amount is '金额';
|
||||
comment on column user_commission_log.source_id is '来源id';
|
||||
comment on column user_commission_log.source_detail is '来源详情';
|
||||
comment on column user_commission_log.order_id is '订单id';
|
||||
comment on column user_commission_log.type is '消费类型 1-收入 2-支出';
|
||||
comment on column user_commission_log.statistical_date is '统计时间';
|
||||
comment on column user_commission_log.channel is '消费渠道';
|
||||
comment on column user_commission_log.channel_detail is '消费渠道详情';
|
||||
comment on column user_commission_log.remark is '备注';
|
||||
comment on column user_commission_log.create_user is '创建人';
|
||||
comment on column user_commission_log.create_dept is '创建部门';
|
||||
comment on column user_commission_log.create_time is '创建时间';
|
||||
comment on column user_commission_log.update_user is '修改人';
|
||||
comment on column user_commission_log.update_time is '修改时间';
|
||||
comment on column user_commission_log.status is '状态';
|
||||
comment on column user_commission_log.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_commission_log
|
||||
owner to postgres;
|
||||
|
||||
|
||||
create table user_cash
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
amount decimal(14, 4) default 0,
|
||||
version int default 1,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
is_deleted integer default 0
|
||||
);
|
||||
|
||||
create index user_cash_index
|
||||
on user_cash (is_deleted, user_id);
|
||||
|
||||
comment on table user_cash is '用户现金券表';
|
||||
comment on column user_cash.id is '主键';
|
||||
comment on column user_cash.user_id is '用户id';
|
||||
comment on column user_cash.amount is '面额';
|
||||
comment on column user_cash.version is '版本号';
|
||||
comment on column user_cash.create_user is '创建人';
|
||||
comment on column user_cash.create_dept is '创建部门';
|
||||
comment on column user_cash.create_time is '创建时间';
|
||||
comment on column user_cash.update_user is '修改人';
|
||||
comment on column user_cash.update_time is '修改时间';
|
||||
comment on column user_cash.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_cash
|
||||
owner to postgres;
|
||||
|
||||
|
||||
create table user_cash_log
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
amount decimal(14, 4) default 0,
|
||||
source_id bigint,
|
||||
source_detail text,
|
||||
order_id bigint,
|
||||
type int default 1,
|
||||
statistical_date timestamp(6),
|
||||
channel varchar(64),
|
||||
channel_detail text,
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
|
||||
create index user_cash_log_index
|
||||
on user_cash_log (is_deleted, user_id, statistical_date , type);
|
||||
|
||||
comment on table user_cash_log is '用户现金券流水表';
|
||||
comment on column user_cash_log.id is '主键';
|
||||
comment on column user_cash_log.user_id is '用户id';
|
||||
comment on column user_cash_log.user_phone is '用户手机号';
|
||||
comment on column user_cash_log.user_name is '用户名称';
|
||||
comment on column user_cash_log.amount is '金额';
|
||||
comment on column user_cash_log.source_id is '来源id';
|
||||
comment on column user_cash_log.source_detail is '来源详情';
|
||||
comment on column user_cash_log.order_id is '订单id';
|
||||
comment on column user_cash_log.type is '消费类型 1-收入 2-支出';
|
||||
comment on column user_cash_log.statistical_date is '统计时间';
|
||||
comment on column user_cash_log.channel is '消费渠道';
|
||||
comment on column user_cash_log.channel_detail is '消费渠道详情';
|
||||
comment on column user_cash_log.remark is '备注';
|
||||
comment on column user_cash_log.create_user is '创建人';
|
||||
comment on column user_cash_log.create_dept is '创建部门';
|
||||
comment on column user_cash_log.create_time is '创建时间';
|
||||
comment on column user_cash_log.update_user is '修改人';
|
||||
comment on column user_cash_log.update_time is '修改时间';
|
||||
comment on column user_cash_log.status is '状态';
|
||||
comment on column user_cash_log.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_cash_log
|
||||
owner to postgres;
|
||||
|
||||
|
||||
create table user_mall_integral
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
amount decimal(14, 4) default 0,
|
||||
version int default 1,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
is_deleted integer default 0
|
||||
);
|
||||
|
||||
create index user_mall_integral_index
|
||||
on user_mall_integral (is_deleted, user_id);
|
||||
|
||||
comment on table user_mall_integral is '用户商城积分表';
|
||||
comment on column user_mall_integral.id is '主键';
|
||||
comment on column user_mall_integral.user_id is '用户id';
|
||||
comment on column user_mall_integral.amount is '面额';
|
||||
comment on column user_mall_integral.version is '版本号';
|
||||
comment on column user_mall_integral.create_user is '创建人';
|
||||
comment on column user_mall_integral.create_dept is '创建部门';
|
||||
comment on column user_mall_integral.create_time is '创建时间';
|
||||
comment on column user_mall_integral.update_user is '修改人';
|
||||
comment on column user_mall_integral.update_time is '修改时间';
|
||||
comment on column user_mall_integral.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_mall_integral
|
||||
owner to postgres;
|
||||
|
||||
|
||||
create table user_mall_integral_log
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
amount decimal(14, 4) default 0,
|
||||
source_id bigint,
|
||||
source_detail text,
|
||||
order_id bigint,
|
||||
type int default 1,
|
||||
statistical_date timestamp(6),
|
||||
channel varchar(64),
|
||||
channel_detail text,
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
|
||||
create index user_mall_integral_log_index
|
||||
on user_mall_integral_log (is_deleted, user_id, statistical_date , type);
|
||||
|
||||
comment on table user_mall_integral_log is '用户商城积分流水表';
|
||||
comment on column user_mall_integral_log.id is '主键';
|
||||
comment on column user_mall_integral_log.user_id is '用户id';
|
||||
comment on column user_mall_integral_log.user_phone is '用户手机号';
|
||||
comment on column user_mall_integral_log.user_name is '用户名称';
|
||||
comment on column user_mall_integral_log.amount is '金额';
|
||||
comment on column user_mall_integral_log.source_id is '来源id';
|
||||
comment on column user_mall_integral_log.source_detail is '来源详情';
|
||||
comment on column user_mall_integral_log.order_id is '订单id';
|
||||
comment on column user_mall_integral_log.type is '消费类型 1-收入 2-支出';
|
||||
comment on column user_mall_integral_log.statistical_date is '统计时间';
|
||||
comment on column user_mall_integral_log.channel is '消费渠道';
|
||||
comment on column user_mall_integral_log.channel_detail is '消费渠道详情';
|
||||
comment on column user_mall_integral_log.remark is '备注';
|
||||
comment on column user_mall_integral_log.create_user is '创建人';
|
||||
comment on column user_mall_integral_log.create_dept is '创建部门';
|
||||
comment on column user_mall_integral_log.create_time is '创建时间';
|
||||
comment on column user_mall_integral_log.update_user is '修改人';
|
||||
comment on column user_mall_integral_log.update_time is '修改时间';
|
||||
comment on column user_mall_integral_log.status is '状态';
|
||||
comment on column user_mall_integral_log.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_mall_integral_log
|
||||
owner to postgres;
|
||||
|
||||
|
||||
|
||||
create table user_gains_day
|
||||
(
|
||||
id bigint not null primary key,
|
||||
statistical_date timestamp(6),
|
||||
user_id bigint,
|
||||
amount decimal(14, 4) default 0,
|
||||
gains_details text,
|
||||
is_credited integer default 0,
|
||||
version int default 1,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
);
|
||||
|
||||
create index ugd_date_index
|
||||
on user_gains_day (is_deleted, statistical_date , is_credited);
|
||||
|
||||
comment on table user_gains_day is '用户每日加速福利值汇总表';
|
||||
comment on column user_gains_day.id is '主键';
|
||||
comment on column user_gains_day.statistical_date is '统计时间';
|
||||
comment on column user_gains_day.user_id is '用户id';
|
||||
comment on column user_gains_day.amount is '金额';
|
||||
comment on column user_gains_day.gains_details is '福利值汇总详情';
|
||||
comment on column user_gains_day.is_credited is '是否已入账 0-未入账 1-已入账';
|
||||
comment on column user_gains_day.version is '版本号';
|
||||
comment on column user_gains_day.create_user is '创建人';
|
||||
comment on column user_gains_day.create_dept is '创建部门';
|
||||
comment on column user_gains_day.create_time is '创建时间';
|
||||
comment on column user_gains_day.update_user is '修改人';
|
||||
comment on column user_gains_day.update_time is '修改时间';
|
||||
comment on column user_gains_day.status is '状态';
|
||||
comment on column user_gains_day.is_deleted is '是否已删除';
|
||||
|
||||
alter table user_gains_day
|
||||
owner to postgres;
|
||||
|
||||
create table user_gains_day_log
|
||||
(
|
||||
id bigint not null primary key,
|
||||
user_id bigint,
|
||||
user_phone bigint,
|
||||
user_name varchar(128),
|
||||
amount decimal(14, 4) default 0,
|
||||
source_id bigint,
|
||||
source_detail text,
|
||||
gains_details text,
|
||||
order_id bigint,
|
||||
statistical_date timestamp(6),
|
||||
is_summary integer default 0,
|
||||
remark text,
|
||||
create_user int8,
|
||||
create_dept int8,
|
||||
create_time timestamp(6),
|
||||
update_user int8,
|
||||
update_time timestamp(6),
|
||||
status integer default 1,
|
||||
is_deleted integer default 0
|
||||
|
||||
);
|
||||
create index ugd_log_date_index
|
||||
on user_gains_day_log (is_deleted, statistical_date , is_summary );
|
||||
|
||||
comment on table user_gains_day_log is '用户每日加速福利值流水表';
|
||||
comment on column user_gains_day_log.id is '主键';
|
||||
comment on column user_gains_day_log.user_id is '用户id';
|
||||
comment on column user_gains_day_log.user_phone is '用户手机号';
|
||||
comment on column user_gains_day_log.user_name is '用户名称';
|
||||
comment on column user_gains_day_log.amount is '金额';
|
||||
comment on column user_gains_day_log.source_id is '来源id';
|
||||
comment on column user_gains_day_log.source_detail is '来源详情';
|
||||
comment on column user_gains_day_log.gains_details is '加速福利详情';
|
||||
comment on column user_gains_day_log.order_id is '订单id';
|
||||
comment on column user_gains_day_log.statistical_date is '统计时间';
|
||||
comment on column user_gains_day_log.is_summary is '是否汇总 0-否 1-是';
|
||||
comment on column user_gains_day_log.remark is '备注';
|
||||
comment on column user_gains_day_log.create_user is '创建人';
|
||||
comment on column user_gains_day_log.create_dept is '创建部门';
|
||||
comment on column user_gains_day_log.create_time is '创建时间';
|
||||
comment on column user_gains_day_log.update_user is '修改人';
|
||||
comment on column user_gains_day_log.update_time is '修改时间';
|
||||
comment on column user_gains_day_log.status is '状态';
|
||||
comment on column user_gains_day_log.is_deleted is '是否已删除';
|
||||
alter table user_gains_day_log
|
||||
owner to postgres;
|
||||
@@ -1,322 +0,0 @@
|
||||
CREATE TABLE vendor_daily_activity
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
settle_date DATE NOT NULL,
|
||||
region_id BIGINT NOT NULL,
|
||||
region_level INTEGER DEFAULT 0 NOT NULL,
|
||||
total_amount INTEGER DEFAULT 0 NOT NULL,
|
||||
activity_amount INTEGER DEFAULT 0 NOT NULL,
|
||||
activity_value_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
increase_activity_value_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE vendor_daily_activity IS '服务商用户收益';
|
||||
COMMENT ON COLUMN vendor_daily_activity.id IS '主键';
|
||||
COMMENT ON COLUMN vendor_daily_activity.settle_date IS '结算日期';
|
||||
COMMENT ON COLUMN vendor_daily_activity.region_id IS '地域id';
|
||||
COMMENT ON COLUMN vendor_daily_activity.region_level IS '地域等级 1-省 2-市 3-区';
|
||||
COMMENT ON COLUMN vendor_daily_activity.total_amount IS '用户总量';
|
||||
COMMENT ON COLUMN vendor_daily_activity.activity_amount IS '活跃数量';
|
||||
COMMENT ON COLUMN vendor_daily_activity.activity_value_amount IS '活跃值总数';
|
||||
COMMENT ON COLUMN vendor_daily_activity.increase_activity_value_amount IS '活跃值增量';
|
||||
COMMENT ON COLUMN vendor_daily_activity.create_user IS '创建人';
|
||||
COMMENT ON COLUMN vendor_daily_activity.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN vendor_daily_activity.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN vendor_daily_activity.update_user IS '修改人';
|
||||
COMMENT ON COLUMN vendor_daily_activity.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN vendor_daily_activity.status IS '状态';
|
||||
COMMENT ON COLUMN vendor_daily_activity.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
CREATE TABLE vendor_daily_profit
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
settle_date DATE NOT NULL,
|
||||
region_id BIGINT NOT NULL,
|
||||
region_level INTEGER DEFAULT 0 NOT NULL,
|
||||
profit_type INTEGER DEFAULT 0 NOT NULL,
|
||||
order_type INTEGER NOT NULL,
|
||||
total_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
profit_amount DECIMAL(10, 1) DEFAULT 0.0 NOT NULL,
|
||||
quantity INTEGER DEFAULT 0 NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE vendor_daily_profit IS '服务商营收收益';
|
||||
COMMENT ON COLUMN vendor_daily_profit.id IS '主键';
|
||||
COMMENT ON COLUMN vendor_daily_profit.settle_date IS '结算日期';
|
||||
COMMENT ON COLUMN vendor_daily_profit.region_id IS '地域id';
|
||||
COMMENT ON COLUMN vendor_daily_profit.region_level IS '地域等级 1-省 2-市 3-区';
|
||||
COMMENT ON COLUMN vendor_daily_profit.profit_type IS '收益类型: 1.线上商城 2.线下点餐';
|
||||
COMMENT ON COLUMN vendor_daily_profit.order_type IS '订单类型 1-商城订单 8-活动订单 9-店铺订单 10-旅行订单 11-门票订单 12-酒店订单';
|
||||
COMMENT ON COLUMN vendor_daily_profit.total_amount IS '总金额';
|
||||
COMMENT ON COLUMN vendor_daily_profit.profit_amount IS '总利润';
|
||||
COMMENT ON COLUMN vendor_daily_profit.quantity IS '总单数';
|
||||
COMMENT ON COLUMN vendor_daily_profit.create_user IS '创建人';
|
||||
COMMENT ON COLUMN vendor_daily_profit.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN vendor_daily_profit.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN vendor_daily_profit.update_user IS '修改人';
|
||||
COMMENT ON COLUMN vendor_daily_profit.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN vendor_daily_profit.status IS '状态';
|
||||
COMMENT ON COLUMN vendor_daily_profit.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE vendor_info
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
region_id BIGINT NOT NULL,
|
||||
user_id BIGINT NOT NULL,
|
||||
company_name VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
legal_person_name VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
id_card VARCHAR(50) DEFAULT '' NOT NULL,
|
||||
contact_no VARCHAR(50) DEFAULT '' NOT NULL,
|
||||
id_card_front VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
id_card_back VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
id_card_handheld VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
business_license VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
audit_status INTEGER DEFAULT 1 NOT NULL,
|
||||
auditor BIGINT NULL,
|
||||
reject_reason VARCHAR(200) DEFAULT '' NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL,
|
||||
apply_time TIMESTAMP(6) NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE vendor_info IS '服务商';
|
||||
COMMENT ON COLUMN vendor_info.id IS '主键';
|
||||
COMMENT ON COLUMN vendor_info.region_id IS '区域id';
|
||||
COMMENT ON COLUMN vendor_info.user_id IS '用户id';
|
||||
COMMENT ON COLUMN vendor_info.company_name IS '企业名称';
|
||||
COMMENT ON COLUMN vendor_info.legal_person_name IS '法人';
|
||||
COMMENT ON COLUMN vendor_info.id_card IS '身份证';
|
||||
COMMENT ON COLUMN vendor_info.contact_no IS '联系电话';
|
||||
COMMENT ON COLUMN vendor_info.id_card_front IS '身份证正面';
|
||||
COMMENT ON COLUMN vendor_info.id_card_back IS '身份证反面';
|
||||
COMMENT ON COLUMN vendor_info.id_card_handheld IS '手持身份证照片';
|
||||
COMMENT ON COLUMN vendor_info.business_license IS '营业执照';
|
||||
COMMENT ON COLUMN vendor_info.audit_status IS '审核状态 1-待审核 2-审核通过 3-审核失败';
|
||||
COMMENT ON COLUMN vendor_info.auditor IS '审核人';
|
||||
COMMENT ON COLUMN vendor_info.reject_reason IS '拒绝原因';
|
||||
COMMENT ON COLUMN vendor_info.create_user IS '创建人';
|
||||
COMMENT ON COLUMN vendor_info.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN vendor_info.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN vendor_info.update_user IS '修改人';
|
||||
COMMENT ON COLUMN vendor_info.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN vendor_info.status IS '状态';
|
||||
COMMENT ON COLUMN vendor_info.is_deleted IS '是否已删除';
|
||||
COMMENT ON COLUMN vendor_info.apply_time IS '申请时间';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE vendor_payout_apply
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
user_id BIGINT DEFAULT 0 NOT NULL,
|
||||
apply_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
company_fully_name VARCHAR(255) NULL,
|
||||
bank_account VARCHAR(255) NULL,
|
||||
branch_info VARCHAR(255) NULL,
|
||||
transfer_description VARCHAR(255) NULL,
|
||||
invoice_url TEXT NULL,
|
||||
invoice_number VARCHAR(255) NULL,
|
||||
transfer_voucher TEXT NULL,
|
||||
apply_status INTEGER DEFAULT 1 NOT NULL,
|
||||
remark VARCHAR(255) NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE vendor_payout_apply IS '服务商提现申请';
|
||||
COMMENT ON COLUMN vendor_payout_apply.id IS '主键';
|
||||
COMMENT ON COLUMN vendor_payout_apply.user_id IS '用户主键';
|
||||
COMMENT ON COLUMN vendor_payout_apply.apply_amount IS '申请提现金额';
|
||||
COMMENT ON COLUMN vendor_payout_apply.company_fully_name IS '公司全称';
|
||||
COMMENT ON COLUMN vendor_payout_apply.bank_account IS '银行账号';
|
||||
COMMENT ON COLUMN vendor_payout_apply.branch_info IS '开户行信息';
|
||||
COMMENT ON COLUMN vendor_payout_apply.transfer_description IS '转账内容描述';
|
||||
COMMENT ON COLUMN vendor_payout_apply.invoice_url IS '发票截图地址';
|
||||
COMMENT ON COLUMN vendor_payout_apply.invoice_number IS '发票号';
|
||||
COMMENT ON COLUMN vendor_payout_apply.transfer_voucher IS '转账凭证';
|
||||
COMMENT ON COLUMN vendor_payout_apply.apply_status IS '申请提现状态 1:待审核 2:审核通过 3:审核不通过';
|
||||
COMMENT ON COLUMN vendor_payout_apply.remark IS '备注';
|
||||
COMMENT ON COLUMN vendor_payout_apply.create_user IS '创建人';
|
||||
COMMENT ON COLUMN vendor_payout_apply.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN vendor_payout_apply.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN vendor_payout_apply.update_user IS '修改人';
|
||||
COMMENT ON COLUMN vendor_payout_apply.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN vendor_payout_apply.status IS '状态';
|
||||
COMMENT ON COLUMN vendor_payout_apply.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE vendor_profit_detail
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
order_id BIGINT DEFAULT 0 NOT NULL,
|
||||
user_id BIGINT DEFAULT 0 NOT NULL,
|
||||
district_id BIGINT DEFAULT 0 NOT NULL,
|
||||
city_id BIGINT DEFAULT 0 NOT NULL,
|
||||
province_id BIGINT DEFAULT 0 NOT NULL,
|
||||
order_type INTEGER DEFAULT 0 NOT NULL,
|
||||
payment_type INTEGER DEFAULT 0 NOT NULL,
|
||||
actual_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
cost_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
profit_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
order_settle_date TIMESTAMP NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE vendor_profit_detail IS '服务商分润详情';
|
||||
COMMENT ON COLUMN vendor_profit_detail.id IS '主键';
|
||||
COMMENT ON COLUMN vendor_profit_detail.order_id IS '订单主键';
|
||||
COMMENT ON COLUMN vendor_profit_detail.user_id IS '用户主键';
|
||||
COMMENT ON COLUMN vendor_profit_detail.district_id IS '区主键';
|
||||
COMMENT ON COLUMN vendor_profit_detail.city_id IS '市主键';
|
||||
COMMENT ON COLUMN vendor_profit_detail.province_id IS '省主键';
|
||||
COMMENT ON COLUMN vendor_profit_detail.order_type IS '订单类型';
|
||||
COMMENT ON COLUMN vendor_profit_detail.payment_type IS '支付类型';
|
||||
COMMENT ON COLUMN vendor_profit_detail.actual_amount IS '实际支付金额';
|
||||
COMMENT ON COLUMN vendor_profit_detail.cost_amount IS '成本金额';
|
||||
COMMENT ON COLUMN vendor_profit_detail.profit_amount IS '利润金额';
|
||||
COMMENT ON COLUMN vendor_profit_detail.order_settle_date IS '订单结算日期';
|
||||
COMMENT ON COLUMN vendor_profit_detail.create_user IS '创建人';
|
||||
COMMENT ON COLUMN vendor_profit_detail.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN vendor_profit_detail.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN vendor_profit_detail.update_user IS '修改人';
|
||||
COMMENT ON COLUMN vendor_profit_detail.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN vendor_profit_detail.status IS '状态';
|
||||
COMMENT ON COLUMN vendor_profit_detail.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE vendor_regions
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
name VARCHAR(50) NULL,
|
||||
level INTEGER NULL,
|
||||
pid INTEGER DEFAULT 0 NULL,
|
||||
lon DECIMAL(10, 6) NULL,
|
||||
lat DECIMAL(10, 6) NULL,
|
||||
vendor_id BIGINT NULL,
|
||||
token_amount DECIMAL(10, 2) DEFAULT 0.00 NULL,
|
||||
points_amount DECIMAL(10, 2) DEFAULT 0.00 NULL,
|
||||
apply_amount DECIMAL(10, 2) DEFAULT 0.00 NULL,
|
||||
apply_status INTEGER DEFAULT 1 NULL,
|
||||
region_code VARCHAR(10) NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE vendor_regions IS '服务商地区';
|
||||
COMMENT ON COLUMN vendor_regions.id IS '主键';
|
||||
COMMENT ON COLUMN vendor_regions.name IS '名称';
|
||||
COMMENT ON COLUMN vendor_regions.level IS '层级';
|
||||
COMMENT ON COLUMN vendor_regions.pid IS '父主键';
|
||||
COMMENT ON COLUMN vendor_regions.lon IS '经度';
|
||||
COMMENT ON COLUMN vendor_regions.lat IS '纬度';
|
||||
COMMENT ON COLUMN vendor_regions.vendor_id IS '服务商id';
|
||||
COMMENT ON COLUMN vendor_regions.token_amount IS '消费金数量';
|
||||
COMMENT ON COLUMN vendor_regions.points_amount IS '抵扣券数量';
|
||||
COMMENT ON COLUMN vendor_regions.apply_amount IS '申请金额';
|
||||
COMMENT ON COLUMN vendor_regions.apply_status IS '1-未申请 2-申请中 3-已申请';
|
||||
COMMENT ON COLUMN vendor_regions.region_code IS '区划编号';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE vendor_virtual_data_activity
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
region_id INTEGER NOT NULL,
|
||||
user_amount INTEGER DEFAULT 0 NOT NULL,
|
||||
active_user_amount INTEGER DEFAULT 0 NOT NULL,
|
||||
order_amount DECIMAL(10, 2) DEFAULT 0.00 NULL,
|
||||
order_quantity INTEGER DEFAULT 0 NOT NULL,
|
||||
activity_value DECIMAL(10, 2) DEFAULT 0.00 NULL,
|
||||
increase_activity_value DECIMAL(10, 2) DEFAULT 0.00 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE vendor_virtual_data_activity IS '服务商活跃度虚拟增益';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.id IS '主键';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.region_id IS '地区id';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.user_amount IS '用户数量';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.active_user_amount IS '活跃用户数量';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.order_amount IS '订单总额';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.order_quantity IS '订单量';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.activity_value IS '活跃值';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.increase_activity_value IS '新增活跃值';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.create_user IS '创建人';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.update_user IS '修改人';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.status IS '状态';
|
||||
COMMENT ON COLUMN vendor_virtual_data_activity.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE vendor_virtual_data_profit
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
region_id INTEGER NOT NULL,
|
||||
settle_date DATE NOT NULL,
|
||||
online_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
offline_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
activity_amount DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE vendor_virtual_data_profit IS '服务商营收虚拟增益';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.id IS '主键';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.region_id IS '地区id';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.settle_date IS '日期';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.online_amount IS '线上收益';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.offline_amount IS '线下收益';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.activity_amount IS '活跃值收益';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.create_user IS '创建人';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.update_user IS '修改人';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.status IS '状态';
|
||||
COMMENT ON COLUMN vendor_virtual_data_profit.is_deleted IS '是否已删除';
|
||||
@@ -1,79 +0,0 @@
|
||||
CREATE TABLE prize_spu
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
spu_name VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
main_img VARCHAR(255) DEFAULT '' NOT NULL,
|
||||
detail_img text NULL,
|
||||
cost_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
original_price DECIMAL(10, 2) DEFAULT 0.00 NOT NULL,
|
||||
spu_qty INTEGER DEFAULT 0 NOT NULL,
|
||||
status INTEGER DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
COMMENT ON TABLE prize_spu IS '奖池商品';
|
||||
COMMENT ON COLUMN prize_spu.id IS '主键';
|
||||
COMMENT ON COLUMN prize_spu.spu_name IS '商品名称';
|
||||
COMMENT ON COLUMN prize_spu.main_img IS '主图';
|
||||
COMMENT ON COLUMN prize_spu.detail_img IS '详情图(多图,逗号分割)';
|
||||
COMMENT ON COLUMN prize_spu.cost_price IS '成本价';
|
||||
COMMENT ON COLUMN prize_spu.original_price IS '原价';
|
||||
COMMENT ON COLUMN prize_spu.spu_qty IS '库存';
|
||||
COMMENT ON COLUMN prize_spu.status IS '状态(0=下架,1=上架,3=删除)';
|
||||
COMMENT ON COLUMN prize_spu.create_user IS '创建人';
|
||||
COMMENT ON COLUMN prize_spu.create_dept IS '创建部门';
|
||||
COMMENT ON COLUMN prize_spu.create_time IS '创建时间';
|
||||
COMMENT ON COLUMN prize_spu.update_user IS '修改人';
|
||||
COMMENT ON COLUMN prize_spu.update_time IS '修改时间';
|
||||
COMMENT ON COLUMN prize_spu.is_deleted IS '是否已删除';
|
||||
|
||||
|
||||
|
||||
CREATE TABLE prize_spu_order
|
||||
(
|
||||
id BIGINT NOT NULL PRIMARY KEY,
|
||||
user_id BIGINT DEFAULT 0 NOT NULL,
|
||||
user_name VARCHAR(128) NULL,
|
||||
user_phone bigint NULL,
|
||||
spu_id bigint NULL,
|
||||
spu_name VARCHAR(255) NULL,
|
||||
main_img VARCHAR(255) NULL,
|
||||
detail_img text NULL,
|
||||
quantity INTEGER DEFAULT 0 NOT NULL,
|
||||
order_status INTEGER DEFAULT 0 NOT NULL,
|
||||
version BIGINT DEFAULT 0 NULL,
|
||||
create_user int8 NULL,
|
||||
create_dept int8 NULL,
|
||||
create_time TIMESTAMP(6) NULL,
|
||||
update_user int8 NULL,
|
||||
update_time TIMESTAMP(6) NULL,
|
||||
status INTEGER DEFAULT -1 NULL,
|
||||
is_deleted INTEGER DEFAULT 0 NULL
|
||||
);
|
||||
|
||||
create index prize_spu_order_index on prize_spu_order (user_id);
|
||||
|
||||
COMMENT ON TABLE prize_spu_order IS '奖池商品订单';
|
||||
comment on column prize_spu_order.id is '主键';
|
||||
comment on column prize_spu_order.user_id is '用户ID';
|
||||
comment on column prize_spu_order.user_name is '用户名称';
|
||||
comment on column prize_spu_order.user_phone is '用户手机号';
|
||||
comment on column prize_spu_order.spu_id is '商品ID';
|
||||
comment on column prize_spu_order.spu_name is '商品名称';
|
||||
comment on column prize_spu_order.main_img is '商品主图';
|
||||
comment on column prize_spu_order.detail_img is '商品详情图(多图,逗号分割)';
|
||||
comment on column prize_spu_order.quantity is '商品数量';
|
||||
comment on column prize_spu_order.order_status is '订单状态(0=待发货,1=已发货,2=已完成,3=已取消)';
|
||||
comment on column prize_spu_order.version is '版本号';
|
||||
comment on column prize_spu_order.create_user is '创建人';
|
||||
comment on column prize_spu_order.create_dept is '创建部门';
|
||||
comment on column prize_spu_order.create_time is '创建时间';
|
||||
comment on column prize_spu_order.update_user is '修改人';
|
||||
comment on column prize_spu_order.update_time is '修改时间';
|
||||
comment on column prize_spu_order.status is '状态(-1=无效,0=有效)';
|
||||
comment on column prize_spu_order.is_deleted is '是否已删除';
|
||||
35
pom.xml
35
pom.xml
@@ -24,6 +24,7 @@
|
||||
<docker.password>admin12345</docker.password>
|
||||
<docker.namespace>blade</docker.namespace>
|
||||
<docker.fabric.version>0.42.0</docker.fabric.version>
|
||||
<mapstruct.version>1.6.3</mapstruct.version>
|
||||
</properties>
|
||||
|
||||
<dependencyManagement>
|
||||
@@ -232,10 +233,10 @@
|
||||
<artifactId>blade-starter-powerjob</artifactId>
|
||||
</dependency>
|
||||
<!-- 工作流 -->
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
<artifactId>blade-starter-flowable</artifactId>
|
||||
</dependency>
|
||||
<!-- <dependency>-->
|
||||
<!-- <groupId>org.springblade</groupId>-->
|
||||
<!-- <artifactId>blade-starter-flowable</artifactId>-->
|
||||
<!-- </dependency>-->
|
||||
<!-- auto -->
|
||||
<dependency>
|
||||
<groupId>org.springblade</groupId>
|
||||
@@ -250,6 +251,32 @@
|
||||
<artifactId>lombok</artifactId>
|
||||
<scope>provided</scope>
|
||||
</dependency>
|
||||
|
||||
<!-- 短信认证服务sdk -->
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>dypnsapi20170525</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.aliyun</groupId>
|
||||
<artifactId>alibabacloud-dypnsapi20170525</artifactId>
|
||||
<version>2.0.0</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>org.mapstruct</groupId>
|
||||
<artifactId>mapstruct-processor</artifactId>
|
||||
<version>${mapstruct.version}</version>
|
||||
</dependency>
|
||||
|
||||
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
|
||||
@@ -28,6 +28,7 @@ package org.springblade;
|
||||
import org.springblade.common.constant.CommonConstant;
|
||||
import org.springblade.core.launch.BladeApplication;
|
||||
import org.springframework.boot.autoconfigure.SpringBootApplication;
|
||||
import org.springframework.retry.annotation.EnableRetry;
|
||||
import org.springframework.scheduling.annotation.EnableScheduling;
|
||||
import org.springframework.session.data.redis.config.annotation.web.http.EnableRedisHttpSession;
|
||||
|
||||
@@ -39,6 +40,7 @@ import org.springframework.session.data.redis.config.annotation.web.http.EnableR
|
||||
@EnableScheduling
|
||||
@EnableRedisHttpSession
|
||||
@SpringBootApplication
|
||||
@EnableRetry //重试机制
|
||||
public class Application {
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
package org.springblade.common.config;
|
||||
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
import org.springframework.scheduling.annotation.EnableAsync;
|
||||
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
|
||||
|
||||
import java.util.concurrent.ThreadPoolExecutor;
|
||||
|
||||
@Configuration
|
||||
@EnableAsync
|
||||
public class AsyncConfiguration {
|
||||
|
||||
|
||||
// 通知类:短信、邮件、站内信
|
||||
@Bean("notificationExecutor")
|
||||
public ThreadPoolTaskExecutor notificationExecutor() {
|
||||
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
|
||||
executor.setCorePoolSize(6);
|
||||
executor.setMaxPoolSize(12);
|
||||
executor.setQueueCapacity(200);
|
||||
executor.setThreadNamePrefix("notify-");
|
||||
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
|
||||
executor.initialize();
|
||||
return executor;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
package org.springblade.common.config;
|
||||
|
||||
import com.baomidou.mybatisplus.annotation.DbType;
|
||||
import com.baomidou.mybatisplus.extension.plugins.MybatisPlusInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.OptimisticLockerInnerInterceptor;
|
||||
import com.baomidou.mybatisplus.extension.plugins.inner.PaginationInnerInterceptor;
|
||||
import org.springframework.context.annotation.Bean;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
@Configuration
|
||||
public class MybatisPlusConfig {
|
||||
@Bean
|
||||
public MybatisPlusInterceptor mybatisPlusInterceptor() {
|
||||
MybatisPlusInterceptor interceptor = new MybatisPlusInterceptor();
|
||||
|
||||
PaginationInnerInterceptor paginationInterceptor = new PaginationInnerInterceptor();
|
||||
paginationInterceptor.setDbType(DbType.POSTGRE_SQL);
|
||||
// 可选:设置最大单页限制(防止恶意请求)
|
||||
paginationInterceptor.setMaxLimit(1000L);
|
||||
interceptor.addInnerInterceptor(paginationInterceptor);
|
||||
|
||||
// 2. 乐观锁插件
|
||||
interceptor.addInnerInterceptor(new OptimisticLockerInnerInterceptor());
|
||||
return interceptor;
|
||||
}
|
||||
}
|
||||
@@ -90,4 +90,9 @@ public interface CommonConstant {
|
||||
Integer API_SCOPE_CATEGORY = 2;
|
||||
|
||||
|
||||
String USER_DEFAULT_DEPT = "user.default.dept";
|
||||
String USER_DEFAULT_POST = "user.default.post";
|
||||
String USER_DEFAULT_ROLE = "user.default.role";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
package org.springblade.common.exception;
|
||||
|
||||
public class OptimisticLockException extends RuntimeException{
|
||||
public OptimisticLockException(String message) {
|
||||
super(message);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
package org.springblade.common.handler;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
import org.postgresql.util.PGobject;
|
||||
|
||||
import java.sql.CallableStatement;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.ResultSet;
|
||||
import java.sql.SQLException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 用于 PostgreSQL JSONB 与 Java 对象(如 List<Map>、Map 等)的双向转换
|
||||
*/
|
||||
@MappedJdbcTypes(JdbcType.OTHER)
|
||||
@MappedTypes({List.class, Map.class})
|
||||
public class PgJsonbTypeHandler extends BaseTypeHandler<Object> {
|
||||
|
||||
private static final ObjectMapper objectMapper = new ObjectMapper();
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, Object parameter, JdbcType jdbcType) throws SQLException {
|
||||
PGobject jsonObject = new PGobject();
|
||||
jsonObject.setType("jsonb");
|
||||
try {
|
||||
jsonObject.setValue(objectMapper.writeValueAsString(parameter));
|
||||
} catch (JsonProcessingException e) {
|
||||
throw new SQLException("Error converting object to JSON", e);
|
||||
}
|
||||
ps.setObject(i, jsonObject);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
return parseJson(rs.getString(columnName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
return parseJson(rs.getString(columnIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
return parseJson(cs.getString(columnIndex));
|
||||
}
|
||||
|
||||
private Object parseJson(String json) throws SQLException {
|
||||
if (json == null || json.isEmpty()) {
|
||||
return null;
|
||||
}
|
||||
try {
|
||||
// 根据实际泛型类型反序列化(此处简化为返回 Object)
|
||||
// 更精确的做法是使用 ParameterizedType,但 MyBatis 不支持泛型擦除后的还原
|
||||
// 所以通常在 Service 层做二次转换,或使用 JsonNode
|
||||
return objectMapper.readValue(json, Object.class);
|
||||
} catch (Exception e) {
|
||||
throw new SQLException("Error parsing JSON", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,53 @@
|
||||
package org.springblade.common.handler;
|
||||
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
@MappedJdbcTypes(JdbcType.ARRAY)
|
||||
@MappedTypes(List.class)
|
||||
public class PgLongArrayToListTypeHandler extends BaseTypeHandler<List<Long>> {
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, List<Long> parameter, JdbcType jdbcType) throws SQLException {
|
||||
// 将 List<Long> 转换为 PostgreSQL 的 bigint[]
|
||||
Array array = ps.getConnection().createArrayOf("bigint", parameter.toArray());
|
||||
ps.setArray(i, array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
// 从 ResultSet 中读取数组并转换为 List<Long>
|
||||
Array array = rs.getArray(columnName);
|
||||
if (array == null) {
|
||||
return null;
|
||||
}
|
||||
return Arrays.asList((Long[]) array.getArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
// 从 ResultSet 中按列索引读取数组并转换为 List<Long>
|
||||
Array array = rs.getArray(columnIndex);
|
||||
if (array == null) {
|
||||
return null;
|
||||
}
|
||||
return Arrays.asList((Long[]) array.getArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Long> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
// 从 CallableStatement 中读取数组并转换为 List<Long>
|
||||
Array array = cs.getArray(columnIndex);
|
||||
if (array == null) {
|
||||
return null;
|
||||
}
|
||||
return Arrays.asList((Long[]) array.getArray());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,49 @@
|
||||
package org.springblade.common.handler;
|
||||
|
||||
import org.apache.ibatis.type.BaseTypeHandler;
|
||||
import org.apache.ibatis.type.JdbcType;
|
||||
import org.apache.ibatis.type.MappedJdbcTypes;
|
||||
import org.apache.ibatis.type.MappedTypes;
|
||||
|
||||
import java.sql.*;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@MappedJdbcTypes(JdbcType.ARRAY)
|
||||
@MappedTypes(List.class)
|
||||
public class PgStringArrayToListTypeHandler extends BaseTypeHandler<List<String>> {
|
||||
|
||||
@Override
|
||||
public void setNonNullParameter(PreparedStatement ps, int i, List<String> parameter, JdbcType jdbcType) throws SQLException {
|
||||
Array array = ps.getConnection().createArrayOf("text", parameter.toArray());
|
||||
ps.setArray(i, array);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNullableResult(ResultSet rs, String columnName) throws SQLException {
|
||||
Array array = rs.getArray(columnName);
|
||||
if (array == null) return Collections.emptyList(); // 返回空列表而非 null
|
||||
return Arrays.asList((String[]) array.getArray());
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNullableResult(ResultSet rs, int columnIndex) throws SQLException {
|
||||
return parseArray(rs.getArray(columnIndex));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> getNullableResult(CallableStatement cs, int columnIndex) throws SQLException {
|
||||
return parseArray(cs.getArray(columnIndex));
|
||||
}
|
||||
|
||||
private List<String> parseArray(Array array) throws SQLException {
|
||||
if (array == null) return null;
|
||||
Object[] objects = (Object[]) array.getArray();
|
||||
return Arrays.stream(objects)
|
||||
.map(Object::toString)
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
}
|
||||
437
src/main/java/org/springblade/common/utils/date/DateUtil.java
Normal file
437
src/main/java/org/springblade/common/utils/date/DateUtil.java
Normal file
@@ -0,0 +1,437 @@
|
||||
package org.springblade.common.utils.date;
|
||||
|
||||
|
||||
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.util.Assert;
|
||||
import org.springframework.util.StringUtils;
|
||||
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.time.*;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Locale;
|
||||
|
||||
|
||||
@Slf4j
|
||||
public class DateUtil {
|
||||
|
||||
private static final ThreadLocal<SimpleDateFormat> SIMPLE_DAY = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd"));
|
||||
private static final ThreadLocal<SimpleDateFormat> SIMPLE_DATE_FORMAT = ThreadLocal.withInitial(() -> new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
|
||||
public static final ThreadLocal<DateTimeFormatter> THREAD_LOCAL_FORMAT = ThreadLocal.withInitial(() -> DateTimeFormatter.ofPattern("yyyy-MM-dd", Locale.CHINA));
|
||||
|
||||
|
||||
/**
|
||||
* 计算天数
|
||||
*
|
||||
* @param beginDate 开始时间
|
||||
* @param endDate 结束时间
|
||||
*/
|
||||
public static Integer getDaySub(Date beginDate, Date endDate) {
|
||||
try {
|
||||
SimpleDateFormat sdf = SIMPLE_DAY.get();
|
||||
Date start = sdf.parse(sdf.format(beginDate));
|
||||
Date end = sdf.parse(sdf.format(endDate));
|
||||
return Math.toIntExact((end.getTime() - start.getTime()) / (24 * 60 * 60 * 1000));
|
||||
} catch (ParseException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
public static Date geFirstDayOfThisMonth() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取本月最后一天
|
||||
*/
|
||||
public static Date geLastDayOfThisMonth() {
|
||||
Calendar cal = Calendar.getInstance();
|
||||
cal.setTime(new Date());
|
||||
cal.roll(Calendar.DAY_OF_MONTH, -1);
|
||||
return cal.getTime();
|
||||
}
|
||||
|
||||
public static Date getThirtyMinuteLate() {
|
||||
Calendar now = Calendar.getInstance();
|
||||
now.add(Calendar.MINUTE, 30);
|
||||
return now.getTime();
|
||||
}
|
||||
|
||||
public static Date getSecondsLate(Date date, int seconds) {
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTime(date);
|
||||
result.add(Calendar.SECOND, seconds);
|
||||
return result.getTime();
|
||||
}
|
||||
|
||||
public static Date getMinutesLate(Date date, int minutes) {
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTime(date);
|
||||
result.add(Calendar.MINUTE, minutes);
|
||||
return result.getTime();
|
||||
}
|
||||
|
||||
public static Date getHoursLate(Date date, int hours) {
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTime(date);
|
||||
result.add(Calendar.HOUR, hours);
|
||||
return result.getTime();
|
||||
}
|
||||
|
||||
public static Date getDaysLate(Date date, int days) {
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTime(date);
|
||||
result.add(Calendar.DAY_OF_MONTH, days);
|
||||
return result.getTime();
|
||||
}
|
||||
|
||||
public static Date getMonthsLate(Date date, int months) {
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTime(date);
|
||||
result.add(Calendar.MONTH, months);
|
||||
return result.getTime();
|
||||
}
|
||||
|
||||
public static Date getZeroTime(Date date) {
|
||||
Calendar result = Calendar.getInstance();
|
||||
result.setTime(date);
|
||||
result.set(Calendar.HOUR_OF_DAY, 0);
|
||||
result.set(Calendar.MINUTE, 0);
|
||||
result.set(Calendar.SECOND, 0);
|
||||
result.set(Calendar.MILLISECOND, 0);
|
||||
return result.getTime();
|
||||
}
|
||||
|
||||
public static boolean isExpireDays(Date date, int i) {
|
||||
Calendar createDate = Calendar.getInstance();
|
||||
createDate.setTime(date);
|
||||
createDate.add(Calendar.DATE, i);
|
||||
return createDate.before(new Date());
|
||||
}
|
||||
|
||||
|
||||
public static Integer getPersonAgeFromIdCard(String pensonnelIdCard) {
|
||||
|
||||
//截取身份证中出行人出生日期中的年、月、日
|
||||
Integer personYear = Integer.parseInt(pensonnelIdCard.substring(6, 10));
|
||||
Integer personMonth = Integer.parseInt(pensonnelIdCard.substring(10, 12));
|
||||
Integer personDay = Integer.parseInt(pensonnelIdCard.substring(12, 14));
|
||||
|
||||
Calendar cal = Calendar.getInstance();
|
||||
// 得到当前时间的年、月、日
|
||||
Integer yearNow = cal.get(Calendar.YEAR);
|
||||
Integer monthNow = cal.get(Calendar.MONTH) + 1;
|
||||
Integer dayNow = cal.get(Calendar.DATE);
|
||||
|
||||
// 用当前年月日减去生日年月日
|
||||
Integer yearMinus = yearNow - personYear;
|
||||
Integer monthMinus = monthNow - personMonth;
|
||||
Integer dayMinus = dayNow - personDay;
|
||||
|
||||
Integer age = yearMinus; //先大致赋值
|
||||
|
||||
if (yearMinus == 0) { //出生年份为当前年份
|
||||
age = 0;
|
||||
} else { //出生年份大于当前年份
|
||||
if (monthMinus < 0) {//出生月份小于当前月份时,还没满周岁
|
||||
age = age - 1;
|
||||
}
|
||||
if (monthMinus == 0) {//当前月份为出生月份时,判断日期
|
||||
if (dayMinus < 0) {//出生日期小于当前月份时,没满周岁
|
||||
age = age - 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
return age;
|
||||
}
|
||||
|
||||
public static Date getToday() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Integer getYear() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
return calendar.get(Calendar.YEAR);
|
||||
}
|
||||
|
||||
public static Integer getMonth() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
return calendar.get(Calendar.MONTH) + 1;
|
||||
}
|
||||
|
||||
public static Integer getDay() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
return calendar.get(Calendar.DATE);
|
||||
}
|
||||
|
||||
public static Date getYesterday() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, -1);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getBeForeYesterday() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, -2);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date setDayToNum(int day) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, day);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getLastWeek() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, -7);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getSixDaysAgo() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, -6);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getTomorrow() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.DATE, 1);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
|
||||
public static Integer getTimeHour() {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
return calendar.get(Calendar.HOUR_OF_DAY);
|
||||
}
|
||||
|
||||
public static Date getTodayHour(String end) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, Integer.parseInt(end));
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Integer getTimeStampSec() {
|
||||
return Integer.valueOf(String.valueOf(Instant.now().getEpochSecond()));
|
||||
}
|
||||
|
||||
public static Date getDayOfMonth(Integer month) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.set(Calendar.DAY_OF_MONTH, month);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* "starttime": "11:00",
|
||||
* "endtime": "20:00",
|
||||
*
|
||||
* @param startTime
|
||||
* @param endTime
|
||||
* @return
|
||||
*/
|
||||
public static int verificationPeriod(String startTime, String endTime) {
|
||||
int status = 0;
|
||||
SimpleDateFormat sdf = SIMPLE_DAY.get();
|
||||
SimpleDateFormat sdtf = SIMPLE_DATE_FORMAT.get();
|
||||
if (StringUtils.hasLength(startTime) && StringUtils.hasLength(endTime) && startTime.length() == 5 && endTime.length() == 5) {
|
||||
String currentDay = sdf.format(new Date());
|
||||
Long current = System.currentTimeMillis();
|
||||
//日期补全
|
||||
String startStr = new StringBuilder(currentDay).append(" ").append(startTime).append(":00").toString();
|
||||
String endStr = new StringBuilder(currentDay).append(" ").append(endTime).append(":00").toString();
|
||||
synchronized (DateUtil.class) {
|
||||
try {
|
||||
Long start = sdtf.parse(startStr).getTime();
|
||||
Long end = sdtf.parse(endStr).getTime();
|
||||
//判断是否跨天
|
||||
if (start > end) {
|
||||
status = current - end >= 0 && current - start <= 0 ? 1 : 0;
|
||||
} else {
|
||||
status = start.equals(end) ? 0 : current - start >= 0 && current - end <= 0 ? 0 : 1;
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("错误的日期格式 开始时间 {} 结束时间{}", startTime, endTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
public static Date convertFromString(String dateString, String format) {
|
||||
SimpleDateFormat ft = new SimpleDateFormat(format);
|
||||
try {
|
||||
return ft.parse(dateString);
|
||||
} catch (Exception e) {
|
||||
throw new RuntimeException(e.getMessage());
|
||||
}
|
||||
}
|
||||
|
||||
public static String convertFromDate(Date date, String format) {
|
||||
SimpleDateFormat ft = new SimpleDateFormat(format);
|
||||
return ft.format(date);
|
||||
}
|
||||
|
||||
public static Date convertLocalDateTimeToDate(LocalDateTime localDateTime) {
|
||||
ZoneId zoneId = ZoneId.systemDefault();
|
||||
ZonedDateTime zdt = localDateTime.atZone(zoneId);
|
||||
return Date.from(zdt.toInstant());
|
||||
}
|
||||
|
||||
public static Integer getDays(Integer number, Integer type) {
|
||||
int days = 0;
|
||||
//计算包对应时长
|
||||
switch (type) {
|
||||
case 1: // 天
|
||||
days = number;
|
||||
break;
|
||||
case 2: // 月
|
||||
days = number * 30;
|
||||
break;
|
||||
case 3: //年
|
||||
days = number * 365;
|
||||
break;
|
||||
default:
|
||||
Assert.isTrue(false, "时间类型错误");
|
||||
}
|
||||
return days;
|
||||
}
|
||||
|
||||
/**
|
||||
* 指定日期后x天的日期
|
||||
*
|
||||
* @param start 日期
|
||||
* @param day 天数
|
||||
* @return
|
||||
*/
|
||||
public static Date getSpecifyDay(Date start, int day) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(start);
|
||||
calendar.add(Calendar.DATE, day);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getBegin(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getEnd(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.SECOND, 59);
|
||||
calendar.set(Calendar.MINUTE, 59);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||
calendar.set(Calendar.MILLISECOND, 999);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getMonthBegin(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.add(Calendar.MONTH, 0);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, 1);
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
calendar.set(Calendar.MINUTE, 0);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 0);
|
||||
calendar.set(Calendar.MILLISECOND, 0);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Date getMonthEnd(Date date) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(date);
|
||||
calendar.set(Calendar.DAY_OF_MONTH, calendar.getActualMaximum(Calendar.DAY_OF_MONTH));
|
||||
calendar.set(Calendar.SECOND, 59);
|
||||
calendar.set(Calendar.MINUTE, 59);
|
||||
calendar.set(Calendar.HOUR_OF_DAY, 23);
|
||||
calendar.set(Calendar.MILLISECOND, 999);
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
public static Long getExpireSecondWithTimestamp(int seconds) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.add(Calendar.SECOND, seconds);
|
||||
return calendar.getTime().getTime();
|
||||
}
|
||||
|
||||
/**
|
||||
* 日期是否为周六/周日
|
||||
*
|
||||
* @param day
|
||||
* @return
|
||||
*/
|
||||
public static Boolean dayOfWeek(String day) {
|
||||
DateTimeFormatter formatter = THREAD_LOCAL_FORMAT.get();
|
||||
LocalDate date = LocalDate.parse(day, formatter);
|
||||
switch (date.getDayOfWeek()) {
|
||||
case SATURDAY:
|
||||
case SUNDAY:
|
||||
return true;
|
||||
default:
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -1,155 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.business.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.flowable.engine.TaskService;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.flow.business.service.FlowBusinessService;
|
||||
import org.springblade.flow.core.entity.BladeFlow;
|
||||
import org.springblade.flow.core.utils.TaskUtil;
|
||||
import org.springblade.flow.engine.entity.FlowProcess;
|
||||
import org.springblade.flow.engine.service.FlowEngineService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 流程事务通用接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping(AppConstant.APPLICATION_FLOW_NAME + "/work")
|
||||
@Tag(name = "流程事务通用接口", description = "流程事务通用接口")
|
||||
public class WorkController {
|
||||
|
||||
private final TaskService taskService;
|
||||
private final FlowEngineService flowEngineService;
|
||||
private final FlowBusinessService flowBusinessService;
|
||||
|
||||
/**
|
||||
* 发起事务列表页
|
||||
*/
|
||||
@GetMapping("start-list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "发起事务列表页", description = "传入流程类型")
|
||||
public R<IPage<FlowProcess>> startList(@Parameter(description = "流程类型") String category, Query query, @RequestParam(required = false, defaultValue = "1") Integer mode) {
|
||||
IPage<FlowProcess> pages = flowEngineService.selectProcessPage(Condition.getPage(query), category, mode);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待签事务列表页
|
||||
*/
|
||||
@GetMapping("claim-list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "待签事务列表页", description = "传入流程信息")
|
||||
public R<IPage<BladeFlow>> claimList(@Parameter(description = "流程信息") BladeFlow bladeFlow, Query query) {
|
||||
IPage<BladeFlow> pages = flowBusinessService.selectClaimPage(Condition.getPage(query), bladeFlow);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 待办事务列表页
|
||||
*/
|
||||
@GetMapping("todo-list")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "待办事务列表页", description = "传入流程信息")
|
||||
public R<IPage<BladeFlow>> todoList(@Parameter(description = "流程信息") BladeFlow bladeFlow, Query query) {
|
||||
IPage<BladeFlow> pages = flowBusinessService.selectTodoPage(Condition.getPage(query), bladeFlow);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 已发事务列表页
|
||||
*/
|
||||
@GetMapping("send-list")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "已发事务列表页", description = "传入流程信息")
|
||||
public R<IPage<BladeFlow>> sendList(@Parameter(description = "流程信息") BladeFlow bladeFlow, Query query) {
|
||||
IPage<BladeFlow> pages = flowBusinessService.selectSendPage(Condition.getPage(query), bladeFlow);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 办结事务列表页
|
||||
*/
|
||||
@GetMapping("done-list")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "办结事务列表页", description = "传入流程信息")
|
||||
public R<IPage<BladeFlow>> doneList(@Parameter(description = "流程信息") BladeFlow bladeFlow, Query query) {
|
||||
IPage<BladeFlow> pages = flowBusinessService.selectDonePage(Condition.getPage(query), bladeFlow);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 签收事务
|
||||
*
|
||||
* @param taskId 任务id
|
||||
*/
|
||||
@PostMapping("claim-task")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "签收事务", description = "传入流程信息")
|
||||
public R claimTask(@Parameter(description = "任务id") String taskId) {
|
||||
taskService.claim(taskId, TaskUtil.getTaskUser());
|
||||
return R.success("签收事务成功");
|
||||
}
|
||||
|
||||
/**
|
||||
* 完成任务
|
||||
*
|
||||
* @param flow 请假信息
|
||||
*/
|
||||
@PostMapping("complete-task")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "完成任务", description = "传入流程信息")
|
||||
public R completeTask(@Parameter(description = "任务信息") @RequestBody BladeFlow flow) {
|
||||
return R.status(flowBusinessService.completeTask(flow));
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除任务
|
||||
*
|
||||
* @param taskId 任务id
|
||||
* @param reason 删除原因
|
||||
*/
|
||||
@PostMapping("delete-task")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "删除任务", description = "传入流程信息")
|
||||
public R deleteTask(@Parameter(description = "任务id") String taskId, @Parameter(description = "删除原因") String reason) {
|
||||
taskService.deleteTask(taskId, reason);
|
||||
return R.success("删除任务成功");
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,86 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.business.service;
|
||||
|
||||
import org.springblade.flow.core.entity.BladeFlow;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工作流调用接口.
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface IFlowService {
|
||||
|
||||
/**
|
||||
* 开启流程
|
||||
*
|
||||
* @param processDefinitionId 流程id
|
||||
* @param businessKey 业务key
|
||||
* @param variables 参数
|
||||
* @return BladeFlow
|
||||
*/
|
||||
BladeFlow startProcessInstanceById(String processDefinitionId, String businessKey, Map<String, Object> variables);
|
||||
|
||||
/**
|
||||
* 开启流程
|
||||
*
|
||||
* @param processDefinitionKey 流程标识
|
||||
* @param businessKey 业务key
|
||||
* @param variables 参数
|
||||
* @return BladeFlow
|
||||
*/
|
||||
BladeFlow startProcessInstanceByKey(String processDefinitionKey, String businessKey, Map<String, Object> variables);
|
||||
|
||||
/**
|
||||
* 完成任务
|
||||
*
|
||||
* @param taskId 任务id
|
||||
* @param processInstanceId 流程实例id
|
||||
* @param comment 评论
|
||||
* @param variables 参数
|
||||
* @return R
|
||||
*/
|
||||
boolean completeTask(String taskId, String processInstanceId, String comment, Map<String, Object> variables);
|
||||
|
||||
/**
|
||||
* 获取流程变量
|
||||
*
|
||||
* @param taskId 任务id
|
||||
* @param variableName 变量名
|
||||
* @return R
|
||||
*/
|
||||
Object taskVariable(String taskId, String variableName);
|
||||
|
||||
/**
|
||||
* 获取流程变量集合
|
||||
*
|
||||
* @param taskId 任务id
|
||||
* @return R
|
||||
*/
|
||||
Map<String, Object> taskVariables(String taskId);
|
||||
}
|
||||
@@ -1,342 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.business.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.flowable.engine.HistoryService;
|
||||
import org.flowable.engine.TaskService;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstanceQuery;
|
||||
import org.flowable.task.api.TaskQuery;
|
||||
import org.flowable.task.api.history.HistoricTaskInstance;
|
||||
import org.flowable.task.api.history.HistoricTaskInstanceQuery;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.support.Kv;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.core.tool.utils.StringPool;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.flow.business.service.FlowBusinessService;
|
||||
import org.springblade.flow.core.constant.ProcessConstant;
|
||||
import org.springblade.flow.core.entity.BladeFlow;
|
||||
import org.springblade.flow.core.utils.TaskUtil;
|
||||
import org.springblade.flow.engine.constant.FlowEngineConstant;
|
||||
import org.springblade.flow.engine.entity.FlowProcess;
|
||||
import org.springblade.flow.engine.utils.FlowCache;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 流程业务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class FlowBusinessServiceImpl implements FlowBusinessService {
|
||||
|
||||
private final TaskService taskService;
|
||||
private final HistoryService historyService;
|
||||
|
||||
@Override
|
||||
public IPage<BladeFlow> selectClaimPage(IPage<BladeFlow> page, BladeFlow bladeFlow) {
|
||||
String taskUser = TaskUtil.getTaskUser();
|
||||
String taskGroup = TaskUtil.getCandidateGroup();
|
||||
List<BladeFlow> flowList = new LinkedList<>();
|
||||
|
||||
// 个人等待签收的任务
|
||||
TaskQuery claimUserQuery = taskService.createTaskQuery().taskCandidateUser(taskUser)
|
||||
.includeProcessVariables().active().orderByTaskCreateTime().desc();
|
||||
// 定制流程等待签收的任务
|
||||
TaskQuery claimRoleWithTenantIdQuery = taskService.createTaskQuery().taskTenantId(AuthUtil.getTenantId()).taskCandidateGroupIn(Func.toStrList(taskGroup))
|
||||
.includeProcessVariables().active().orderByTaskCreateTime().desc();
|
||||
// 通用流程等待签收的任务
|
||||
TaskQuery claimRoleWithoutTenantIdQuery = taskService.createTaskQuery().taskWithoutTenantId().taskCandidateGroupIn(Func.toStrList(taskGroup))
|
||||
.includeProcessVariables().active().orderByTaskCreateTime().desc();
|
||||
|
||||
// 构建列表数据
|
||||
buildFlowTaskList(bladeFlow, flowList, claimUserQuery, FlowEngineConstant.STATUS_CLAIM);
|
||||
buildFlowTaskList(bladeFlow, flowList, claimRoleWithTenantIdQuery, FlowEngineConstant.STATUS_CLAIM);
|
||||
buildFlowTaskList(bladeFlow, flowList, claimRoleWithoutTenantIdQuery, FlowEngineConstant.STATUS_CLAIM);
|
||||
|
||||
// 计算总数
|
||||
long count = claimUserQuery.count() + claimRoleWithTenantIdQuery.count() + claimRoleWithoutTenantIdQuery.count();
|
||||
// 设置页数
|
||||
page.setSize(count);
|
||||
// 设置总数
|
||||
page.setTotal(count);
|
||||
// 设置数据
|
||||
page.setRecords(flowList);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<BladeFlow> selectTodoPage(IPage<BladeFlow> page, BladeFlow bladeFlow) {
|
||||
String taskUser = TaskUtil.getTaskUser();
|
||||
List<BladeFlow> flowList = new LinkedList<>();
|
||||
|
||||
// 已签收的任务
|
||||
TaskQuery todoQuery = taskService.createTaskQuery().taskAssignee(taskUser).active()
|
||||
.includeProcessVariables().orderByTaskCreateTime().desc();
|
||||
|
||||
// 构建列表数据
|
||||
buildFlowTaskList(bladeFlow, flowList, todoQuery, FlowEngineConstant.STATUS_TODO);
|
||||
|
||||
// 计算总数
|
||||
long count = todoQuery.count();
|
||||
// 设置页数
|
||||
page.setSize(count);
|
||||
// 设置总数
|
||||
page.setTotal(count);
|
||||
// 设置数据
|
||||
page.setRecords(flowList);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<BladeFlow> selectSendPage(IPage<BladeFlow> page, BladeFlow bladeFlow) {
|
||||
String taskUser = TaskUtil.getTaskUser();
|
||||
List<BladeFlow> flowList = new LinkedList<>();
|
||||
|
||||
HistoricProcessInstanceQuery historyQuery = historyService.createHistoricProcessInstanceQuery().startedBy(taskUser).orderByProcessInstanceStartTime().desc();
|
||||
|
||||
if (bladeFlow.getCategory() != null) {
|
||||
historyQuery.processDefinitionCategory(bladeFlow.getCategory());
|
||||
}
|
||||
if (bladeFlow.getProcessDefinitionName() != null) {
|
||||
historyQuery.processDefinitionName(bladeFlow.getProcessDefinitionName());
|
||||
}
|
||||
if (bladeFlow.getBeginDate() != null) {
|
||||
historyQuery.startedAfter(bladeFlow.getBeginDate());
|
||||
}
|
||||
if (bladeFlow.getEndDate() != null) {
|
||||
historyQuery.startedBefore(bladeFlow.getEndDate());
|
||||
}
|
||||
|
||||
// 查询列表
|
||||
List<HistoricProcessInstance> historyList = historyQuery.listPage(Func.toInt((page.getCurrent() - 1) * page.getSize()), Func.toInt(page.getSize()));
|
||||
|
||||
historyList.forEach(historicProcessInstance -> {
|
||||
BladeFlow flow = new BladeFlow();
|
||||
// historicProcessInstance
|
||||
flow.setCreateTime(historicProcessInstance.getStartTime());
|
||||
flow.setEndTime(historicProcessInstance.getEndTime());
|
||||
flow.setVariables(historicProcessInstance.getProcessVariables());
|
||||
String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey());
|
||||
if (businessKey.length > 1) {
|
||||
flow.setBusinessTable(businessKey[0]);
|
||||
flow.setBusinessId(businessKey[1]);
|
||||
}
|
||||
flow.setHistoryActivityName(historicProcessInstance.getName());
|
||||
flow.setProcessInstanceId(historicProcessInstance.getId());
|
||||
flow.setHistoryProcessInstanceId(historicProcessInstance.getId());
|
||||
// ProcessDefinition
|
||||
FlowProcess processDefinition = FlowCache.getProcessDefinition(historicProcessInstance.getProcessDefinitionId());
|
||||
flow.setProcessDefinitionId(processDefinition.getId());
|
||||
flow.setProcessDefinitionName(processDefinition.getName());
|
||||
flow.setProcessDefinitionVersion(processDefinition.getVersion());
|
||||
flow.setProcessDefinitionKey(processDefinition.getKey());
|
||||
flow.setCategory(processDefinition.getCategory());
|
||||
flow.setCategoryName(FlowCache.getCategoryName(processDefinition.getCategory()));
|
||||
flow.setProcessInstanceId(historicProcessInstance.getId());
|
||||
// HistoricTaskInstance
|
||||
List<HistoricTaskInstance> historyTasks = historyService.createHistoricTaskInstanceQuery().processInstanceId(historicProcessInstance.getId()).orderByHistoricTaskInstanceEndTime().desc().list();
|
||||
if (Func.isNotEmpty(historyTasks)) {
|
||||
HistoricTaskInstance historyTask = historyTasks.iterator().next();
|
||||
flow.setTaskId(historyTask.getId());
|
||||
flow.setTaskName(historyTask.getName());
|
||||
flow.setTaskDefinitionKey(historyTask.getTaskDefinitionKey());
|
||||
}
|
||||
// Status
|
||||
if (historicProcessInstance.getEndActivityId() != null) {
|
||||
flow.setProcessIsFinished(FlowEngineConstant.STATUS_FINISHED);
|
||||
} else {
|
||||
flow.setProcessIsFinished(FlowEngineConstant.STATUS_UNFINISHED);
|
||||
}
|
||||
flow.setStatus(FlowEngineConstant.STATUS_FINISH);
|
||||
flowList.add(flow);
|
||||
});
|
||||
|
||||
// 计算总数
|
||||
long count = historyQuery.count();
|
||||
// 设置总数
|
||||
page.setTotal(count);
|
||||
page.setRecords(flowList);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<BladeFlow> selectDonePage(IPage<BladeFlow> page, BladeFlow bladeFlow) {
|
||||
String taskUser = TaskUtil.getTaskUser();
|
||||
List<BladeFlow> flowList = new LinkedList<>();
|
||||
|
||||
HistoricTaskInstanceQuery doneQuery = historyService.createHistoricTaskInstanceQuery().taskAssignee(taskUser).finished()
|
||||
.includeProcessVariables().orderByHistoricTaskInstanceEndTime().desc();
|
||||
|
||||
if (bladeFlow.getCategory() != null) {
|
||||
doneQuery.processCategoryIn(Func.toStrList(bladeFlow.getCategory()));
|
||||
}
|
||||
if (bladeFlow.getProcessDefinitionName() != null) {
|
||||
doneQuery.processDefinitionName(bladeFlow.getProcessDefinitionName());
|
||||
}
|
||||
if (bladeFlow.getBeginDate() != null) {
|
||||
doneQuery.taskCompletedAfter(bladeFlow.getBeginDate());
|
||||
}
|
||||
if (bladeFlow.getEndDate() != null) {
|
||||
doneQuery.taskCompletedBefore(bladeFlow.getEndDate());
|
||||
}
|
||||
|
||||
// 查询列表
|
||||
List<HistoricTaskInstance> doneList = doneQuery.listPage(Func.toInt((page.getCurrent() - 1) * page.getSize()), Func.toInt(page.getSize()));
|
||||
doneList.forEach(historicTaskInstance -> {
|
||||
BladeFlow flow = new BladeFlow();
|
||||
flow.setTaskId(historicTaskInstance.getId());
|
||||
flow.setTaskDefinitionKey(historicTaskInstance.getTaskDefinitionKey());
|
||||
flow.setTaskName(historicTaskInstance.getName());
|
||||
flow.setAssignee(historicTaskInstance.getAssignee());
|
||||
flow.setCreateTime(historicTaskInstance.getCreateTime());
|
||||
flow.setExecutionId(historicTaskInstance.getExecutionId());
|
||||
flow.setHistoryTaskEndTime(historicTaskInstance.getEndTime());
|
||||
flow.setVariables(historicTaskInstance.getProcessVariables());
|
||||
|
||||
FlowProcess processDefinition = FlowCache.getProcessDefinition(historicTaskInstance.getProcessDefinitionId());
|
||||
flow.setProcessDefinitionId(processDefinition.getId());
|
||||
flow.setProcessDefinitionName(processDefinition.getName());
|
||||
flow.setProcessDefinitionKey(processDefinition.getKey());
|
||||
flow.setProcessDefinitionVersion(processDefinition.getVersion());
|
||||
flow.setCategory(processDefinition.getCategory());
|
||||
flow.setCategoryName(FlowCache.getCategoryName(processDefinition.getCategory()));
|
||||
|
||||
flow.setProcessInstanceId(historicTaskInstance.getProcessInstanceId());
|
||||
flow.setHistoryProcessInstanceId(historicTaskInstance.getProcessInstanceId());
|
||||
HistoricProcessInstance historicProcessInstance = getHistoricProcessInstance((historicTaskInstance.getProcessInstanceId()));
|
||||
if (Func.isNotEmpty(historicProcessInstance)) {
|
||||
String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey());
|
||||
flow.setBusinessTable(businessKey[0]);
|
||||
flow.setBusinessId(businessKey[1]);
|
||||
if (historicProcessInstance.getEndActivityId() != null) {
|
||||
flow.setProcessIsFinished(FlowEngineConstant.STATUS_FINISHED);
|
||||
} else {
|
||||
flow.setProcessIsFinished(FlowEngineConstant.STATUS_UNFINISHED);
|
||||
}
|
||||
}
|
||||
flow.setStatus(FlowEngineConstant.STATUS_FINISH);
|
||||
flowList.add(flow);
|
||||
});
|
||||
// 计算总数
|
||||
long count = doneQuery.count();
|
||||
// 设置总数
|
||||
page.setTotal(count);
|
||||
page.setRecords(flowList);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean completeTask(BladeFlow flow) {
|
||||
String taskId = flow.getTaskId();
|
||||
String processInstanceId = flow.getProcessInstanceId();
|
||||
String comment = Func.toStr(flow.getComment(), ProcessConstant.PASS_COMMENT);
|
||||
// 增加评论
|
||||
if (StringUtil.isNoneBlank(processInstanceId, comment)) {
|
||||
taskService.addComment(taskId, processInstanceId, comment);
|
||||
}
|
||||
// 创建变量
|
||||
Map<String, Object> variables = flow.getVariables();
|
||||
if (variables == null) {
|
||||
variables = Kv.create();
|
||||
}
|
||||
variables.put(ProcessConstant.PASS_KEY, flow.isPass());
|
||||
// 完成任务
|
||||
taskService.complete(taskId, variables);
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 构建流程
|
||||
*
|
||||
* @param bladeFlow 流程通用类
|
||||
* @param flowList 流程列表
|
||||
* @param taskQuery 任务查询类
|
||||
* @param status 状态
|
||||
*/
|
||||
private void buildFlowTaskList(BladeFlow bladeFlow, List<BladeFlow> flowList, TaskQuery taskQuery, String status) {
|
||||
if (bladeFlow.getCategory() != null) {
|
||||
taskQuery.processCategoryIn(Func.toStrList(bladeFlow.getCategory()));
|
||||
}
|
||||
if (bladeFlow.getProcessDefinitionName() != null) {
|
||||
taskQuery.processDefinitionName(bladeFlow.getProcessDefinitionName());
|
||||
}
|
||||
if (bladeFlow.getBeginDate() != null) {
|
||||
taskQuery.taskCreatedAfter(bladeFlow.getBeginDate());
|
||||
}
|
||||
if (bladeFlow.getEndDate() != null) {
|
||||
taskQuery.taskCreatedBefore(bladeFlow.getEndDate());
|
||||
}
|
||||
taskQuery.list().forEach(task -> {
|
||||
BladeFlow flow = new BladeFlow();
|
||||
flow.setTaskId(task.getId());
|
||||
flow.setTaskDefinitionKey(task.getTaskDefinitionKey());
|
||||
flow.setTaskName(task.getName());
|
||||
flow.setAssignee(task.getAssignee());
|
||||
flow.setCreateTime(task.getCreateTime());
|
||||
flow.setClaimTime(task.getClaimTime());
|
||||
flow.setExecutionId(task.getExecutionId());
|
||||
flow.setVariables(task.getProcessVariables());
|
||||
|
||||
HistoricProcessInstance historicProcessInstance = getHistoricProcessInstance(task.getProcessInstanceId());
|
||||
if (Func.isNotEmpty(historicProcessInstance)) {
|
||||
String[] businessKey = Func.toStrArray(StringPool.COLON, historicProcessInstance.getBusinessKey());
|
||||
flow.setBusinessTable(businessKey[0]);
|
||||
flow.setBusinessId(businessKey[1]);
|
||||
}
|
||||
|
||||
FlowProcess processDefinition = FlowCache.getProcessDefinition(task.getProcessDefinitionId());
|
||||
flow.setCategory(processDefinition.getCategory());
|
||||
flow.setCategoryName(FlowCache.getCategoryName(processDefinition.getCategory()));
|
||||
flow.setProcessDefinitionId(processDefinition.getId());
|
||||
flow.setProcessDefinitionName(processDefinition.getName());
|
||||
flow.setProcessDefinitionKey(processDefinition.getKey());
|
||||
flow.setProcessDefinitionVersion(processDefinition.getVersion());
|
||||
flow.setProcessInstanceId(task.getProcessInstanceId());
|
||||
flow.setStatus(status);
|
||||
flowList.add(flow);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取历史流程
|
||||
*
|
||||
* @param processInstanceId 流程实例id
|
||||
* @return HistoricProcessInstance
|
||||
*/
|
||||
private HistoricProcessInstance getHistoricProcessInstance(String processInstanceId) {
|
||||
return historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,106 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.business.service.impl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.flowable.engine.IdentityService;
|
||||
import org.flowable.engine.RuntimeService;
|
||||
import org.flowable.engine.TaskService;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.support.Kv;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.flow.business.service.IFlowService;
|
||||
import org.springblade.flow.core.entity.BladeFlow;
|
||||
import org.springblade.flow.core.utils.TaskUtil;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 流程实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
public class FlowServiceImpl implements IFlowService {
|
||||
|
||||
private final RuntimeService runtimeService;
|
||||
private final IdentityService identityService;
|
||||
private final TaskService taskService;
|
||||
|
||||
@Override
|
||||
public BladeFlow startProcessInstanceById(String processDefinitionId, String businessKey, Map<String, Object> variables) {
|
||||
// 设置流程启动用户
|
||||
identityService.setAuthenticatedUserId(TaskUtil.getTaskUser());
|
||||
// 开启流程
|
||||
ProcessInstance processInstance = runtimeService.startProcessInstanceById(processDefinitionId, businessKey, variables);
|
||||
// 组装流程通用类
|
||||
BladeFlow flow = new BladeFlow();
|
||||
flow.setProcessInstanceId(processInstance.getId());
|
||||
return flow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BladeFlow startProcessInstanceByKey(String processDefinitionKey, String businessKey, Map<String, Object> variables) {
|
||||
// 设置流程启动用户
|
||||
identityService.setAuthenticatedUserId(TaskUtil.getTaskUser());
|
||||
// 开启流程
|
||||
ProcessInstance processInstance = runtimeService.startProcessInstanceByKey(processDefinitionKey, businessKey, variables);
|
||||
// 组装流程通用类
|
||||
BladeFlow flow = new BladeFlow();
|
||||
flow.setProcessInstanceId(processInstance.getId());
|
||||
return flow;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean completeTask(String taskId, String processInstanceId, String comment, Map<String, Object> variables) {
|
||||
// 增加评论
|
||||
if (StringUtil.isNoneBlank(processInstanceId, comment)) {
|
||||
taskService.addComment(taskId, processInstanceId, comment);
|
||||
}
|
||||
// 非空判断
|
||||
if (Func.isEmpty(variables)) {
|
||||
variables = Kv.create();
|
||||
}
|
||||
// 完成任务
|
||||
taskService.complete(taskId, variables);
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Object taskVariable(String taskId, String variableName) {
|
||||
return R.data(taskService.getVariable(taskId, variableName));
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> taskVariables(String taskId) {
|
||||
return taskService.getVariables(taskId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,190 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.core.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import org.springblade.flow.core.constant.ProcessConstant;
|
||||
|
||||
import java.io.Serial;
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工作流通用实体类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
public class BladeFlow implements Serializable {
|
||||
@Serial
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
/**
|
||||
* 任务编号
|
||||
*/
|
||||
private String taskId;
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
private String taskName;
|
||||
/**
|
||||
* 任务定义Key
|
||||
*/
|
||||
private String taskDefinitionKey;
|
||||
/**
|
||||
* 任务执行人编号
|
||||
*/
|
||||
private String assignee;
|
||||
/**
|
||||
* 任务执行人名称
|
||||
*/
|
||||
private String assigneeName;
|
||||
/**
|
||||
* 流程分类
|
||||
*/
|
||||
private String category;
|
||||
/**
|
||||
* 流程分类名
|
||||
*/
|
||||
private String categoryName;
|
||||
/**
|
||||
* 创建时间
|
||||
*/
|
||||
private Date createTime;
|
||||
/**
|
||||
* 结束时间
|
||||
*/
|
||||
private Date endTime;
|
||||
/**
|
||||
* 签收时间
|
||||
*/
|
||||
private Date claimTime;
|
||||
/**
|
||||
* 历史任务结束时间
|
||||
*/
|
||||
private Date historyTaskEndTime;
|
||||
/**
|
||||
* 执行ID
|
||||
*/
|
||||
private String executionId;
|
||||
/**
|
||||
* 流程实例ID
|
||||
*/
|
||||
private String processInstanceId;
|
||||
/**
|
||||
* 流程ID
|
||||
*/
|
||||
private String processDefinitionId;
|
||||
/**
|
||||
* 流程标识
|
||||
*/
|
||||
private String processDefinitionKey;
|
||||
/**
|
||||
* 流程名
|
||||
*/
|
||||
private String processDefinitionName;
|
||||
/**
|
||||
* 流程版本
|
||||
*/
|
||||
private int processDefinitionVersion;
|
||||
/**
|
||||
* 流程说明
|
||||
*/
|
||||
private String processDefinitionDesc;
|
||||
/**
|
||||
* 流程简图名
|
||||
*/
|
||||
private String processDefinitionDiagramResName;
|
||||
/**
|
||||
* 流程重命名
|
||||
*/
|
||||
private String processDefinitionResName;
|
||||
/**
|
||||
* 历史任务流程实例ID 查看流程图会用到
|
||||
*/
|
||||
private String historyProcessInstanceId;
|
||||
/**
|
||||
* 流程实例是否结束
|
||||
*/
|
||||
private String processIsFinished;
|
||||
/**
|
||||
* 历史活动ID
|
||||
*/
|
||||
private String historyActivityId;
|
||||
/**
|
||||
* 历史活动流程
|
||||
*/
|
||||
private String historyActivityName;
|
||||
/**
|
||||
* 历史活动耗时
|
||||
*/
|
||||
private String historyActivityDurationTime;
|
||||
/**
|
||||
* 业务绑定Table
|
||||
*/
|
||||
private String businessTable;
|
||||
/**
|
||||
* 业务绑定ID
|
||||
*/
|
||||
private String businessId;
|
||||
/**
|
||||
* 任务状态
|
||||
*/
|
||||
private String status;
|
||||
/**
|
||||
* 任务意见
|
||||
*/
|
||||
private String comment;
|
||||
/**
|
||||
* 是否通过
|
||||
*/
|
||||
private boolean isPass;
|
||||
/**
|
||||
* 是否通过代号
|
||||
*/
|
||||
private String flag;
|
||||
/**
|
||||
* 开始查询日期
|
||||
*/
|
||||
private Date beginDate;
|
||||
/**
|
||||
* 结束查询日期
|
||||
*/
|
||||
private Date endDate;
|
||||
/**
|
||||
* 流程参数
|
||||
*/
|
||||
private Map<String, Object> variables;
|
||||
|
||||
/**
|
||||
* 获取是否通过
|
||||
*/
|
||||
public boolean isPass() {
|
||||
return ProcessConstant.PASS_ALIAS.equals(flag) || ProcessConstant.PASS_COMMENT.equals(comment);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,76 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.core.utils;
|
||||
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.core.tool.utils.StringPool;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.flow.core.constant.ProcessConstant;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 工作流工具类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public class FlowUtil {
|
||||
|
||||
/**
|
||||
* 定义流程key对应的表名
|
||||
*/
|
||||
private final static Map<String, String> BUSINESS_TABLE = new HashMap<>();
|
||||
|
||||
static {
|
||||
BUSINESS_TABLE.put(ProcessConstant.LEAVE_KEY, "blade_process_leave");
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过流程key获取业务表名
|
||||
*
|
||||
* @param key 流程key
|
||||
*/
|
||||
public static String getBusinessTable(String key) {
|
||||
String businessTable = BUSINESS_TABLE.get(key);
|
||||
if (Func.isEmpty(businessTable)) {
|
||||
return StringPool.EMPTY;
|
||||
}
|
||||
return businessTable;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取业务标识
|
||||
*
|
||||
* @param businessTable 业务表
|
||||
* @param businessId 业务表主键
|
||||
* @return businessKey
|
||||
*/
|
||||
public static String getBusinessKey(String businessTable, String businessId) {
|
||||
return StringUtil.format("{}:{}", businessTable, businessId);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,80 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.core.utils;
|
||||
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
|
||||
import static org.springblade.core.launch.constant.FlowConstant.TASK_USR_PREFIX;
|
||||
|
||||
/**
|
||||
* 工作流任务工具类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public class TaskUtil {
|
||||
|
||||
/**
|
||||
* 获取任务用户格式
|
||||
*
|
||||
* @return taskUser
|
||||
*/
|
||||
public static String getTaskUser() {
|
||||
return StringUtil.format("{}{}", TASK_USR_PREFIX, AuthUtil.getUserId());
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取任务用户格式
|
||||
*
|
||||
* @param userId 用户id
|
||||
* @return taskUser
|
||||
*/
|
||||
public static String getTaskUser(String userId) {
|
||||
return StringUtil.format("{}{}", TASK_USR_PREFIX, userId);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取用户主键
|
||||
*
|
||||
* @param taskUser 任务用户
|
||||
* @return userId
|
||||
*/
|
||||
public static Long getUserId(String taskUser) {
|
||||
return Func.toLong(StringUtil.removePrefix(taskUser, TASK_USR_PREFIX));
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取用户组格式
|
||||
*
|
||||
* @return candidateGroup
|
||||
*/
|
||||
public static String getCandidateGroup() {
|
||||
return AuthUtil.getUserRole();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.demo.leave.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.common.cache.UserCache;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springblade.core.tenant.annotation.NonDS;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.flow.demo.leave.entity.ProcessLeave;
|
||||
import org.springblade.flow.demo.leave.service.ILeaveService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@NonDS
|
||||
@Hidden
|
||||
@RestController
|
||||
@RequestMapping(AppConstant.APPLICATION_DESK_NAME + "/process/leave")
|
||||
@AllArgsConstructor
|
||||
public class LeaveController {
|
||||
|
||||
private final ILeaveService leaveService;
|
||||
|
||||
/**
|
||||
* 详情
|
||||
*
|
||||
* @param businessId 主键
|
||||
*/
|
||||
@GetMapping("detail")
|
||||
public R<ProcessLeave> detail(Long businessId) {
|
||||
ProcessLeave detail = leaveService.getById(businessId);
|
||||
detail.getFlow().setAssigneeName(UserCache.getUser(detail.getCreateUser()).getName());
|
||||
return R.data(detail);
|
||||
}
|
||||
|
||||
/**
|
||||
* 新增或修改
|
||||
*
|
||||
* @param leave 请假信息
|
||||
*/
|
||||
@PostMapping("start-process")
|
||||
public R startProcess(@RequestBody ProcessLeave leave) {
|
||||
return R.status(leaveService.startProcess(leave));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.springblade.flow.demo.leave.mapper.LeaveMapper">
|
||||
|
||||
|
||||
</mapper>
|
||||
@@ -1,91 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.demo.leave.service.impl;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.mp.base.BaseServiceImpl;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.support.Kv;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.flow.business.service.IFlowService;
|
||||
import org.springblade.flow.core.constant.ProcessConstant;
|
||||
import org.springblade.flow.core.entity.BladeFlow;
|
||||
import org.springblade.flow.core.utils.FlowUtil;
|
||||
import org.springblade.flow.core.utils.TaskUtil;
|
||||
import org.springblade.flow.demo.leave.entity.ProcessLeave;
|
||||
import org.springblade.flow.demo.leave.mapper.LeaveMapper;
|
||||
import org.springblade.flow.demo.leave.service.ILeaveService;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
/**
|
||||
* 服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class LeaveServiceImpl extends BaseServiceImpl<LeaveMapper, ProcessLeave> implements ILeaveService {
|
||||
|
||||
private final IFlowService flowService;
|
||||
|
||||
@Override
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public boolean startProcess(ProcessLeave leave) {
|
||||
String businessTable = FlowUtil.getBusinessTable(ProcessConstant.LEAVE_KEY);
|
||||
if (Func.isEmpty(businessTable)) {
|
||||
throw new ServiceException("流程启动失败,未找到相关业务表");
|
||||
}
|
||||
if (Func.isEmpty(leave.getId())) {
|
||||
// 保存leave
|
||||
leave.setApplyTime(DateUtil.now());
|
||||
save(leave);
|
||||
// 启动流程
|
||||
Kv variables = Kv.create()
|
||||
.set(ProcessConstant.TASK_VARIABLE_CREATE_USER, AuthUtil.getUserName())
|
||||
.set("taskUser", TaskUtil.getTaskUser(leave.getTaskUser()))
|
||||
.set("days", DateUtil.between(leave.getStartTime(), leave.getEndTime()).toDays());
|
||||
BladeFlow flow = flowService.startProcessInstanceById(leave.getProcessDefinitionId(), FlowUtil.getBusinessKey(businessTable, String.valueOf(leave.getId())), variables);
|
||||
if (Func.isNotEmpty(flow)) {
|
||||
log.debug("流程已启动,流程ID:" + flow.getProcessInstanceId());
|
||||
// 返回流程id写入leave
|
||||
leave.setProcessInstanceId(flow.getProcessInstanceId());
|
||||
updateById(leave);
|
||||
} else {
|
||||
throw new ServiceException("开启流程失败");
|
||||
}
|
||||
} else {
|
||||
|
||||
updateById(leave);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,6 +0,0 @@
|
||||
/**
|
||||
* Created by Blade.
|
||||
*
|
||||
* @author zhuangqian
|
||||
*/
|
||||
package org.springblade.flow.demo;
|
||||
@@ -1,53 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.engine.config;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.flowable.spring.SpringProcessEngineConfiguration;
|
||||
import org.flowable.spring.boot.EngineConfigurationConfigurer;
|
||||
import org.flowable.spring.boot.FlowableProperties;
|
||||
import org.springframework.boot.context.properties.EnableConfigurationProperties;
|
||||
import org.springframework.context.annotation.Configuration;
|
||||
|
||||
/**
|
||||
* Flowable配置类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Configuration(proxyBeanMethods = false)
|
||||
@AllArgsConstructor
|
||||
@EnableConfigurationProperties(FlowableProperties.class)
|
||||
public class FlowableConfiguration implements EngineConfigurationConfigurer<SpringProcessEngineConfiguration> {
|
||||
private final FlowableProperties flowableProperties;
|
||||
|
||||
@Override
|
||||
public void configure(SpringProcessEngineConfiguration engineConfiguration) {
|
||||
engineConfiguration.setActivityFontName(flowableProperties.getActivityFontName());
|
||||
engineConfiguration.setLabelFontName(flowableProperties.getLabelFontName());
|
||||
engineConfiguration.setAnnotationFontName(flowableProperties.getAnnotationFontName());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,61 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.engine.constant;
|
||||
|
||||
/**
|
||||
* 流程常量.
|
||||
*
|
||||
* @author zhuangqian
|
||||
*/
|
||||
public interface FlowEngineConstant {
|
||||
|
||||
String FLOWABLE_BASE_PACKAGES = "org.flowable.ui";
|
||||
|
||||
String SUFFIX = ".bpmn20.xml";
|
||||
|
||||
String ACTIVE = "active";
|
||||
|
||||
String SUSPEND = "suspend";
|
||||
|
||||
String STATUS_TODO = "todo";
|
||||
|
||||
String STATUS_CLAIM = "claim";
|
||||
|
||||
String STATUS_SEND = "send";
|
||||
|
||||
String STATUS_DONE = "done";
|
||||
|
||||
String STATUS_FINISHED = "finished";
|
||||
|
||||
String STATUS_UNFINISHED = "unfinished";
|
||||
|
||||
String STATUS_FINISH = "finish";
|
||||
|
||||
String START_EVENT = "startEvent";
|
||||
|
||||
String END_EVENT = "endEvent";
|
||||
|
||||
}
|
||||
@@ -1,83 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.engine.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.IsAdministrator;
|
||||
import org.springblade.core.tenant.annotation.NonDS;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.flow.engine.entity.FlowExecution;
|
||||
import org.springblade.flow.engine.service.FlowEngineService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
/**
|
||||
* 流程状态控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Hidden
|
||||
@NonDS
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@IsAdministrator
|
||||
@RequestMapping(AppConstant.APPLICATION_FLOW_NAME + "/follow")
|
||||
@Tag(name = "流程状态接口", description = "流程状态接口")
|
||||
public class FlowFollowController {
|
||||
|
||||
private final FlowEngineService flowEngineService;
|
||||
|
||||
/**
|
||||
* 流程状态列表
|
||||
*/
|
||||
@GetMapping("list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "分页", description = "传入notice")
|
||||
public R<IPage<FlowExecution>> list(Query query, @Parameter(description = "流程实例id") String processInstanceId, @Parameter(description = "流程key") String processDefinitionKey) {
|
||||
IPage<FlowExecution> pages = flowEngineService.selectFollowPage(Condition.getPage(query), processInstanceId, processDefinitionKey);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除流程实例
|
||||
*/
|
||||
@PostMapping("delete-process-instance")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "删除", description = "传入主键集合")
|
||||
public R deleteProcessInstance(@Parameter(description = "流程实例id") @RequestParam String processInstanceId, @Parameter(description = "删除原因") @RequestParam String deleteReason) {
|
||||
boolean temp = flowEngineService.deleteProcessInstance(processInstanceId, deleteReason);
|
||||
return R.status(temp);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,133 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.engine.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.IsAdministrator;
|
||||
import org.springblade.core.tenant.annotation.NonDS;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.support.Kv;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.flow.engine.constant.FlowEngineConstant;
|
||||
import org.springblade.flow.engine.entity.FlowProcess;
|
||||
import org.springblade.flow.engine.service.FlowEngineService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Objects;
|
||||
|
||||
/**
|
||||
* 流程管理接口
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Hidden
|
||||
@NonDS
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@IsAdministrator
|
||||
@RequestMapping(AppConstant.APPLICATION_FLOW_NAME + "/manager")
|
||||
@Tag(name = "流程管理接口", description = "流程管理接口")
|
||||
public class FlowManagerController {
|
||||
|
||||
private final FlowEngineService flowEngineService;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "分页", description = "传入流程类型")
|
||||
public R<IPage<FlowProcess>> list(@Parameter(description = "流程类型") String category, Query query, @RequestParam(required = false, defaultValue = "1") Integer mode) {
|
||||
IPage<FlowProcess> pages = flowEngineService.selectProcessPage(Condition.getPage(query), category, mode);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 变更流程状态
|
||||
*
|
||||
* @param state 状态
|
||||
* @param processId 流程id
|
||||
*/
|
||||
@PostMapping("change-state")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "变更流程状态", description = "传入state,processId")
|
||||
public R changeState(@RequestParam String state, @RequestParam String processId) {
|
||||
String msg = flowEngineService.changeState(state, processId);
|
||||
return R.success(msg);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除部署流程
|
||||
*
|
||||
* @param deploymentIds 部署流程id集合
|
||||
*/
|
||||
@PostMapping("delete-deployment")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "删除部署流程", description = "部署流程id集合")
|
||||
public R deleteDeployment(String deploymentIds) {
|
||||
return R.status(flowEngineService.deleteDeployment(deploymentIds));
|
||||
}
|
||||
|
||||
/**
|
||||
* 检查流程文件格式
|
||||
*
|
||||
* @param file 流程文件
|
||||
*/
|
||||
@PostMapping("check-upload")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "上传部署流程文件", description = "传入文件")
|
||||
public R checkUpload(@RequestParam MultipartFile file) {
|
||||
boolean temp = Objects.requireNonNull(file.getOriginalFilename()).endsWith(FlowEngineConstant.SUFFIX);
|
||||
return R.data(Kv.create().set("name", file.getOriginalFilename()).set("success", temp));
|
||||
}
|
||||
|
||||
/**
|
||||
* 上传部署流程文件
|
||||
*
|
||||
* @param files 流程文件
|
||||
* @param category 类型
|
||||
*/
|
||||
@PostMapping("deploy-upload")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "上传部署流程文件", description = "传入文件")
|
||||
public R deployUpload(@RequestParam List<MultipartFile> files,
|
||||
@RequestParam String category,
|
||||
@RequestParam(required = false, defaultValue = "") String tenantIds) {
|
||||
return R.status(flowEngineService.deployUpload(files, category, Func.toStrList(tenantIds)));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,134 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.engine.controller;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.Parameter;
|
||||
import io.swagger.v3.oas.annotations.Parameters;
|
||||
import io.swagger.v3.oas.annotations.enums.ParameterIn;
|
||||
import io.swagger.v3.oas.annotations.media.Schema;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.annotation.IsAdministrator;
|
||||
import org.springblade.core.tenant.annotation.NonDS;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.core.xss.annotation.XssIgnore;
|
||||
import org.springblade.flow.engine.entity.FlowModel;
|
||||
import org.springblade.flow.engine.service.FlowEngineService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 流程模型控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Hidden
|
||||
@NonDS
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@IsAdministrator
|
||||
@RequestMapping(AppConstant.APPLICATION_FLOW_NAME + "/model")
|
||||
@Tag(name = "流程模型管理接口", description = "流程模型管理接口")
|
||||
public class FlowModelController {
|
||||
|
||||
private final FlowEngineService flowEngineService;
|
||||
|
||||
/**
|
||||
* 分页
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@Parameters({
|
||||
@Parameter(name = "modelKey", description = "模型标识", in = ParameterIn.QUERY, schema = @Schema(type = "string")),
|
||||
@Parameter(name = "name", description = "模型名称", in = ParameterIn.QUERY, schema = @Schema(type = "string"))
|
||||
})
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "分页", description = "传入notice")
|
||||
public R<IPage<FlowModel>> list(@Parameter(hidden = true) @RequestParam Map<String, Object> flow, Query query) {
|
||||
IPage<FlowModel> pages = flowEngineService.page(Condition.getPage(query), Condition.getQueryWrapper(flow, FlowModel.class)
|
||||
.select("id,model_key modelKey,name,description,version,created,last_updated lastUpdated")
|
||||
.orderByDesc("last_updated"));
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 删除
|
||||
*/
|
||||
@PostMapping("/remove")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "删除", description = "传入主键集合")
|
||||
public R remove(@Parameter(description = "主键集合") @RequestParam String ids) {
|
||||
boolean temp = flowEngineService.removeByIds(Func.toStrList(ids));
|
||||
return R.status(temp);
|
||||
}
|
||||
|
||||
/**
|
||||
* 部署
|
||||
*/
|
||||
@PostMapping("/deploy")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "部署", description = "传入模型id和分类")
|
||||
public R deploy(@Parameter(description = "模型id") @RequestParam String modelId,
|
||||
@Parameter(description = "工作流分类") @RequestParam String category,
|
||||
@Parameter(description = "租户ID") @RequestParam(required = false, defaultValue = "") String tenantIds) {
|
||||
boolean temp = flowEngineService.deployModel(modelId, category, Func.toStrList(tenantIds));
|
||||
return R.status(temp);
|
||||
}
|
||||
|
||||
@XssIgnore
|
||||
@PostMapping("submit")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "保存/编辑")
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "模型id"),
|
||||
@Parameter(name = "name", description = "模型名称", required = true),
|
||||
@Parameter(name = "modelKey", description = "模型key", required = true),
|
||||
@Parameter(name = "description", description = "模型描述"),
|
||||
@Parameter(name = "xml", description = "模型xml", required = true),
|
||||
})
|
||||
public R<FlowModel> submit(@RequestBody @Parameter(hidden = true) FlowModel model) {
|
||||
return R.data(flowEngineService.submitModel(model));
|
||||
}
|
||||
|
||||
@GetMapping("detail")
|
||||
@Operation(summary = "详情")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Parameters({
|
||||
@Parameter(name = "id", description = "模型id", required = true),
|
||||
})
|
||||
public R<FlowModel> detail(String id) {
|
||||
return R.data(flowEngineService.getById(id));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,109 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.engine.controller;
|
||||
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.core.launch.constant.AppConstant;
|
||||
import org.springblade.core.tenant.annotation.NonDS;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.flow.core.entity.BladeFlow;
|
||||
import org.springblade.flow.engine.service.FlowEngineService;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 流程通用控制器
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Hidden
|
||||
@NonDS
|
||||
@Slf4j
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping(AppConstant.APPLICATION_FLOW_NAME + "/process")
|
||||
@Tag(name = "流程通用接口", description = "流程通用接口")
|
||||
public class FlowProcessController {
|
||||
|
||||
private static final String IMAGE_NAME = "image";
|
||||
private final FlowEngineService flowEngineService;
|
||||
|
||||
/**
|
||||
* 获取流转历史列表
|
||||
*
|
||||
* @param processInstanceId 流程实例id
|
||||
* @param startActivityId 开始节点id
|
||||
* @param endActivityId 结束节点id
|
||||
*/
|
||||
@GetMapping(value = "history-flow-list")
|
||||
public R<List<BladeFlow>> historyFlowList(@RequestParam String processInstanceId, String startActivityId, String endActivityId) {
|
||||
return R.data(flowEngineService.historyFlowList(processInstanceId, startActivityId, endActivityId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程节点进程图
|
||||
*
|
||||
* @param processDefinitionId 流程id
|
||||
* @param processInstanceId 流程实例id
|
||||
*/
|
||||
@GetMapping(value = "model-view")
|
||||
public R modelView(String processDefinitionId, String processInstanceId) {
|
||||
return R.data(flowEngineService.modelView(processDefinitionId, processInstanceId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程节点进程图
|
||||
*
|
||||
* @param processInstanceId 流程实例id
|
||||
* @param httpServletResponse http响应
|
||||
*/
|
||||
@GetMapping(value = "diagram-view")
|
||||
public void diagramView(String processInstanceId, HttpServletResponse httpServletResponse) {
|
||||
flowEngineService.diagramView(processInstanceId, httpServletResponse);
|
||||
}
|
||||
|
||||
/**
|
||||
* 流程图展示
|
||||
*
|
||||
* @param processDefinitionId 流程id
|
||||
* @param processInstanceId 实例id
|
||||
* @param resourceType 资源类型
|
||||
* @param response 响应
|
||||
*/
|
||||
@GetMapping("resource-view")
|
||||
public void resourceView(@RequestParam String processDefinitionId, String processInstanceId, @RequestParam(defaultValue = IMAGE_NAME) String resourceType, HttpServletResponse response) {
|
||||
flowEngineService.resourceView(processDefinitionId, processInstanceId, resourceType, response);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.engine.entity;
|
||||
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityImpl;
|
||||
import org.springblade.flow.engine.utils.FlowCache;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* FlowProcess
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
public class FlowProcess implements Serializable {
|
||||
|
||||
private String id;
|
||||
private String tenantId;
|
||||
private String name;
|
||||
private String key;
|
||||
private String category;
|
||||
private String categoryName;
|
||||
private Integer version;
|
||||
private String deploymentId;
|
||||
private String resourceName;
|
||||
private String diagramResourceName;
|
||||
private Integer suspensionState;
|
||||
private Date deploymentTime;
|
||||
|
||||
public FlowProcess(ProcessDefinitionEntityImpl entity) {
|
||||
if (entity != null) {
|
||||
this.id = entity.getId();
|
||||
this.tenantId = entity.getTenantId();
|
||||
this.name = entity.getName();
|
||||
this.key = entity.getKey();
|
||||
this.category = entity.getCategory();
|
||||
this.categoryName = FlowCache.getCategoryName(entity.getCategory());
|
||||
this.version = entity.getVersion();
|
||||
this.deploymentId = entity.getDeploymentId();
|
||||
this.resourceName = entity.getResourceName();
|
||||
this.diagramResourceName = entity.getDiagramResourceName();
|
||||
this.suspensionState = entity.getSuspensionState();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,53 +0,0 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="org.springblade.flow.engine.mapper.FlowMapper">
|
||||
|
||||
<!-- 通用查询映射结果 -->
|
||||
<resultMap id="flowModelResultMap" type="org.springblade.flow.engine.entity.FlowModel">
|
||||
<result column="id" property="id"/>
|
||||
<result column="name" property="name"/>
|
||||
<result column="model_key" property="modelKey"/>
|
||||
<result column="description" property="description"/>
|
||||
<result column="model_comment" property="modelComment"/>
|
||||
<result column="created" property="created"/>
|
||||
<result column="created_by" property="createdBy"/>
|
||||
<result column="last_updated" property="lastUpdated"/>
|
||||
<result column="last_updated_by" property="lastUpdatedBy"/>
|
||||
<result column="version" property="version"/>
|
||||
<result column="model_editor_json" property="modelEditorJson"/>
|
||||
<result column="thumbnail" property="thumbnail"/>
|
||||
<result column="model_type" property="modelType"/>
|
||||
<result column="tenant_id" property="tenantId"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="selectFlowPage" resultMap="flowModelResultMap">
|
||||
SELECT
|
||||
a.id,
|
||||
a.name,
|
||||
a.model_key,
|
||||
a.description,
|
||||
a.model_comment,
|
||||
a.created,
|
||||
a.created_by,
|
||||
a.last_updated,
|
||||
a.last_updated_by,
|
||||
a.version,
|
||||
a.model_editor_json,
|
||||
a.thumbnail,
|
||||
a.model_type,
|
||||
a.tenant_id
|
||||
FROM
|
||||
ACT_DE_MODEL a
|
||||
WHERE
|
||||
1 = 1
|
||||
ORDER BY
|
||||
a.created DESC
|
||||
</select>
|
||||
|
||||
<select id="findByParentModelId" parameterType="string" resultMap="flowModelResultMap">
|
||||
select model.* from ACT_DE_MODEL_RELATION modelrelation
|
||||
inner join ACT_DE_MODEL model on modelrelation.model_id = model.id
|
||||
where modelrelation.parent_model_id = #{_parameter}
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
@@ -1,174 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.engine.service;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import org.springblade.flow.core.entity.BladeFlow;
|
||||
import org.springblade.flow.engine.entity.FlowExecution;
|
||||
import org.springblade.flow.engine.entity.FlowModel;
|
||||
import org.springblade.flow.engine.entity.FlowProcess;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* FlowEngineService
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public interface FlowEngineService extends IService<FlowModel> {
|
||||
|
||||
/**
|
||||
* 自定义分页
|
||||
*
|
||||
* @param page 分页工具
|
||||
* @param flowModel 流程模型
|
||||
* @return
|
||||
*/
|
||||
IPage<FlowModel> selectFlowPage(IPage<FlowModel> page, FlowModel flowModel);
|
||||
|
||||
/**
|
||||
* 流程管理列表
|
||||
*
|
||||
* @param page 分页工具
|
||||
* @param category 分类
|
||||
* @param mode 形态
|
||||
* @return
|
||||
*/
|
||||
IPage<FlowProcess> selectProcessPage(IPage<FlowProcess> page, String category, Integer mode);
|
||||
|
||||
/**
|
||||
* 流程管理列表
|
||||
*
|
||||
* @param page 分页工具
|
||||
* @param processInstanceId 流程实例id
|
||||
* @param processDefinitionKey 流程key
|
||||
* @return
|
||||
*/
|
||||
IPage<FlowExecution> selectFollowPage(IPage<FlowExecution> page, String processInstanceId, String processDefinitionKey);
|
||||
|
||||
/**
|
||||
* 获取流转历史列表
|
||||
*
|
||||
* @param processInstanceId 流程实例id
|
||||
* @param startActivityId 开始节点id
|
||||
* @param endActivityId 结束节点id
|
||||
* @return
|
||||
*/
|
||||
List<BladeFlow> historyFlowList(String processInstanceId, String startActivityId, String endActivityId);
|
||||
|
||||
/**
|
||||
* 变更流程状态
|
||||
*
|
||||
* @param state 状态
|
||||
* @param processId 流程ID
|
||||
* @return
|
||||
*/
|
||||
String changeState(String state, String processId);
|
||||
|
||||
/**
|
||||
* 删除部署流程
|
||||
*
|
||||
* @param deploymentIds 部署流程id集合
|
||||
* @return
|
||||
*/
|
||||
boolean deleteDeployment(String deploymentIds);
|
||||
|
||||
/**
|
||||
* 上传部署流程
|
||||
*
|
||||
* @param files 流程配置文件
|
||||
* @param category 流程分类
|
||||
* @param tenantIdList 租户id集合
|
||||
* @return
|
||||
*/
|
||||
boolean deployUpload(List<MultipartFile> files, String category, List<String> tenantIdList);
|
||||
|
||||
/**
|
||||
* 部署流程
|
||||
*
|
||||
* @param modelId 模型id
|
||||
* @param category 分类
|
||||
* @param tenantIdList 租户id集合
|
||||
* @return
|
||||
*/
|
||||
boolean deployModel(String modelId, String category, List<String> tenantIdList);
|
||||
|
||||
/**
|
||||
* 删除流程实例
|
||||
*
|
||||
* @param processInstanceId 流程实例id
|
||||
* @param deleteReason 删除原因
|
||||
* @return
|
||||
*/
|
||||
boolean deleteProcessInstance(String processInstanceId, String deleteReason);
|
||||
|
||||
/**
|
||||
* 保存/更新模型
|
||||
*
|
||||
* @param model 模型
|
||||
* @return 模型
|
||||
*/
|
||||
FlowModel submitModel(FlowModel model);
|
||||
|
||||
/**
|
||||
* 流程节点进程图
|
||||
*
|
||||
* @param processDefinitionId
|
||||
* @param processInstanceId
|
||||
* @return
|
||||
*/
|
||||
Map<String, Object> modelView(String processDefinitionId, String processInstanceId);
|
||||
|
||||
/**
|
||||
* 流程节点进程图
|
||||
*
|
||||
* @param processInstanceId
|
||||
* @param httpServletResponse
|
||||
*/
|
||||
void diagramView(String processInstanceId, HttpServletResponse httpServletResponse);
|
||||
|
||||
/**
|
||||
* 流程图展示
|
||||
*
|
||||
* @param processDefinitionId
|
||||
* @param processInstanceId
|
||||
* @param resourceType
|
||||
* @param response
|
||||
*/
|
||||
void resourceView(String processDefinitionId, String processInstanceId, String resourceType, HttpServletResponse response);
|
||||
|
||||
/**
|
||||
* 获取XML
|
||||
*
|
||||
* @param model
|
||||
* @return
|
||||
*/
|
||||
byte[] getModelEditorXML(FlowModel model);
|
||||
}
|
||||
@@ -1,568 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.engine.service.impl;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.node.ObjectNode;
|
||||
import jakarta.servlet.http.HttpServletResponse;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
import org.flowable.bpmn.converter.BpmnXMLConverter;
|
||||
import org.flowable.bpmn.model.BpmnModel;
|
||||
import org.flowable.bpmn.model.Process;
|
||||
import org.flowable.common.engine.impl.util.IoUtil;
|
||||
import org.flowable.common.engine.impl.util.io.StringStreamSource;
|
||||
import org.flowable.editor.language.json.converter.BpmnJsonConverter;
|
||||
import org.flowable.editor.language.json.converter.BpmnJsonConverterContext;
|
||||
import org.flowable.editor.language.json.converter.CustomBpmnJsonConverterContext;
|
||||
import org.flowable.engine.*;
|
||||
import org.flowable.engine.history.HistoricActivityInstance;
|
||||
import org.flowable.engine.history.HistoricProcessInstance;
|
||||
import org.flowable.engine.impl.persistence.entity.ExecutionEntityImpl;
|
||||
import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityImpl;
|
||||
import org.flowable.engine.repository.Deployment;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.flowable.engine.repository.ProcessDefinitionQuery;
|
||||
import org.flowable.engine.runtime.ProcessInstance;
|
||||
import org.flowable.engine.runtime.ProcessInstanceQuery;
|
||||
import org.flowable.engine.task.Comment;
|
||||
import org.flowable.image.ProcessDiagramGenerator;
|
||||
import org.springblade.common.cache.UserCache;
|
||||
import org.springblade.core.log.exception.ServiceException;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.utils.DateUtil;
|
||||
import org.springblade.core.tool.utils.FileUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.core.tool.utils.StringUtil;
|
||||
import org.springblade.flow.core.entity.BladeFlow;
|
||||
import org.springblade.flow.core.enums.FlowModeEnum;
|
||||
import org.springblade.flow.core.utils.TaskUtil;
|
||||
import org.springblade.flow.engine.constant.FlowEngineConstant;
|
||||
import org.springblade.flow.engine.entity.FlowExecution;
|
||||
import org.springblade.flow.engine.entity.FlowModel;
|
||||
import org.springblade.flow.engine.entity.FlowProcess;
|
||||
import org.springblade.flow.engine.mapper.FlowMapper;
|
||||
import org.springblade.flow.engine.service.FlowEngineService;
|
||||
import org.springblade.flow.engine.utils.FlowCache;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
import org.springframework.stereotype.Service;
|
||||
import org.springframework.web.multipart.MultipartFile;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.io.InputStream;
|
||||
import java.io.OutputStream;
|
||||
import java.util.*;
|
||||
|
||||
/**
|
||||
* 工作流服务实现类
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Slf4j
|
||||
@Service
|
||||
@AllArgsConstructor
|
||||
public class FlowEngineServiceImpl extends ServiceImpl<FlowMapper, FlowModel> implements FlowEngineService {
|
||||
private static final String ALREADY_IN_STATE = "already in state";
|
||||
private static final String USR_TASK = "userTask";
|
||||
private static final String IMAGE_NAME = "image";
|
||||
private static final String XML_NAME = "xml";
|
||||
private static final Integer INT_1024 = 1024;
|
||||
private static final BpmnJsonConverter BPMN_JSON_CONVERTER = new BpmnJsonConverter();
|
||||
private static final BpmnXMLConverter BPMN_XML_CONVERTER = new BpmnXMLConverter();
|
||||
private final ObjectMapper objectMapper;
|
||||
private final RepositoryService repositoryService;
|
||||
private final RuntimeService runtimeService;
|
||||
private final HistoryService historyService;
|
||||
private final TaskService taskService;
|
||||
private final ProcessEngine processEngine;
|
||||
|
||||
@Override
|
||||
public IPage<FlowModel> selectFlowPage(IPage<FlowModel> page, FlowModel flowModel) {
|
||||
return page.setRecords(baseMapper.selectFlowPage(page, flowModel));
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<FlowProcess> selectProcessPage(IPage<FlowProcess> page, String category, Integer mode) {
|
||||
ProcessDefinitionQuery processDefinitionQuery = repositoryService.createProcessDefinitionQuery().latestVersion().orderByProcessDefinitionKey().asc();
|
||||
// 通用流程
|
||||
if (mode == FlowModeEnum.COMMON.getMode()) {
|
||||
processDefinitionQuery.processDefinitionWithoutTenantId();
|
||||
}
|
||||
// 定制流程
|
||||
else if (!AuthUtil.isAdministrator()) {
|
||||
processDefinitionQuery.processDefinitionTenantId(AuthUtil.getTenantId());
|
||||
}
|
||||
if (StringUtils.isNotEmpty(category)) {
|
||||
processDefinitionQuery.processDefinitionCategory(category);
|
||||
}
|
||||
List<ProcessDefinition> processDefinitionList = processDefinitionQuery.listPage(Func.toInt((page.getCurrent() - 1) * page.getSize()), Func.toInt(page.getSize()));
|
||||
List<FlowProcess> flowProcessList = new ArrayList<>();
|
||||
processDefinitionList.forEach(processDefinition -> {
|
||||
String deploymentId = processDefinition.getDeploymentId();
|
||||
Deployment deployment = repositoryService.createDeploymentQuery().deploymentId(deploymentId).singleResult();
|
||||
FlowProcess flowProcess = new FlowProcess((ProcessDefinitionEntityImpl) processDefinition);
|
||||
flowProcess.setDeploymentTime(deployment.getDeploymentTime());
|
||||
flowProcessList.add(flowProcess);
|
||||
});
|
||||
page.setTotal(processDefinitionQuery.count());
|
||||
page.setRecords(flowProcessList);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IPage<FlowExecution> selectFollowPage(IPage<FlowExecution> page, String processInstanceId, String processDefinitionKey) {
|
||||
ProcessInstanceQuery processInstanceQuery = runtimeService.createProcessInstanceQuery();
|
||||
if (StringUtil.isNotBlank(processInstanceId)) {
|
||||
processInstanceQuery.processInstanceId(processInstanceId);
|
||||
}
|
||||
if (StringUtil.isNotBlank(processDefinitionKey)) {
|
||||
processInstanceQuery.processDefinitionKey(processDefinitionKey);
|
||||
}
|
||||
List<FlowExecution> flowList = new ArrayList<>();
|
||||
List<ProcessInstance> procInsList = processInstanceQuery.listPage(Func.toInt((page.getCurrent() - 1) * page.getSize()), Func.toInt(page.getSize()));
|
||||
procInsList.forEach(processInstance -> {
|
||||
ExecutionEntityImpl execution = (ExecutionEntityImpl) processInstance;
|
||||
FlowExecution flowExecution = new FlowExecution();
|
||||
flowExecution.setId(execution.getId());
|
||||
flowExecution.setName(execution.getName());
|
||||
flowExecution.setStartUserId(execution.getStartUserId());
|
||||
User taskUser = UserCache.getUserByTaskUser(execution.getStartUserId());
|
||||
if (taskUser != null) {
|
||||
flowExecution.setStartUser(taskUser.getName());
|
||||
}
|
||||
flowExecution.setStartTime(execution.getStartTime());
|
||||
flowExecution.setExecutionId(execution.getId());
|
||||
flowExecution.setProcessInstanceId(execution.getProcessInstanceId());
|
||||
flowExecution.setProcessDefinitionId(execution.getProcessDefinitionId());
|
||||
flowExecution.setProcessDefinitionKey(execution.getProcessDefinitionKey());
|
||||
flowExecution.setSuspensionState(execution.getSuspensionState());
|
||||
FlowProcess processDefinition = FlowCache.getProcessDefinition(execution.getProcessDefinitionId());
|
||||
flowExecution.setCategory(processDefinition.getCategory());
|
||||
flowExecution.setCategoryName(FlowCache.getCategoryName(processDefinition.getCategory()));
|
||||
flowList.add(flowExecution);
|
||||
});
|
||||
page.setTotal(processInstanceQuery.count());
|
||||
page.setRecords(flowList);
|
||||
return page;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<BladeFlow> historyFlowList(String processInstanceId, String startActivityId, String endActivityId) {
|
||||
List<BladeFlow> flowList = new LinkedList<>();
|
||||
List<HistoricActivityInstance> historicActivityInstanceList = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).orderByHistoricActivityInstanceStartTime().asc().orderByHistoricActivityInstanceEndTime().asc().list();
|
||||
boolean start = false;
|
||||
Map<String, Integer> activityMap = new HashMap<>(16);
|
||||
for (int i = 0; i < historicActivityInstanceList.size(); i++) {
|
||||
HistoricActivityInstance historicActivityInstance = historicActivityInstanceList.get(i);
|
||||
// 过滤开始节点前的节点
|
||||
if (StringUtil.isNotBlank(startActivityId) && startActivityId.equals(historicActivityInstance.getActivityId())) {
|
||||
start = true;
|
||||
}
|
||||
if (StringUtil.isNotBlank(startActivityId) && !start) {
|
||||
continue;
|
||||
}
|
||||
// 显示开始节点和结束节点,并且执行人不为空的任务
|
||||
if (StringUtils.equals(USR_TASK, historicActivityInstance.getActivityType())
|
||||
|| FlowEngineConstant.START_EVENT.equals(historicActivityInstance.getActivityType())
|
||||
|| FlowEngineConstant.END_EVENT.equals(historicActivityInstance.getActivityType())) {
|
||||
// 给节点增加序号
|
||||
activityMap.computeIfAbsent(historicActivityInstance.getActivityId(), k -> activityMap.size());
|
||||
BladeFlow flow = new BladeFlow();
|
||||
flow.setHistoryActivityId(historicActivityInstance.getActivityId());
|
||||
flow.setHistoryActivityName(historicActivityInstance.getActivityName());
|
||||
flow.setCreateTime(historicActivityInstance.getStartTime());
|
||||
flow.setEndTime(historicActivityInstance.getEndTime());
|
||||
String durationTime = DateUtil.secondToTime(Func.toLong(historicActivityInstance.getDurationInMillis(), 0L) / 1000);
|
||||
flow.setHistoryActivityDurationTime(durationTime);
|
||||
// 获取流程发起人名称
|
||||
if (FlowEngineConstant.START_EVENT.equals(historicActivityInstance.getActivityType())) {
|
||||
List<HistoricProcessInstance> processInstanceList = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).orderByProcessInstanceStartTime().asc().list();
|
||||
if (!processInstanceList.isEmpty()) {
|
||||
if (StringUtil.isNotBlank(processInstanceList.get(0).getStartUserId())) {
|
||||
String taskUser = processInstanceList.get(0).getStartUserId();
|
||||
User user = UserCache.getUser(TaskUtil.getUserId(taskUser));
|
||||
if (user != null) {
|
||||
flow.setAssignee(historicActivityInstance.getAssignee());
|
||||
flow.setAssigneeName(user.getName());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
// 获取任务执行人名称
|
||||
if (StringUtil.isNotBlank(historicActivityInstance.getAssignee())) {
|
||||
User user = UserCache.getUser(TaskUtil.getUserId(historicActivityInstance.getAssignee()));
|
||||
if (user != null) {
|
||||
flow.setAssignee(historicActivityInstance.getAssignee());
|
||||
flow.setAssigneeName(user.getName());
|
||||
}
|
||||
}
|
||||
// 获取意见评论内容
|
||||
if (StringUtil.isNotBlank(historicActivityInstance.getTaskId())) {
|
||||
List<Comment> commentList = taskService.getTaskComments(historicActivityInstance.getTaskId());
|
||||
if (!commentList.isEmpty()) {
|
||||
flow.setComment(commentList.get(0).getFullMessage());
|
||||
}
|
||||
}
|
||||
flowList.add(flow);
|
||||
}
|
||||
// 过滤结束节点后的节点
|
||||
if (StringUtils.isNotBlank(endActivityId) && endActivityId.equals(historicActivityInstance.getActivityId())) {
|
||||
boolean temp = false;
|
||||
Integer activityNum = activityMap.get(historicActivityInstance.getActivityId());
|
||||
// 该活动节点,后续节点是否在结束节点之前,在后续节点中是否存在
|
||||
for (int j = i + 1; j < historicActivityInstanceList.size(); j++) {
|
||||
HistoricActivityInstance hi = historicActivityInstanceList.get(j);
|
||||
Integer activityNumA = activityMap.get(hi.getActivityId());
|
||||
boolean numberTemp = activityNumA != null && activityNumA < activityNum;
|
||||
boolean equalsTemp = StringUtils.equals(hi.getActivityId(), historicActivityInstance.getActivityId());
|
||||
if (numberTemp || equalsTemp) {
|
||||
temp = true;
|
||||
}
|
||||
}
|
||||
if (!temp) {
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
return flowList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String changeState(String state, String processId) {
|
||||
try {
|
||||
if (state.equals(FlowEngineConstant.ACTIVE)) {
|
||||
repositoryService.activateProcessDefinitionById(processId, true, null);
|
||||
return StringUtil.format("激活ID为 [{}] 的流程成功", processId);
|
||||
} else if (state.equals(FlowEngineConstant.SUSPEND)) {
|
||||
repositoryService.suspendProcessDefinitionById(processId, true, null);
|
||||
return StringUtil.format("挂起ID为 [{}] 的流程成功", processId);
|
||||
} else {
|
||||
return "暂无流程变更";
|
||||
}
|
||||
} catch (Exception e) {
|
||||
if (e.getMessage().contains(ALREADY_IN_STATE)) {
|
||||
return StringUtil.format("ID为 [{}] 的流程已是此状态,无需操作", processId);
|
||||
}
|
||||
return e.getMessage();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteDeployment(String deploymentIds) {
|
||||
Func.toStrList(deploymentIds).forEach(deploymentId -> repositoryService.deleteDeployment(deploymentId, true));
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deployUpload(List<MultipartFile> files, String category, List<String> tenantIdList) {
|
||||
files.forEach(file -> {
|
||||
try {
|
||||
String fileName = file.getOriginalFilename();
|
||||
InputStream fileInputStream = file.getInputStream();
|
||||
byte[] bytes = FileUtil.copyToByteArray(fileInputStream);
|
||||
if (Func.isNotEmpty(tenantIdList)) {
|
||||
tenantIdList.forEach(tenantId -> {
|
||||
Deployment deployment = repositoryService.createDeployment().addBytes(fileName, bytes).tenantId(tenantId).deploy();
|
||||
deploy(deployment, category);
|
||||
});
|
||||
} else {
|
||||
Deployment deployment = repositoryService.createDeployment().addBytes(fileName, bytes).deploy();
|
||||
deploy(deployment, category);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
});
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deployModel(String modelId, String category, List<String> tenantIdList) {
|
||||
FlowModel model = this.getById(modelId);
|
||||
if (model == null) {
|
||||
throw new ServiceException("未找到模型 id: " + modelId);
|
||||
}
|
||||
byte[] bytes = getBpmnXML(model);
|
||||
String processName = model.getName();
|
||||
if (!StringUtil.endsWithIgnoreCase(processName, FlowEngineConstant.SUFFIX)) {
|
||||
processName += FlowEngineConstant.SUFFIX;
|
||||
}
|
||||
String finalProcessName = processName;
|
||||
if (Func.isNotEmpty(tenantIdList)) {
|
||||
tenantIdList.forEach(tenantId -> {
|
||||
Deployment deployment = repositoryService.createDeployment().addBytes(finalProcessName, bytes).name(model.getName()).key(model.getModelKey()).tenantId(tenantId).deploy();
|
||||
deploy(deployment, category);
|
||||
});
|
||||
} else {
|
||||
Deployment deployment = repositoryService.createDeployment().addBytes(finalProcessName, bytes).name(model.getName()).key(model.getModelKey()).deploy();
|
||||
deploy(deployment, category);
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean deleteProcessInstance(String processInstanceId, String deleteReason) {
|
||||
runtimeService.deleteProcessInstance(processInstanceId, deleteReason);
|
||||
return true;
|
||||
}
|
||||
|
||||
private void deploy(Deployment deployment, String category) {
|
||||
log.debug("流程部署--------deploy: " + deployment + " 分类---------->" + category);
|
||||
List<ProcessDefinition> list = repositoryService.createProcessDefinitionQuery().deploymentId(deployment.getId()).list();
|
||||
StringBuilder logBuilder = new StringBuilder(500);
|
||||
List<Object> logArgs = new ArrayList<>();
|
||||
// 设置流程分类
|
||||
for (ProcessDefinition processDefinition : list) {
|
||||
if (StringUtil.isNotBlank(category)) {
|
||||
repositoryService.setProcessDefinitionCategory(processDefinition.getId(), category);
|
||||
}
|
||||
logBuilder.append("部署成功,流程ID={} \n");
|
||||
logArgs.add(processDefinition.getId());
|
||||
}
|
||||
if (list.isEmpty()) {
|
||||
throw new ServiceException("部署失败,未找到流程");
|
||||
} else {
|
||||
log.info(logBuilder.toString(), logArgs.toArray());
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public FlowModel submitModel(FlowModel model) {
|
||||
FlowModel flowModel = new FlowModel();
|
||||
flowModel.setId(model.getId());
|
||||
flowModel.setVersion(Func.toInt(model.getVersion(), 0) + 1);
|
||||
flowModel.setName(model.getName());
|
||||
flowModel.setModelKey(model.getModelKey());
|
||||
flowModel.setModelType(FlowModel.MODEL_TYPE_BPMN);
|
||||
flowModel.setCreatedBy(TaskUtil.getTaskUser());
|
||||
flowModel.setDescription(model.getDescription());
|
||||
flowModel.setLastUpdated(Calendar.getInstance().getTime());
|
||||
flowModel.setLastUpdatedBy(TaskUtil.getTaskUser());
|
||||
flowModel.setTenantId(AuthUtil.getTenantId());
|
||||
flowModel.setModelEditorXml(model.getModelEditorXml());
|
||||
if (StringUtil.isBlank(model.getId())) {
|
||||
flowModel.setCreated(Calendar.getInstance().getTime());
|
||||
}
|
||||
if (StringUtil.isNotBlank(model.getModelEditorXml())) {
|
||||
flowModel.setModelEditorJson(getBpmnJson(model.getModelEditorXml()));
|
||||
}
|
||||
this.saveOrUpdate(flowModel);
|
||||
return flowModel;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> modelView(String processDefinitionId, String processInstanceId) {
|
||||
Map<String, Object> result = new HashMap<>();
|
||||
// 节点标记
|
||||
if (StringUtil.isNotBlank(processInstanceId)) {
|
||||
result.put("flow", this.historyFlowList(processInstanceId, null, null));
|
||||
HistoricProcessInstance processInstance = historyService.createHistoricProcessInstanceQuery()
|
||||
.processInstanceId(processInstanceId)
|
||||
.singleResult();
|
||||
processDefinitionId = processInstance.getProcessDefinitionId();
|
||||
}
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
|
||||
// 流程图展示
|
||||
result.put("xml", new String(new BpmnXMLConverter().convertToXML(bpmnModel)));
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void diagramView(String processInstanceId, HttpServletResponse httpServletResponse) {
|
||||
// 获得当前活动的节点
|
||||
String processDefinitionId;
|
||||
// 如果流程已经结束,则得到结束节点
|
||||
if (this.isFinished(processInstanceId)) {
|
||||
HistoricProcessInstance pi = historyService.createHistoricProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
processDefinitionId = pi.getProcessDefinitionId();
|
||||
} else {
|
||||
// 如果流程没有结束,则取当前活动节点
|
||||
// 根据流程实例ID获得当前处于活动状态的ActivityId合集
|
||||
ProcessInstance pi = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
processDefinitionId = pi.getProcessDefinitionId();
|
||||
}
|
||||
List<String> highLightedActivities = new ArrayList<>();
|
||||
|
||||
// 获得活动的节点
|
||||
List<HistoricActivityInstance> highLightedActivityList = historyService.createHistoricActivityInstanceQuery().processInstanceId(processInstanceId).orderByHistoricActivityInstanceStartTime().asc().list();
|
||||
|
||||
for (HistoricActivityInstance tempActivity : highLightedActivityList) {
|
||||
String activityId = tempActivity.getActivityId();
|
||||
highLightedActivities.add(activityId);
|
||||
}
|
||||
|
||||
List<String> flows = new ArrayList<>();
|
||||
// 获取流程图
|
||||
BpmnModel bpmnModel = repositoryService.getBpmnModel(processDefinitionId);
|
||||
ProcessEngineConfiguration engConf = processEngine.getProcessEngineConfiguration();
|
||||
|
||||
ProcessDiagramGenerator diagramGenerator = engConf.getProcessDiagramGenerator();
|
||||
InputStream in = diagramGenerator.generateDiagram(bpmnModel, "bmp", highLightedActivities, flows, engConf.getActivityFontName(),
|
||||
engConf.getLabelFontName(), engConf.getAnnotationFontName(), engConf.getClassLoader(), 1.0, true);
|
||||
OutputStream out = null;
|
||||
byte[] buf = new byte[1024];
|
||||
int length;
|
||||
try {
|
||||
out = httpServletResponse.getOutputStream();
|
||||
while ((length = in.read(buf)) != -1) {
|
||||
out.write(buf, 0, length);
|
||||
}
|
||||
} catch (IOException e) {
|
||||
log.error("操作异常", e);
|
||||
} finally {
|
||||
IoUtil.closeSilently(out);
|
||||
IoUtil.closeSilently(in);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void resourceView(String processDefinitionId, String processInstanceId, String resourceType, HttpServletResponse response) {
|
||||
if (StringUtil.isAllBlank(processDefinitionId, processInstanceId)) {
|
||||
return;
|
||||
}
|
||||
if (StringUtil.isBlank(processDefinitionId)) {
|
||||
ProcessInstance processInstance = runtimeService.createProcessInstanceQuery().processInstanceId(processInstanceId).singleResult();
|
||||
processDefinitionId = processInstance.getProcessDefinitionId();
|
||||
}
|
||||
ProcessDefinition processDefinition = repositoryService.createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
|
||||
String resourceName = "";
|
||||
if (resourceType.equals(IMAGE_NAME)) {
|
||||
resourceName = processDefinition.getDiagramResourceName();
|
||||
} else if (resourceType.equals(XML_NAME)) {
|
||||
resourceName = processDefinition.getResourceName();
|
||||
}
|
||||
try {
|
||||
InputStream resourceAsStream = repositoryService.getResourceAsStream(processDefinition.getDeploymentId(), resourceName);
|
||||
byte[] b = new byte[1024];
|
||||
int len;
|
||||
while ((len = resourceAsStream.read(b, 0, INT_1024)) != -1) {
|
||||
response.getOutputStream().write(b, 0, len);
|
||||
}
|
||||
} catch (Exception exception) {
|
||||
exception.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public byte[] getModelEditorXML(FlowModel model) {
|
||||
return getBpmnXML(model);
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否已完结
|
||||
*
|
||||
* @param processInstanceId 流程实例id
|
||||
* @return bool
|
||||
*/
|
||||
private boolean isFinished(String processInstanceId) {
|
||||
return historyService.createHistoricProcessInstanceQuery().finished()
|
||||
.processInstanceId(processInstanceId).count() > 0;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* xml转bpmn json
|
||||
*
|
||||
* @param xml xml
|
||||
* @return json
|
||||
*/
|
||||
private String getBpmnJson(String xml) {
|
||||
return BPMN_JSON_CONVERTER.convertToJson(getBpmnModel(xml)).toString();
|
||||
}
|
||||
|
||||
/**
|
||||
* xml转bpmnModel
|
||||
*
|
||||
* @param xml xml
|
||||
* @return bpmnModel
|
||||
*/
|
||||
private BpmnModel getBpmnModel(String xml) {
|
||||
return BPMN_XML_CONVERTER.convertToBpmnModel(new StringStreamSource(xml), false, false);
|
||||
}
|
||||
|
||||
private byte[] getBpmnXML(FlowModel model) {
|
||||
BpmnModel bpmnModel = getBpmnModel(model);
|
||||
return getBpmnXML(bpmnModel);
|
||||
}
|
||||
|
||||
private byte[] getBpmnXML(BpmnModel bpmnModel) {
|
||||
for (Process process : bpmnModel.getProcesses()) {
|
||||
if (StringUtils.isNotEmpty(process.getId())) {
|
||||
char firstCharacter = process.getId().charAt(0);
|
||||
if (Character.isDigit(firstCharacter)) {
|
||||
process.setId("a" + process.getId());
|
||||
}
|
||||
}
|
||||
}
|
||||
return BPMN_XML_CONVERTER.convertToXML(bpmnModel);
|
||||
}
|
||||
|
||||
private BpmnModel getBpmnModel(FlowModel model) {
|
||||
BpmnModel bpmnModel;
|
||||
try {
|
||||
Map<String, FlowModel> formMap = new HashMap<>(16);
|
||||
Map<String, FlowModel> decisionTableMap = new HashMap<>(16);
|
||||
|
||||
List<FlowModel> referencedModels = baseMapper.findByParentModelId(model.getId());
|
||||
for (FlowModel childModel : referencedModels) {
|
||||
if (FlowModel.MODEL_TYPE_FORM == childModel.getModelType()) {
|
||||
formMap.put(childModel.getId(), childModel);
|
||||
|
||||
} else if (FlowModel.MODEL_TYPE_DECISION_TABLE == childModel.getModelType()) {
|
||||
decisionTableMap.put(childModel.getId(), childModel);
|
||||
}
|
||||
}
|
||||
bpmnModel = getBpmnModel(model, formMap, decisionTableMap);
|
||||
} catch (Exception e) {
|
||||
log.error("Could not generate BPMN 2.0 model for {}", model.getId(), e);
|
||||
throw new ServiceException("Could not generate BPMN 2.0 model");
|
||||
}
|
||||
return bpmnModel;
|
||||
}
|
||||
|
||||
private BpmnModel getBpmnModel(FlowModel model, Map<String, FlowModel> formMap, Map<String, FlowModel> decisionTableMap) {
|
||||
try {
|
||||
ObjectNode editorJsonNode = (ObjectNode) objectMapper.readTree(model.getModelEditorJson());
|
||||
Map<String, String> formKeyMap = new HashMap<>(16);
|
||||
for (FlowModel formModel : formMap.values()) {
|
||||
formKeyMap.put(formModel.getId(), formModel.getModelKey());
|
||||
}
|
||||
Map<String, String> decisionTableKeyMap = new HashMap<>(16);
|
||||
for (FlowModel decisionTableModel : decisionTableMap.values()) {
|
||||
decisionTableKeyMap.put(decisionTableModel.getId(), decisionTableModel.getModelKey());
|
||||
}
|
||||
BpmnJsonConverterContext converterContext = new CustomBpmnJsonConverterContext(formKeyMap, decisionTableKeyMap);
|
||||
return BPMN_JSON_CONVERTER.convertToBpmnModel(editorJsonNode, converterContext);
|
||||
} catch (Exception e) {
|
||||
log.error("Could not generate BPMN 2.0 model for {}", model.getId(), e);
|
||||
throw new ServiceException("Could not generate BPMN 2.0 model");
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
/**
|
||||
* BladeX Commercial License Agreement
|
||||
* Copyright (c) 2018-2099, https://bladex.cn. All rights reserved.
|
||||
* <p>
|
||||
* Use of this software is governed by the Commercial License Agreement
|
||||
* obtained after purchasing a license from BladeX.
|
||||
* <p>
|
||||
* 1. This software is for development use only under a valid license
|
||||
* from BladeX.
|
||||
* <p>
|
||||
* 2. Redistribution of this software's source code to any third party
|
||||
* without a commercial license is strictly prohibited.
|
||||
* <p>
|
||||
* 3. Licensees may copyright their own code but cannot use segments
|
||||
* from this software for such purposes. Copyright of this software
|
||||
* remains with BladeX.
|
||||
* <p>
|
||||
* Using this software signifies agreement to this License, and the software
|
||||
* must not be used for illegal purposes.
|
||||
* <p>
|
||||
* THIS SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY. The author is
|
||||
* not liable for any claims arising from secondary or illegal development.
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.engine.utils;
|
||||
|
||||
import org.flowable.engine.RepositoryService;
|
||||
import org.flowable.engine.impl.persistence.entity.ProcessDefinitionEntityImpl;
|
||||
import org.flowable.engine.repository.ProcessDefinition;
|
||||
import org.springblade.common.cache.DictCache;
|
||||
import org.springblade.core.cache.utils.CacheUtil;
|
||||
import org.springblade.core.tool.utils.BeanUtil;
|
||||
import org.springblade.core.tool.utils.Func;
|
||||
import org.springblade.core.tool.utils.SpringUtil;
|
||||
import org.springblade.core.tool.utils.StringPool;
|
||||
import org.springblade.flow.engine.entity.FlowProcess;
|
||||
|
||||
/**
|
||||
* 流程缓存
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
public class FlowCache {
|
||||
|
||||
private static final String FLOW_CACHE = "flow:process";
|
||||
private static final String FLOW_DEFINITION_ID = "definition:id";
|
||||
private static RepositoryService repositoryService;
|
||||
|
||||
private static RepositoryService getRepositoryService() {
|
||||
if (repositoryService == null) {
|
||||
repositoryService = SpringUtil.getBean(RepositoryService.class);
|
||||
}
|
||||
return repositoryService;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获得流程定义对象
|
||||
*
|
||||
* @param processDefinitionId 流程对象id
|
||||
* @return
|
||||
*/
|
||||
public static FlowProcess getProcessDefinition(String processDefinitionId) {
|
||||
return CacheUtil.get(FLOW_CACHE, FLOW_DEFINITION_ID, processDefinitionId, () -> {
|
||||
ProcessDefinition processDefinition = getRepositoryService().createProcessDefinitionQuery().processDefinitionId(processDefinitionId).singleResult();
|
||||
ProcessDefinitionEntityImpl processDefinitionEntity = BeanUtil.copyProperties(processDefinition, ProcessDefinitionEntityImpl.class);
|
||||
return new FlowProcess(processDefinitionEntity);
|
||||
});
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取流程类型名
|
||||
*
|
||||
* @param category 流程类型
|
||||
* @return
|
||||
*/
|
||||
public static String getCategoryName(String category) {
|
||||
if (Func.isEmpty(category)) {
|
||||
return StringPool.EMPTY;
|
||||
}
|
||||
String[] categoryArr = category.split(StringPool.UNDERSCORE);
|
||||
if (categoryArr.length <= 1) {
|
||||
return StringPool.EMPTY;
|
||||
} else {
|
||||
return DictCache.getValue(category.split(StringPool.UNDERSCORE)[0], Func.toInt(category.split(StringPool.UNDERSCORE)[1]));
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
package org.springblade.job.processor;
|
||||
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.modules.market.eums.MarketBusinessModule;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPointEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPointLogEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketPackageDailySettlementEntity;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPackageService;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPointLogService;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPointService;
|
||||
import org.springblade.modules.market.service.IMarketPackageDailySettlementService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import tech.powerjob.worker.core.processor.ProcessResult;
|
||||
import tech.powerjob.worker.core.processor.TaskContext;
|
||||
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
|
||||
import tech.powerjob.worker.log.OmsLogger;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
|
||||
/**
|
||||
* 福利包每日发放福利积分到用户
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class BenefitPackageSendPointProcessor implements BasicProcessor {
|
||||
|
||||
private final IMarketBenefitPackageService userBenefitPackageService;
|
||||
private final IMarketPackageDailySettlementService userPackageDailySettlementService;
|
||||
private final IMarketBenefitPointService benefitPointService;
|
||||
private final IMarketBenefitPointLogService benefitPointLogService;
|
||||
|
||||
@Override
|
||||
public ProcessResult process(TaskContext context) {
|
||||
|
||||
OmsLogger omsLogger = context.getOmsLogger();
|
||||
try {
|
||||
omsLogger.info("开始执行定时任务-发放福利积分");
|
||||
benefitPackageSendPoint();
|
||||
omsLogger.info("结束执行定时任务-发放福利积分");
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("任务执行异常", e);
|
||||
omsLogger.error("任务执行异常: {}", e.getMessage());
|
||||
return new ProcessResult(false, "系统异常: " + e.getMessage());
|
||||
}
|
||||
|
||||
// 返回结果,该结果会被持久化到数据库,在前端页面直接查看,极为方便
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
|
||||
public void benefitPackageSendPoint() {
|
||||
// 1. 查询待处理的结算任务
|
||||
List<MarketPackageDailySettlementEntity> settlementEntityList = userPackageDailySettlementService.list(
|
||||
Wrappers.lambdaQuery(MarketPackageDailySettlementEntity.class)
|
||||
.eq(MarketPackageDailySettlementEntity::getStatisticalDate, DateUtil.getToday())
|
||||
.eq(MarketPackageDailySettlementEntity::getIsComplete, 0)
|
||||
);
|
||||
|
||||
if (settlementEntityList.isEmpty()) {
|
||||
return; // 提前退出,避免无谓查询
|
||||
}
|
||||
|
||||
// 2. 查询所有状态为“进行中”的福利包
|
||||
List<MarketBenefitPackageEntity> userBenefitPackageList = userBenefitPackageService.list(
|
||||
Wrappers.lambdaQuery(MarketBenefitPackageEntity.class)
|
||||
.eq(MarketBenefitPackageEntity::getStatus, 2)
|
||||
);
|
||||
|
||||
// 3. 按用户分组(注意:这里创建的是新 List,但后续仍需包装)
|
||||
Map<Long, List<MarketBenefitPackageEntity>> benefitPackageMap = userBenefitPackageList.stream()
|
||||
.collect(Collectors.groupingBy(MarketBenefitPackageEntity::getUserId));
|
||||
|
||||
// 4. 处理每个结算任务
|
||||
for (MarketPackageDailySettlementEntity settlementEntity : settlementEntityList) {
|
||||
Long userId = settlementEntity.getUserId();
|
||||
List<MarketBenefitPackageEntity> originalList = benefitPackageMap.get(userId);
|
||||
|
||||
if (originalList.isEmpty()) {
|
||||
continue;
|
||||
}
|
||||
|
||||
// 关键:创建可变副本,避免不可变列表问题
|
||||
List<MarketBenefitPackageEntity> benefitPackageList = new ArrayList<>(originalList);
|
||||
|
||||
// 获取用户积分账户
|
||||
MarketBenefitPointEntity benefitPoint = benefitPointService.getById(userId);
|
||||
if (benefitPoint == null) {
|
||||
log.warn("用户积分账户不存在,userId: {}", userId);
|
||||
continue;
|
||||
}
|
||||
|
||||
BigDecimal lastAmount = benefitPoint.getAmount();
|
||||
List<MarketBenefitPointLogEntity> pointLogList = new ArrayList<>();
|
||||
|
||||
// 处理每个福利包
|
||||
for (MarketBenefitPackageEntity pkg : benefitPackageList) {
|
||||
BigDecimal amountOut = pkg.getAmountOut();
|
||||
BigDecimal amountTotal = pkg.getAmountTotal();
|
||||
BigDecimal amountDay = pkg.getAmountDay();
|
||||
|
||||
// 修正:防止超额发放
|
||||
BigDecimal newAmountOut = amountOut.add(amountDay);
|
||||
if (newAmountOut.compareTo(amountTotal) > 0) {
|
||||
amountDay = amountTotal.subtract(amountOut); // 只发剩余部分
|
||||
newAmountOut = amountTotal;
|
||||
pkg.setStatus(3); // 完成
|
||||
}
|
||||
|
||||
// 处理天数
|
||||
int outDay = pkg.getOutDay() + 1;
|
||||
if (outDay >= pkg.getDayTotal()) {
|
||||
outDay = pkg.getDayTotal();
|
||||
pkg.setStatus(3); // 完成
|
||||
}
|
||||
|
||||
// 记录日志
|
||||
pointLogList.add(new MarketBenefitPointLogEntity()
|
||||
.setUserId(userId)
|
||||
.setAmount(amountDay)
|
||||
.setLastAmount(lastAmount)
|
||||
.setFee(BigDecimal.ZERO)
|
||||
.setSourceType(MarketBusinessModule.BENEFIT_PACKAGE.getCode())
|
||||
.setSourceId(pkg.getId())
|
||||
.setSourceDetail(JSONObject.toJSONString(pkg))
|
||||
.setIsComplete(0)
|
||||
.setStatisticalDate(new Date())
|
||||
.setRemark(pkg.getPackageName() + "每日福利积分产出")
|
||||
);
|
||||
|
||||
lastAmount = lastAmount.add(amountDay);
|
||||
|
||||
// 更新福利包状态
|
||||
pkg.setAmountOut(newAmountOut);
|
||||
pkg.setOutDay(outDay);
|
||||
}
|
||||
|
||||
// 批量保存日志
|
||||
if (!pointLogList.isEmpty()) {
|
||||
if (!benefitPointLogService.saveBatch(pointLogList)) {
|
||||
log.error("福利积分记录失败-批量保存日志, userId: " + userId);
|
||||
throw new RuntimeException("福利积分记录失败, userId: " + userId);
|
||||
}
|
||||
|
||||
// 标记日志为完成
|
||||
pointLogList.forEach(log -> log.setIsComplete(1));
|
||||
benefitPointLogService.updateBatchById(pointLogList);
|
||||
|
||||
// 累加总发放积分
|
||||
BigDecimal sendPoint = pointLogList.stream()
|
||||
.map(MarketBenefitPointLogEntity::getAmount)
|
||||
.reduce(BigDecimal.ZERO, BigDecimal::add);
|
||||
|
||||
// 更新用户积分总额
|
||||
benefitPoint.setAmount(benefitPoint.getAmount().add(sendPoint));
|
||||
if (!benefitPointService.updateById(benefitPoint)) {
|
||||
log.error("更新用户积分失败-更新福利积分, userId: " + userId);
|
||||
throw new RuntimeException("更新用户积分失败, userId: " + userId);
|
||||
}
|
||||
|
||||
// 更新福利包(使用可变列表)
|
||||
if (!userBenefitPackageService.updateBatchById(benefitPackageList)) {
|
||||
log.error("更新福利包失败-更新福利包, userId: " + userId);
|
||||
throw new RuntimeException("更新福利包失败, userId: " + userId);
|
||||
}
|
||||
}
|
||||
|
||||
// 更新结算任务
|
||||
List<Long> packageIds = benefitPackageList.stream()
|
||||
.map(MarketBenefitPackageEntity::getId)
|
||||
.collect(Collectors.toList());
|
||||
|
||||
settlementEntity.setIsComplete(1);
|
||||
settlementEntity.setPackageId(packageIds);
|
||||
userPackageDailySettlementService.updateById(settlementEntity);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,94 @@
|
||||
package org.springblade.job.processor;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springblade.common.utils.date.DateUtil;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPackageEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketPackageDailySettlementEntity;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPackageService;
|
||||
import org.springblade.modules.market.service.IMarketPackageDailySettlementService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import tech.powerjob.worker.core.processor.ProcessResult;
|
||||
import tech.powerjob.worker.core.processor.TaskContext;
|
||||
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
|
||||
import tech.powerjob.worker.log.OmsLogger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
/**
|
||||
* 福利包每日发放结算记录
|
||||
*/
|
||||
@Slf4j
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class InitBenefitPackageSettlementProcessor implements BasicProcessor {
|
||||
|
||||
private final IMarketBenefitPackageService userBenefitPackageService;
|
||||
private final IMarketPackageDailySettlementService userPackageDailySettlementService;
|
||||
|
||||
@Override
|
||||
public ProcessResult process(TaskContext context) {
|
||||
|
||||
OmsLogger omsLogger = context.getOmsLogger(); // PowerJob 内置日志,控制台可查
|
||||
|
||||
try {
|
||||
omsLogger.info("开始执行定时任务-初始化用户福利包每天结算记录...");
|
||||
initUserPackageDailySettlement();
|
||||
omsLogger.info("结束执行定时任务-初始化用户福利包每天结算记录");
|
||||
|
||||
} catch (Exception e) {
|
||||
log.error("任务执行异常", e);
|
||||
omsLogger.error("任务执行异常: {}", e.getMessage());
|
||||
return new ProcessResult(false, "系统异常: " + e.getMessage());
|
||||
}
|
||||
|
||||
// 返回结果,该结果会被持久化到数据库,在前端页面直接查看,极为方便
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
public void initUserPackageDailySettlement() {
|
||||
|
||||
//用户福利包列表
|
||||
List<MarketBenefitPackageEntity> benefitPackageList = userBenefitPackageService.list(
|
||||
Wrappers.lambdaQuery(MarketBenefitPackageEntity.class)
|
||||
.eq(MarketBenefitPackageEntity::getStatus, 2)
|
||||
);
|
||||
|
||||
//用户福利包列表-map
|
||||
Map<Long, List<MarketBenefitPackageEntity>> benefitPackageMap = benefitPackageList.stream().collect(Collectors.groupingBy(MarketBenefitPackageEntity::getUserId));
|
||||
|
||||
//用户当天发放福利积分记录列表
|
||||
List<MarketPackageDailySettlementEntity> settlementEntityList = userPackageDailySettlementService.list(
|
||||
Wrappers.lambdaQuery(MarketPackageDailySettlementEntity.class)
|
||||
.eq(MarketPackageDailySettlementEntity::getStatisticalDate, DateUtil.getToday())
|
||||
);
|
||||
//用户当天发放福利积分记录列表-map
|
||||
Map<Long, List<MarketPackageDailySettlementEntity>> settlementEntityMap = settlementEntityList.stream().collect(Collectors.groupingBy(MarketPackageDailySettlementEntity::getUserId));
|
||||
|
||||
|
||||
List<MarketPackageDailySettlementEntity> userPackageSettlementList = new ArrayList<>();
|
||||
|
||||
benefitPackageMap.forEach((userId, packageList) -> {
|
||||
|
||||
if (!settlementEntityMap.containsKey(userId)){
|
||||
userPackageSettlementList.add(
|
||||
new MarketPackageDailySettlementEntity()
|
||||
.setUserId(userId)
|
||||
.setUserName(packageList.get(0).getUserName())
|
||||
.setAccount(packageList.get(0).getPhone())
|
||||
.setStatisticalDate(DateUtil.getToday())
|
||||
.setPackageId(List.of())
|
||||
.setIsComplete(0)
|
||||
);
|
||||
}
|
||||
});
|
||||
|
||||
userPackageDailySettlementService.saveBatch(userPackageSettlementList);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package org.springblade.job.processor;
|
||||
|
||||
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.modules.common.pojo.entity.CommonUserPointEntity;
|
||||
import org.springblade.modules.common.service.ICommonUserPointService;
|
||||
import org.springblade.modules.market.pojo.entity.MarketBenefitPointEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketCashCouponEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketInfoEntity;
|
||||
import org.springblade.modules.market.pojo.entity.MarketUserCommissionEntity;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPointService;
|
||||
import org.springblade.modules.market.service.IMarketCashCouponService;
|
||||
import org.springblade.modules.market.service.IMarketInfoService;
|
||||
import org.springblade.modules.market.service.IMarketUserCommissionService;
|
||||
import org.springblade.modules.system.pojo.entity.User;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springframework.stereotype.Component;
|
||||
import tech.powerjob.worker.core.processor.ProcessResult;
|
||||
import tech.powerjob.worker.core.processor.TaskContext;
|
||||
import tech.powerjob.worker.core.processor.sdk.BasicProcessor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Component
|
||||
@AllArgsConstructor
|
||||
public class InitUserAssetsProcessor implements BasicProcessor {
|
||||
|
||||
private final IUserService userService;
|
||||
|
||||
private final IMarketInfoService marketInfoService;
|
||||
|
||||
private final ICommonUserPointService userPointService;
|
||||
|
||||
private final IMarketCashCouponService cashCouponService;
|
||||
|
||||
private final IMarketBenefitPointService benefitPointService;
|
||||
|
||||
private final IMarketUserCommissionService commissionService;
|
||||
|
||||
|
||||
@Override
|
||||
public ProcessResult process(TaskContext taskContext) throws Exception {
|
||||
List<User> userList = userService.list(Wrappers.<User>lambdaQuery().eq(User::getUserType, 2).eq(User::getIsDeleted, 0));
|
||||
userList.forEach(user -> {
|
||||
MarketInfoEntity marketInfo = marketInfoService.getById(user.getId());
|
||||
if (marketInfo == null) {
|
||||
marketInfo = new MarketInfoEntity();
|
||||
marketInfo.setId(user.getId());
|
||||
marketInfoService.save(marketInfo);
|
||||
}
|
||||
CommonUserPointEntity userPoint = userPointService.getById(user.getId());
|
||||
if (userPoint == null) {
|
||||
userPoint = new CommonUserPointEntity();
|
||||
userPoint.setId(user.getId());
|
||||
userPointService.save(userPoint);
|
||||
}
|
||||
MarketCashCouponEntity cashCoupon = cashCouponService.getById(user.getId());
|
||||
if (cashCoupon == null) {
|
||||
cashCoupon = new MarketCashCouponEntity();
|
||||
cashCoupon.setId(user.getId());
|
||||
cashCouponService.save(cashCoupon);
|
||||
}
|
||||
MarketBenefitPointEntity benefitPoint = benefitPointService.getById(user.getId());
|
||||
if (benefitPoint == null) {
|
||||
benefitPoint = new MarketBenefitPointEntity();
|
||||
benefitPoint.setId(user.getId());
|
||||
benefitPointService.save(benefitPoint);
|
||||
}
|
||||
MarketUserCommissionEntity commission = commissionService.getById(user.getId());
|
||||
if (commission == null) {
|
||||
commission = new MarketUserCommissionEntity();
|
||||
commission.setId(user.getId());
|
||||
commissionService.save(commission);
|
||||
}
|
||||
});
|
||||
return new ProcessResult(true, "result is success");
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,52 @@
|
||||
package org.springblade.modules.api.app;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.constraints.Max;
|
||||
import jakarta.validation.constraints.Min;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.common.pojo.vo.AppCommonRegionsInfoVO;
|
||||
import org.springblade.modules.common.service.ICommonRegionsInfoService;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-common")
|
||||
@Tag(name = "APP基础接口", description = "APP基础接口")
|
||||
public class APPCommonController {
|
||||
|
||||
private final IUserService userService;
|
||||
private final ICommonRegionsInfoService commonRegionsInfoService;
|
||||
|
||||
|
||||
/**
|
||||
* 最新版本
|
||||
*/
|
||||
@GetMapping("/latest-version")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "最新版本")
|
||||
public R<Boolean> hasChangedPassword() {
|
||||
return R.data(userService.hasChangedPassword());
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取省市区列表
|
||||
*/
|
||||
@GetMapping("/region-list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "获取省市区列表")
|
||||
public R<List<AppCommonRegionsInfoVO>> findRegionList(@RequestParam @Min(value = 0 , message = "请选择有效地区") Long pid ,
|
||||
@RequestParam @Min(value = 1 , message = "请选择省、市、区或街道") @Max(value = 4 , message = "请选择省、市、区或街道") Integer level) {
|
||||
return R.data(commonRegionsInfoService.findRegionList(pid , level));
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
package org.springblade.modules.api.app;
|
||||
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.vo.MallCategoryApiVO;
|
||||
import org.springblade.modules.api.vo.MallProductApiVO;
|
||||
import org.springblade.modules.api.vo.MallProductDetailApiVO;
|
||||
import org.springblade.modules.mall.convert.AppMallConvert;
|
||||
import org.springblade.modules.mall.pojo.entity.MallCategoryEntity;
|
||||
import org.springblade.modules.mall.service.IMallCategoryService;
|
||||
import org.springblade.modules.mall.service.IMallProductService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-mall")
|
||||
@Tag(name = "APP用户接口", description = "APP用户接口")
|
||||
public class APPMallController {
|
||||
|
||||
private final IMallProductService productService;
|
||||
|
||||
private final IMallCategoryService categoryService;
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
@GetMapping("/categories")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "列表")
|
||||
public R<List<MallCategoryApiVO>> categories() {
|
||||
List<MallCategoryEntity> list = categoryService.list();
|
||||
return R.data(AppMallConvert.INSTANCE.convertMallCategoryApiListVO(list));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品列表
|
||||
*/
|
||||
@GetMapping("/list")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "列表")
|
||||
public R<List<MallProductApiVO>> list(@RequestParam(required = false) Long categoryId) {
|
||||
return R.data(productService.apiVoList(categoryId));
|
||||
}
|
||||
|
||||
/**
|
||||
* 商品详情
|
||||
*/
|
||||
@GetMapping("/detail")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "详情", description = "传入vo")
|
||||
public R<MallProductDetailApiVO> detail(@Valid MallProductDetailApiVO vo) {
|
||||
return R.data(productService.apiDetailVO(vo.getId()));
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,217 @@
|
||||
package org.springblade.modules.api.app;
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import jakarta.validation.Valid;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.request.*;
|
||||
import org.springblade.modules.api.response.CreateOrderResponse;
|
||||
import org.springblade.modules.api.response.PaymentResponse;
|
||||
import org.springblade.modules.api.vo.*;
|
||||
import org.springblade.modules.common.service.*;
|
||||
import org.springblade.modules.system.service.IUserService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/app-user")
|
||||
@Tag(name = "APP用户接口", description = "APP用户接口")
|
||||
public class APPUserController {
|
||||
|
||||
private final IUserService userService;
|
||||
|
||||
private final ICommonUserOrderService orderService;
|
||||
|
||||
private final ICommonUserNoticeService userNoticeService;
|
||||
|
||||
private final ICommonUserAddressService addressService;
|
||||
|
||||
private final ICommonUserPointService pointService;
|
||||
|
||||
private final ICommonLotteryRecordService lotteryRecordService;
|
||||
|
||||
private final ICommonLotteryPrizeService lotteryPrizeService;
|
||||
|
||||
|
||||
/**
|
||||
* 是否修改过密码
|
||||
*/
|
||||
@GetMapping("/has-changed")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "是否修改过密码")
|
||||
public R<Boolean> hasChangedPassword() {
|
||||
return R.data(userService.hasChangedPassword());
|
||||
}
|
||||
|
||||
/**
|
||||
* 修改登录密码
|
||||
*/
|
||||
@PostMapping("/change-password")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "修改登录密码", description = "传入String")
|
||||
public R changePassword(@RequestBody String password) {
|
||||
return R.status(userService.changePassword(password));
|
||||
}
|
||||
|
||||
/**
|
||||
* 邀请码
|
||||
*/
|
||||
@GetMapping("/invite-code")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "是否修改过密码")
|
||||
public R<String> inviteCode() {
|
||||
return R.data(userService.inviteCode());
|
||||
}
|
||||
|
||||
/**
|
||||
* 下单
|
||||
*/
|
||||
@PostMapping("/create-order")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "下单", description = "传入CreateOrderRequest")
|
||||
public R<CreateOrderResponse> createOrder(@Valid @RequestBody CreateOrderRequest request) {
|
||||
return R.data(orderService.createOrder(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 支付
|
||||
*/
|
||||
@PostMapping("/pay")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "支付", description = "传入PaymentRequest")
|
||||
public R<PaymentResponse> pay(@Valid @RequestBody PaymentRequest request) {
|
||||
return R.data(orderService.pay(request));
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户订单列表
|
||||
*/
|
||||
@GetMapping("/order-page")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "用户订单分页列表", description = "传入userAddress")
|
||||
public R<IPage<CommonUserOrderApiVO>> orderList(CommonUserOrderApiVO userOrder, Query query) {
|
||||
IPage<CommonUserOrderApiVO> pages = orderService.selectOrderApiPage(Condition.getPage(query), userOrder);
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
/**
|
||||
* 用户订单列表
|
||||
*/
|
||||
@GetMapping("/order-detail")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "用户订单分页列表")
|
||||
public R<CommonUserOrderDetailApiVO> orderDetail(Long id) {
|
||||
return R.data(orderService.orderDetail(id));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/system-notice")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "APP系统消息列表")
|
||||
public R<List<CommonUserNoticeApiVO>> systemNotice() {
|
||||
return R.data(userNoticeService.appSystemNoticeList());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/user-notice")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "用户消息列表", description = "传入userNoticeVO")
|
||||
public R<IPage<CommonUserNoticeApiVO>> noticePage(Query query) {
|
||||
IPage<CommonUserNoticeApiVO> pages = userNoticeService.selectAppUserNoticeApiPage(Condition.getPage(query), new CommonUserNoticeApiVO());
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/notice-detail")
|
||||
@ApiOperationSupport(order = 9)
|
||||
@Operation(summary = "用户读取消息")
|
||||
public R<CommonUserNoticeDetailApiVO> noticeDetail(Long id) {
|
||||
return R.data(userNoticeService.userNoticeDetail(id));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/unread")
|
||||
@ApiOperationSupport(order = 10)
|
||||
@Operation(summary = "用户未读消息数量")
|
||||
public R<Long> unreadNum() {
|
||||
return R.data(userNoticeService.appUnreadNoticeNum());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/user-address")
|
||||
@ApiOperationSupport(order = 11)
|
||||
@Operation(summary = "用户收货地址", description = "传入userAddressVO")
|
||||
public R<List<CommonUserAddressApiVO>> addressList(Query query) {
|
||||
return R.data(addressService.selectAddressList(Condition.getPage(query), new CommonUserAddressApiVO()));
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/submit-address")
|
||||
@ApiOperationSupport(order = 12)
|
||||
@Operation(summary = "提交用户收货地址", description = "传入AddressSubmitRequest")
|
||||
public R<Boolean> submitAddress(@Valid @RequestBody AddressSubmitRequest request) {
|
||||
return R.status(addressService.submitAddress(request));
|
||||
}
|
||||
|
||||
|
||||
@DeleteMapping("/delete-address")
|
||||
@ApiOperationSupport(order = 13)
|
||||
@Operation(summary = "删除用户收货地址", description = "传入id")
|
||||
public R<Boolean> removeAddress(@Valid @RequestBody AddressRemoveRequest request) {
|
||||
return R.status(addressService.removeAddress(request.getIds()));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/user-points")
|
||||
@ApiOperationSupport(order = 14)
|
||||
@Operation(summary = "用户积分查询")
|
||||
public R<BigDecimal> userPoints() {
|
||||
return R.data(pointService.queryPoint());
|
||||
}
|
||||
|
||||
@GetMapping("/lottery-prizes")
|
||||
@ApiOperationSupport(order = 15)
|
||||
@Operation(summary = "奖品列表")
|
||||
public R<List<CommonLotteryPrizeApiVO>> lotteryPrizes() {
|
||||
return R.data(lotteryPrizeService.staticList());
|
||||
}
|
||||
|
||||
@GetMapping("/lottery-records")
|
||||
@ApiOperationSupport(order = 16)
|
||||
@Operation(summary = "抽奖记录")
|
||||
public R<IPage<CommonLotteryRecordApiVO>> lotteryRecords(Query query) {
|
||||
return R.data(lotteryRecordService.selectLotteryRecordApiPage(Condition.getPage(query), new CommonLotteryRecordApiVO()));
|
||||
}
|
||||
|
||||
@PostMapping("/lottery-draw")
|
||||
@ApiOperationSupport(order = 17)
|
||||
@Operation(summary = "用户抽奖", description = "传入LotteriesDrawRequest")
|
||||
public R<CommonLotteryPrizeApiVO> draw(@Valid @RequestBody LotteryDrawRequest request) {
|
||||
return R.data(lotteryPrizeService.draw(request));
|
||||
}
|
||||
|
||||
@GetMapping("/lottery-rules")
|
||||
@ApiOperationSupport(order = 18)
|
||||
@Operation(summary = "抽奖规则")
|
||||
public R<String> lotteryRules() {
|
||||
return R.data(lotteryPrizeService.rules());
|
||||
}
|
||||
|
||||
@GetMapping("/lottery-winners")
|
||||
@ApiOperationSupport(order = 19)
|
||||
@Operation(summary = "获奖名单")
|
||||
public R<List<CommonLotteryWinnerApiVO>> lotteryWinners() {
|
||||
return R.data(lotteryRecordService.lotteryWinners());
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,142 @@
|
||||
package org.springblade.modules.api.market;
|
||||
|
||||
|
||||
import com.baomidou.mybatisplus.core.metadata.IPage;
|
||||
import com.github.xiaoymin.knife4j.annotations.ApiOperationSupport;
|
||||
import io.swagger.v3.oas.annotations.Hidden;
|
||||
import io.swagger.v3.oas.annotations.Operation;
|
||||
import io.swagger.v3.oas.annotations.tags.Tag;
|
||||
import lombok.AllArgsConstructor;
|
||||
import org.springblade.core.mp.support.Condition;
|
||||
import org.springblade.core.mp.support.Query;
|
||||
import org.springblade.core.secure.utils.AuthUtil;
|
||||
import org.springblade.core.tool.api.R;
|
||||
import org.springblade.modules.api.request.AcquireBenefitPackageRequest;
|
||||
import org.springblade.modules.api.vo.*;
|
||||
import org.springblade.modules.common.service.ICommonUserNoticeService;
|
||||
import org.springblade.modules.market.manager.MarketUserManager;
|
||||
import org.springblade.modules.market.manager.MarketUserPointManager;
|
||||
import org.springblade.modules.market.service.IMarketBenefitPackageService;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
@Hidden
|
||||
@RestController
|
||||
@AllArgsConstructor
|
||||
@RequestMapping("/market-user")
|
||||
@Tag(name = "APP福利包接口", description = "APP福利包接口")
|
||||
public class MarketUserController {
|
||||
|
||||
private final IMarketBenefitPackageService userMarketBenefitPackageService;
|
||||
|
||||
private final MarketUserManager marketUserManager;
|
||||
|
||||
private final ICommonUserNoticeService userNoticeService;
|
||||
|
||||
private final MarketUserPointManager marketUserPointManager;
|
||||
|
||||
|
||||
@GetMapping("/package-list")
|
||||
@ApiOperationSupport(order = 1)
|
||||
@Operation(summary = "分页", description = "传入userMarketBenefitPackage")
|
||||
public R<IPage<MarketBenefitPackageVO>> findUserPackList(MarketBenefitPackageVO userMarketBenefitPackage, Query query) {
|
||||
IPage<MarketBenefitPackageVO> pages = userMarketBenefitPackageService.findUserPackList(Condition.getPage(query),userMarketBenefitPackage , AuthUtil.getUserId());
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/my-team")
|
||||
@ApiOperationSupport(order = 2)
|
||||
@Operation(summary = "查直推")
|
||||
public R<List<MarketDirectInfoApiVO>> myTeam() {
|
||||
return R.data(marketUserManager.findUserPackList());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/my-invitor")
|
||||
@ApiOperationSupport(order = 3)
|
||||
@Operation(summary = "查推荐人信息")
|
||||
public R<MarketDirectInfoApiVO> myInvitor() {
|
||||
return R.data(marketUserManager.findMarketParent());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/system-notice")
|
||||
@ApiOperationSupport(order = 4)
|
||||
@Operation(summary = "Market系统消息列表")
|
||||
public R<List<CommonUserNoticeApiVO>> systemNotice() {
|
||||
return R.data(userNoticeService.marketSystemNoticeList());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/user-notice")
|
||||
@ApiOperationSupport(order = 5)
|
||||
@Operation(summary = "Market用户消息列表", description = "传入userNoticeVO")
|
||||
public R<IPage<CommonUserNoticeApiVO>> noticePage(Query query) {
|
||||
IPage<CommonUserNoticeApiVO> pages = userNoticeService.selectMarketUserNoticeApiPage(Condition.getPage(query), new CommonUserNoticeApiVO());
|
||||
return R.data(pages);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/notice-detail")
|
||||
@ApiOperationSupport(order = 6)
|
||||
@Operation(summary = "用户消息详情", description = "传入request")
|
||||
public R<CommonUserNoticeDetailApiVO> noticeDetail(Long id) {
|
||||
return R.data(userNoticeService.userNoticeDetail(id));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/unread")
|
||||
@ApiOperationSupport(order = 7)
|
||||
@Operation(summary = "Market用户未读消息数量")
|
||||
public R<Long> unreadNum() {
|
||||
return R.data(userNoticeService.marketUnreadNoticeNum());
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/benefit-package")
|
||||
@ApiOperationSupport(order = 8)
|
||||
@Operation(summary = "福利包列表")
|
||||
public R<List<MarketPackageTemplateVO>> benefitPackageList() {
|
||||
return R.data(marketUserManager.benefitPackageList());
|
||||
}
|
||||
|
||||
@PostMapping("/acquire-benefit-package")
|
||||
@ApiOperationSupport(order = 9)
|
||||
@Operation(summary = "兑换福利包", description = "传入acquireBenefitPackageRequest")
|
||||
public R<Boolean> acquireBenefitPackage(@RequestBody AcquireBenefitPackageRequest request) {
|
||||
return R.status(marketUserManager.acquireBenefitPackage(request));
|
||||
}
|
||||
|
||||
@GetMapping("/user-assets")
|
||||
@ApiOperationSupport(order = 10)
|
||||
@Operation(summary = "用户资产查询")
|
||||
public R<UserAssetsApiVO> userAssets() {
|
||||
return R.data(marketUserManager.userAssets());
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/benefit-point-log")
|
||||
@ApiOperationSupport(order = 11)
|
||||
@Operation(summary = "福利积分流水")
|
||||
public R<IPage<MarketUserBenefitPointLogVO>> benefitPointLogList(Query query , MarketUserBenefitPointLogVO benefitPointLogVO) {
|
||||
return R.data(marketUserPointManager.benefitPointLogList(Condition.getPage(query) , benefitPointLogVO));
|
||||
}
|
||||
|
||||
@GetMapping("/cash-coupon-log")
|
||||
@ApiOperationSupport(order = 12)
|
||||
@Operation(summary = "现金券流水")
|
||||
public R<IPage<MarketUserCashCouponLogVO>> cashCouponLogList(Query query , MarketUserCashCouponLogVO cashCouponLogVO) {
|
||||
return R.data(marketUserPointManager.cashCouponLogList(Condition.getPage(query) , cashCouponLogVO));
|
||||
}
|
||||
|
||||
@GetMapping("/user-commission-log")
|
||||
@ApiOperationSupport(order = 13)
|
||||
@Operation(summary = "用户佣金流水")
|
||||
public R<IPage<MarketUserCommissionLogVO>> userCommissionLogList(Query query , MarketUserCommissionLogVO userCommissionLogVO) {
|
||||
return R.data(marketUserPointManager.userCommissionLogList(Condition.getPage(query) , userCommissionLogVO));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
import lombok.experimental.Accessors;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@Accessors(chain = true)
|
||||
public class AcquireBenefitPackageRequest implements Serializable {
|
||||
|
||||
@NotNull(message = "请选择要兑换的福利包")
|
||||
private Long packId;
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.util.List;
|
||||
|
||||
@Data
|
||||
public class AddressRemoveRequest implements Serializable {
|
||||
|
||||
@NotEmpty(message = "至少选择一条地址")
|
||||
private List<Long> ids;
|
||||
|
||||
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class AddressSubmitRequest implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
@NotNull(message = "请选择地区")
|
||||
private Integer regionsId;
|
||||
|
||||
@NotEmpty(message = "详细地址必填")
|
||||
private String detail;
|
||||
|
||||
@NotEmpty(message = "联系人必填")
|
||||
private String consignee;
|
||||
|
||||
@NotEmpty(message = "手机号必填")
|
||||
private String phone;
|
||||
|
||||
@NotNull(message = "是否默认必选")
|
||||
private Integer isDefault;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.Min;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CreateOrderRequest implements Serializable {
|
||||
|
||||
@NotEmpty(message = "请填写联系人")
|
||||
private String consignee;
|
||||
|
||||
@NotEmpty(message = "请填写联系电话")
|
||||
private String consigneePhone;
|
||||
|
||||
@NotEmpty(message = "订单类型为空")
|
||||
private String orderType;
|
||||
|
||||
@NotEmpty(message = "商品编号为空")
|
||||
private String itemCode;
|
||||
|
||||
@NotNull(message = "商品数量不能为空")
|
||||
@Min(value = 1, message = "无效商品数量")
|
||||
private Integer quantity;
|
||||
|
||||
@NotEmpty(message = "请填写收货地址")
|
||||
private String address;
|
||||
|
||||
@NotNull(message = "无效支付方式")
|
||||
private Integer paymentType;
|
||||
|
||||
@NotNull(message = "无效标识")
|
||||
private Boolean isOfflinePayment;
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import jakarta.validation.constraints.NotNull;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
public class LotteryDrawRequest implements Serializable {
|
||||
|
||||
@NotNull(message = "无效积分")
|
||||
private BigDecimal amount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package org.springblade.modules.api.request;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PaymentRequest implements Serializable {
|
||||
|
||||
private String orderId;
|
||||
|
||||
private Integer paymentType;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
package org.springblade.modules.api.response;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class CreateOrderResponse implements Serializable {
|
||||
|
||||
private String orderId;
|
||||
|
||||
private BigDecimal actualAmount;
|
||||
|
||||
private BigDecimal totalAmount;
|
||||
|
||||
private BigDecimal discount;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.springblade.modules.api.response;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class PaymentResponse implements Serializable {
|
||||
|
||||
private Integer paymentType;
|
||||
|
||||
private String payChannel;
|
||||
|
||||
private String params;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
@AllArgsConstructor
|
||||
public class CommonLotteryPrizeApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String prizeName;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,20 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
@Data
|
||||
public class CommonLotteryRecordApiVO implements Serializable {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String prizeName;
|
||||
|
||||
private BigDecimal pointsUsed;
|
||||
|
||||
private Date createTime;
|
||||
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.Data;
|
||||
|
||||
import java.io.Serializable;
|
||||
|
||||
@Data
|
||||
public class CommonLotteryWinnerApiVO implements Serializable {
|
||||
|
||||
private String prizeName;
|
||||
|
||||
private String account;
|
||||
|
||||
private String username;
|
||||
|
||||
}
|
||||
@@ -23,32 +23,34 @@
|
||||
* <p>
|
||||
* Author: Chill Zhuang (bladejava@qq.com)
|
||||
*/
|
||||
package org.springblade.flow.core.enums;
|
||||
package org.springblade.modules.api.vo;
|
||||
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Getter;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 流程类型枚举
|
||||
*
|
||||
* @author Chill
|
||||
*/
|
||||
@Getter
|
||||
@AllArgsConstructor
|
||||
public enum FlowModeEnum {
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
* 通用流程
|
||||
*/
|
||||
COMMON("common", 1),
|
||||
|
||||
/**
|
||||
* 定制流程
|
||||
*/
|
||||
CUSTOM("custom", 2),
|
||||
;
|
||||
@Data
|
||||
public class CommonUserAddressApiVO implements Serializable {
|
||||
|
||||
final String name;
|
||||
final int mode;
|
||||
private Long id;
|
||||
|
||||
private Long regionsInfoId;
|
||||
|
||||
private String province;
|
||||
|
||||
private String city;
|
||||
|
||||
private String district;
|
||||
|
||||
private String street;
|
||||
|
||||
private String detail;
|
||||
|
||||
private String consignee;
|
||||
|
||||
private String phone;
|
||||
|
||||
private Integer isDefault;
|
||||
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user