zuihou-admin-cloud 2.7.0 released, many details optimized

2.7.0 version update details:

  1.  fix: After the repair task is started, update the task trigger time, it will not take effect. fix:29
  2.  fix: redis persistence strategy does not affect global configuration
  3.  fix: fix the bug that the uid module may report an error when starting
  4.  feat: Combine ContextHandlerInterceptor, TenantContextHandlerInterceptor, and MdcHandlerInterceptor into HeaderThreadLocalInterceptor, specifically used to process the parameters in the request header and encapsulate it into ThreadLocal
  5.  feat: TokenContextFilter supports separate configuration to ignore tenant and token
  6.  feat: Rename IgnoreTokenProperties to IgnoreProperties, and change the original configuration ʻignore.token.url` to `zuihou.ignore.xxx`
  7.  feat: discard useless unit tests
  8.  feat: Replace StringUtils of apache with StrUtil of hutool
  9.  feat: xss-starter related functions support configuration through configuration files
  10.  feat: SysLog annotation supports getting parameters in the current thread context. Usage #threadLocal.name
  11.  feat: Data injection code structure, comment optimization
  12.  feat: Data injection supports ignoring injection of specified fields
  13.  feat: Code comments are improved, code logic is optimized, and bugs fixed

Introduction:


Microservice scaffolding based on `SpringCloud(Hoxton.SR7)` + `SpringBoot(2.2.9.RELEASE)`, with the ability to freely disable and switch tenant implementation methods. With user management, resource authority management, unified gateway authentication, Xss Anti-cross-site attacks, automatic code generation, multiple storage systems, distributed transactions, distributed timing tasks and other modules, support the parallel development of multi-business systems, support the parallel development of multiple services, and can be used as a back-end service development scaffold. The code is concise and the structure is clear, which is very suitable for learning and use. The core technology adopts Nacos, Fegin, Ribbon, Zuul, Hystrix, JWT Token, Mybatis, SpringBoot, Seata, Sentinel, RabbitMQ, FastDFS and other main frameworks and middleware.

I hope to work hard to create a solution from  SaaS basic framework  -  microservice architecture  -  automated deployment  -  system monitoring  . This project aims to achieve basic capabilities and does not involve specific businesses.

This project aims to realize the code generation function, basic function, common function, and general function of the system through the convention table structure design specification, code writing specification, and module split specification.

 

Architecture diagram:

Tenant model:

Tenant model description advantage Disadvantage Distributed transaction
NONE (non-tenant mode)  No tenants Simple and suitable for independent systems Lack of convenience of tenant system stand by
COLUMN (field mode) Tenants share a database, add fields in the business table to distinguish   Simple, uncomplicated, development without perception  Poor data isolation, poor security, difficult data backup and recovery stand by
SCHEMA (independent schema)  Each tenant has an independent database (schema). When executing sql, dynamically add the schema before the table name Simple, no perception of development, good data isolation The root account of the database must be configured in the configuration file, and complex SQL and SQL nested custom functions are not supported stand by
DATASOURCE (independent data source)  Each tenant has an independent database (data source), and the data source is dynamically switched when the code is executed The database can be deployed independently, with good data isolation, high scalability, and low failure impact Relatively complex, development needs to pay attention to transaction issues when switching data sources, and requires more databases stand by

Features:

 

  1. Tenant management: operation background (zuihou-admin-ui) manages all tenant creation
  2. User Center: organization, position, user data maintenance, reset user password, etc.
  3. Authority management: menu, resource configuration, role management, bind users to roles, authorize menus and resources to roles
  4. Basic configuration: maintenance of dictionary, region, system parameters and other information
  5. Developer management: application management, database monitoring, operation logs, login logs, swagger interface documents, registration centers, various monitoring
  6. Message Center: Send and view messages on this site
  7. SMS Center: Basic SMS configuration of major operators. After configuration, the system has the ability to send SMS
  8. File Center: Provides system attachment upload and storage capabilities, built-in support for local storage, FastDFS storage, Alibaba Cloud storage, and only switching through configuration
  9. Gateway management: current limit capability, access blocking capability (ie hei list)
  10. Process management: common functions of workflow (model management, process deployment, etc.)

Technical point introduction:

 Service authentication:

JWT is used to strengthen the authorization verification of scheduling between services to ensure the security of internal services.

monitor:

Use Spring Boot Admin to monitor the running status of each independent Service; use turbine to view the running status and call frequency of the interface in real time; use Zipkin to view the call chain between each service.

data permission:

Simple data permissions are implemented using the DataScopeInterceptor interceptor based on Mybatis

SaaS's non-sense solution:

Use Mybatis interceptor to achieve the interception of all SQL, COLUMN mode dynamically splicing tenant codes, SCHEMA mode to modify the default Schema, DATASOURCE mode to dynamically switch data sources, so as to achieve the purpose of multi-tenant data isolation. And supports the disabled tenant mode.

Secondary cache:

J2Cache is used to operate the cache, the first level cache uses memory (Caffeine), and the second level cache uses Redis. Since a large number of cache reads will cause the L2 network to become the bottleneck of the entire system, the goal of L1 is to reduce the number of reads to L2. The caching framework is mainly used in a cluster environment. It can also be used on a stand-alone machine to avoid the impact on the back-end business after the cache cold restart caused by the application restart.

Elegant Bean conversion:

Use Dozer components to optimize the conversion of DTO, DO, PO and other objects

Unified front-end and back-end form validation:

Rigorous form validation usually requires both front-end and back-end verification. However, traditional projects can only be tested once for each front and back. After the rule changes, the front and back ends must be modified simultaneously. Therefore, on the basis of hibernate-validator, the initial dependency of Zuihou-validator-starter is encapsulated, and a common interface is provided to obtain the rules that need to verify the form, and then the front-end uses the rules returned by the back-end. If the rules change in the future, only the back-end is required Just modify it.

Anti-cross-site scripting (XSS):

  •      Filter the form parameters in all requests through filters
  •      Filter all application/json type parameters through Json deserializer

Current user information injector:

 User identity injection through annotations

Online API:

Because some functions of native swagger-ui are not friendly enough, the domestic open source knife4j is adopted and a statuser is made to facilitate the use of springboot users.

Code generator:

A set of code generator is customized based on Mybatis-plus-generator. By configuring the annotations of the database fields, it automatically generates enumeration classes, data dictionary annotations, SaveDTO, UpdateDTO, form validation rule annotations, Swagger annotations, etc.

Timed task scheduler:

The function is enhanced based on xxl-jobs. (Such as: sending tasks at specified time, executor and scheduler combined projects, multiple data sources)

Large file/breakpoint/slice resume:

The front-end uses webupload.js and the back-end uses NIO to realize large file breakpoint and fragmented resuming. After starting Eureka, Zuul, and File services, directly open docs/chunkUploadDemo/demo.html for testing. After testing, the local limit stack maximum memory 128M starts the File service, and a large file of 4.6G+ can be successfully uploaded within 5 minutes. The formal service time will be affected by the user bandwidth and server bandwidth, and the time will be relatively long.

Distributed transaction:

Integrate Ali's distributed transaction middleware: seata, to  solve the distributed transaction problems faced by microservices in an  efficient  and intrusive way to the business  .

Gray release:
    
In order to solve frequent service updates and launches , version rollbacks, rapid iteration, and collaborative development within the company, this project uses a modified ribbon load balancing strategy to achieve gray release.     

Automatic injection of associated data:

It is used to solve the pain of inter-table, cross-database, and cross-service paging data attributes or the attributes of a single object to echo associated data. It supports automatic injection of static data attributes (data dictionary) and dynamic primary key data.

Project code address

project gitee github Remarks
Micro service project https://gitee.com/zuihou111/zuihou-admin-cloud https://github.com/zuihou/zuihou-admin-cloud SpringCloud version backend code
Single project https://gitee.com/zuihou111/zuihou-admin-boot https://github.com/zuihou/zuihou-admin-boot SpringBoot version backend code
Tenant background https://gitee.com/zuihou111/zuihou-ui https://github.com/zuihou/zuihou-ui | Front end for customers
Development & operation background https://gitee.com/zuihou111/zuihou-admin-ui https://github.com/zuihou/zuihou-admin-ui Used by the company's internal development & operation & operation and maintenance personnel
Code generator https://gitee.com/zuihou111/zuihou-generator https://github.com/zuihou/zuihou-generator Developers use
Core toolkit https://gitee.com/zuihou111/zuihou-commons https://github.com/zuihou/zuihou-commons Core toolkit

Demonstration address (the demo account has no write permission, only query)

project Demo address Administrator account Ordinary account
Tenant background http://tangyh.top:10000/zuihou-ui zuihou/zuihou test/zuiou
Development & operation background http://tangyh.top:180/zuihou-admin-ui demoAdmin/zuihou no

Guess you like

Origin www.oschina.net/news/119996/zuihou-admin-cloud-2-7-0-released