Phase 1 #17: Spring Cloud Alibaba 微服务框架搭建

- Maven 父工程 wm-parent (Spring Boot 3.3.5 + Cloud 2023.0.3 + Alibaba 2023.0.1)
- 12个子模块: wm-common/gateway/base/iot/data-engine/bpm/production/revenue/patrol/bi/notify/job
- wm-common: 统一响应 R<T> + 全局异常处理 + BusinessException
- wm-gateway: Spring Cloud Gateway 路由配置(7个微服务路由)
- 集成: Nacos(注册/配置) + PostgreSQL + Redis + Kafka + Sa-Token + MyBatis-Plus + Knife4j
- docker-compose.yml: 一键启动10个中间件(PG+PostGIS/TDengine/Redis/Kafka/EMQX/Nacos/ES/Kibana/MinIO/GeoServer)
This commit is contained in:
bot_pm
2026-06-14 13:14:07 +08:00
parent 57e4898e87
commit e929f65948
39 changed files with 933 additions and 0 deletions
+184
View File
@@ -0,0 +1,184 @@
version: '3.8'
services:
# ==================== 基础设施 ====================
postgres:
image: postgis/postgis:16-3.4
container_name: wm-postgres
environment:
POSTGRES_DB: water_management
POSTGRES_USER: water
POSTGRES_PASSWORD: water123
ports:
- "5432:5432"
volumes:
- pgdata:/var/lib/postgresql/data
healthcheck:
test: ["CMD-SHELL", "pg_isready -U water"]
interval: 10s
timeout: 5s
retries: 5
tdengine:
image: tdengine/tdengine:3.3.3.0
container_name: wm-tdengine
ports:
- "6030:6030"
- "6041:6041"
- "6043:6043"
environment:
TAOS_FQDN: tdengine
volumes:
- tddata:/var/lib/taos
healthcheck:
test: ["CMD", "taos", "-s", "show databases"]
interval: 10s
timeout: 5s
retries: 5
redis:
image: redis:7-alpine
container_name: wm-redis
ports:
- "6379:6379"
volumes:
- redisdata:/data
healthcheck:
test: ["CMD", "redis-cli", "ping"]
interval: 10s
timeout: 3s
retries: 5
# ==================== 消息队列 ====================
kafka:
image: bitnami/kafka:3.8
container_name: wm-kafka
ports:
- "9092:9092"
environment:
KAFKA_CFG_NODE_ID: 0
KAFKA_CFG_PROCESS_ROLES: controller,broker
KAFKA_CFG_CONTROLLER_QUORUM_VOTERS: 0@kafka:9093
KAFKA_CFG_LISTENERS: PLAINTEXT://:9092,CONTROLLER://:9093
KAFKA_CFG_ADVERTISED_LISTENERS: PLAINTEXT://${KAFKA_ADVERTISED:-localhost}:9092
KAFKA_CFG_LISTENER_SECURITY_PROTOCOL_MAP: CONTROLLER:PLAINTEXT,PLAINTEXT:PLAINTEXT
KAFKA_CFG_CONTROLLER_LISTENER_NAMES: CONTROLLER
KAFKA_CFG_AUTO_CREATE_TOPICS_ENABLE: "true"
volumes:
- kafkadata:/bitnami/kafka
healthcheck:
test: ["CMD-SHELL", "kafka-topics.sh --bootstrap-server localhost:9092 --list"]
interval: 15s
timeout: 10s
retries: 5
# ==================== 物联网 MQTT ====================
emqx:
image: emqx/emqx:5.7.2
container_name: wm-emqx
ports:
- "1883:1883"
- "8083:8083"
- "18083:18083"
environment:
EMQX_DASHBOARD__DEFAULT_USERNAME: admin
EMQX_DASHBOARD__DEFAULT_PASSWORD: public
volumes:
- emqxdata:/opt/emqx/data
healthcheck:
test: ["CMD", "emqx", "ping"]
interval: 10s
timeout: 5s
retries: 5
# ==================== 服务注册/配置 ====================
nacos:
image: nacos/nacos-server:v2.3.2
container_name: wm-nacos
environment:
MODE: standalone
PREFER_HOST_MODE: hostname
ports:
- "8848:8848"
- "9848:9848"
volumes:
- nacosdata:/home/nacos/data
healthcheck:
test: ["CMD-SHELL", "curl -s http://localhost:8848/nacos/v1/console/health/readiness"]
interval: 15s
timeout: 5s
retries: 5
# ==================== 搜索引擎 ====================
elasticsearch:
image: elasticsearch:8.15.0
container_name: wm-es
environment:
discovery.type: single-node
xpack.security.enabled: "false"
"ES_JAVA_OPTS": "-Xms512m -Xmx512m"
ports:
- "9200:9200"
volumes:
- esdata:/usr/share/elasticsearch/data
kibana:
image: kibana:8.15.0
container_name: wm-kibana
ports:
- "5601:5601"
environment:
ELASTICSEARCH_HOSTS: http://elasticsearch:9200
depends_on:
- elasticsearch
# ==================== 对象存储 ====================
minio:
image: minio/minio:latest
container_name: wm-minio
ports:
- "9000:9000"
- "9001:9001"
environment:
MINIO_ROOT_USER: minioadmin
MINIO_ROOT_PASSWORD: minioadmin
volumes:
- miniodata:/data
command: server /data --console-address ":9001"
healthcheck:
test: ["CMD", "curl", "-f", "http://localhost:9000/minio/health/live"]
interval: 10s
timeout: 5s
retries: 5
# ==================== GIS 地图服务 ====================
geoserver:
image: docker.osgeo.org/geoserver:2.25.2
container_name: wm-geoserver
ports:
- "8081:8080"
environment:
INSTALL_EXTENSIONS: "true"
STABLE_EXTENSIONS: "wps,csw"
GEOSERVER_ADMIN_USER: admin
GEOSERVER_ADMIN_PASSWORD: geoserver
volumes:
- geoserverdata:/opt/geoserver_data
profiles:
- gis
healthcheck:
test: ["CMD-SHELL", "curl -s http://localhost:8080/geoserver/web/"]
interval: 20s
timeout: 10s
retries: 3
volumes:
pgdata:
tddata:
redisdata:
kafkadata:
emqxdata:
nacosdata:
esdata:
miniodata:
geoserverdata:
+121
View File
@@ -0,0 +1,121 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0
https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.3.5</version>
<relativePath/>
</parent>
<groupId>com.water</groupId>
<artifactId>wm-parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<packaging>pom</packaging>
<name>智慧水务管理系统</name>
<description>精河县供水工程综合管理平台</description>
<properties>
<java.version>17</java.version>
<spring-cloud.version>2023.0.3</spring-cloud.version>
<spring-cloud-alibaba.version>2023.0.1.0</spring-cloud-alibaba.version>
<mybatis-plus.version>3.5.7</mybatis-plus.version>
<sa-token.version>1.39.0</sa-token.version>
<hutool.version>5.8.29</hutool.version>
<knife4j.version>4.5.0</knife4j.version>
<easyexcel.version>3.3.4</easyexcel.version>
<postgis.version>2023.1.0</postgis.version>
<minio.version>8.5.10</minio.version>
</properties>
<modules>
<module>wm-common</module>
<module>wm-gateway</module>
<module>wm-base</module>
<module>wm-iot</module>
<module>wm-data-engine</module>
<module>wm-bpm</module>
<module>wm-production</module>
<module>wm-revenue</module>
<module>wm-patrol</module>
<module>wm-bi</module>
<module>wm-notify</module>
<module>wm-job</module>
</modules>
<dependencyManagement>
<dependencies>
<dependency>
<groupId>org.springframework.cloud</groupId>
<artifactId>spring-cloud-dependencies</artifactId>
<version>${spring-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-alibaba-dependencies</artifactId>
<version>${spring-cloud-alibaba.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.baomidou</groupId>
<artifactId>mybatis-plus-spring-boot3-starter</artifactId>
<version>${mybatis-plus.version}</version>
</dependency>
<dependency>
<groupId>cn.dev33</groupId>
<artifactId>sa-token-spring-boot3-starter</artifactId>
<version>${sa-token.version}</version>
</dependency>
<dependency>
<groupId>cn.hutool</groupId>
<artifactId>hutool-all</artifactId>
<version>${hutool.version}</version>
</dependency>
<dependency>
<groupId>com.github.xiaoymin</groupId>
<artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId>
<version>${knife4j.version}</version>
</dependency>
<dependency>
<groupId>com.alibaba</groupId>
<artifactId>easyexcel</artifactId>
<version>${easyexcel.version}</version>
</dependency>
<dependency>
<groupId>net.postgis</groupId>
<artifactId>postgis-jdbc</artifactId>
<version>${postgis.version}</version>
</dependency>
<dependency>
<groupId>io.minio</groupId>
<artifactId>minio</artifactId>
<version>${minio.version}</version>
</dependency>
<dependency>
<groupId>com.water</groupId>
<artifactId>wm-common</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<optional>true</optional>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
</project>
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.water</groupId><artifactId>wm-parent</artifactId><version>1.0.0-SNAPSHOT</version></parent>
<artifactId>wm-base</artifactId>
<dependencies>
<dependency><groupId>com.water</groupId><artifactId>wm-common</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency>
<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>cn.dev33</groupId><artifactId>sa-token-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId></dependency>
</dependencies>
</project>
@@ -0,0 +1,11 @@
package com.water.base;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BaseApplication {
public static void main(String[] args) {
SpringApplication.run(BaseApplication.class, args);
}
}
@@ -0,0 +1,31 @@
server:
port: 8081
spring:
application:
name: wm-base
datasource:
url: jdbc:postgresql://${PG_HOST:127.0.0.1}:5432/water_management
username: ${PG_USER:water}
password: ${PG_PASS:water123}
driver-class-name: org.postgresql.Driver
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:127.0.0.1}:8848
sa-token:
token-name: Authorization
timeout: 86400
is-concurrent: false
is-share: false
token-style: uuid
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml
global-config:
db-config:
id-type: auto
logic-delete-field: deleted
logic-delete-value: 1
logic-not-delete-value: 0
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.water</groupId><artifactId>wm-parent</artifactId><version>1.0.0-SNAPSHOT</version></parent>
<artifactId>wm-bi</artifactId>
<dependencies>
<dependency><groupId>com.water</groupId><artifactId>wm-common</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency>
<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>cn.dev33</groupId><artifactId>sa-token-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId></dependency>
</dependencies>
</project>
@@ -0,0 +1,11 @@
package com.water.bi;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BiApplication {
public static void main(String[] args) {
SpringApplication.run(BiApplication.class, args);
}
}
+17
View File
@@ -0,0 +1,17 @@
server:
port: 8088
spring:
application:
name: wm-bi
datasource:
url: jdbc:postgresql://${PG_HOST:127.0.0.1}:5432/water_management
username: ${PG_USER:water}
password: ${PG_PASS:water123}
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:127.0.0.1}:8848
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.water</groupId><artifactId>wm-parent</artifactId><version>1.0.0-SNAPSHOT</version></parent>
<artifactId>wm-bpm</artifactId>
<dependencies>
<dependency><groupId>com.water</groupId><artifactId>wm-common</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency>
<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>cn.dev33</groupId><artifactId>sa-token-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId></dependency>
</dependencies>
</project>
@@ -0,0 +1,11 @@
package com.water.bpm;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class BpmApplication {
public static void main(String[] args) {
SpringApplication.run(BpmApplication.class, args);
}
}
+17
View File
@@ -0,0 +1,17 @@
server:
port: 8084
spring:
application:
name: wm-bpm
datasource:
url: jdbc:postgresql://${PG_HOST:127.0.0.1}:5432/water_management
username: ${PG_USER:water}
password: ${PG_PASS:water123}
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:127.0.0.1}:8848
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml
+15
View File
@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.water</groupId><artifactId>wm-parent</artifactId><version>1.0.0-SNAPSHOT</version></parent>
<artifactId>wm-common</artifactId>
<dependencies>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>com.github.xiaoymin</groupId><artifactId>knife4j-openapi3-jakarta-spring-boot-starter</artifactId></dependency>
<dependency><groupId>cn.hutool</groupId><artifactId>hutool-all</artifactId></dependency>
<dependency><groupId>com.alibaba</groupId><artifactId>easyexcel</artifactId></dependency>
</dependencies>
</project>
@@ -0,0 +1,10 @@
package com.water.common.core.exception;
import lombok.Getter;
@Getter
public class BusinessException extends RuntimeException {
private final int code;
public BusinessException(int code, String message) { super(message); this.code = code; }
public BusinessException(String message) { this(400, message); }
}
@@ -0,0 +1,24 @@
package com.water.common.core.exception;
import com.water.common.core.result.R;
import jakarta.servlet.http.HttpServletRequest;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.RestControllerAdvice;
@Slf4j
@RestControllerAdvice
public class GlobalExceptionHandler {
@ExceptionHandler(BusinessException.class)
public R<Void> handleBusiness(BusinessException e, HttpServletRequest request) {
log.warn("Business exception: {} - {}", e.getCode(), e.getMessage());
return R.fail(e.getCode(), e.getMessage());
}
@ExceptionHandler(Exception.class)
public R<Void> handleException(Exception e, HttpServletRequest request) {
log.error("System exception: {}", e.getMessage(), e);
return R.fail(500, "系统内部错误");
}
}
@@ -0,0 +1,36 @@
package com.water.common.core.result;
import lombok.Data;
import java.io.Serializable;
@Data
public class R<T> implements Serializable {
private int code;
private String message;
private T data;
private long timestamp = System.currentTimeMillis();
public static <T> R<T> ok() {
return ok(null);
}
public static <T> R<T> ok(T data) {
R<T> r = new R<>();
r.code = 200;
r.message = "success";
r.data = data;
return r;
}
public static <T> R<T> fail(int code, String message) {
R<T> r = new R<>();
r.code = code;
r.message = message;
return r;
}
public static <T> R<T> fail(String message) {
return fail(500, message);
}
}
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.water</groupId><artifactId>wm-parent</artifactId><version>1.0.0-SNAPSHOT</version></parent>
<artifactId>wm-data-engine</artifactId>
<dependencies>
<dependency><groupId>com.water</groupId><artifactId>wm-common</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency>
<dependency><groupId>org.springframework.kafka</groupId><artifactId>spring-kafka</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency>
<dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId></dependency>
<dependency><groupId>net.postgis</groupId><artifactId>postgis-jdbc</artifactId></dependency>
</dependencies>
</project>
@@ -0,0 +1,11 @@
package com.water.data_engine;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class DataEngineApplication {
public static void main(String[] args) {
SpringApplication.run(DataEngineApplication.class, args);
}
}
@@ -0,0 +1,17 @@
server:
port: 8083
spring:
application:
name: wm-data-engine
datasource:
url: jdbc:postgresql://${PG_HOST:127.0.0.1}:5432/water_management
username: ${PG_USER:water}
password: ${PG_PASS:water123}
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:127.0.0.1}:8848
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml
+14
View File
@@ -0,0 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.water</groupId><artifactId>wm-parent</artifactId><version>1.0.0-SNAPSHOT</version></parent>
<artifactId>wm-gateway</artifactId>
<dependencies>
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-gateway</artifactId></dependency>
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency>
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId></dependency>
<dependency><groupId>org.springframework.cloud</groupId><artifactId>spring-cloud-starter-loadbalancer</artifactId></dependency>
</dependencies>
</project>
@@ -0,0 +1,13 @@
package com.water.gateway;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.cloud.client.discovery.EnableDiscoveryClient;
@SpringBootApplication
@EnableDiscoveryClient
public class GatewayApplication {
public static void main(String[] args) {
SpringApplication.run(GatewayApplication.class, args);
}
}
@@ -0,0 +1,54 @@
server:
port: 8080
spring:
application:
name: wm-gateway
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:127.0.0.1}:8848
config:
server-addr: ${NACOS_HOST:127.0.0.1}:8848
gateway:
discovery:
locator:
enabled: true
lower-case-service-id: true
routes:
- id: wm-base
uri: lb://wm-base
predicates:
- Path=/api/base/**
filters:
- StripPrefix=1
- id: wm-iot
uri: lb://wm-iot
predicates:
- Path=/api/iot/**
filters:
- StripPrefix=1
- id: wm-production
uri: lb://wm-production
predicates:
- Path=/api/production/**
filters:
- StripPrefix=1
- id: wm-revenue
uri: lb://wm-revenue
predicates:
- Path=/api/revenue/**
filters:
- StripPrefix=1
- id: wm-patrol
uri: lb://wm-patrol
predicates:
- Path=/api/patrol/**
filters:
- StripPrefix=1
- id: wm-bi
uri: lb://wm-bi
predicates:
- Path=/api/bi/**
filters:
- StripPrefix=1
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.water</groupId><artifactId>wm-parent</artifactId><version>1.0.0-SNAPSHOT</version></parent>
<artifactId>wm-iot</artifactId>
<dependencies>
<dependency><groupId>com.water</groupId><artifactId>wm-common</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency>
<dependency><groupId>org.springframework.kafka</groupId><artifactId>spring-kafka</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency>
<dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId></dependency>
<dependency><groupId>net.postgis</groupId><artifactId>postgis-jdbc</artifactId></dependency>
</dependencies>
</project>
@@ -0,0 +1,11 @@
package com.water.iot;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class IotApplication {
public static void main(String[] args) {
SpringApplication.run(IotApplication.class, args);
}
}
+22
View File
@@ -0,0 +1,22 @@
server:
port: 8082
spring:
application:
name: wm-iot
datasource:
url: jdbc:postgresql://${PG_HOST:127.0.0.1}:5432/water_management
username: ${PG_USER:water}
password: ${PG_PASS:water123}
data:
redis:
host: ${REDIS_HOST:127.0.0.1}
port: 6379
kafka:
bootstrap-servers: ${KAFKA_HOST:127.0.0.1}:9092
consumer:
group-id: wm-iot-consumer
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:127.0.0.1}:8848
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.water</groupId><artifactId>wm-parent</artifactId><version>1.0.0-SNAPSHOT</version></parent>
<artifactId>wm-job</artifactId>
<dependencies>
<dependency><groupId>com.water</groupId><artifactId>wm-common</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency>
<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>cn.dev33</groupId><artifactId>sa-token-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId></dependency>
</dependencies>
</project>
@@ -0,0 +1,11 @@
package com.water.job;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class JobApplication {
public static void main(String[] args) {
SpringApplication.run(JobApplication.class, args);
}
}
+17
View File
@@ -0,0 +1,17 @@
server:
port: 8090
spring:
application:
name: wm-job
datasource:
url: jdbc:postgresql://${PG_HOST:127.0.0.1}:5432/water_management
username: ${PG_USER:water}
password: ${PG_PASS:water123}
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:127.0.0.1}:8848
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml
+17
View File
@@ -0,0 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.water</groupId><artifactId>wm-parent</artifactId><version>1.0.0-SNAPSHOT</version></parent>
<artifactId>wm-notify</artifactId>
<dependencies>
<dependency><groupId>com.water</groupId><artifactId>wm-common</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency>
<dependency><groupId>org.springframework.kafka</groupId><artifactId>spring-kafka</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-data-redis</artifactId></dependency>
<dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId></dependency>
<dependency><groupId>net.postgis</groupId><artifactId>postgis-jdbc</artifactId></dependency>
</dependencies>
</project>
@@ -0,0 +1,11 @@
package com.water.notify;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class NotifyApplication {
public static void main(String[] args) {
SpringApplication.run(NotifyApplication.class, args);
}
}
@@ -0,0 +1,17 @@
server:
port: 8089
spring:
application:
name: wm-notify
datasource:
url: jdbc:postgresql://${PG_HOST:127.0.0.1}:5432/water_management
username: ${PG_USER:water}
password: ${PG_PASS:water123}
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:127.0.0.1}:8848
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.water</groupId><artifactId>wm-parent</artifactId><version>1.0.0-SNAPSHOT</version></parent>
<artifactId>wm-patrol</artifactId>
<dependencies>
<dependency><groupId>com.water</groupId><artifactId>wm-common</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency>
<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>cn.dev33</groupId><artifactId>sa-token-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId></dependency>
</dependencies>
</project>
@@ -0,0 +1,11 @@
package com.water.patrol;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class PatrolApplication {
public static void main(String[] args) {
SpringApplication.run(PatrolApplication.class, args);
}
}
@@ -0,0 +1,17 @@
server:
port: 8087
spring:
application:
name: wm-patrol
datasource:
url: jdbc:postgresql://${PG_HOST:127.0.0.1}:5432/water_management
username: ${PG_USER:water}
password: ${PG_PASS:water123}
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:127.0.0.1}:8848
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.water</groupId><artifactId>wm-parent</artifactId><version>1.0.0-SNAPSHOT</version></parent>
<artifactId>wm-production</artifactId>
<dependencies>
<dependency><groupId>com.water</groupId><artifactId>wm-common</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency>
<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>cn.dev33</groupId><artifactId>sa-token-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId></dependency>
</dependencies>
</project>
@@ -0,0 +1,11 @@
package com.water.production;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class ProductionApplication {
public static void main(String[] args) {
SpringApplication.run(ProductionApplication.class, args);
}
}
@@ -0,0 +1,17 @@
server:
port: 8085
spring:
application:
name: wm-production
datasource:
url: jdbc:postgresql://${PG_HOST:127.0.0.1}:5432/water_management
username: ${PG_USER:water}
password: ${PG_PASS:water123}
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:127.0.0.1}:8848
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml
+16
View File
@@ -0,0 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<parent><groupId>com.water</groupId><artifactId>wm-parent</artifactId><version>1.0.0-SNAPSHOT</version></parent>
<artifactId>wm-revenue</artifactId>
<dependencies>
<dependency><groupId>com.water</groupId><artifactId>wm-common</artifactId></dependency>
<dependency><groupId>org.springframework.boot</groupId><artifactId>spring-boot-starter-web</artifactId></dependency>
<dependency><groupId>com.alibaba.cloud</groupId><artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId></dependency>
<dependency><groupId>com.baomidou</groupId><artifactId>mybatis-plus-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>cn.dev33</groupId><artifactId>sa-token-spring-boot3-starter</artifactId></dependency>
<dependency><groupId>org.postgresql</groupId><artifactId>postgresql</artifactId></dependency>
</dependencies>
</project>
@@ -0,0 +1,11 @@
package com.water.revenue;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
@SpringBootApplication
public class RevenueApplication {
public static void main(String[] args) {
SpringApplication.run(RevenueApplication.class, args);
}
}
@@ -0,0 +1,17 @@
server:
port: 8086
spring:
application:
name: wm-revenue
datasource:
url: jdbc:postgresql://${PG_HOST:127.0.0.1}:5432/water_management
username: ${PG_USER:water}
password: ${PG_PASS:water123}
cloud:
nacos:
discovery:
server-addr: ${NACOS_HOST:127.0.0.1}:8848
mybatis-plus:
mapper-locations: classpath*:/mapper/**/*.xml