当前位置:   article > 正文

SpringBoot整合数据可视化大屏使用_springboot大屏

springboot大屏

1 前言

DataV数据可视化是使用可视化应用的方式来分析并展示庞杂数据的产品。DataV旨让更多的人看到数据可视化的魅力,帮助非专业的工程师通过图形化的界面轻松搭建专业水准的可视化应用,满足您会议展览、业务监控、风险预警、地理信息分析等多种业务的展示需求,

部分效果图如下所示:

2 版本要求

工具

版本

备注

JDK

1.8

强制要求

Maven

3.5+

MySQL

5.7.8 +

强制要求

Redis

3.2 +

3 实现步骤

3.1 创建Springboot项目

这个就不仔细介绍了,需要的可以去百度

3.2 引入依赖

pom.xml文件如图:

  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  3. xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
  4. <modelVersion>4.0.0</modelVersion>
  5. <parent>
  6. <groupId>org.springframework.boot</groupId>
  7. <artifactId>spring-boot-starter-parent</artifactId>
  8. <version>2.7.0</version>
  9. <relativePath/> <!-- lookup parent from repository -->
  10. </parent>
  11. <groupId>com.wkf</groupId>
  12. <artifactId>datav</artifactId>
  13. <version>0.0.1-SNAPSHOT</version>
  14. <name>datav</name>
  15. <description>datav</description>
  16. <properties>
  17. <java.version>8</java.version>
  18. <mybatisplus.version>3.5.3</mybatisplus.version>
  19. <magic.version>2.0.1</magic.version>
  20. </properties>
  21. <dependencies>
  22. <!-- springboot 依赖 -->
  23. <dependency>
  24. <groupId>org.springframework.boot</groupId>
  25. <artifactId>spring-boot-starter-web</artifactId>
  26. </dependency>
  27. <dependency>
  28. <groupId>org.springframework.boot</groupId>
  29. <artifactId>spring-boot-starter-test</artifactId>
  30. <scope>test</scope>
  31. </dependency>
  32. <dependency>
  33. <groupId>org.springframework.boot</groupId>
  34. <artifactId>spring-boot-configuration-processor</artifactId>
  35. <optional>true</optional>
  36. </dependency>
  37. <dependency>
  38. <groupId>io.springfox</groupId>
  39. <artifactId>springfox-boot-starter</artifactId>
  40. <version>3.0.0</version>
  41. </dependency>
  42. <!-- license -->
  43. <dependency>
  44. <groupId>org.smartboot.license</groupId>
  45. <artifactId>license-client</artifactId>
  46. <version>1.0.4</version>
  47. </dependency>
  48. <!-- html页面 -->
  49. <dependency>
  50. <groupId>org.springframework.boot</groupId>
  51. <artifactId>spring-boot-starter-thymeleaf</artifactId>
  52. </dependency>
  53. <!-- hutool工具类 -->
  54. <dependency>
  55. <groupId>cn.hutool</groupId>
  56. <artifactId>hutool-all</artifactId>
  57. <version>5.8.12</version>
  58. </dependency>
  59. <!-- mybatis start -->
  60. <!-- mysql驱动 -->
  61. <dependency>
  62. <groupId>mysql</groupId>
  63. <artifactId>mysql-connector-java</artifactId>
  64. <version>${mysql.version}</version>
  65. </dependency>
  66. <dependency>
  67. <groupId>com.baomidou</groupId>
  68. <artifactId>mybatis-plus-boot-starter</artifactId>
  69. <version>${mybatisplus.version}</version>
  70. </dependency>
  71. <dependency>
  72. <groupId>com.baomidou</groupId>
  73. <artifactId>mybatis-plus-extension</artifactId>
  74. <version>${mybatisplus.version}</version>
  75. </dependency>
  76. <!-- 多数据源 -->
  77. <dependency>
  78. <groupId>com.baomidou</groupId>
  79. <artifactId>dynamic-datasource-spring-boot-starter</artifactId>
  80. <version>3.5.1</version>
  81. </dependency>
  82. <!-- mysql驱动 -->
  83. <!-- mybatis end -->
  84. <!-- lombok -->
  85. <dependency>
  86. <groupId>org.projectlombok</groupId>
  87. <artifactId>lombok</artifactId>
  88. <version>RELEASE</version>
  89. <scope>compile</scope>
  90. </dependency>
  91. <!-- Valid校验 -->
  92. <dependency>
  93. <groupId>org.hibernate.validator</groupId>
  94. <artifactId>hibernate-validator</artifactId>
  95. <version>6.0.16.Final</version>
  96. <scope>compile</scope>
  97. </dependency>
  98. <dependency>
  99. <groupId>javax.validation</groupId>
  100. <artifactId>validation-api</artifactId>
  101. <version>2.0.1.Final</version>
  102. </dependency>
  103. <!-- 低代码 -->
  104. <dependency>
  105. <groupId>org.ssssssss</groupId>
  106. <artifactId>magic-api-spring-boot-starter</artifactId>
  107. <version>${magic.version}</version>
  108. <exclusions>
  109. <exclusion>
  110. <artifactId>magic-editor</artifactId>
  111. <groupId>org.ssssssss</groupId>
  112. </exclusion>
  113. </exclusions>
  114. </dependency>
  115. </dependencies>
  116. <build>
  117. <plugins>
  118. <plugin>
  119. <groupId>org.springframework.boot</groupId>
  120. <artifactId>spring-boot-maven-plugin</artifactId>
  121. </plugin>
  122. </plugins>
  123. </build>
  124. </project>

3.3 修改yml文件

yml文件如图:

  1. server:
  2. port: 8090
  3. spring:
  4. datasource:
  5. driverClassName: com.mysql.cj.jdbc.Driver
  6. dynamic:
  7. primary: localhost80
  8. datasource:
  9. localhost80:
  10. url: jdbc:mysql://127.0.0.1:3304/datav?allowMultiQueries=true&useUnicode=true&characterEncoding=UTF-8&useSSL=false&serverTimezone=GMT%2B8
  11. username: root
  12. password: 123456
  13. hikari:
  14. minimum-idle: 20
  15. maximum-pool-size: 300
  16. #大屏可视化
  17. datav:
  18. img-path: /img/
  19. mybatis-plus:
  20. mapper-locations: classpath*:mapper/**/*.xml
  21. typeAliasesPackage: com.wkf.datav.entity.**
  22. configuration:
  23. call-setters-on-nulls: true
  24. log-impl: org.apache.ibatis.logging.stdout.StdOutImpl
  25. # 关闭 mybatis-plus banner
  26. global-config:
  27. banner: false

3.4 数据库表结构

数据库表结构如图所示:

  1. CREATE TABLE `data_visual` (
  2. `id` bigint NOT NULL,
  3. `background_url` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  4. `category` bigint DEFAULT NULL,
  5. `password` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  6. `status` bigint DEFAULT NULL,
  7. `title` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  8. PRIMARY KEY (`id`) USING BTREE
  9. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
  10. CREATE TABLE `data_visual_category` (
  11. `id` bigint NOT NULL,
  12. `category_key` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  13. `category_value` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  14. PRIMARY KEY (`id`) USING BTREE
  15. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
  16. CREATE TABLE `data_visual_config` (
  17. `id` bigint NOT NULL,
  18. `component` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
  19. `detail` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
  20. `visual_id` bigint DEFAULT NULL,
  21. PRIMARY KEY (`id`) USING BTREE
  22. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;
  23. CREATE TABLE `data_visual_map` (
  24. `id` bigint NOT NULL,
  25. `data` longtext CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci,
  26. `name` varchar(255) CHARACTER SET utf8mb4 COLLATE utf8mb4_general_ci DEFAULT NULL,
  27. PRIMARY KEY (`id`) USING BTREE
  28. ) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COLLATE=utf8mb4_general_ci ROW_FORMAT=DYNAMIC;

3.5 添加静态文件(html,js,css等)

3.5.1 在resource下的templates文件夹添加index.html文件

  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4. <meta charset="utf-8">
  5. <meta http-equiv="X-UA-Compatible" content="IE=edge">
  6. <meta name="viewport" content="width=device-width,initial-scale=1">
  7. <meta http-equiv="DataV-Build-Version" content="2023-03-16 12:27:52">
  8. <meta http-equiv="Pragma" content="no-cache">
  9. <meta http-equiv="Cache-Control" content="no-cache">
  10. <meta http-equiv="Expires" content="0">
  11. <link rel="stylesheet" href="/cdn/iconfont/iconfont.css">
  12. <link rel="stylesheet" href=&#
声明:本文内容由网友自发贡献,不代表【wpsshop博客】立场,版权归原作者所有,本站不承担相应法律责任。如您发现有侵权的内容,请联系我们。转载请注明出处:https://www.wpsshop.cn/w/黑客灵魂/article/detail/808524
推荐阅读
相关标签
  

闽ICP备14008679号