diff --git a/document/docker/docker-compose-app.yml b/document/docker/docker-compose-app.yml index ff403ef..7469953 100644 --- a/document/docker/docker-compose-app.yml +++ b/document/docker/docker-compose-app.yml @@ -5,14 +5,23 @@ services: container_name: mall-admin ports: - 8080:8080 + volumes: + - /mydata/app/mall-admin/logs:/var/logs + - /etc/localtime:/etc/localtime + environment: + - 'TZ="Asia/Shanghai"' external_links: - - redis:redis #可以用redis这个域名访问redis服务 - mysql:db #可以用db这个域名访问mysql服务 mall-search: image: mall/mall-search:1.0-SNAPSHOT container_name: mall-search ports: - 8081:8081 + volumes: + - /mydata/app/mall-search/logs:/var/logs + - /etc/localtime:/etc/localtime + environment: + - 'TZ="Asia/Shanghai"' external_links: - elasticsearch:es #可以用es这个域名访问elasticsearch服务 - mysql:db #可以用db这个域名访问mysql服务 @@ -21,6 +30,11 @@ services: container_name: mall-portal ports: - 8085:8085 + volumes: + - /mydata/app/mall-portal/logs:/var/logs + - /etc/localtime:/etc/localtime + environment: + - 'TZ="Asia/Shanghai"' external_links: - redis:redis #可以用redis这个域名访问redis服务 - mongo:mongo #可以用mongo这个域名访问mongo服务 diff --git a/document/docker/docker-compose-env.yml b/document/docker/docker-compose-env.yml index b4e1f82..bd5bc51 100644 --- a/document/docker/docker-compose-env.yml +++ b/document/docker/docker-compose-env.yml @@ -14,7 +14,7 @@ services: - /mydata/mysql/data/conf:/etc/mysql/conf.d #配置文件挂载 - /mydata/mysql/log:/var/log/mysql #日志文件挂载 redis: - image: redis:3.2 + image: redis:5 container_name: redis command: redis-server --appendonly yes volumes: @@ -40,7 +40,7 @@ services: - 5672:5672 - 15672:15672 elasticsearch: - image: elasticsearch:6.4.0 + image: elasticsearch:7.6.2 container_name: elasticsearch environment: - "cluster.name=elasticsearch" #设置集群名称为elasticsearch @@ -52,8 +52,24 @@ services: ports: - 9200:9200 - 9300:9300 + logstash: + image: logstash:7.6.2 + container_name: logstash + environment: + - TZ=Asia/Shanghai + volumes: + - /mydata/logstash/logstash.conf:/usr/share/logstash/pipeline/logstash.conf #挂载logstash的配置文件 + depends_on: + - elasticsearch #kibana在elasticsearch启动之后再启动 + links: + - elasticsearch:es #可以用es这个域名访问elasticsearch服务 + ports: + - 4560:4560 + - 4561:4561 + - 4562:4562 + - 4563:4563 kibana: - image: kibana:6.4.0 + image: kibana:7.6.2 container_name: kibana links: - elasticsearch:es #可以用es这个域名访问elasticsearch服务 @@ -64,7 +80,7 @@ services: ports: - 5601:5601 mongo: - image: mongo:3.2 + image: mongo:4.2.5 container_name: mongo volumes: - /mydata/mongo/db:/data/db #数据文件挂载 diff --git a/document/docker/docker-deploy.md b/document/docker/docker-deploy.md deleted file mode 100644 index 8cd872f..0000000 --- a/document/docker/docker-deploy.md +++ /dev/null @@ -1,149 +0,0 @@ -# docker环境部署 - -## docker环境安装 -### docker安装 -1. 安装yum-utils: -yum install -y yum-utils \ -device-mapper-persistent-data \ -lvm2 -2. 为yum源添加docker仓库位置: -yum-config-manager \ ---add-repo \ -https://download.docker.com/linux/centos/docker-ce.repo -3. 安装docker: -yum install docker-ce -4. 启动docker: -systemctl start docker -注:常见命令见document/reference文件夹中的docker.md -5. 安装上传下载插件: -yum -y install lrzsz -### docker compose安装 -1. 下载地址:https://github.com/docker/compose/releases -2. 安装地址:/usr/local/bin/docker-compose -3. 设置为可执行:sudo chmod +x /usr/local/bin/docker-compose -4. 测试是否安装成功:docker-compose --version - -## mysql安装 -### 下载镜像文件 -docker pull mysql:5.7 -### 创建实例并启动 -docker run -p 3306:3306 --name mysql \ --v /mydata/mysql/log:/var/log/mysql \ --v /mydata/mysql/data:/var/lib/mysql \ --v /mydata/mysql/conf:/etc/mysql \ --e MYSQL_ROOT_PASSWORD=root \ --d mysql:5.7 -> 参数说明 -- -p 3306:3306:将容器的3306端口映射到主机的3306端口 -- -v /mydata/mysql/conf:/etc/mysql:将配置文件夹挂在到主机 -- -v /mydata/mysql/log:/var/log/mysql:将日志文件夹挂载到主机 -- -v /mydata/mysql/data:/var/lib/mysql/:将配置文件夹挂载到主机 -- -e MYSQL_ROOT_PASSWORD=root:初始化root用户的密码 -### 通过容器的mysql命令行工具连接 -docker exec -it mysql mysql -uroot -proot -### 设置远程访问 -grant all privileges on *.* to 'root' @'%' identified by 'root'; -flush privileges; -### 进入容器文件系统 -docker exec -it mysql /bin/bash - -## redis安装 -### 下载镜像文件 -docker pull redis:3.2 -### 创建实例并启动 -docker run -p 6379:6379 --name redis -v /mydata/redis/data:/data -d redis:3.2 redis-server --appendonly yes -### 使用redis镜像执行redis-cli命令连接 -docker exec -it redis redis-cli - -## nginx安装 -### 下载镜像文件 -docker pull nginx:1.10 -### 创建实例并启动 -docker run -p 80:80 --name nginx \ --v /mydata/nginx/html:/usr/share/nginx/html \ --v /mydata/nginx/logs:/var/log/nginx \ --d nginx:1.10 -### 修改nginx配置 -1. 将容器内的配置文件拷贝到当前目录:docker container cp nginx:/etc/nginx . -2. 修改文件名称:mv nginx conf -3. 终止容器:docker stop nginx -4. 执行命令删除原容器:docker rm $ContainerId -5. 执行以下命令: -docker run -p 80:80 --name nginx \ --v /mydata/nginx/html:/usr/share/nginx/html \ --v /mydata/nginx/logs:/var/log/nginx \ --v /mydata/nginx/conf:/etc/nginx \ --d nginx:1.10 - -## rabbitmq安装 -### 下载镜像文件 -docker pull rabbitmq:management -### 创建实例并启动 -docker run -d --name rabbitmq --publish 5671:5671 \ - --publish 5672:5672 --publish 4369:4369 --publish 25672:25672 --publish 15671:15671 --publish 15672:15672 \ -rabbitmq:management - -## elasticsearch安装 -### 下载镜像文件 -docker pull elasticsearch:6.4.0 -### 创建实例并运行 -docker run -p 9200:9200 -p 9300:9300 --name elasticsearch \ --v /mydata/elasticsearch/plugins:/usr/share/elasticsearch/plugins \ --v /mydata/elasticsearch/data:/usr/share/elasticsearch/data \ --d elasticsearch:6.4.0 -### 测试 -访问会返回版本信息:http://192.168.1.66:9200/ -### 安装目录位置 -/usr/share/elasticsearch -### 安装head插件(可以不安装,仅用于测试) -1. 进入docker内部bash:docker exec -it elasticsearch /bin/bash -2. 安装插件,具体参考:https://github.com/mobz/elasticsearch-head -3. 测试:http://192.168.1.66:9200/_plugin/head/ -### 安装中文分词器IKAnalyzer -1. 进入docker内部bash:docker exec -it elasticsearch /bin/bash -2. 安装中文分词插件,执行以下命令:elasticsearch-plugin install https://github.com/medcl/elasticsearch-analysis-ik/releases/download/v6.2.2/elasticsearch-analysis-ik-6.2.2.zip -3. 测试: - - 访问header插件:打开地址http://192.168.1.66:9200/_plugin/head/ - - 选择复合查询,输入地址:POST:http://192.168.1.66:9200/_analyze - - 输入参数:JSON:{"analyzer":"ik","text":"我们是大数据开发人员"} - -## mongodb安装 -### 下载镜像文件 -docker pull mongo:3.2 -### 创建实例并运行 -docker run -p 27017:27017 --name mongo -v /mydata/mongo/db:/data/db -d mongo:3.2 -### 使用mongo命令进入容器 -docker exec -it mongo mongo - -## SpringBoot应用命令部署 -**docker容器间进行连接才能互相访问** -### 部署mall-admin -docker run -p 8080:8080 --name mall-admin \ ---link mysql:db \ --v /etc/timezone:/etc/timezone \ --v /etc/localtime:/etc/localtime \ --v /mydata/app/admin/logs:/var/logs \ --d mall/mall-admin:1.0-SNAPSHOT -### 部署mall-search -docker run -p 8081:8081 --name mall-search \ ---link elasticsearch:es \ ---link mysql:db \ --v /etc/timezone:/etc/timezone \ --v /etc/localtime:/etc/localtime \ --v /mydata/app/search/logs:/var/logs \ --d mall/mall-search:1.0-SNAPSHOT -### 部署mall-port -docker run -p 8085:8085 --name mall-portal \ ---link mysql:db \ ---link redis:redis \ ---link mongo:mongo \ --v /etc/timezone:/etc/timezone \ --v /etc/localtime:/etc/localtime \ --v /mydata/app/portal/logs:/var/logs \ --d mall/mall-portal:1.0-SNAPSHOT - -## SpringBoot应用自动化部署 -### 部署文件 -document/docker/docker-compose.yml -### 部署命令 -docker-compose up -d \ No newline at end of file diff --git a/document/elk/logback-spring.xml b/document/elk/logback-spring.xml deleted file mode 100644 index 4b7b6da..0000000 --- a/document/elk/logback-spring.xml +++ /dev/null @@ -1,14 +0,0 @@ - - - - - - localhost:4560 - - - - - - - - diff --git a/document/elk/logstash-springboot.conf b/document/elk/logstash-springboot.conf deleted file mode 100644 index a71e919..0000000 --- a/document/elk/logstash-springboot.conf +++ /dev/null @@ -1,14 +0,0 @@ -input { - tcp { - mode => "server" - host => "0.0.0.0" - port => 4560 - codec => json_lines - } -} -output { - elasticsearch { - hosts => "es:9200" - index => "springboot-logstash-%{+YYYY.MM.dd}" - } -} \ No newline at end of file diff --git a/document/elk/logstash.conf b/document/elk/logstash.conf new file mode 100644 index 0000000..e1b23f4 --- /dev/null +++ b/document/elk/logstash.conf @@ -0,0 +1,49 @@ +input { + tcp { + mode => "server" + host => "0.0.0.0" + port => 4560 + codec => json_lines + type => "debug" + } + tcp { + mode => "server" + host => "0.0.0.0" + port => 4561 + codec => json_lines + type => "error" + } + tcp { + mode => "server" + host => "0.0.0.0" + port => 4562 + codec => json_lines + type => "business" + } + tcp { + mode => "server" + host => "0.0.0.0" + port => 4563 + codec => json_lines + type => "record" + } +} +filter{ + if [type] == "record" { + mutate { + remove_field => "port" + remove_field => "host" + remove_field => "@version" + } + json { + source => "message" + remove_field => ["message"] + } + } +} +output { + elasticsearch { + hosts => "localhost:9200" + index => "mall-%{type}-%{+YYYY.MM.dd}" + } +} \ No newline at end of file diff --git a/document/pdm/mall.pdb b/document/pdm/mall.pdb index 49f4951..74921ec 100644 --- a/document/pdm/mall.pdb +++ b/document/pdm/mall.pdb @@ -1,5 +1,5 @@ - + @@ -15379,7 +15379,7 @@ LABL 0 新宋体,8,N oms_order_item 1522660695 zhenghong -1540542634 +1582621151 zhenghong 订单中所包含的商品 @@ -15532,40 +15532,6 @@ LABL 0 新宋体,8,N bigint -51302EF8-1CD4-43F5-9C02-7920ED857D35 -sp1 -sp1 -1522724687 -zhenghong -1522724745 -zhenghong -商品的销售属性 -varchar(100) -100 - - -AA056090-3D72-4BAC-A931-CD49C31B9D7E -sp2 -sp2 -1522724687 -zhenghong -1522724738 -zhenghong -varchar(100) -100 - - -C0CCCE2C-B2C8-44A1-9F6B-771BFE62D760 -sp3 -sp3 -1522724687 -zhenghong -1522724738 -zhenghong -varchar(100) -100 - - 00A626D1-90DA-4262-8FFB-874691D67C3E promotion_name promotion_name @@ -15577,7 +15543,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + FCD8E9C9-7C56-47F0-8FBB-5534EB9B8FDE promotion_amount promotion_amount @@ -15590,7 +15556,7 @@ LABL 0 新宋体,8,N 10 2 - + 073E4D15-F6EB-405D-9429-3A2FD362E949 coupon_amount coupon_amount @@ -15603,7 +15569,7 @@ LABL 0 新宋体,8,N 10 2 - + B4781397-191A-42B9-AAF7-D96E7BC3449D integration_amount integration_amount @@ -15616,7 +15582,7 @@ LABL 0 新宋体,8,N 10 2 - + AD7CAE73-04BF-4BB8-BEFA-E0A7B94BF373 real_amount real_amount @@ -15629,7 +15595,7 @@ LABL 0 新宋体,8,N 10 2 - + 3FBC2AE3-3000-41C7-B78C-DB7AC7ABDC16 gift_integration gift_integration @@ -15642,7 +15608,7 @@ LABL 0 新宋体,8,N int 1 - + C7705A4E-64E8-44A3-B3BE-7A8762E73CFD gift_growth gift_growth @@ -15655,7 +15621,7 @@ LABL 0 新宋体,8,N int 1 - + 07F49796-6B7C-4A44-BF17-6EF191BE819A product_attr product_attr @@ -15669,7 +15635,7 @@ LABL 0 新宋体,8,N - + 8B728C73-2ED3-4C44-8C64-95692A16EA10 Key_1 Key_1 @@ -15683,7 +15649,7 @@ LABL 0 新宋体,8,N - + @@ -15697,7 +15663,7 @@ LABL 0 新宋体,8,N 订单操作历史记录 - + 46247D13-9B17-44EB-9300-7BA49AC214FB id id @@ -15709,7 +15675,7 @@ LABL 0 新宋体,8,N 1 1 - + CBAA2797-F782-492E-89D8-B87830B4FD86 order_id order_id @@ -15720,7 +15686,7 @@ LABL 0 新宋体,8,N 订单id bigint - + B26D3031-3438-4CAB-BC93-2277F41D2F64 operate_man operate_man @@ -15732,7 +15698,7 @@ LABL 0 新宋体,8,N varchar(100) 100 - + 14B87125-FC24-4D09-982E-F43F618B6C3A create_time create_time @@ -15743,7 +15709,7 @@ LABL 0 新宋体,8,N 操作时间 datetime - + 296A8CF6-1BC8-46E1-846F-25114FF35EEB order_status order_status @@ -15755,7 +15721,7 @@ LABL 0 新宋体,8,N int(1) 1 - + 9F651D4E-088F-4735-ACAD-12ED16C49FDE note note @@ -15769,7 +15735,7 @@ LABL 0 新宋体,8,N - + 50772925-29B2-4E77-A02B-5AB8C229953C Key_1 Key_1 @@ -15778,12 +15744,12 @@ LABL 0 新宋体,8,N 1522725011 zhenghong - + - + @@ -15797,7 +15763,7 @@ LABL 0 新宋体,8,N 订单设置表 - + 03B16432-ECCE-4698-B24A-05554E64C35C id id @@ -15809,7 +15775,7 @@ LABL 0 新宋体,8,N 1 1 - + AC98E6B7-ADDF-43AD-B2F0-6CFE7715E9F1 flash_order_overtime flash_order_overtime @@ -15820,7 +15786,7 @@ LABL 0 新宋体,8,N 秒杀订单超时关闭时间(分) int - + C4E474C5-194A-4B54-8DF1-F37B681DE42B normal_order_overtime normal_order_overtime @@ -15831,7 +15797,7 @@ LABL 0 新宋体,8,N 正常订单超时时间(分) int - + 773FEFCD-F4A3-4D9E-B061-10C12CA1B397 confirm_overtime confirm_overtime @@ -15842,7 +15808,7 @@ LABL 0 新宋体,8,N 发货后自动确认收货时间(天) int - + DD5B89B8-5DC6-4EB1-B916-D76BD75CB0F5 finish_overtime finish_overtime @@ -15853,7 +15819,7 @@ LABL 0 新宋体,8,N 自动完成交易时间,不能申请售后(天) int - + D090D0ED-6A45-445C-ADE3-F1E18734F159 comment_overtime comment_overtime @@ -15866,7 +15832,7 @@ LABL 0 新宋体,8,N - + 7C2ADDA9-1584-4310-A3FE-7F1E18447823 Key_1 Key_1 @@ -15875,12 +15841,12 @@ LABL 0 新宋体,8,N 1522726101 zhenghong - + - + @@ -15894,7 +15860,7 @@ LABL 0 新宋体,8,N 订单退货申请 - + CF99B61C-D0E5-4EB4-BFC6-111A9F3D44E8 id id @@ -15906,7 +15872,7 @@ LABL 0 新宋体,8,N 1 1 - + A6E68B83-006A-468C-A461-C647705E038C order_id order_id @@ -15917,7 +15883,7 @@ LABL 0 新宋体,8,N 订单id bigint - + 8D1F23F9-09FD-416B-8E38-CFDE67721417 company_address_id company_address_id @@ -15928,7 +15894,7 @@ LABL 0 新宋体,8,N 收货地址表id bigint - + A6898418-67C2-4E9F-9093-6FF8782BD12F product_id product_id @@ -15939,7 +15905,7 @@ LABL 0 新宋体,8,N 退货商品id bigint - + 56ACAE3C-5533-44A1-BA57-602058B6CEF2 order_sn order_sn @@ -15951,7 +15917,7 @@ LABL 0 新宋体,8,N varchar(64) 64 - + F2C78E24-CDB0-4AA7-B6CD-21E55B380E95 create_time create_time @@ -15962,7 +15928,7 @@ LABL 0 新宋体,8,N 申请时间 datetime - + 70FBE2CF-BE0D-44DD-8679-39DAA782E1A3 member_username member_username @@ -15974,7 +15940,7 @@ LABL 0 新宋体,8,N varchar(64) 64 - + 7B8A70B3-9FC9-4136-BEC9-D2DF393DB988 return_amount return_amount @@ -15987,7 +15953,7 @@ LABL 0 新宋体,8,N 10 2 - + 4FB9898E-63E4-4B21-B577-504320D3D4F9 return_name return_name @@ -15999,7 +15965,7 @@ LABL 0 新宋体,8,N varchar(100) 100 - + 8ADCC57B-6CA5-4A89-8B5A-6283FE7B3DDF return_phone return_phone @@ -16011,7 +15977,7 @@ LABL 0 新宋体,8,N varchar(100) 100 - + F01CC8D2-508C-424D-BF17-AE42ABE28223 status status @@ -16023,7 +15989,7 @@ LABL 0 新宋体,8,N int(1) 1 - + 65402A2F-A01C-4B4D-9F19-9ACD48637159 handle_time handle_time @@ -16034,7 +16000,7 @@ LABL 0 新宋体,8,N 处理时间 datetime - + AADBD0C8-E8CD-45D6-BDF4-13840EEFA26C product_pic product_pic @@ -16046,7 +16012,7 @@ LABL 0 新宋体,8,N varchar(500) 500 - + B4BB6015-3948-411C-9558-6CAF55CEF04C product_name product_name @@ -16058,7 +16024,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + D30E609F-3F5C-401C-8690-EEA47B0E6694 product_brand product_brand @@ -16070,7 +16036,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + 86B4B2F7-9A36-47AC-A3DA-7F45FFF21639 product_attr product_attr @@ -16082,7 +16048,7 @@ LABL 0 新宋体,8,N varchar(500) 500 - + DE661909-8CDC-4C09-A0C1-5587F969523A product_count product_count @@ -16093,7 +16059,7 @@ LABL 0 新宋体,8,N 退货数量 int - + B16F9E1E-749A-477B-B8E1-70B635CC8F00 product_price product_price @@ -16106,7 +16072,7 @@ LABL 0 新宋体,8,N 10 2 - + 442BB5FC-951A-43B5-94AD-B3C2E1C8F28F product_real_price product_real_price @@ -16119,7 +16085,7 @@ LABL 0 新宋体,8,N 10 2 - + B4DB3A15-7B0F-4C6D-B961-AF2C4CF14D50 reason reason @@ -16131,7 +16097,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + ECE8A578-4D6B-47EB-BB72-207D9BC93324 description description @@ -16143,7 +16109,7 @@ LABL 0 新宋体,8,N varchar(500) 500 - + E3C2C9CF-D72D-44AA-B1A3-5B5AC1950B63 proof_pics proof_pics @@ -16155,7 +16121,7 @@ LABL 0 新宋体,8,N varchar(1000) 1000 - + B16F27C1-DFFA-40F1-83B5-F9DA3BB86FE6 handle_note handle_note @@ -16167,7 +16133,7 @@ LABL 0 新宋体,8,N varchar(500) 500 - + B8982C29-EB0D-4F63-A047-DDEDC91A78C3 handle_man handle_man @@ -16179,7 +16145,7 @@ LABL 0 新宋体,8,N varchar(100) 100 - + 49E217E2-31BF-4F23-8125-62D5920E0B60 receive_man receive_man @@ -16191,7 +16157,7 @@ LABL 0 新宋体,8,N varchar(100) 100 - + 8111E4F5-B8EA-4DCB-B899-A2E4921E6BC2 receive_time receive_time @@ -16202,7 +16168,7 @@ LABL 0 新宋体,8,N 收货时间 datetime - + 4C802C73-FB19-4C09-84C3-37E152CA8299 receive_note receive_note @@ -16216,7 +16182,7 @@ LABL 0 新宋体,8,N - + D06B934B-B63D-4DCC-B1C1-62F79744A8AC Key_1 Key_1 @@ -16225,12 +16191,12 @@ LABL 0 新宋体,8,N 1522732939 zhenghong - + - + @@ -16244,7 +16210,7 @@ LABL 0 新宋体,8,N 公司收发货地址表 - + F5A62BE4-F0B9-46C3-8591-5864BB83220D id id @@ -16256,7 +16222,7 @@ LABL 0 新宋体,8,N 1 1 - + 359C7F83-8810-4F75-935C-8099B75676C6 address_name address_name @@ -16268,7 +16234,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + 5AA8AC8B-9617-4A6F-B898-4206F7CE8169 send_status send_status @@ -16280,7 +16246,7 @@ LABL 0 新宋体,8,N int(1) 1 - + CDF1655B-32CC-4E54-BBE7-5F00549B7722 receive_status receive_status @@ -16292,7 +16258,7 @@ LABL 0 新宋体,8,N int(1) 1 - + F5195500-8663-482B-B587-27789546188C name name @@ -16304,7 +16270,7 @@ LABL 0 新宋体,8,N varchar(64) 64 - + D51012F2-BECB-4E6B-A7E9-5B6AC06D9087 phone phone @@ -16316,7 +16282,7 @@ LABL 0 新宋体,8,N varchar(64) 64 - + 3D2DC8D4-9D56-4E95-8266-052132761CDE province province @@ -16328,7 +16294,7 @@ LABL 0 新宋体,8,N varchar(64) 64 - + 57267BF2-434D-4AEC-8E6B-DDCAA85233F7 city city @@ -16340,7 +16306,7 @@ LABL 0 新宋体,8,N varchar(64) 64 - + F1F15023-139B-4048-8D0C-C9C46884C6E9 region region @@ -16352,7 +16318,7 @@ LABL 0 新宋体,8,N varchar(64) 64 - + D3EA532D-AD33-45AF-BA17-1FE7D821EE64 detail_address detail_address @@ -16366,7 +16332,7 @@ LABL 0 新宋体,8,N - + 9B8E57D5-D022-48D7-BA87-3214D2DAB1BD Key_1 Key_1 @@ -16375,12 +16341,12 @@ LABL 0 新宋体,8,N 1522745192 zhenghong - + - + @@ -16394,7 +16360,7 @@ LABL 0 新宋体,8,N 退货原因表 - + 8398CF1C-2327-4762-B370-7F7BB681FBE8 id id @@ -16406,7 +16372,7 @@ LABL 0 新宋体,8,N 1 1 - + 7C7CCC5E-FBE6-49A6-A428-95A8A078B4EA name name @@ -16418,7 +16384,7 @@ LABL 0 新宋体,8,N varchar(100) 100 - + 0C284FC4-E892-4BFF-B0AC-AD9BCB8E39D2 sort sort @@ -16428,7 +16394,7 @@ LABL 0 新宋体,8,N zhenghong int - + D0151FA2-84E3-4252-9565-766B748B7AD3 status status @@ -16440,7 +16406,7 @@ LABL 0 新宋体,8,N int(1) 1 - + A3F8C1D7-A495-4E99-885D-FC8FB1E5747C create_time create_time @@ -16453,7 +16419,7 @@ LABL 0 新宋体,8,N - + F0009D1F-CC14-45AA-BDB7-F25CFBBFE380 Key_1 Key_1 @@ -16462,12 +16428,12 @@ LABL 0 新宋体,8,N 1533115911 zhenghong - + - + @@ -16481,7 +16447,7 @@ LABL 0 新宋体,8,N 购物车表 - + 0496CCD8-F7CC-4DD4-AEE7-919D8EFCD676 id id @@ -16493,7 +16459,7 @@ LABL 0 新宋体,8,N 1 1 - + BC6AB2CA-354D-447A-A466-54980B87F57F product_id product_id @@ -16503,7 +16469,7 @@ LABL 0 新宋体,8,N zhenghong bigint - + 48241AB2-A6B4-48E5-A792-FAB72D97FD42 product_sku_id product_sku_id @@ -16513,7 +16479,7 @@ LABL 0 新宋体,8,N zhenghong bigint - + 70CEB9F6-7F7D-4AB1-BB9D-3667BA109C72 member_id member_id @@ -16523,7 +16489,7 @@ LABL 0 新宋体,8,N zhenghong bigint - + 8B8B68C0-7987-4E2B-9BAD-FF4F3428E03A quantity quantity @@ -16534,7 +16500,7 @@ LABL 0 新宋体,8,N 购买数量 int - + E2A71768-48C5-46B2-82B8-635169BFE66D price price @@ -16547,7 +16513,7 @@ LABL 0 新宋体,8,N 10 2 - + B5A53CF7-C87D-411B-89DF-41888E2722C7 product_pic product_pic @@ -16559,7 +16525,7 @@ LABL 0 新宋体,8,N varchar(1000) 1000 - + E1A4F06D-34AE-4B0C-BCC6-F82BA9D1A76F product_name product_name @@ -16571,7 +16537,7 @@ LABL 0 新宋体,8,N varchar(500) 500 - + 7BBD4FA7-9C75-4ECA-9E08-BBEAC572BCB1 product_brand product_brand @@ -16582,7 +16548,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + 11170A56-1C61-4372-9E46-A3C9C587340E product_sn product_sn @@ -16593,7 +16559,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + 2D4BFCEF-83F1-4697-8EF7-DCC5D2A9491D product_sub_title product_sub_title @@ -16605,7 +16571,7 @@ LABL 0 新宋体,8,N varchar(500) 500 - + 8A7E5878-BB5E-49F3-BE20-E6986E172BB3 product_sku_code product_sku_code @@ -16617,7 +16583,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + 23C68713-D38A-4915-96E3-A9762199D386 member_nickname member_nickname @@ -16629,7 +16595,7 @@ LABL 0 新宋体,8,N varchar(500) 500 - + 5675315C-7265-4AC3-88D4-BC1525AC73B7 create_date create_date @@ -16640,7 +16606,7 @@ LABL 0 新宋体,8,N 创建时间 datetime - + 1D877A06-39CD-4A3C-B4A8-059588D13838 modify_date modify_date @@ -16651,7 +16617,7 @@ LABL 0 新宋体,8,N 修改时间 datetime - + 20EF4C13-435F-4C03-B8A9-7E31F1432E21 delete_status delete_status @@ -16664,7 +16630,7 @@ LABL 0 新宋体,8,N int(1) 1 - + 9C9C2AC9-F58B-4D31-BEF4-1D1892931E51 product_category_id product_category_id @@ -16675,7 +16641,7 @@ LABL 0 新宋体,8,N 商品的分类 bigint - + B7274386-A224-491A-88E0-8FAADCA00C90 product_attr product_attr @@ -16689,7 +16655,7 @@ LABL 0 新宋体,8,N - + 29D735B7-E618-4C13-AF03-3858C68E6BA4 Key_1 Key_1 @@ -16698,12 +16664,12 @@ LABL 0 新宋体,8,N 1533108680 zhenghong - + - + @@ -16717,7 +16683,7 @@ LABL 0 新宋体,8,N 后台用户角色表 - + 2E853DB4-DEFD-42D5-A6BE-6226A3194CE4 id id @@ -16729,7 +16695,7 @@ LABL 0 新宋体,8,N 1 1 - + A7C5F5AC-3D79-4BAB-A058-E801649746EB name name @@ -16741,7 +16707,7 @@ LABL 0 新宋体,8,N varchar(100) 100 - + 013099EA-F84F-4262-9125-15DA3687C8CE description description @@ -16753,7 +16719,7 @@ LABL 0 新宋体,8,N varchar(500) 500 - + F376357B-61CA-46D5-BED7-51C5322735A9 admin_count admin_count @@ -16764,7 +16730,7 @@ LABL 0 新宋体,8,N 后台用户数量 int - + EAC9E6A6-7E67-44F0-B085-B7A2380828E9 create_time create_time @@ -16775,7 +16741,7 @@ LABL 0 新宋体,8,N 创建时间 datetime - + 8B4E2D43-F39C-46CD-B498-1CD02CDE1F81 status status @@ -16788,7 +16754,7 @@ LABL 0 新宋体,8,N int(1) 1 - + CDB0B35E-6C3A-4FE5-9D47-E7682E71302E sort sort @@ -16801,7 +16767,7 @@ LABL 0 新宋体,8,N - + 14F5A838-542A-4B80-8627-B17FF80D3D0C Key_1 Key_1 @@ -16810,12 +16776,12 @@ LABL 0 新宋体,8,N 1538201117 zhenghong - + - + @@ -16829,7 +16795,7 @@ LABL 0 新宋体,8,N 后台用户权限表 - + E945AB0D-430D-4564-A942-AFAF3D3C6106 id id @@ -16845,7 +16811,7 @@ LABL 0 新宋体,8,N - + B073CBDF-527E-4961-BF55-9C5A1F643303 pid pid @@ -16856,7 +16822,7 @@ LABL 0 新宋体,8,N 父级权限id bigint - + E06DA657-9A51-42D9-A915-3D76B6D12AC7 name name @@ -16868,7 +16834,7 @@ LABL 0 新宋体,8,N varchar(100) 100 - + C2345EAD-45D6-41E7-8EAA-9DB2FD0F6C48 value value @@ -16880,7 +16846,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + 471034FB-C5B6-49C2-A117-AE9FEE311F8C icon icon @@ -16892,7 +16858,7 @@ LABL 0 新宋体,8,N varchar(500) 500 - + 64C52B4C-E7C5-4A7E-AE70-CF628EFC67A7 type type @@ -16904,7 +16870,7 @@ LABL 0 新宋体,8,N int(1) 1 - + 8E492BD0-8033-4FE5-8B5B-C13F6977D9A9 uri uri @@ -16916,7 +16882,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + 88B074E5-990C-4217-91F5-A88E56CC8142 status status @@ -16928,7 +16894,7 @@ LABL 0 新宋体,8,N int(1) 1 - + 6A46B30B-44EC-4D13-BEBF-77C4D26113CA create_time create_time @@ -16939,7 +16905,7 @@ LABL 0 新宋体,8,N 创建时间 datetime - + FE8DC496-D926-4C4C-94C0-59F19B98D411 sort sort @@ -16952,7 +16918,7 @@ LABL 0 新宋体,8,N - + 1A1D360B-3856-4FE0-ABC3-9C9DD7180247 Key_1 Key_1 @@ -16961,12 +16927,12 @@ LABL 0 新宋体,8,N 1538201932 zhenghong - + - + @@ -16980,7 +16946,7 @@ LABL 0 新宋体,8,N 后台用户和角色关系表 - + FD4417BB-10DA-489F-95B7-2538DA63FEB7 id id @@ -16992,7 +16958,7 @@ LABL 0 新宋体,8,N 1 1 - + 7E2D454E-E44B-490F-9E86-11CB1D02A55F admin_id admin_id @@ -17002,7 +16968,7 @@ LABL 0 新宋体,8,N zhenghong bigint - + 6408BE19-A7C6-4F9D-B9C0-921BD494570B role_id role_id @@ -17014,7 +16980,7 @@ LABL 0 新宋体,8,N - + 6D817E44-8C99-4CFE-A645-0E536256B9D2 Key_1 Key_1 @@ -17023,12 +16989,12 @@ LABL 0 新宋体,8,N 1538202458 zhenghong - + - + @@ -17042,7 +17008,7 @@ LABL 0 新宋体,8,N 后台用户角色和权限关系表 - + 1144AF4C-1426-47B7-8212-DA3B3E6C2A36 id id @@ -17054,7 +17020,7 @@ LABL 0 新宋体,8,N 1 1 - + FE5CF0B5-65AA-4B6D-AE3C-04E4A57077D0 role_id role_id @@ -17064,7 +17030,7 @@ LABL 0 新宋体,8,N zhenghong bigint - + 3E519CF4-C6F8-4D40-828A-F3AFFDA09699 permission_id permission_id @@ -17076,7 +17042,7 @@ LABL 0 新宋体,8,N - + 7169397A-EC6D-422E-9575-7D580D618896 Key_1 Key_1 @@ -17085,12 +17051,12 @@ LABL 0 新宋体,8,N 1538202576 zhenghong - + - + @@ -17104,7 +17070,7 @@ LABL 0 新宋体,8,N 后台用户和权限关系表(除角色中定义的权限以外的加减权限) - + BE753374-E9C7-4C53-AC9C-D71DCF50662D id id @@ -17116,7 +17082,7 @@ LABL 0 新宋体,8,N 1 1 - + 12FF5B6B-8647-49E1-927C-D43F14BBB174 admin_id admin_id @@ -17126,7 +17092,7 @@ LABL 0 新宋体,8,N zhenghong bigint - + 8BDB3D8B-FFEF-4031-8D7A-EF81BE9BE670 permission_id permission_id @@ -17136,7 +17102,7 @@ LABL 0 新宋体,8,N zhenghong bigint - + D5D4EBC8-9FCD-4A79-8171-4BC6027FA23E type type @@ -17149,7 +17115,7 @@ LABL 0 新宋体,8,N - + DF246E9E-48BE-43A9-A0A8-282F0AC6E482 Key_1 Key_1 @@ -17158,12 +17124,12 @@ LABL 0 新宋体,8,N 1538202916 zhenghong - + - + @@ -17177,7 +17143,7 @@ LABL 0 新宋体,8,N 限时购场次表 - + 10DEE53F-C0A5-4C47-B567-5B9318C189F5 id id @@ -17190,7 +17156,7 @@ LABL 0 新宋体,8,N 1 1 - + 70BA3EA1-6434-4AFF-A8B7-BCFD893EE7BF name name @@ -17202,7 +17168,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + E0270862-71AD-474C-96FE-3EEA4134152D start_time start_time @@ -17213,7 +17179,7 @@ LABL 0 新宋体,8,N 每日开始时间 time - + A180A2E0-0FA8-475C-8D71-729FD0617D20 end_time end_time @@ -17224,7 +17190,7 @@ LABL 0 新宋体,8,N 每日结束时间 time - + 49630CAC-6129-4521-AD71-0A3AFD07583A status status @@ -17236,7 +17202,7 @@ LABL 0 新宋体,8,N int(1) 1 - + 3E293EDE-0D9A-4933-8B3D-4293903D92D0 create_time create_time @@ -17249,7 +17215,7 @@ LABL 0 新宋体,8,N - + 6F8C4687-C113-41B9-B674-6D8DE3D1E8D5 Key_1 Key_1 @@ -17258,12 +17224,12 @@ LABL 0 新宋体,8,N 1542178344 zhenghong - + - + @@ -17277,7 +17243,7 @@ LABL 0 新宋体,8,N 商品限时购与商品关系表 - + CAE82E75-D12D-4AD6-9A17-68423BF7E4E0 id id @@ -17290,7 +17256,7 @@ LABL 0 新宋体,8,N 1 1 - + CEAF14F7-5D5C-4FF9-B86B-CF943BE9EAC9 flash_promotion_id flash_promotion_id @@ -17300,7 +17266,7 @@ LABL 0 新宋体,8,N zhenghong bigint - + 23D89E50-A620-478D-A305-369556A666D9 flash_promotion_session_id flash_promotion_session_id @@ -17311,7 +17277,7 @@ LABL 0 新宋体,8,N 编号 bigint - + 016A43A1-CCDE-4553-A432-5F9195B3E630 product_id product_id @@ -17321,7 +17287,7 @@ LABL 0 新宋体,8,N zhenghong bigint - + A82B7A85-9A20-438A-B428-5252675D21E5 flash_promotion_price flash_promotion_price @@ -17334,7 +17300,7 @@ LABL 0 新宋体,8,N 10 2 - + 608C7EEE-3CD9-452E-873C-AD3AFDF563A0 flash_promotion_count flash_promotion_count @@ -17345,7 +17311,7 @@ LABL 0 新宋体,8,N 限时购数量 int - + 8211380C-691E-47D2-B1D7-F37E83667A4C flash_promotion_limit flash_promotion_limit @@ -17356,7 +17322,7 @@ LABL 0 新宋体,8,N 每人限购数量 int - + 7DB32E90-BA97-46B7-B90B-655587BBE50E sort sort @@ -17369,7 +17335,7 @@ LABL 0 新宋体,8,N - + A2983D35-1038-45A0-954A-5BC756B9FBF6 Key_1 Key_1 @@ -17378,12 +17344,12 @@ LABL 0 新宋体,8,N 1542179137 zhenghong - + - + @@ -17397,7 +17363,7 @@ LABL 0 新宋体,8,N 后台菜单表 - + 6E8CAA92-2096-418D-A93D-E79F719BB927 id id @@ -17409,7 +17375,7 @@ LABL 0 新宋体,8,N 1 1 - + ED194F66-7660-463A-A991-C2A652AB7BDD parent_id parent_id @@ -17420,7 +17386,7 @@ LABL 0 新宋体,8,N 父级ID bigint - + 751DDAFB-E47E-4C1F-8861-98417ABE4003 create_time create_time @@ -17431,7 +17397,7 @@ LABL 0 新宋体,8,N 创建时间 datetime - + C19B0D2B-9E4E-4D92-B934-23A5A434367E title title @@ -17443,7 +17409,7 @@ LABL 0 新宋体,8,N varchar(100) 100 - + 3991C198-C8BC-442F-B9C3-8C3E822BDF58 level level @@ -17455,7 +17421,7 @@ LABL 0 新宋体,8,N int(4) 4 - + F021AF73-1074-429E-A756-7795EAC8D046 sort sort @@ -17467,7 +17433,7 @@ LABL 0 新宋体,8,N int(4) 4 - + 4B420CCD-31CE-4F99-864B-2130DB065195 name name @@ -17479,7 +17445,7 @@ LABL 0 新宋体,8,N varchar(100) 100 - + F77FA949-AD6E-4812-8523-B4B89D603A5E icon icon @@ -17491,7 +17457,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + BA0254CB-2942-4FA6-86A0-E90E43311099 hidden hidden @@ -17505,7 +17471,7 @@ LABL 0 新宋体,8,N - + 5B17DE1C-3EF2-41FE-8598-919EF33A2D85 Key_1 Key_1 @@ -17514,12 +17480,12 @@ LABL 0 新宋体,8,N 1580624739 zhenghong - + - + @@ -17533,7 +17499,7 @@ LABL 0 新宋体,8,N 后台资源表 - + F6CBDD55-60A9-4F16-8426-166F661106CF id id @@ -17545,7 +17511,7 @@ LABL 0 新宋体,8,N 1 1 - + 83039C2E-46A3-43E5-9F44-0C2793617519 category_id category_id @@ -17556,7 +17522,7 @@ LABL 0 新宋体,8,N 资源分类ID bigint - + A9E82014-27A7-49AF-9BF1-2F10A4ABC85D create_time create_time @@ -17567,7 +17533,7 @@ LABL 0 新宋体,8,N 创建时间 datetime - + 623196A3-33D6-4F77-909E-66A8F05CDD19 name name @@ -17579,7 +17545,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + 01AB5B01-DA3F-4F28-A338-A916E623F2A0 url url @@ -17591,7 +17557,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + B3CFE91C-D059-421F-8D9C-17321C7F38E7 description description @@ -17605,7 +17571,7 @@ LABL 0 新宋体,8,N - + 10E24F7A-0390-476B-BAAE-1882C0BBD062 Key_1 Key_1 @@ -17614,12 +17580,12 @@ LABL 0 新宋体,8,N 1580625197 zhenghong - + - + @@ -17633,7 +17599,7 @@ LABL 0 新宋体,8,N 后台角色菜单关系表 - + 0A34DDDB-B366-496A-AED8-416DE19149F5 id id @@ -17645,7 +17611,7 @@ LABL 0 新宋体,8,N 1 1 - + 2AE22924-4904-41FA-AFB7-B0CF7FCBFC56 role_id role_id @@ -17656,7 +17622,7 @@ LABL 0 新宋体,8,N 角色ID bigint - + 748FA33E-A269-4189-A357-21F5885427C4 menu_id menu_id @@ -17669,7 +17635,7 @@ LABL 0 新宋体,8,N - + 882EFB9B-0F11-4AE1-995B-C15CEDF564FA Key_1 Key_1 @@ -17678,12 +17644,12 @@ LABL 0 新宋体,8,N 1580625322 zhenghong - + - + @@ -17697,7 +17663,7 @@ LABL 0 新宋体,8,N 后台角色资源关系表 - + 6DF052C6-67CA-4BAA-A125-9F03DEDA9012 id id @@ -17709,7 +17675,7 @@ LABL 0 新宋体,8,N 1 1 - + 83982BFF-3E3D-4E6F-A458-FF3075464342 role_id role_id @@ -17720,7 +17686,7 @@ LABL 0 新宋体,8,N 角色ID bigint - + 09F02FAF-844E-44FE-93C8-7B4623939F50 resource_id resource_id @@ -17733,7 +17699,7 @@ LABL 0 新宋体,8,N - + AB798EFF-998F-4E0E-B0A4-A20719A6AF79 Key_1 Key_1 @@ -17742,12 +17708,12 @@ LABL 0 新宋体,8,N 1580625408 zhenghong - + - + @@ -17761,7 +17727,7 @@ LABL 0 新宋体,8,N 资源分类表 - + F885A10E-E590-447C-8D5D-BC2BCD3DB671 id id @@ -17773,7 +17739,7 @@ LABL 0 新宋体,8,N 1 1 - + D01B83FC-5268-4206-B92F-8F9BFE927112 create_time create_time @@ -17784,7 +17750,7 @@ LABL 0 新宋体,8,N 创建时间 datetime - + B986AFDF-AFBB-4E49-93AA-5CAD7907153A name name @@ -17796,7 +17762,7 @@ LABL 0 新宋体,8,N varchar(200) 200 - + 094290D5-34B8-4EE4-B629-670A4BAA7382 sort sort @@ -17810,7 +17776,7 @@ LABL 0 新宋体,8,N - + 70C39D60-14D7-4260-94E9-1F6025702EC5 Key_1 Key_1 @@ -17819,12 +17785,12 @@ LABL 0 新宋体,8,N 1580869095 zhenghong - + - + @@ -17850,7 +17816,7 @@ LABL 0 新宋体,8,N - + 5236F74C-2761-4AC4-834A-BECC5D040393 1521706257 zhenghong @@ -17886,7 +17852,7 @@ LABL 0 新宋体,8,N - + 6EE78803-E5F6-4090-B810-7BBF7814F60C 1521710488 zhenghong @@ -17922,7 +17888,7 @@ LABL 0 新宋体,8,N - + 84F722B4-DF57-4BC3-88FD-B249B70D21A7 1521770349 zhenghong @@ -17958,7 +17924,7 @@ LABL 0 新宋体,8,N - + 0309D83E-51C3-4973-A636-9FEB27F4A6B6 1521771362 zhenghong @@ -17994,7 +17960,7 @@ LABL 0 新宋体,8,N - + 7B820697-9FFD-4446-B6DF-F03F4F02FFE3 1521773101 zhenghong @@ -18030,7 +17996,7 @@ LABL 0 新宋体,8,N - + 13DDC5F6-372D-47FF-AAFA-8AEF349E7FA8 1521783613 zhenghong @@ -18066,7 +18032,7 @@ LABL 0 新宋体,8,N - + 31ADEBC6-F176-41A7-8EAA-9AC3B8A253AB 1521791466 zhenghong @@ -18102,7 +18068,7 @@ LABL 0 新宋体,8,N - + F2B169B3-7AC8-4FB1-822D-E1C91DFF6FFD 1521792428 zhenghong @@ -18138,7 +18104,7 @@ LABL 0 新宋体,8,N - + 00AD7B43-F4CA-45D7-86BB-5756B4ED55BD 1521792909 zhenghong @@ -18174,7 +18140,7 @@ LABL 0 新宋体,8,N - + 286E06C6-6FAD-4323-82D9-6FB781153C46 1522045168 zhenghong @@ -18210,7 +18176,7 @@ LABL 0 新宋体,8,N - + A2161167-D453-4661-9BF0-71D8908A6C42 1522046100 zhenghong @@ -18246,7 +18212,7 @@ LABL 0 新宋体,8,N - + E25FF0B6-41E2-4801-8FE9-337EF9B991F7 1522046451 zhenghong @@ -18282,7 +18248,7 @@ LABL 0 新宋体,8,N - + 1E64FE44-48BA-49B0-BDE1-66DA22B89EFF 1522046456 zhenghong @@ -18318,7 +18284,7 @@ LABL 0 新宋体,8,N - + DEE74089-6A6D-4D7E-BADD-76E4D08EFA2D 1522112691 zhenghong @@ -18354,7 +18320,7 @@ LABL 0 新宋体,8,N - + 5D44A212-AD69-4958-BAAF-9E16ED63FC67 1522112694 zhenghong @@ -18390,7 +18356,7 @@ LABL 0 新宋体,8,N - + ECA8F78C-7015-44EB-9CD2-F72634D7F4BD 1522114406 zhenghong @@ -18426,7 +18392,7 @@ LABL 0 新宋体,8,N - + 32BD37D4-4436-4069-9BD1-90CF0B1867E0 1522115961 zhenghong @@ -18462,7 +18428,7 @@ LABL 0 新宋体,8,N - + 1A23B754-71EE-4496-B70F-0A3268C6F651 1522115983 zhenghong @@ -18498,7 +18464,7 @@ LABL 0 新宋体,8,N - + 1C883E67-84F9-4CD0-A4F5-D7CA2BE15DC5 1522118676 zhenghong @@ -18534,7 +18500,7 @@ LABL 0 新宋体,8,N - + 1CE2FCCB-DF37-4C88-99DD-FA8C3EE7A09C 1522119056 zhenghong @@ -18570,7 +18536,7 @@ LABL 0 新宋体,8,N - + 7D8DC4F2-D0A4-4CE9-B03E-44AE166786C0 1522120295 zhenghong @@ -18606,7 +18572,7 @@ LABL 0 新宋体,8,N - + 7CB99F50-753B-4347-B896-1F18D8FE6691 1522138613 zhenghong @@ -18642,7 +18608,7 @@ LABL 0 新宋体,8,N - + EC89DA87-A575-4940-973B-665854268261 1522138618 zhenghong @@ -18678,7 +18644,7 @@ LABL 0 新宋体,8,N - + 8E1A22EC-2246-48C4-A499-3D8A4D264C09 1522138705 zhenghong @@ -18714,7 +18680,7 @@ LABL 0 新宋体,8,N - + 2EA7348D-C8E8-4FCC-8215-01FE3AD58DFB 1522141157 zhenghong @@ -18750,7 +18716,7 @@ LABL 0 新宋体,8,N - + 8B858AAC-D00A-42FE-BEDC-73536876C045 1522141232 zhenghong @@ -18786,7 +18752,7 @@ LABL 0 新宋体,8,N - + FC3A22FE-FD24-4DF0-BAC8-22659D3C8987 1522141317 zhenghong @@ -18822,7 +18788,7 @@ LABL 0 新宋体,8,N - + 14DB9C0C-F9F0-4D4A-B44E-592028F6E75A 1522142006 zhenghong @@ -18858,7 +18824,7 @@ LABL 0 新宋体,8,N - + 15304E84-71AA-40B1-84CB-904384B34B25 1522215975 zhenghong @@ -18894,7 +18860,7 @@ LABL 0 新宋体,8,N - + 457237AD-87EB-4A09-BA9F-36198B10D2FF 1522216015 zhenghong @@ -18930,7 +18896,7 @@ LABL 0 新宋体,8,N - + 3C2E5F27-A07C-4D88-9357-089D36122A25 1522216251 zhenghong @@ -18966,7 +18932,7 @@ LABL 0 新宋体,8,N - + A8FA4798-0F1E-4D96-A254-77F5D71F6BBD 1522216380 zhenghong @@ -19002,7 +18968,7 @@ LABL 0 新宋体,8,N - + 5026171A-4B51-4B83-A113-4051F1E4F415 1522220508 zhenghong @@ -19038,7 +19004,7 @@ LABL 0 新宋体,8,N - + 462222B9-A203-4D60-A353-A168356E3140 1522220546 zhenghong @@ -19074,7 +19040,7 @@ LABL 0 新宋体,8,N - + BD28F911-4F98-4C9D-9171-E99F60476E2A 1522224364 zhenghong @@ -19110,7 +19076,7 @@ LABL 0 新宋体,8,N - + 8D1675C9-7749-4831-A5E6-ACD971AACF57 1522225874 zhenghong @@ -19146,7 +19112,7 @@ LABL 0 新宋体,8,N - + B30347B3-4138-4EA8-A0F5-EF0D9A34E01F 1522226077 zhenghong @@ -19182,7 +19148,7 @@ LABL 0 新宋体,8,N - + 7D29D8DF-7EF1-4F43-928F-DDAC96A23858 1522226272 zhenghong @@ -19218,7 +19184,7 @@ LABL 0 新宋体,8,N - + 942BBD31-85B8-46EA-893C-CB327C86F5BA 1522303390 zhenghong @@ -19254,7 +19220,7 @@ LABL 0 新宋体,8,N - + 1E5174EE-C0B0-4144-98D5-679634DCCAEE 1522303410 zhenghong @@ -19290,7 +19256,7 @@ LABL 0 新宋体,8,N - + BD55704C-3F36-44CC-90E1-143F097FA894 1522304178 zhenghong @@ -19326,7 +19292,7 @@ LABL 0 新宋体,8,N - + 17EC5CAA-580C-493D-9C2D-2EA3E9732A78 1522386868 zhenghong @@ -19362,7 +19328,7 @@ LABL 0 新宋体,8,N - + F469B162-D88C-42A3-B64C-7B2751A4FCE1 1522387461 zhenghong @@ -19398,7 +19364,7 @@ LABL 0 新宋体,8,N - + 1D18BF30-4375-4618-A1C9-6DC998F248E4 1522387526 zhenghong @@ -19434,7 +19400,7 @@ LABL 0 新宋体,8,N - + 183F9969-663E-4842-ABC2-C938F02C05E4 1522389232 zhenghong @@ -19470,7 +19436,7 @@ LABL 0 新宋体,8,N - + AC355266-228D-4333-8E95-D13F2D176DB4 1522390434 zhenghong @@ -19506,7 +19472,7 @@ LABL 0 新宋体,8,N - + 3A358827-AE90-4AC6-80E6-CA340D69F7F2 1522390644 zhenghong @@ -19542,7 +19508,7 @@ LABL 0 新宋体,8,N - + B0F12E0B-F2E6-40A6-AD2B-9FE858AAA8BE 1522391366 zhenghong @@ -19578,7 +19544,7 @@ LABL 0 新宋体,8,N - + F46C48A9-78A1-4C9A-BD75-DE0ED230A76D 1522391379 zhenghong @@ -19614,7 +19580,7 @@ LABL 0 新宋体,8,N - + 711AD4D5-212E-4E3B-BB26-DB79C4BE4E52 1522396648 zhenghong @@ -19650,7 +19616,7 @@ LABL 0 新宋体,8,N - + 094B7BE5-D0AB-4987-8D74-508A27D3117F 1522396864 zhenghong @@ -19686,7 +19652,7 @@ LABL 0 新宋体,8,N - + 8C15D427-62A0-40E7-9B02-84063CC6EB94 1522659209 zhenghong @@ -19722,7 +19688,7 @@ LABL 0 新宋体,8,N - + 043B7E7F-6688-42FD-BECE-3A4CE5A560F2 1522660753 zhenghong @@ -19758,7 +19724,7 @@ LABL 0 新宋体,8,N - + 3592DAA0-2C95-48CF-9359-C157A0E27DC3 1522660820 zhenghong @@ -19794,7 +19760,7 @@ LABL 0 新宋体,8,N - + BEE8D279-8DBF-40B3-899D-5B07570D0AD9 1522721755 zhenghong @@ -19830,7 +19796,7 @@ LABL 0 新宋体,8,N - + F5D0566A-35C3-4451-9C7D-782BC776C53E 1522724329 zhenghong @@ -19866,7 +19832,7 @@ LABL 0 新宋体,8,N - + 3AA8813B-9363-406A-91DF-4AD16E9C3CCA 1522725331 zhenghong @@ -19876,7 +19842,7 @@ LABL 0 新宋体,8,N - + @@ -19902,7 +19868,7 @@ LABL 0 新宋体,8,N - + DD05624A-7E08-4273-9758-C5EDA1A03134 1522733188 zhenghong @@ -19912,7 +19878,7 @@ LABL 0 新宋体,8,N - + @@ -19935,20 +19901,20 @@ LABL 0 新宋体,8,N - + - + EBF8A4B9-24B3-4D18-82FD-D12F847328C6 1522745521 zhenghong 1522745521 zhenghong - + - + @@ -19974,7 +19940,7 @@ LABL 0 新宋体,8,N - + BA7665F0-D173-45C6-AFE8-3C93CF330D79 1533109970 zhenghong @@ -19984,7 +19950,7 @@ LABL 0 新宋体,8,N - + @@ -20010,7 +19976,7 @@ LABL 0 新宋体,8,N - + 521484A5-B9C4-477D-8D45-97F7B15D7854 1533115829 zhenghong @@ -20020,7 +19986,7 @@ LABL 0 新宋体,8,N - + @@ -20046,7 +20012,7 @@ LABL 0 新宋体,8,N - + FCADB7B3-0636-44C7-8AB4-067148971867 1533115896 zhenghong @@ -20056,7 +20022,7 @@ LABL 0 新宋体,8,N - + @@ -20079,20 +20045,20 @@ LABL 0 新宋体,8,N - + - + D2F8A3AD-54BE-4AE4-A988-128511B938A4 1538202362 zhenghong 1538202362 zhenghong - + - + @@ -20118,7 +20084,7 @@ LABL 0 新宋体,8,N - + 993B6DB6-8CE7-4A56-9273-AA66FB16F4A0 1538202471 zhenghong @@ -20128,7 +20094,7 @@ LABL 0 新宋体,8,N - + @@ -20151,20 +20117,20 @@ LABL 0 新宋体,8,N - + - + E47EA734-EA83-4289-8295-068CBD82C878 1538202492 zhenghong 1538202492 zhenghong - + - + @@ -20187,20 +20153,20 @@ LABL 0 新宋体,8,N - + - + C3D164FC-7971-4ECF-B2F0-6B384C75DB8A 1538202586 zhenghong 1538202586 zhenghong - + - + @@ -20223,20 +20189,20 @@ LABL 0 新宋体,8,N - + - + 5D69B943-755C-4D8A-90CC-525B02C3D50C 1538202588 zhenghong 1538202588 zhenghong - + - + @@ -20262,7 +20228,7 @@ LABL 0 新宋体,8,N - + C4F1E261-E196-4270-8809-851FB823B079 1538202927 zhenghong @@ -20272,7 +20238,7 @@ LABL 0 新宋体,8,N - + @@ -20295,20 +20261,20 @@ LABL 0 新宋体,8,N - + - + 9040B9D2-76A5-43F5-8889-3E21C379E806 1538202929 zhenghong 1538202929 zhenghong - + - + @@ -20334,7 +20300,7 @@ LABL 0 新宋体,8,N - + 6D41CF48-9B5F-47F1-8391-F0BC65998A26 1539746524 zhenghong @@ -20344,7 +20310,7 @@ LABL 0 新宋体,8,N - + @@ -20370,7 +20336,7 @@ LABL 0 新宋体,8,N - + 933A26A1-5D64-4E1E-A05E-F70A9A4571A1 1541490552 zhenghong @@ -20406,7 +20372,7 @@ LABL 0 新宋体,8,N - + CF2A4EB2-4046-4B11-A333-E288CA091AFF 1542179374 zhenghong @@ -20416,7 +20382,7 @@ LABL 0 新宋体,8,N - + @@ -20439,20 +20405,20 @@ LABL 0 新宋体,8,N - + - + F03E2D7F-4760-4BDE-AB11-2394F26DB466 1542179394 zhenghong 1542179394 zhenghong - + - + @@ -20478,7 +20444,7 @@ LABL 0 新宋体,8,N - + 389ADFA5-E125-4583-ADBE-95053D3F0C72 1542179440 zhenghong @@ -20488,7 +20454,7 @@ LABL 0 新宋体,8,N - + @@ -20511,20 +20477,20 @@ LABL 0 新宋体,8,N - + - + 9085DD5C-8F83-493E-9CFE-628DA54C8B96 1580625109 zhenghong 1580625129 zhenghong - + - + @@ -20547,20 +20513,20 @@ LABL 0 新宋体,8,N - + - + A48E310F-1E8C-4B06-AF1B-4D070613C9E4 1580625333 zhenghong 1580625333 zhenghong - + - + @@ -20583,20 +20549,20 @@ LABL 0 新宋体,8,N - + - + BF0FFD9A-62E7-47E9-84FB-9F2E08021926 1580625352 zhenghong 1580625352 zhenghong - + - + @@ -20619,20 +20585,20 @@ LABL 0 新宋体,8,N - + - + 6F492BCB-5604-4D5C-9DFE-B622A7D5FC91 1580625421 zhenghong 1580625421 zhenghong - + - + @@ -20655,20 +20621,20 @@ LABL 0 新宋体,8,N - + - + B77FA1D0-9DDC-4FD9-B5FA-24CF8FE39B40 1580625435 zhenghong 1580625435 zhenghong - + - + @@ -20691,27 +20657,27 @@ LABL 0 新宋体,8,N - + - + 6D8367E1-F1BA-4FAF-A735-B63D8A8D5D7A 1580869150 zhenghong 1580869150 zhenghong - + - + - + 48492A0F-63AD-4453-B46B-89915CC87545 PUBLIC PUBLIC @@ -20722,7 +20688,7 @@ LABL 0 新宋体,8,N - + 232AA7B8-E743-48F3-9530-102684B229BE MySQL 5.0 MYSQL50 diff --git a/document/pdm/mall.pdm b/document/pdm/mall.pdm index 74921ec..96503fc 100644 --- a/document/pdm/mall.pdm +++ b/document/pdm/mall.pdm @@ -1,5 +1,5 @@ - + @@ -12,7 +12,7 @@ mall 1521705583 zhenghong -1580869150 +1586932560 zhenghong [FolderOptions] @@ -238,7 +238,7 @@ Constraint declaration=No Physical Options=Yes [FolderOptions\Physical Objects\Database Generation\Table&&Column\Foreign key] -Create=No +Create=Yes Drop=Yes Comment=Yes @@ -13122,9 +13122,9 @@ LABL 0 新宋体,8,N member_id 1522303390 zhenghong -1522303400 +1586932707 zhenghong -int +bigint 0E5CDA77-D030-43C4-8F3F-62F1DDAF2321 diff --git a/document/resource/mall_micro_service_arch.jpg b/document/resource/mall_micro_service_arch.jpg index 2b6b884..83c98a8 100644 Binary files a/document/resource/mall_micro_service_arch.jpg and b/document/resource/mall_micro_service_arch.jpg differ diff --git a/document/sh/Dockerfile b/document/sh/Dockerfile new file mode 100644 index 0000000..4a2c69e --- /dev/null +++ b/document/sh/Dockerfile @@ -0,0 +1,10 @@ +# 该镜像需要依赖的基础镜像 +FROM java:8 +# 将当前目录下的jar包复制到docker容器的/目录下 +ADD mall-admin-1.0.1-SNAPSHOT.jar /mall-admin-1.0.1-SNAPSHOT.jar +# 声明服务运行在8088端口 +EXPOSE 8080 +# 指定docker容器启动时运行jar包 +ENTRYPOINT ["java", "-jar","/mall-admin-1.0.1-SNAPSHOT.jar"] +# 指定维护者的名字 +MAINTAINER macro \ No newline at end of file diff --git a/document/sh/run.sh b/document/sh/run.sh new file mode 100644 index 0000000..4b0ce02 --- /dev/null +++ b/document/sh/run.sh @@ -0,0 +1,28 @@ +#!/usr/bin/env bash +# 定义应用组名 +group_name='mall' +# 定义应用名称 +app_name='mall-admin' +# 定义应用版本 +app_version='1.0.1-SNAPSHOT' +# 定义应用环境 +profile_active='prod' +echo '----copy jar----' +docker stop ${app_name} +echo '----stop container----' +docker rm ${app_name} +echo '----rm container----' +docker rmi ${group_name}/${app_name}:${app_version} +echo '----rm image----' +# 打包编译docker镜像 +docker build -t ${group_name}/${app_name}:${app_version} . +echo '----build image----' +docker run -p 8080:8080 --name ${app_name} \ +--link mysql:db \ +--link redis:redis \ +-e 'spring.profiles.active'=${profile_active} \ +-e TZ="Asia/Shanghai" \ +-v /etc/localtime:/etc/localtime \ +-v /mydata/app/${app_name}/logs:/var/logs \ +-d ${group_name}/${app_name}:${app_version} +echo '----start container----' \ No newline at end of file diff --git a/mall-admin/pom.xml b/mall-admin/pom.xml index 00066d5..c0a59e8 100644 --- a/mall-admin/pom.xml +++ b/mall-admin/pom.xml @@ -29,14 +29,14 @@ com.aliyun.oss aliyun-sdk-oss - - net.logstash.logback - logstash-logback-encoder - io.minio minio + + jakarta.validation + jakarta.validation-api + diff --git a/mall-admin/src/main/java/com/macro/mall/bo/WebLog.java b/mall-admin/src/main/java/com/macro/mall/bo/WebLog.java deleted file mode 100644 index 98c51dd..0000000 --- a/mall-admin/src/main/java/com/macro/mall/bo/WebLog.java +++ /dev/null @@ -1,144 +0,0 @@ -package com.macro.mall.bo; - -/** - * Controller层的日志封装类 - * Created by macro on 2018/4/26. - */ -public class WebLog { - /** - * 操作描述 - */ - private String description; - - /** - * 操作用户 - */ - private String username; - - /** - * 操作时间 - */ - private Long startTime; - - /** - * 消耗时间 - */ - private Integer spendTime; - - /** - * 根路径 - */ - private String basePath; - - /** - * URI - */ - private String uri; - - /** - * URL - */ - private String url; - - /** - * 请求类型 - */ - private String method; - - /** - * IP地址 - */ - private String ip; - - private Object parameter; - - private Object result; - - public String getDescription() { - return description; - } - - public void setDescription(String description) { - this.description = description; - } - - public String getUsername() { - return username; - } - - public void setUsername(String username) { - this.username = username; - } - - public Long getStartTime() { - return startTime; - } - - public void setStartTime(Long startTime) { - this.startTime = startTime; - } - - public Integer getSpendTime() { - return spendTime; - } - - public void setSpendTime(Integer spendTime) { - this.spendTime = spendTime; - } - - public String getBasePath() { - return basePath; - } - - public void setBasePath(String basePath) { - this.basePath = basePath; - } - - public String getUri() { - return uri; - } - - public void setUri(String uri) { - this.uri = uri; - } - - public String getUrl() { - return url; - } - - public void setUrl(String url) { - this.url = url; - } - - public String getMethod() { - return method; - } - - public void setMethod(String method) { - this.method = method; - } - - public String getIp() { - return ip; - } - - public void setIp(String ip) { - this.ip = ip; - } - - public Object getParameter() { - return parameter; - } - - public void setParameter(Object parameter) { - this.parameter = parameter; - } - - public Object getResult() { - return result; - } - - public void setResult(Object result) { - this.result = result; - } -} diff --git a/mall-admin/src/main/java/com/macro/mall/config/Swagger2Config.java b/mall-admin/src/main/java/com/macro/mall/config/Swagger2Config.java deleted file mode 100644 index 15df3fa..0000000 --- a/mall-admin/src/main/java/com/macro/mall/config/Swagger2Config.java +++ /dev/null @@ -1,78 +0,0 @@ -package com.macro.mall.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.ApiKey; -import springfox.documentation.service.AuthorizationScope; -import springfox.documentation.service.SecurityReference; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spi.service.contexts.SecurityContext; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -import java.util.ArrayList; -import java.util.List; - -/** - * Swagger API文档相关配置 - * Created by macro on 2018/4/26. - */ -@Configuration -@EnableSwagger2 -public class Swagger2Config { - @Bean - public Docket createRestApi(){ - return new Docket(DocumentationType.SWAGGER_2) - .apiInfo(apiInfo()) - .select() - .apis(RequestHandlerSelectors.basePackage("com.macro.mall.controller")) - .paths(PathSelectors.any()) - .build() - .securitySchemes(securitySchemes()) - .securityContexts(securityContexts()); - } - - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("mall后台系统") - .description("mall后台模块") - .contact("macro") - .version("1.0") - .build(); - } - - private List securitySchemes() { - //设置请求头信息 - List result = new ArrayList<>(); - ApiKey apiKey = new ApiKey("Authorization", "Authorization", "header"); - result.add(apiKey); - return result; - } - - private List securityContexts() { - //设置需要登录认证的路径 - List result = new ArrayList<>(); - result.add(getContextByPath("/*/.*")); - return result; - } - - private SecurityContext getContextByPath(String pathRegex){ - return SecurityContext.builder() - .securityReferences(defaultAuth()) - .forPaths(PathSelectors.regex(pathRegex)) - .build(); - } - - private List defaultAuth() { - List result = new ArrayList<>(); - AuthorizationScope authorizationScope = new AuthorizationScope("global", "accessEverything"); - AuthorizationScope[] authorizationScopes = new AuthorizationScope[1]; - authorizationScopes[0] = authorizationScope; - result.add(new SecurityReference("Authorization", authorizationScopes)); - return result; - } -} diff --git a/mall-admin/src/main/java/com/macro/mall/config/SwaggerConfig.java b/mall-admin/src/main/java/com/macro/mall/config/SwaggerConfig.java new file mode 100644 index 0000000..5b5d324 --- /dev/null +++ b/mall-admin/src/main/java/com/macro/mall/config/SwaggerConfig.java @@ -0,0 +1,27 @@ +package com.macro.mall.config; + +import com.macro.mall.common.config.BaseSwaggerConfig; +import com.macro.mall.common.domain.SwaggerProperties; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * Swagger API文档相关配置 + * Created by macro on 2018/4/26. + */ +@Configuration +@EnableSwagger2 +public class SwaggerConfig extends BaseSwaggerConfig { + + @Override + public SwaggerProperties swaggerProperties() { + return SwaggerProperties.builder() + .apiBasePackage("com.macro.mall.controller") + .title("mall后台系统") + .description("mall后台相关接口文档") + .contactName("macro") + .version("1.0") + .enableSecurity(true) + .build(); + } +} diff --git a/mall-admin/src/main/java/com/macro/mall/service/impl/UmsAdminCacheServiceImpl.java b/mall-admin/src/main/java/com/macro/mall/service/impl/UmsAdminCacheServiceImpl.java index d00fa45..a85878e 100644 --- a/mall-admin/src/main/java/com/macro/mall/service/impl/UmsAdminCacheServiceImpl.java +++ b/mall-admin/src/main/java/com/macro/mall/service/impl/UmsAdminCacheServiceImpl.java @@ -1,13 +1,13 @@ package com.macro.mall.service.impl; import cn.hutool.core.collection.CollUtil; +import com.macro.mall.common.service.RedisService; import com.macro.mall.dao.UmsAdminRoleRelationDao; import com.macro.mall.mapper.UmsAdminRoleRelationMapper; import com.macro.mall.model.UmsAdmin; import com.macro.mall.model.UmsAdminRoleRelation; import com.macro.mall.model.UmsAdminRoleRelationExample; import com.macro.mall.model.UmsResource; -import com.macro.mall.security.service.RedisService; import com.macro.mall.service.UmsAdminCacheService; import com.macro.mall.service.UmsAdminService; import org.springframework.beans.factory.annotation.Autowired; diff --git a/mall-admin/src/main/resources/application-dev.yml b/mall-admin/src/main/resources/application-dev.yml index efd29b2..b6d7a0b 100644 --- a/mall-admin/src/main/resources/application-dev.yml +++ b/mall-admin/src/main/resources/application-dev.yml @@ -17,4 +17,12 @@ spring: database: 0 # Redis数据库索引(默认为0) port: 6379 # Redis服务器连接端口 password: # Redis服务器连接密码(默认为空) - timeout: 300ms # 连接超时时间(毫秒) \ No newline at end of file + timeout: 300ms # 连接超时时间(毫秒) + +logging: + level: + root: info + com.macro.mall: debug + +logstash: + host: localhost \ No newline at end of file diff --git a/mall-admin/src/main/resources/application-prod.yml b/mall-admin/src/main/resources/application-prod.yml index dac7648..c8cfe5c 100644 --- a/mall-admin/src/main/resources/application-prod.yml +++ b/mall-admin/src/main/resources/application-prod.yml @@ -20,4 +20,11 @@ spring: timeout: 300ms # 连接超时时间(毫秒) logging: - path: /var/logs #配置日志生成路径 \ No newline at end of file + file: + path: /var/logs + level: + root: info + com.macro.mall: info + +logstash: + host: logstash \ No newline at end of file diff --git a/mall-admin/src/main/resources/application.yml b/mall-admin/src/main/resources/application.yml index 09a1fde..1499091 100644 --- a/mall-admin/src/main/resources/application.yml +++ b/mall-admin/src/main/resources/application.yml @@ -1,4 +1,6 @@ spring: + application: + name: mall-admin profiles: active: dev #默认为开发环境 servlet: @@ -15,7 +17,7 @@ jwt: tokenHeader: Authorization #JWT存储的请求头 secret: mall-admin-secret #JWT加解密使用的密钥 expiration: 604800 #JWT的超期限时间(60*60*24*7) - tokenHead: 'Bearer ' #JWT负载中拿到开头 + tokenHead: 'Bearer ' #JWT负载中拿到开头 redis: database: mall @@ -63,10 +65,3 @@ minio: bucketName: mall #存储桶名称 accessKey: minioadmin #访问的key secretKey: minioadmin #访问的秘钥 - -logging: - level: - root: info #日志配置DEBUG,INFO,WARN,ERROR - com.macro.mall: debug -# file: demo_log.log #配置日志生成路径 -# path: /var/logs #配置日志文件名称 diff --git a/mall-admin/src/main/resources/logback-spring.xml b/mall-admin/src/main/resources/logback-spring.xml deleted file mode 100644 index bda9284..0000000 --- a/mall-admin/src/main/resources/logback-spring.xml +++ /dev/null @@ -1,31 +0,0 @@ - - - - - - - - - - ${APP_NAME} - - - - ${LOG_FILE_PATH}/${APP_NAME}-%d{yyyy-MM-dd}.log - 30 - - - ${FILE_LOG_PATTERN} - - - - - localhost:4560 - - - - - - - - diff --git a/mall-common/pom.xml b/mall-common/pom.xml index 2a6f37a..9adf16d 100644 --- a/mall-common/pom.xml +++ b/mall-common/pom.xml @@ -19,6 +19,26 @@ + + com.github.pagehelper + pagehelper + + + org.springframework.boot + spring-boot-starter-web + + + org.springframework.boot + spring-boot-starter-data-redis + + + org.springframework.data + spring-data-commons + + + net.logstash.logback + logstash-logback-encoder + io.springfox springfox-swagger2 @@ -27,18 +47,6 @@ io.springfox springfox-swagger-ui - - org.springframework.data - spring-data-commons - - - cn.hutool - hutool-all - - - org.projectlombok - lombok - \ No newline at end of file diff --git a/mall-common/src/main/java/com/macro/mall/common/config/BaseRedisConfig.java b/mall-common/src/main/java/com/macro/mall/common/config/BaseRedisConfig.java new file mode 100644 index 0000000..dddc083 --- /dev/null +++ b/mall-common/src/main/java/com/macro/mall/common/config/BaseRedisConfig.java @@ -0,0 +1,68 @@ +package com.macro.mall.common.config; + +import com.fasterxml.jackson.annotation.JsonAutoDetect; +import com.fasterxml.jackson.annotation.PropertyAccessor; +import com.fasterxml.jackson.databind.ObjectMapper; +import com.fasterxml.jackson.databind.jsontype.impl.LaissezFaireSubTypeValidator; +import com.macro.mall.common.service.RedisService; +import com.macro.mall.common.service.impl.RedisServiceImpl; +import org.springframework.context.annotation.Bean; +import org.springframework.data.redis.cache.RedisCacheConfiguration; +import org.springframework.data.redis.cache.RedisCacheManager; +import org.springframework.data.redis.cache.RedisCacheWriter; +import org.springframework.data.redis.connection.RedisConnectionFactory; +import org.springframework.data.redis.core.RedisTemplate; +import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; +import org.springframework.data.redis.serializer.RedisSerializationContext; +import org.springframework.data.redis.serializer.RedisSerializer; +import org.springframework.data.redis.serializer.StringRedisSerializer; + +import java.time.Duration; + +/** + * Redis基础配置 + * Created by macro on 2020/6/19. + */ +public class BaseRedisConfig { + + @Bean + public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) { + RedisSerializer serializer = redisSerializer(); + RedisTemplate redisTemplate = new RedisTemplate<>(); + redisTemplate.setConnectionFactory(redisConnectionFactory); + redisTemplate.setKeySerializer(new StringRedisSerializer()); + redisTemplate.setValueSerializer(serializer); + redisTemplate.setHashKeySerializer(new StringRedisSerializer()); + redisTemplate.setHashValueSerializer(serializer); + redisTemplate.afterPropertiesSet(); + return redisTemplate; + } + + @Bean + public RedisSerializer redisSerializer() { + //创建JSON序列化器 + Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer<>(Object.class); + ObjectMapper objectMapper = new ObjectMapper(); + objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); + //必须设置,否则无法将JSON转化为对象,会转化成Map类型 + objectMapper.activateDefaultTyping(LaissezFaireSubTypeValidator.instance,ObjectMapper.DefaultTyping.NON_FINAL); + serializer.setObjectMapper(objectMapper); + return serializer; + } + + @Bean + public RedisCacheManager redisCacheManager(RedisConnectionFactory redisConnectionFactory) { + RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(redisConnectionFactory); + //设置Redis缓存有效期为1天 + RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig() + .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(redisSerializer())).entryTtl(Duration.ofDays(1)); + return new RedisCacheManager(redisCacheWriter, redisCacheConfiguration); + } + + + @Bean + public RedisService redisService(){ + return new RedisServiceImpl(); + } + +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/config/Swagger2Config.java b/mall-common/src/main/java/com/macro/mall/common/config/BaseSwaggerConfig.java similarity index 60% rename from mall-portal/src/main/java/com/macro/mall/portal/config/Swagger2Config.java rename to mall-common/src/main/java/com/macro/mall/common/config/BaseSwaggerConfig.java index ce4542a..011af3e 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/config/Swagger2Config.java +++ b/mall-common/src/main/java/com/macro/mall/common/config/BaseSwaggerConfig.java @@ -1,47 +1,45 @@ -package com.macro.mall.portal.config; +package com.macro.mall.common.config; +import com.macro.mall.common.domain.SwaggerProperties; import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; import springfox.documentation.builders.ApiInfoBuilder; import springfox.documentation.builders.PathSelectors; import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.service.ApiKey; -import springfox.documentation.service.AuthorizationScope; -import springfox.documentation.service.SecurityReference; +import springfox.documentation.service.*; import springfox.documentation.spi.DocumentationType; import springfox.documentation.spi.service.contexts.SecurityContext; import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; import java.util.ArrayList; import java.util.List; /** - * Swagger API文档相关配置 - * Created by macro on 2018/4/26. + * Swagger基础配置 + * Created by macro on 2020/7/16. */ -@Configuration -@EnableSwagger2 -public class Swagger2Config { +public abstract class BaseSwaggerConfig { + @Bean public Docket createRestApi() { - return new Docket(DocumentationType.SWAGGER_2) - .apiInfo(apiInfo()) + SwaggerProperties swaggerProperties = swaggerProperties(); + Docket docket = new Docket(DocumentationType.SWAGGER_2) + .apiInfo(apiInfo(swaggerProperties)) .select() - .apis(RequestHandlerSelectors.basePackage("com.macro.mall.portal.controller")) + .apis(RequestHandlerSelectors.basePackage(swaggerProperties.getApiBasePackage())) .paths(PathSelectors.any()) - .build() - .securitySchemes(securitySchemes()) - .securityContexts(securityContexts()); + .build(); + if (swaggerProperties.isEnableSecurity()) { + docket.securitySchemes(securitySchemes()).securityContexts(securityContexts()); + } + return docket; } - private ApiInfo apiInfo() { + private ApiInfo apiInfo(SwaggerProperties swaggerProperties) { return new ApiInfoBuilder() - .title("mall前台系统") - .description("mall前台模块") - .contact("macro") - .version("1.0") + .title(swaggerProperties.getTitle()) + .description(swaggerProperties.getDescription()) + .contact(new Contact(swaggerProperties.getContactName(), swaggerProperties.getContactUrl(), swaggerProperties.getContactEmail())) + .version(swaggerProperties.getVersion()) .build(); } @@ -75,4 +73,9 @@ public class Swagger2Config { result.add(new SecurityReference("Authorization", authorizationScopes)); return result; } + + /** + * 自定义Swagger配置 + */ + public abstract SwaggerProperties swaggerProperties(); } diff --git a/mall-common/src/main/java/com/macro/mall/common/domain/SwaggerProperties.java b/mall-common/src/main/java/com/macro/mall/common/domain/SwaggerProperties.java new file mode 100644 index 0000000..4043805 --- /dev/null +++ b/mall-common/src/main/java/com/macro/mall/common/domain/SwaggerProperties.java @@ -0,0 +1,47 @@ +package com.macro.mall.common.domain; + +import lombok.Builder; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * Swagger自定义配置 + * Created by macro on 2020/7/16. + */ +@Data +@EqualsAndHashCode(callSuper = false) +@Builder +public class SwaggerProperties { + /** + * API文档生成基础路径 + */ + private String apiBasePackage; + /** + * 是否要启用登录认证 + */ + private boolean enableSecurity; + /** + * 文档标题 + */ + private String title; + /** + * 文档描述 + */ + private String description; + /** + * 文档版本 + */ + private String version; + /** + * 文档联系人姓名 + */ + private String contactName; + /** + * 文档联系人网址 + */ + private String contactUrl; + /** + * 文档联系人邮箱 + */ + private String contactEmail; +} diff --git a/mall-common/src/main/java/com/macro/mall/common/domain/WebLog.java b/mall-common/src/main/java/com/macro/mall/common/domain/WebLog.java new file mode 100644 index 0000000..e4faf97 --- /dev/null +++ b/mall-common/src/main/java/com/macro/mall/common/domain/WebLog.java @@ -0,0 +1,68 @@ +package com.macro.mall.common.domain; + +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * Controller层的日志封装类 + * Created by macro on 2018/4/26. + */ +@Data +@EqualsAndHashCode(callSuper = false) +public class WebLog { + /** + * 操作描述 + */ + private String description; + + /** + * 操作用户 + */ + private String username; + + /** + * 操作时间 + */ + private Long startTime; + + /** + * 消耗时间 + */ + private Integer spendTime; + + /** + * 根路径 + */ + private String basePath; + + /** + * URI + */ + private String uri; + + /** + * URL + */ + private String url; + + /** + * 请求类型 + */ + private String method; + + /** + * IP地址 + */ + private String ip; + + /** + * 请求参数 + */ + private Object parameter; + + /** + * 返回结果 + */ + private Object result; + +} diff --git a/mall-admin/src/main/java/com/macro/mall/component/WebLogAspect.java b/mall-common/src/main/java/com/macro/mall/common/log/WebLogAspect.java similarity index 97% rename from mall-admin/src/main/java/com/macro/mall/component/WebLogAspect.java rename to mall-common/src/main/java/com/macro/mall/common/log/WebLogAspect.java index 6e5bdf8..fb99c70 100644 --- a/mall-admin/src/main/java/com/macro/mall/component/WebLogAspect.java +++ b/mall-common/src/main/java/com/macro/mall/common/log/WebLogAspect.java @@ -1,10 +1,9 @@ -package com.macro.mall.component; +package com.macro.mall.common.log; import cn.hutool.core.util.StrUtil; import cn.hutool.core.util.URLUtil; -import cn.hutool.json.JSON; import cn.hutool.json.JSONUtil; -import com.macro.mall.bo.WebLog; +import com.macro.mall.common.domain.WebLog; import io.swagger.annotations.ApiOperation; import net.logstash.logback.marker.Markers; import org.aspectj.lang.JoinPoint; @@ -40,7 +39,7 @@ import java.util.Map; public class WebLogAspect { private static final Logger LOGGER = LoggerFactory.getLogger(WebLogAspect.class); - @Pointcut("execution(public * com.macro.mall.controller.*.*(..))") + @Pointcut("execution(public * com.macro.mall.controller.*.*(..))||execution(public * com.macro.mall.*.controller.*.*(..))") public void webLog() { } diff --git a/mall-security/src/main/java/com/macro/mall/security/service/RedisService.java b/mall-common/src/main/java/com/macro/mall/common/service/RedisService.java similarity index 97% rename from mall-security/src/main/java/com/macro/mall/security/service/RedisService.java rename to mall-common/src/main/java/com/macro/mall/common/service/RedisService.java index a33943b..9f2de5e 100644 --- a/mall-security/src/main/java/com/macro/mall/security/service/RedisService.java +++ b/mall-common/src/main/java/com/macro/mall/common/service/RedisService.java @@ -1,4 +1,4 @@ -package com.macro.mall.security.service; +package com.macro.mall.common.service; import java.util.List; import java.util.Map; @@ -88,7 +88,7 @@ public interface RedisService { /** * 直接设置整个Hash结构 */ - void hSetAll(String key, Map map); + void hSetAll(String key, Map map); /** * 删除Hash结构中的属性 diff --git a/mall-security/src/main/java/com/macro/mall/security/service/impl/RedisServiceImpl.java b/mall-common/src/main/java/com/macro/mall/common/service/impl/RedisServiceImpl.java similarity index 95% rename from mall-security/src/main/java/com/macro/mall/security/service/impl/RedisServiceImpl.java rename to mall-common/src/main/java/com/macro/mall/common/service/impl/RedisServiceImpl.java index 0347ea3..342b8a1 100644 --- a/mall-security/src/main/java/com/macro/mall/security/service/impl/RedisServiceImpl.java +++ b/mall-common/src/main/java/com/macro/mall/common/service/impl/RedisServiceImpl.java @@ -1,9 +1,8 @@ -package com.macro.mall.security.service.impl; +package com.macro.mall.common.service.impl; -import com.macro.mall.security.service.RedisService; +import com.macro.mall.common.service.RedisService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.stereotype.Service; import java.util.List; import java.util.Map; @@ -14,7 +13,6 @@ import java.util.concurrent.TimeUnit; * redis操作实现类 * Created by macro on 2020/3/3. */ -@Service public class RedisServiceImpl implements RedisService { @Autowired private RedisTemplate redisTemplate; @@ -97,7 +95,7 @@ public class RedisServiceImpl implements RedisService { } @Override - public void hSetAll(String key, Map map) { + public void hSetAll(String key, Map map) { redisTemplate.opsForHash().putAll(key, map); } diff --git a/mall-common/src/main/resources/logback-spring.xml b/mall-common/src/main/resources/logback-spring.xml new file mode 100644 index 0000000..eeac305 --- /dev/null +++ b/mall-common/src/main/resources/logback-spring.xml @@ -0,0 +1,196 @@ + + + + + + + + + + + + + + + + + + + DEBUG + + + + ${FILE_LOG_PATTERN} + UTF-8 + + + + ${LOG_FILE_PATH}/debug/${APP_NAME}-%d{yyyy-MM-dd}-%i.log + + ${LOG_FILE_MAX_SIZE:-10MB} + + ${LOG_FILE_MAX_HISTORY:-30} + + + + + + + + ERROR + ACCEPT + DENY + + + + ${FILE_LOG_PATTERN} + UTF-8 + + + + ${LOG_FILE_PATH}/error/${APP_NAME}-%d{yyyy-MM-dd}-%i.log + + ${LOG_FILE_MAX_SIZE:-10MB} + + ${LOG_FILE_MAX_HISTORY:-30} + + + + + + + DEBUG + + ${LOG_STASH_HOST}:4560 + + + + Asia/Shanghai + + + + + { + "project": "mall", + "level": "%level", + "service": "${APP_NAME:-}", + "pid": "${PID:-}", + "thread": "%thread", + "class": "%logger", + "message": "%message", + "stack_trace": "%exception{20}" + } + + + + + + + + + + ERROR + ACCEPT + DENY + + ${LOG_STASH_HOST}:4561 + + + + Asia/Shanghai + + + + + { + "project": "mall", + "level": "%level", + "service": "${APP_NAME:-}", + "pid": "${PID:-}", + "thread": "%thread", + "class": "%logger", + "message": "%message", + "stack_trace": "%exception{20}" + } + + + + + + + + + ${LOG_STASH_HOST}:4562 + + + + Asia/Shanghai + + + + + { + "project": "mall", + "level": "%level", + "service": "${APP_NAME:-}", + "pid": "${PID:-}", + "thread": "%thread", + "class": "%logger", + "message": "%message", + "stack_trace": "%exception{20}" + } + + + + + + + + + ${LOG_STASH_HOST}:4563 + + + + Asia/Shanghai + + + + + { + "project": "mall", + "level": "%level", + "service": "${APP_NAME:-}", + "class": "%logger", + "message": "%message" + } + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/mall-demo/pom.xml b/mall-demo/pom.xml index 2fc739b..61247f0 100644 --- a/mall-demo/pom.xml +++ b/mall-demo/pom.xml @@ -33,6 +33,10 @@ net.logstash.logback logstash-logback-encoder + + jakarta.validation + jakarta.validation-api + diff --git a/mall-demo/src/main/java/com/macro/mall/demo/config/Swagger2Config.java b/mall-demo/src/main/java/com/macro/mall/demo/config/Swagger2Config.java deleted file mode 100644 index 133bc71..0000000 --- a/mall-demo/src/main/java/com/macro/mall/demo/config/Swagger2Config.java +++ /dev/null @@ -1,37 +0,0 @@ -package com.macro.mall.demo.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -/** - * Swagger API文档相关配置 - */ -@Configuration -@EnableSwagger2 -public class Swagger2Config { - @Bean - public Docket createRestApi(){ - return new Docket(DocumentationType.SWAGGER_2) - .apiInfo(apiInfo()) - .select() - .apis(RequestHandlerSelectors.basePackage("com.macro.mall.demo")) - .paths(PathSelectors.any()) - .build(); - } - - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("SwaggerUI演示") - .description("Demo模块") - .contact("macro") - .version("1.0") - .build(); - } -} diff --git a/mall-demo/src/main/java/com/macro/mall/demo/config/SwaggerConfig.java b/mall-demo/src/main/java/com/macro/mall/demo/config/SwaggerConfig.java new file mode 100644 index 0000000..4e4dd3e --- /dev/null +++ b/mall-demo/src/main/java/com/macro/mall/demo/config/SwaggerConfig.java @@ -0,0 +1,28 @@ +package com.macro.mall.demo.config; + +import com.macro.mall.common.config.BaseSwaggerConfig; +import com.macro.mall.common.domain.SwaggerProperties; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * Swagger相关配置 + * Created by macro on 2019/4/8. + */ +@Configuration +@EnableSwagger2 +public class SwaggerConfig extends BaseSwaggerConfig { + + @Override + public SwaggerProperties swaggerProperties() { + return SwaggerProperties.builder() + .apiBasePackage("com.macro.mall.demo.controller") + .title("mall-demo系统") + .description("SpringBoot版本中的一些示例") + .contactName("macro") + .version("1.0") + .enableSecurity(true) + .build(); + } + +} diff --git a/mall-demo/src/main/resources/application.yml b/mall-demo/src/main/resources/application.yml index 319bfad..392785a 100644 --- a/mall-demo/src/main/resources/application.yml +++ b/mall-demo/src/main/resources/application.yml @@ -2,6 +2,8 @@ server: port: 8082 spring: + application: + name: mall-demo datasource: url: jdbc:mysql://localhost:3306/mall?useUnicode=true&characterEncoding=utf-8&serverTimezone=Asia/Shanghai username: root @@ -12,7 +14,6 @@ spring: servlet: content-type: text/html cache: false #开发时关闭缓存,不然没法看到实时页面 - mybatis: mapper-locations: - classpath:mapper/*.xml @@ -20,10 +21,8 @@ mybatis: logging: level: - root: info #日志配置DEBUG,INFO,WARN,ERROR + root: info com.macro.mall: debug -# file: demo_log.log #配置日志生成路径 -# path: /var/logs #配置日志文件名称 host: mall: diff --git a/mall-mbg/pom.xml b/mall-mbg/pom.xml index caac930..2a4d17a 100644 --- a/mall-mbg/pom.xml +++ b/mall-mbg/pom.xml @@ -23,6 +23,14 @@ com.macro.mall mall-common + + com.github.pagehelper + pagehelper-spring-boot-starter + + + com.alibaba + druid-spring-boot-starter + org.mybatis.generator mybatis-generator-core diff --git a/mall-portal/src/main/java/com/macro/mall/portal/config/SwaggerConfig.java b/mall-portal/src/main/java/com/macro/mall/portal/config/SwaggerConfig.java new file mode 100644 index 0000000..c79522c --- /dev/null +++ b/mall-portal/src/main/java/com/macro/mall/portal/config/SwaggerConfig.java @@ -0,0 +1,27 @@ +package com.macro.mall.portal.config; + +import com.macro.mall.common.config.BaseSwaggerConfig; +import com.macro.mall.common.domain.SwaggerProperties; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * Swagger2API文档的配置 + * Created by macro on 2018/4/26. + */ +@Configuration +@EnableSwagger2 +public class SwaggerConfig extends BaseSwaggerConfig { + + @Override + public SwaggerProperties swaggerProperties() { + return SwaggerProperties.builder() + .apiBasePackage("com.macro.mall.portal.controller") + .title("mall前台系统") + .description("mall前台相关接口文档") + .contactName("macro") + .version("1.0") + .enableSecurity(true) + .build(); + } +} diff --git a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPortalOrderServiceImpl.java b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPortalOrderServiceImpl.java index 8f32e78..bc021e6 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPortalOrderServiceImpl.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/OmsPortalOrderServiceImpl.java @@ -5,6 +5,7 @@ import cn.hutool.core.collection.CollUtil; import com.github.pagehelper.PageHelper; import com.macro.mall.common.api.CommonPage; import com.macro.mall.common.exception.Asserts; +import com.macro.mall.common.service.RedisService; import com.macro.mall.mapper.*; import com.macro.mall.model.*; import com.macro.mall.portal.component.CancelOrderSender; @@ -13,7 +14,6 @@ import com.macro.mall.portal.dao.PortalOrderItemDao; import com.macro.mall.portal.dao.SmsCouponHistoryDao; import com.macro.mall.portal.domain.*; import com.macro.mall.portal.service.*; -import com.macro.mall.security.service.RedisService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; diff --git a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsMemberCacheServiceImpl.java b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsMemberCacheServiceImpl.java index a969d56..a75962e 100644 --- a/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsMemberCacheServiceImpl.java +++ b/mall-portal/src/main/java/com/macro/mall/portal/service/impl/UmsMemberCacheServiceImpl.java @@ -1,11 +1,10 @@ package com.macro.mall.portal.service.impl; +import com.macro.mall.common.service.RedisService; import com.macro.mall.mapper.UmsMemberMapper; import com.macro.mall.model.UmsMember; import com.macro.mall.portal.service.UmsMemberCacheService; import com.macro.mall.security.annotation.CacheException; -import com.macro.mall.security.config.RedisConfig; -import com.macro.mall.security.service.RedisService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; diff --git a/mall-portal/src/main/resources/application-dev.yml b/mall-portal/src/main/resources/application-dev.yml index 82d70de..c0af59e 100644 --- a/mall-portal/src/main/resources/application-dev.yml +++ b/mall-portal/src/main/resources/application-dev.yml @@ -15,32 +15,29 @@ spring: stat-view-servlet: #访问监控网页的登录用户名和密码 login-username: druid login-password: druid - data: mongodb: host: localhost port: 27017 database: mall-port - redis: host: localhost # Redis服务器地址 database: 0 # Redis数据库索引(默认为0) port: 6379 # Redis服务器连接端口 password: # Redis服务器连接密码(默认为空) timeout: 300ms # 连接超时时间(毫秒) - rabbitmq: host: localhost port: 5672 virtual-host: /mall username: mall password: mall - publisher-confirms: true #如果对异步消息需要回调必须设置为true -# 日志配置 logging: level: - org.springframework.data.mongodb.core: debug - com.macro.mall.mapper: debug - com.macro.mall.portal.dao: debug + root: info + com.macro.mall: debug + +logstash: + host: localhost diff --git a/mall-portal/src/main/resources/application-prod.yml b/mall-portal/src/main/resources/application-prod.yml index b47707a..c272a4f 100644 --- a/mall-portal/src/main/resources/application-prod.yml +++ b/mall-portal/src/main/resources/application-prod.yml @@ -35,8 +35,14 @@ spring: virtual-host: /mall username: mall password: mall - publisher-confirms: true #如果对异步消息需要回调必须设置为true -# 日志配置 -logging: - path: /var/logs + +logging: + file: + path: /var/logs + level: + root: info + com.macro.mall: info + +logstash: + host: logstash diff --git a/mall-portal/src/main/resources/application.yml b/mall-portal/src/main/resources/application.yml index a352bc3..d2101ed 100644 --- a/mall-portal/src/main/resources/application.yml +++ b/mall-portal/src/main/resources/application.yml @@ -1,4 +1,6 @@ spring: + application: + name: mall-portal profiles: active: dev #默认为开发环境 diff --git a/mall-search/src/main/java/com/macro/mall/search/MallSearchApplication.java b/mall-search/src/main/java/com/macro/mall/search/MallSearchApplication.java index 3f820d8..029b1a2 100644 --- a/mall-search/src/main/java/com/macro/mall/search/MallSearchApplication.java +++ b/mall-search/src/main/java/com/macro/mall/search/MallSearchApplication.java @@ -3,7 +3,7 @@ package com.macro.mall.search; import org.springframework.boot.SpringApplication; import org.springframework.boot.autoconfigure.SpringBootApplication; -@SpringBootApplication +@SpringBootApplication(scanBasePackages = "com.macro.mall") public class MallSearchApplication { public static void main(String[] args) { diff --git a/mall-search/src/main/java/com/macro/mall/search/config/Swagger2Config.java b/mall-search/src/main/java/com/macro/mall/search/config/Swagger2Config.java deleted file mode 100644 index fd8b782..0000000 --- a/mall-search/src/main/java/com/macro/mall/search/config/Swagger2Config.java +++ /dev/null @@ -1,38 +0,0 @@ -package com.macro.mall.search.config; - -import org.springframework.context.annotation.Bean; -import org.springframework.context.annotation.Configuration; -import springfox.documentation.builders.ApiInfoBuilder; -import springfox.documentation.builders.PathSelectors; -import springfox.documentation.builders.RequestHandlerSelectors; -import springfox.documentation.service.ApiInfo; -import springfox.documentation.spi.DocumentationType; -import springfox.documentation.spring.web.plugins.Docket; -import springfox.documentation.swagger2.annotations.EnableSwagger2; - -/** - * Swagger API文档相关配置 - * Created by macro on 2018/4/26. - */ -@Configuration -@EnableSwagger2 -public class Swagger2Config { - @Bean - public Docket createRestApi(){ - return new Docket(DocumentationType.SWAGGER_2) - .apiInfo(apiInfo()) - .select() - .apis(RequestHandlerSelectors.basePackage("com.macro.mall.search.controller")) - .paths(PathSelectors.any()) - .build(); - } - - private ApiInfo apiInfo() { - return new ApiInfoBuilder() - .title("mall搜索系统") - .description("mall搜索模块") - .contact("macro") - .version("1.0") - .build(); - } -} diff --git a/mall-search/src/main/java/com/macro/mall/search/config/SwaggerConfig.java b/mall-search/src/main/java/com/macro/mall/search/config/SwaggerConfig.java new file mode 100644 index 0000000..adf1f21 --- /dev/null +++ b/mall-search/src/main/java/com/macro/mall/search/config/SwaggerConfig.java @@ -0,0 +1,27 @@ +package com.macro.mall.search.config; + +import com.macro.mall.common.config.BaseSwaggerConfig; +import com.macro.mall.common.domain.SwaggerProperties; +import org.springframework.context.annotation.Configuration; +import springfox.documentation.swagger2.annotations.EnableSwagger2; + +/** + * Swagger2API文档的配置 + * Created by macro on 2018/4/26. + */ +@Configuration +@EnableSwagger2 +public class SwaggerConfig extends BaseSwaggerConfig { + + @Override + public SwaggerProperties swaggerProperties() { + return SwaggerProperties.builder() + .apiBasePackage("com.macro.mall.search.controller") + .title("mall搜索系统") + .description("mall搜索相关接口文档") + .contactName("macro") + .version("1.0") + .enableSecurity(false) + .build(); + } +} diff --git a/mall-search/src/main/java/com/macro/mall/search/service/impl/EsProductServiceImpl.java b/mall-search/src/main/java/com/macro/mall/search/service/impl/EsProductServiceImpl.java index 761df10..a2021e6 100644 --- a/mall-search/src/main/java/com/macro/mall/search/service/impl/EsProductServiceImpl.java +++ b/mall-search/src/main/java/com/macro/mall/search/service/impl/EsProductServiceImpl.java @@ -5,7 +5,6 @@ import com.macro.mall.search.domain.EsProduct; import com.macro.mall.search.domain.EsProductRelatedInfo; import com.macro.mall.search.repository.EsProductRepository; import com.macro.mall.search.service.EsProductService; -import org.elasticsearch.action.search.SearchResponse; import org.elasticsearch.common.lucene.search.function.FunctionScoreQuery; import org.elasticsearch.index.query.BoolQueryBuilder; import org.elasticsearch.index.query.QueryBuilders; @@ -14,10 +13,10 @@ import org.elasticsearch.index.query.functionscore.ScoreFunctionBuilders; import org.elasticsearch.search.aggregations.AbstractAggregationBuilder; import org.elasticsearch.search.aggregations.Aggregation; import org.elasticsearch.search.aggregations.AggregationBuilders; -import org.elasticsearch.search.aggregations.bucket.filter.InternalFilter; -import org.elasticsearch.search.aggregations.bucket.nested.InternalNested; -import org.elasticsearch.search.aggregations.bucket.terms.LongTerms; -import org.elasticsearch.search.aggregations.bucket.terms.StringTerms; +import org.elasticsearch.search.aggregations.bucket.filter.ParsedFilter; +import org.elasticsearch.search.aggregations.bucket.nested.ParsedNested; +import org.elasticsearch.search.aggregations.bucket.terms.ParsedLongTerms; +import org.elasticsearch.search.aggregations.bucket.terms.ParsedStringTerms; import org.elasticsearch.search.aggregations.bucket.terms.Terms; import org.elasticsearch.search.sort.SortBuilders; import org.elasticsearch.search.sort.SortOrder; @@ -28,7 +27,10 @@ import org.springframework.data.domain.Page; import org.springframework.data.domain.PageImpl; import org.springframework.data.domain.PageRequest; import org.springframework.data.domain.Pageable; -import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; +import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; +import org.springframework.data.elasticsearch.core.SearchHit; +import org.springframework.data.elasticsearch.core.SearchHits; +import org.springframework.data.elasticsearch.core.mapping.IndexCoordinates; import org.springframework.data.elasticsearch.core.query.NativeSearchQuery; import org.springframework.data.elasticsearch.core.query.NativeSearchQueryBuilder; import org.springframework.stereotype.Service; @@ -39,6 +41,7 @@ import java.util.ArrayList; import java.util.Iterator; import java.util.List; import java.util.Map; +import java.util.stream.Collectors; /** @@ -53,7 +56,7 @@ public class EsProductServiceImpl implements EsProductService { @Autowired private EsProductRepository productRepository; @Autowired - private ElasticsearchTemplate elasticsearchTemplate; + private ElasticsearchRestTemplate elasticsearchRestTemplate; @Override public int importAll() { List esProductList = productDao.getAllEsProductList(null); @@ -157,7 +160,12 @@ public class EsProductServiceImpl implements EsProductService { nativeSearchQueryBuilder.withSort(SortBuilders.scoreSort().order(SortOrder.DESC)); NativeSearchQuery searchQuery = nativeSearchQueryBuilder.build(); LOGGER.info("DSL:{}", searchQuery.getQuery().toString()); - return productRepository.search(searchQuery); + SearchHits searchHits = elasticsearchRestTemplate.search(searchQuery, EsProduct.class); + if(searchHits.getTotalHits()<=0){ + return new PageImpl<>(null,pageable,0); + } + List searchProductList = searchHits.stream().map(SearchHit::getContent).collect(Collectors.toList()); + return new PageImpl<>(searchProductList,pageable,searchHits.getTotalHits()); } @Override @@ -196,7 +204,12 @@ public class EsProductServiceImpl implements EsProductService { builder.withPageable(pageable); NativeSearchQuery searchQuery = builder.build(); LOGGER.info("DSL:{}", searchQuery.getQuery().toString()); - return productRepository.search(searchQuery); + SearchHits searchHits = elasticsearchRestTemplate.search(searchQuery, EsProduct.class); + if(searchHits.getTotalHits()<=0){ + return new PageImpl<>(null,pageable,0); + } + List searchProductList = searchHits.stream().map(SearchHit::getContent).collect(Collectors.toList()); + return new PageImpl<>(searchProductList,pageable,searchHits.getTotalHits()); } return new PageImpl<>(null); } @@ -225,16 +238,14 @@ public class EsProductServiceImpl implements EsProductService { .field("attrValueList.name")))); builder.addAggregation(aggregationBuilder); NativeSearchQuery searchQuery = builder.build(); - return elasticsearchTemplate.query(searchQuery, response -> { - LOGGER.info("DSL:{}",searchQuery.getQuery().toString()); - return convertProductRelatedInfo(response); - }); + SearchHits searchHits = elasticsearchRestTemplate.search(searchQuery, EsProduct.class); + return convertProductRelatedInfo(searchHits); } /** * 将返回结果转换为对象 */ - private EsProductRelatedInfo convertProductRelatedInfo(SearchResponse response) { + private EsProductRelatedInfo convertProductRelatedInfo(SearchHits response) { EsProductRelatedInfo productRelatedInfo = new EsProductRelatedInfo(); Map aggregationMap = response.getAggregations().getAsMap(); //设置品牌 @@ -253,14 +264,14 @@ public class EsProductServiceImpl implements EsProductService { productRelatedInfo.setProductCategoryNames(productCategoryNameList); //设置参数 Aggregation productAttrs = aggregationMap.get("allAttrValues"); - List attrIds = ((LongTerms) ((InternalFilter) ((InternalNested) productAttrs).getProperty("productAttrs")).getProperty("attrIds")).getBuckets(); + List attrIds = ((ParsedLongTerms) ((ParsedFilter) ((ParsedNested) productAttrs).getAggregations().get("productAttrs")).getAggregations().get("attrIds")).getBuckets(); List attrList = new ArrayList<>(); for (Terms.Bucket attrId : attrIds) { EsProductRelatedInfo.ProductAttr attr = new EsProductRelatedInfo.ProductAttr(); attr.setAttrId((Long) attrId.getKey()); List attrValueList = new ArrayList<>(); - List attrValues = ((StringTerms) attrId.getAggregations().get("attrValues")).getBuckets(); - List attrNames = ((StringTerms) attrId.getAggregations().get("attrNames")).getBuckets(); + List attrValues = ((ParsedStringTerms) attrId.getAggregations().get("attrValues")).getBuckets(); + List attrNames = ((ParsedStringTerms) attrId.getAggregations().get("attrNames")).getBuckets(); for (Terms.Bucket attrValue : attrValues) { attrValueList.add(attrValue.getKeyAsString()); } diff --git a/mall-search/src/main/resources/application-dev.yml b/mall-search/src/main/resources/application-dev.yml index f1a2b81..9804340 100644 --- a/mall-search/src/main/resources/application-dev.yml +++ b/mall-search/src/main/resources/application-dev.yml @@ -16,4 +16,14 @@ spring: elasticsearch: repositories: enabled: true - cluster-nodes: 127.0.0.1:9300 \ No newline at end of file + elasticsearch: + rest: + uris: localhost:9200 + +logging: + level: + root: info + com.macro.mall: debug + +logstash: + host: localhost \ No newline at end of file diff --git a/mall-search/src/main/resources/application-prod.yml b/mall-search/src/main/resources/application-prod.yml index 7d40256..2fd0771 100644 --- a/mall-search/src/main/resources/application-prod.yml +++ b/mall-search/src/main/resources/application-prod.yml @@ -12,12 +12,20 @@ spring: stat-view-servlet: #访问监控网页的登录用户名和密码 login-username: druid login-password: druid - data: elasticsearch: repositories: enabled: true - cluster-nodes: es:9300 + elasticsearch: + rest: + uris: es:9200 logging: - path: /var/logs #配置日志生成路径 + file: + path: /var/logs + level: + root: info + com.macro.mall: info + +logstash: + host: logstash \ No newline at end of file diff --git a/mall-search/src/main/resources/application.yml b/mall-search/src/main/resources/application.yml index 7fad5de..3e55585 100644 --- a/mall-search/src/main/resources/application.yml +++ b/mall-search/src/main/resources/application.yml @@ -1,4 +1,6 @@ spring: + application: + name: mall-search profiles: active: dev #默认为开发环境 @@ -10,10 +12,5 @@ mybatis: - classpath:dao/*.xml - classpath*:com/**/mapper/*.xml -logging: - level: - root: info - com.macro.mall: debug - diff --git a/mall-search/src/test/java/com/macro/mall/search/MallSearchApplicationTests.java b/mall-search/src/test/java/com/macro/mall/search/MallSearchApplicationTests.java index ab1f90e..cf4661a 100644 --- a/mall-search/src/test/java/com/macro/mall/search/MallSearchApplicationTests.java +++ b/mall-search/src/test/java/com/macro/mall/search/MallSearchApplicationTests.java @@ -2,14 +2,12 @@ package com.macro.mall.search; import com.macro.mall.search.dao.EsProductDao; import com.macro.mall.search.domain.EsProduct; -import com.macro.mall.search.repository.EsProductRepository; -import org.elasticsearch.action.search.SearchResponse; import org.junit.Test; import org.junit.runner.RunWith; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.boot.test.context.SpringBootTest; -import org.springframework.data.elasticsearch.core.ElasticsearchTemplate; -import org.springframework.data.elasticsearch.core.ResultsExtractor; +import org.springframework.data.elasticsearch.core.ElasticsearchRestTemplate; +import org.springframework.data.elasticsearch.core.IndexOperations; import org.springframework.test.context.junit4.SpringRunner; import java.util.List; @@ -21,7 +19,7 @@ public class MallSearchApplicationTests { @Autowired private EsProductDao productDao; @Autowired - private ElasticsearchTemplate elasticsearchTemplate; + private ElasticsearchRestTemplate elasticsearchTemplate; @Test public void contextLoads() { } @@ -32,8 +30,9 @@ public class MallSearchApplicationTests { } @Test public void testEsProductMapping(){ - elasticsearchTemplate.putMapping(EsProduct.class); - Map mapping = elasticsearchTemplate.getMapping(EsProduct.class); + IndexOperations indexOperations = elasticsearchTemplate.indexOps(EsProduct.class); + indexOperations.putMapping(indexOperations.createMapping(EsProduct.class)); + Map mapping = indexOperations.getMapping(); System.out.println(mapping); } diff --git a/mall-security/src/main/java/com/macro/mall/security/config/RedisConfig.java b/mall-security/src/main/java/com/macro/mall/security/config/RedisConfig.java index 7fbb664..52bb3f8 100644 --- a/mall-security/src/main/java/com/macro/mall/security/config/RedisConfig.java +++ b/mall-security/src/main/java/com/macro/mall/security/config/RedisConfig.java @@ -1,63 +1,15 @@ package com.macro.mall.security.config; -import com.fasterxml.jackson.annotation.JsonAutoDetect; -import com.fasterxml.jackson.annotation.PropertyAccessor; -import com.fasterxml.jackson.databind.ObjectMapper; -import org.springframework.cache.annotation.CachingConfigurerSupport; +import com.macro.mall.common.config.BaseRedisConfig; import org.springframework.cache.annotation.EnableCaching; -import org.springframework.context.annotation.Bean; import org.springframework.context.annotation.Configuration; -import org.springframework.data.redis.cache.RedisCacheConfiguration; -import org.springframework.data.redis.cache.RedisCacheManager; -import org.springframework.data.redis.cache.RedisCacheWriter; -import org.springframework.data.redis.connection.RedisConnectionFactory; -import org.springframework.data.redis.core.RedisTemplate; -import org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer; -import org.springframework.data.redis.serializer.RedisSerializationContext; -import org.springframework.data.redis.serializer.RedisSerializer; -import org.springframework.data.redis.serializer.StringRedisSerializer; - -import java.time.Duration; /** - * Redis相关配置 + * Redis配置类 * Created by macro on 2020/3/2. */ @EnableCaching @Configuration -public class RedisConfig extends CachingConfigurerSupport { - - @Bean - public RedisTemplate redisTemplate(RedisConnectionFactory redisConnectionFactory) { - RedisSerializer serializer = redisSerializer(); - RedisTemplate redisTemplate = new RedisTemplate<>(); - redisTemplate.setConnectionFactory(redisConnectionFactory); - redisTemplate.setKeySerializer(new StringRedisSerializer()); - redisTemplate.setValueSerializer(serializer); - redisTemplate.setHashKeySerializer(new StringRedisSerializer()); - redisTemplate.setHashValueSerializer(serializer); - redisTemplate.afterPropertiesSet(); - return redisTemplate; - } - - @Bean - public RedisSerializer redisSerializer() { - //创建JSON序列化器 - Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer<>(Object.class); - ObjectMapper objectMapper = new ObjectMapper(); - objectMapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY); - objectMapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL); - serializer.setObjectMapper(objectMapper); - return serializer; - } - - @Bean - public RedisCacheManager redisCacheManager(RedisConnectionFactory redisConnectionFactory) { - RedisCacheWriter redisCacheWriter = RedisCacheWriter.nonLockingRedisCacheWriter(redisConnectionFactory); - //设置Redis缓存有效期为1天 - RedisCacheConfiguration redisCacheConfiguration = RedisCacheConfiguration.defaultCacheConfig() - .serializeValuesWith(RedisSerializationContext.SerializationPair.fromSerializer(redisSerializer())).entryTtl(Duration.ofDays(1)); - return new RedisCacheManager(redisCacheWriter, redisCacheConfiguration); - } +public class RedisConfig extends BaseRedisConfig { } diff --git a/pom.xml b/pom.xml index 76a551b..f5fb922 100644 --- a/pom.xml +++ b/pom.xml @@ -22,7 +22,7 @@ org.springframework.boot spring-boot-starter-parent - 2.1.7.RELEASE + 2.3.0.RELEASE @@ -42,11 +42,11 @@ 1.6.0 1.3.7 3.4.6 - 8.0.16 - 2.1.5.RELEASE + 8.0.15 + 2.3.0.RELEASE 0.9.0 2.5.0 - 4.8 + 5.3 3.0.10 20.0 1.0-SNAPSHOT @@ -55,10 +55,6 @@ - - org.springframework.boot - spring-boot-starter-web - org.springframework.boot spring-boot-starter-actuator @@ -73,12 +69,17 @@ test - com.github.pagehelper - pagehelper-spring-boot-starter + cn.hutool + hutool-all - com.alibaba - druid-spring-boot-starter + org.projectlombok + lombok + + + org.springframework.boot + spring-boot-configuration-processor + true