preface

Jeecg building block report is an open source but not open source code of a custom report, can be based on web page flexible adjustment of report layout, style and other content, without programming, designed for enterprise data analysis, report production; Reduce the threshold for managers to summarize and make reports, and solve all kinds of difficulties in daily management and reporting. However, because the code is not open source, many companies will be in an awkward situation because of the building block report logo, TILTE, routing and so on in commercial use. This paper realizes the integration of building block report based on SpringBoot to achieve its own report project integration. The source code is attached at the end of the article. Because there is code display, so it is recommended to open the PC browsing.

Dry goods

  1. To build SpringBoot Project idea, select File-new-project, Spring Initializr, select the corresponding JDK version, and click Next

Enter the project name, package name, etc. Click Next

Skip selecting default dependencies and go to Next

Select the project location and click Finish to complete the SpringBoot project creation.

2. Configure Maven dependencies. Delete unnecessary configuration dependencies and retain only project configuration dependencies

Add the configuration dependencies required by the report

<parent>
    <groupId>org.springframework.boot</groupId>
    <artifactId>spring-boot-starter-parent</artifactId>
    <version>2.4. 5</version> <relativePath/> <! -- lookup parent from repository --> </parent> <properties> <java.version>1.8</java.version> <! -- DB driver --> <postgresql.version>42.26.</postgresql.version>
    <ojdbc6.version>11.2. 03.</ojdbc6.version>
    <sqljdbc4.version>4.0</sqljdbc4.version>
    <mysql-connector-java.version>8.020.</mysql-connector-java.version>
    <minio.version>8.03.</minio.version> </properties> <dependencies> <! -- JimuReport --> <dependency> <groupId>org.jeecgframework.jimureport</groupId> <artifactId>spring-boot-starter-jimureport</artifactId> <version>1.31.-beta4</version> </dependency> <! -- SpringBoot--> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-web</artifactId> </dependency> <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-freemarker</artifactId> </dependency> <! -- minio oss--> <dependency> <groupId>io.minio</groupId> <artifactId>minio</artifactId> <version>${minio.version}</version> <optional>true</optional> </dependency> <! -- Database driver --> <! --mysql--> <dependency> <groupId>mysql</groupId> <artifactId>mysql-connector-java</artifactId> <version>${mysql-connector-java.version}</version> <scope>runtime</scope> </dependency> <! <dependency> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-starter-data-jpa</artifactId> </dependency> </dependencies> <build> <plugins> <plugin> <groupId>org.springframework.boot</groupId> <artifactId>spring-boot-maven-plugin</artifactId> </plugin> <plugin> <groupId>org.apache.maven.plugins</groupId> <artifactId>maven-resources-plugin</artifactId> <version>2.6</version>
        </plugin>
    </plugins>
</build>


Copy the code

3. Configure the YML file

server:
  port: 8080Spring: # configure static resource MVCstatic-path-pattern: /** source: static-locations: classpath:/static/ # com.mysql.cj.jdbc.Driver url: jdbc:mysql://${MYSQL-HOST:ip}:${MYSQL-PORT:port}/${MYSQL-DB:db}? ServerTimezone =UTC&useUnicode=true&characterEncoding= UTF-8 &allowPublicKeyRetrieval=true #JimuReport Base - package: org. Jeecg. Modules. Jmreport. Desreport. Dao * db - type: mysql # JimuReport jeecg upload configuration, # # local | minio | alioss uploadType: local local path: # upload file path: / opt/upload # alioss oss: the endpoint: oss-cn-beijing.aliyuncs.com accessKey: ?? secretKey: ?? staticDomain: ?? bucketName: ?? # minio minio: minio_url: http://minio.jeecg.com minio_name:?? Minio_pass:?? BucketName:?? org.jeecg.modules.jmreport : debugCopy the code

4. Start classes to add sweeping annotations

@SpringBootApplication(scanBasePackages = {"org.jeecg.modules.jmreport", "com.report.customize"})
Copy the code

5. Launch the project to access the printed link to access the report design page

Open the local Maven repository to find org\ JeecgFramework \ jimuReport \spring-boot-starter-jimureport\1.3.1-beta4 block JAR package

Go to jmReport. Go to desReport. Edit FTL files: demo, index, list.

Replace the original block title with the desired title name (for example: XXX report Designer)

Save after editing. Close the internal editor and the compression software prompts you to modify and save. Click OK to save the modification and follow the same rules

After the three files (a total of 4) are modified, go back to IDEA and restart the project. Visit the list page again and find that the title has been modified to custom.

Tile logo and report icon Resources In the static directory of the jmReport desreport_ directory in the corelib directory jiade. JPG is the report icon, logo

Open the static directory, jmReport directory, desreport_ directory, js directory, core directory

Open API. Js

Change the corresponding JMReport to the route name you want to display (for example: report)

7. Nginx configures the proxy

Server {# need to listen port number, if this port number is not occupied, otherwise, restart Nginx error listen9102; Server_name report; Location /report {proxy_pass://ip:port/jmreport;#proxy_redirect off; proxy_set_header Host $proxy_host; #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #proxy_set_header Cookie $http_cookie; } # configure the actual route for static resource (js, CSS, etc.) requests.//ip:port/jmreport;#proxy_redirect off; proxy_set_header Host $proxy_host; #proxy_set_header X-Real-IP $remote_addr; #proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; #proxy_set_header Cookie $http_cookie; }}Copy the code

Access the ports and routes configured by Nginx to automatically forward the custom report content

At this point, the custom report modification configuration work is over, and you can use it happily

This article project source code: gitee.com/bigearchart…

If it is helpful to you, please pay attention to it. Thank you very much