1、初始化仓库
dev
yinxing 2023-11-15 10:31:59 +08:00
commit b554cc6cc7
16 changed files with 435 additions and 0 deletions

29
.gitignore vendored 100644
View File

@ -0,0 +1,29 @@
*.class
*/logs
#package files
*.war
*.ear
#kdiff3 ignore
target/
#eclipse ignore
.settings/
.project
.classpath
#idea
.idea/
/idea/
*.ipr
*.iml
*.iws
# temp file
*.log
*.cache
*.diff
*.patch
*.tmp
*.versionsBackup

View File

@ -0,0 +1,28 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.hbt.sass</groupId>
<artifactId>hbt-vehicle-management</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hbt-vehicle-management-api</artifactId>
<dependencies>
<!-- hbt Common Security -->
<dependency>
<groupId>com.hbt.onreal</groupId>
<artifactId>hbt-onreal-common-security</artifactId>
</dependency>
<dependency>
<groupId>joda-time</groupId>
<artifactId>joda-time</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,23 @@
package com.hbt.vehicle.management.api;
import com.hbt.common.core.domain.R;
import com.hbt.vehicle.management.api.factory.RemoteVehicleManagementFallbackFactory;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
/**
*
*
* @author hbt
*/
@FeignClient(contextId = "remoteVehicleManagementService", value = "hbt-vehicle-management", fallbackFactory = RemoteVehicleManagementFallbackFactory.class)
public interface RemoteVehicleManagementService
{
/**
*
*
* @return
*/
@GetMapping(value = "/vehicle/action")
R<String> action() ;
}

View File

@ -0,0 +1,26 @@
package com.hbt.vehicle.management.api.factory;
import com.hbt.common.core.domain.R;
import com.hbt.vehicle.management.api.RemoteVehicleManagementService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
*
*
* @author hbt
*/
@Component
public class RemoteVehicleManagementFallbackFactory implements FallbackFactory<RemoteVehicleManagementService>
{
private static final Logger log = LoggerFactory.getLogger(RemoteVehicleManagementFallbackFactory.class);
@Override
public RemoteVehicleManagementService create(Throwable throwable)
{
log.error("template服务调用失败:{}", throwable.getMessage());
return () -> R.fail("调用失败:" + throwable.getMessage());
}
}

View File

@ -0,0 +1,4 @@
FROM 119.45.158.12:5000/mini-java8:latest
COPY target/hbt-template-1.0-SNAPSHOT.jar /app/app.jar
ENV NACOSIP=""
ENTRYPOINT ["sh","-c","java -Dnacos.ip=$NACOSIP -jar /app/app.jar"]

View File

@ -0,0 +1,83 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<groupId>com.hbt.sass</groupId>
<artifactId>hbt-vehicle-management</artifactId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>hbt-vehicle-management-biz</artifactId>
<dependencies>
<!-- SpringCloud Ailibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Ailibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Ailibaba Sentinel -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-sentinel</artifactId>
</dependency>
<!-- SpringBoot Actuator -->
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-actuator</artifactId>
</dependency>
<!-- hbt Common DataSource -->
<dependency>
<groupId>com.hbt.onreal</groupId>
<artifactId>hbt-onreal-common-datasource</artifactId>
</dependency>
<!-- hbt Common Security -->
<dependency>
<groupId>com.hbt.onreal</groupId>
<artifactId>hbt-onreal-common-security</artifactId>
</dependency>
<!-- hbt Common Swagger -->
<dependency>
<groupId>com.hbt.onreal</groupId>
<artifactId>hbt-onreal-common-swagger</artifactId>
</dependency>
<!-- hbt Common log -->
<dependency>
<groupId>com.hbt.onreal</groupId>
<artifactId>hbt-onreal-common-log</artifactId>
</dependency>
<!-- Swagger -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,25 @@
package com.hbt.vehicle.management;
import com.hbt.common.security.annotation.EnableCustomConfig;
import com.hbt.common.security.annotation.EnableRyFeignClients;
import com.hbt.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.web.servlet.ServletComponentScan;
import org.springframework.cloud.client.SpringCloudApplication;
/**
* ,
*/
@EnableCustomConfig
@SpringCloudApplication
@EnableCustomSwagger2
@EnableRyFeignClients
@ServletComponentScan(basePackages = "com.hbt.vehicle.management")
public class vehicleManagementApplication {
public static void main(String[] args)
{
SpringApplication.run(vehicleManagementApplication.class, args);
System.out.println("(♥◠‿◠)ノ゙ 车辆管理系统启动成功 ლ(´ڡ`ლ)゙ ");
}
}

View File

@ -0,0 +1,9 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}
hbt-vehicle-management version: 1.0
_ _ _
| | | | | |
| |__ | |__ | |_ ______ ___ __ _ ___ ___
| '_ \| '_ \| __|______/ __| / _` | / __| / __|
| | | | |_) | |_ \__ \ | (_| | \__ \ \__ \
|_| |_|_.__/ \__| |___/ \__,_| |___/ |___/

View File

@ -0,0 +1,16 @@
# Spring
spring:
cloud:
nacos:
username: nacos
password: zkhbt888
discovery:
# 服务注册地址
server-addr: ${nacos.ip}:8848
config:
# 配置中心地址
server-addr: ${nacos.ip}:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-dataids: application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}

View File

@ -0,0 +1,14 @@
# Tomcat
server:
port: 9404
# Spring
spring:
application:
# 应用名称
name: hbt-vehicle-management
profiles:
# 环境配置
active: dev
nacos:
ip: 119.45.158.12

View File

@ -0,0 +1,4 @@
执行顺序:
template_01_init_struct.sql -- 初始化表结构SQL
template_02_init_data.sql --初始化数据SQL
template_03_init_index.sql --初始化表索引SQL

View File

@ -0,0 +1 @@
-- 第一步初始化表结构

View File

@ -0,0 +1 @@
-- 第二步初始化数据

View File

@ -0,0 +1 @@
-- 第三步初始化表索引

126
pom.xml 100644
View File

@ -0,0 +1,126 @@
<?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 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.hbt.sass</groupId>
<artifactId>hbt-vehicle-management</artifactId>
<version>1.0-SNAPSHOT</version>
<description>template</description>
<modules>
<module>hbt-vehicle-management-api</module>
<module>hbt-vehicle-management-biz</module>
</modules>
<packaging>pom</packaging>
<properties>
<hbt-cloud.version>3.7.0-SNAPSHOT</hbt-cloud.version>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
<java.version>1.8</java.version>
<spring-boot.version>2.7.7</spring-boot.version>
</properties>
<repositories>
<repository>
<id>central</id>
<url>https://maven.aliyun.com/repository/public</url>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
<repository>
<id>maven-public</id>
<url>http://81.70.119.104:8081/repository/maven-public/</url>
<releases>
<enabled>false</enabled>
<updatePolicy>always</updatePolicy>
</releases>
<snapshots>
<enabled>true</enabled>
<updatePolicy>always</updatePolicy>
<checksumPolicy>warn</checksumPolicy>
</snapshots>
</repository>
</repositories>
<pluginRepositories>
<pluginRepository>
<id>maven-public</id>
<url>http://81.70.119.104:8081/repository/maven-public/</url>
<releases>
<enabled>true</enabled>
</releases>
<snapshots>
<enabled>true</enabled>
</snapshots>
</pluginRepository>
</pluginRepositories>
<distributionManagement>
<repository>
<id>maven-public</id>
<url>http://81.70.119.104:8081/repository/maven-releases/</url>
</repository>
<snapshotRepository>
<id>maven-public</id>
<url>http://81.70.119.104:8081/repository/maven-snapshots/</url>
</snapshotRepository>
</distributionManagement>
<dependencyManagement>
<dependencies>
<!-- hbt-cloud 中定义的包不需要再定义 -->
<dependency>
<groupId>com.hbt.onreal</groupId>
<artifactId>hbt-onreal</artifactId>
<version>${hbt-cloud.version}</version>
<type>pom</type>
<scope>import</scope>
</dependency>
<dependency>
<groupId>com.hbt.sass</groupId>
<artifactId>hbt-vehicle-management-api</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<source>${java.version}</source>
<target>${java.version}</target>
<encoding>${project.build.sourceEncoding}</encoding>
</configuration>
</plugin>
</plugins>
<pluginManagement>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<version>${spring-boot.version}</version>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</pluginManagement>
</build>
</project>

45
replace.bat 100644
View File

@ -0,0 +1,45 @@
chcp 65001
@echo off & SetLocal EnableDelayedExpansion
echo 正在清理git文件
@for /r . %%a in (.) do @if exist "%%a/.git" rd /s /q "%%a/.git"
@echo git已经全部删除
set old=template
Set /p new=请输入工程英文简称(如prevention):
Set /p version=请输入onreal版本(如3.7.0):
echo.
echo 正在替换文件内容
:: 替换版本号
for /f %%i in ('dir /b /s /a:-d pom.xml') do (
powershell -Command "(Get-Content %%i -Encoding utf8) -replace '3.7.0-SNAPSHOT', '%version%' | Set-Content %%i -Encoding utf8"
)
:: 将当前目录(包括子目录)下的所有 java 文本中的 template 替换为输入字符
for /f %%i in ('dir /b /s /a:-d *.java,pom.xml,*.yml,*.sql,*.txt,Dockerfile') do (
powershell -Command "(Get-Content %%i -Encoding utf8) -replace '%old%', '%new%' | Set-Content %%i -Encoding utf8"
)
echo 替换文件内容完成
echo.
echo 正在替换文件夹名
for /d /r %%i in (*.*) do (
set t=%%~ni
set t=!t:%old%=%new%!
if not exist "%%~dpi!t!" ren "%%i" "!t!"
)
echo 替换文件夹名完成
echo.
echo 正在替换文件名
for /f %%i in ('dir /a:-d /s /b *.java,pom.xml,*.yml,*.sql,*.txt') do (
set t=%%~ni
set ext=%%~xi
set t=!t:%old%=%new%!
if not exist "%%~dpi!t!" ren "%%i" "!t!!ext!" 2>nul
)
echo 替换文件名完成
echo 替换完成
pause