Compare commits

...

3 Commits

31 changed files with 176 additions and 477 deletions

View File

@ -0,0 +1,27 @@
package com.couplet.common.domain.request;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import lombok.ToString;
/**
* @author fufanrui
* @version 1.0
* @description:
* @date 2024/4/4 14:35
*/
@Data
@AllArgsConstructor
@NoArgsConstructor
@ToString
public class RealTimeDataRequest {
private Integer userId;
private String vin;
}

View File

@ -0,0 +1,53 @@
package com.couplet.business.server.controller;
import com.couplet.business.server.service.VehicleDetectionService;
import com.couplet.common.core.domain.Result;
import com.couplet.common.domain.Vehicle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
* @author fufanrui
* @version 1.0
* @description:
* @date 2024/4/4 10:11
*/
@RestController
@RequestMapping("detection")
public class VehicleDetectionController {
@Autowired
private VehicleDetectionService vehicleDetectionService;
/*
* @param :
* @return Result<List<Vehicle>>
* @author
* @description 线
* @date
*/
@PostMapping("/detectionList")
public Result<List<Vehicle>> detectionList() {
return Result.success(vehicleDetectionService.detectionList());
}
/*
* @param vin:
* @return Result<List<Vehicle>>
* @author
* @description vin
* @date
*/
@PostMapping("/findByVin/{vehicleId}")
public Result<List<Vehicle>> findByVin(@PathVariable("vehicleId") Integer vehicleId) {
return Result.success(vehicleDetectionService.findByVin(vehicleId));
}
}

View File

@ -0,0 +1,13 @@
package com.couplet.business.server.mapper;
import com.couplet.common.domain.Vehicle;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
@Mapper
public interface VehicleDetectionMapper {
List<Vehicle> detectionList();
List<Vehicle> findByVin(Integer vehicleId);
}

View File

@ -0,0 +1,13 @@
package com.couplet.business.server.service;
import com.couplet.common.core.domain.Result;
import com.couplet.common.domain.Vehicle;
import java.util.List;
public interface VehicleDetectionService {
List<Vehicle> detectionList();
List<Vehicle> findByVin(Integer vehicleId);
}

View File

@ -0,0 +1,34 @@
package com.couplet.business.server.service.impl;
import com.couplet.business.server.mapper.VehicleDetectionMapper;
import com.couplet.business.server.service.VehicleDetectionService;
import com.couplet.business.server.service.VehicleManageService;
import com.couplet.common.core.domain.Result;
import com.couplet.common.domain.Vehicle;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* @author fufanrui
* @version 1.0
* @description:
* @date 2024/4/4 10:23
*/
@Service
public class VehicleDetectionServiceImpl implements VehicleDetectionService{
@Autowired
private VehicleDetectionMapper vehicleDetectionMapper;
@Override
public List<Vehicle> detectionList() {
return vehicleDetectionMapper.detectionList();
}
@Override
public List<Vehicle> findByVin(Integer vehicleId) {
return vehicleDetectionMapper.findByVin(vehicleId);
}
}

View File

@ -0,0 +1,36 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.couplet.business.server.mapper.VehicleDetectionMapper">
<sql id="selectVehicle">
SELECT
v.vehicle_id,
v.vehicle_type,
v.motor_manufacturer,
v.battery_manufacturer,
v.motor_number,
v.battery_number,
v.vin,
v.vehicle_state,
v.isdelete,
t.vehicle_type_id,
t.vehicle_type_name
FROM
couplet_vehicle v
LEFT JOIN couplet_vehicle_type t ON v.vehicle_type = t.vehicle_type_id
WHERE v.isdelete = 0
</sql>
<select id="detectionList" resultType="com.couplet.common.domain.Vehicle">
<include refid="selectVehicle"/>
AND v.vehicle_state = 1
</select>
<select id="findByVin" resultType="com.couplet.common.domain.Vehicle">
<include refid="selectVehicle"/>
<if test="null!=vin and ''!=vin">
AND v.vehicle_id, = #{vehicleId}
</if>
AND v.vehicle_state = 1
</select>
</mapper>

View File

@ -1,41 +0,0 @@
#!/bin/sh
# 复制项目的文件到对应docker路径便于一键生成镜像。
usage() {
echo "Usage: sh copy.sh"
exit 1
}
# copy sql
echo "begin copy sql "
cp ../sql/ry_20230706.sql ./mysql/db
cp ../sql/ry_config_20220929.sql ./mysql/db
# copy html
echo "begin copy html "
cp -r ../couplet-ui/dist/** ./nginx/html/dist
# copy jar
echo "begin copy couplet-gateway "
cp ../couplet-gateway/target/couplet-gateway.jar ./couplet/gateway/jar
echo "begin copy couplet-auth "
cp ../couplet-auth/target/couplet-auth.jar ./couplet/auth/jar
echo "begin copy couplet-visual "
cp ../couplet-visual/couplet-monitor/target/couplet-visual-monitor.jar ./couplet/visual/monitor/jar
echo "begin copy couplet-modules-system "
cp ../couplet-modules/couplet-system/target/couplet-modules-system.jar ./couplet/modules/system/jar
echo "begin copy couplet-modules-file "
cp ../couplet-modules/couplet-file/target/couplet-modules-file.jar ./couplet/modules/file/jar
echo "begin copy couplet-modules-job "
cp ../couplet-modules/couplet-job/target/couplet-modules-job.jar ./couplet/modules/job/jar
echo "begin copy couplet-modules-gen "
cp ../couplet-modules/couplet-gen/target/couplet-modules-gen.jar ./couplet/modules/gen/jar

View File

@ -1,67 +0,0 @@
#!/bin/sh
# 使用说明,用来提示输入参数
usage() {
echo "Usage: sh 执行脚本.sh [port|base|modules|stop|rm]"
exit 1
}
# 开启所需端口
port(){
firewall-cmd --add-port=80/tcp --permanent
firewall-cmd --add-port=8080/tcp --permanent
firewall-cmd --add-port=8848/tcp --permanent
firewall-cmd --add-port=9848/tcp --permanent
firewall-cmd --add-port=9849/tcp --permanent
firewall-cmd --add-port=6379/tcp --permanent
firewall-cmd --add-port=3306/tcp --permanent
firewall-cmd --add-port=9100/tcp --permanent
firewall-cmd --add-port=9200/tcp --permanent
firewall-cmd --add-port=9201/tcp --permanent
firewall-cmd --add-port=9202/tcp --permanent
firewall-cmd --add-port=9203/tcp --permanent
firewall-cmd --add-port=9300/tcp --permanent
service firewalld restart
}
# 启动基础环境(必须)
base(){
docker-compose up -d couplet-mysql couplet-redis couplet-nacos
}
# 启动程序模块(必须)
modules(){
docker-compose up -d couplet-nginx couplet-gateway couplet-auth couplet-modules-system
}
# 关闭所有环境/模块
stop(){
docker-compose stop
}
# 删除所有环境/模块
rm(){
docker-compose rm
}
# 根据输入参数,选择执行对应方法,不输入则执行使用说明
case "$1" in
"port")
port
;;
"base")
base
;;
"modules")
modules
;;
"stop")
stop
;;
"rm")
rm
;;
*)
usage
;;
esac

View File

@ -1,140 +0,0 @@
version : '3.8'
services:
couplet-nacos:
container_name: couplet-nacos
image: nacos/nacos-server
build:
context: ./nacos
environment:
- MODE=standalone
volumes:
- ./nacos/logs/:/home/nacos/logs
- ./nacos/conf/application.properties:/home/nacos/conf/application.properties
ports:
- "8848:8848"
- "9848:9848"
- "9849:9849"
depends_on:
- couplet-mysql
couplet-mysql:
container_name: couplet-mysql
image: mysql:5.7
build:
context: ./mysql
ports:
- "3306:3306"
volumes:
- ./mysql/conf:/etc/mysql/conf.d
- ./mysql/logs:/logs
- ./mysql/data:/var/lib/mysql
command: [
'mysqld',
'--innodb-buffer-pool-size=80M',
'--character-set-server=utf8mb4',
'--collation-server=utf8mb4_unicode_ci',
'--default-time-zone=+8:00',
'--lower-case-table-names=1'
]
environment:
MYSQL_DATABASE: 'ry-cloud'
MYSQL_ROOT_PASSWORD: password
couplet-redis:
container_name: couplet-redis
image: redis
build:
context: ./redis
ports:
- "6379:6379"
volumes:
- ./redis/conf/redis.conf:/home/couplet/redis/redis.conf
- ./redis/data:/data
command: redis-server /home/couplet/redis/redis.conf
couplet-nginx:
container_name: couplet-nginx
image: nginx
build:
context: ./nginx
ports:
- "80:80"
volumes:
- ./nginx/html/dist:/home/couplet/projects/couplet-ui
- ./nginx/conf/nginx.conf:/etc/nginx/nginx.conf
- ./nginx/logs:/var/log/nginx
- ./nginx/conf.d:/etc/nginx/conf.d
depends_on:
- couplet-gateway
links:
- couplet-gateway
couplet-gateway:
container_name: couplet-gateway
build:
context: ./couplet/gateway
dockerfile: dockerfile
ports:
- "8080:8080"
depends_on:
- couplet-redis
links:
- couplet-redis
couplet-auth:
container_name: couplet-auth
build:
context: ./couplet/auth
dockerfile: dockerfile
ports:
- "9200:9200"
depends_on:
- couplet-redis
links:
- couplet-redis
couplet-modules-system:
container_name: couplet-modules-system
build:
context: ./couplet/modules/system
dockerfile: dockerfile
ports:
- "9201:9201"
depends_on:
- couplet-redis
- couplet-mysql
links:
- couplet-redis
- couplet-mysql
couplet-modules-gen:
container_name: couplet-modules-gen
build:
context: ./couplet/modules/gen
dockerfile: dockerfile
ports:
- "9202:9202"
depends_on:
- couplet-mysql
links:
- couplet-mysql
couplet-modules-job:
container_name: couplet-modules-job
build:
context: ./couplet/modules/job
dockerfile: dockerfile
ports:
- "9203:9203"
depends_on:
- couplet-mysql
links:
- couplet-mysql
couplet-modules-file:
container_name: couplet-modules-file
build:
context: ./couplet/modules/file
dockerfile: dockerfile
ports:
- "9300:9300"
volumes:
- ./couplet/uploadPath:/home/couplet/uploadPath
couplet-visual-monitor:
container_name: couplet-visual-monitor
build:
context: ./couplet/visual/monitor
dockerfile: dockerfile
ports:
- "9100:9100"

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER couplet
# 挂载目录
VOLUME /home/couplet
# 创建目录
RUN mkdir -p /home/couplet
# 指定路径
WORKDIR /home/couplet
# 复制jar文件到路径
COPY ./jar/couplet-auth.jar /home/couplet/couplet-auth.jar
# 启动认证服务
ENTRYPOINT ["java","-jar","couplet-auth.jar"]

View File

@ -1 +0,0 @@
存放认证中心打包好的jar文件用于docker启动应用。

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER couplet
# 挂载目录
VOLUME /home/couplet
# 创建目录
RUN mkdir -p /home/couplet
# 指定路径
WORKDIR /home/couplet
# 复制jar文件到路径
COPY ./jar/couplet-gateway.jar /home/couplet/couplet-gateway.jar
# 启动网关服务
ENTRYPOINT ["java","-jar","couplet-gateway.jar"]

View File

@ -1 +0,0 @@
存放网关模块打包好的jar文件用于docker启动应用。

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER couplet
# 挂载目录
VOLUME /home/couplet
# 创建目录
RUN mkdir -p /home/couplet
# 指定路径
WORKDIR /home/couplet
# 复制jar文件到路径
COPY ./jar/couplet-modules-file.jar /home/couplet/couplet-modules-file.jar
# 启动文件服务
ENTRYPOINT ["java","-jar","couplet-modules-file.jar"]

View File

@ -1 +0,0 @@
存放文件服务打包好的jar文件用于docker启动应用。

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER couplet
# 挂载目录
VOLUME /home/couplet
# 创建目录
RUN mkdir -p /home/couplet
# 指定路径
WORKDIR /home/couplet
# 复制jar文件到路径
COPY ./jar/couplet-modules-gen.jar /home/couplet/couplet-modules-gen.jar
# 启动代码生成服务
ENTRYPOINT ["java","-jar","couplet-modules-gen.jar"]

View File

@ -1 +0,0 @@
存放代码生成打包好的jar文件用于docker启动应用。

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER couplet
# 挂载目录
VOLUME /home/couplet
# 创建目录
RUN mkdir -p /home/couplet
# 指定路径
WORKDIR /home/couplet
# 复制jar文件到路径
COPY ./jar/couplet-modules-job.jar /home/couplet/couplet-modules-job.jar
# 启动定时任务服务
ENTRYPOINT ["java","-jar","couplet-modules-job.jar"]

View File

@ -1 +0,0 @@
存放定时任务打包好的jar文件用于docker启动应用。

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER couplet
# 挂载目录
VOLUME /home/couplet
# 创建目录
RUN mkdir -p /home/couplet
# 指定路径
WORKDIR /home/couplet
# 复制jar文件到路径
COPY ./jar/couplet-modules-system.jar /home/couplet/couplet-modules-system.jar
# 启动系统服务
ENTRYPOINT ["java","-jar","couplet-modules-system.jar"]

View File

@ -1 +0,0 @@
存放系统模块打包好的jar文件用于docker启动应用。

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM openjdk:8-jre
# author
MAINTAINER couplet
# 挂载目录
VOLUME /home/couplet
# 创建目录
RUN mkdir -p /home/couplet
# 指定路径
WORKDIR /home/couplet
# 复制jar文件到路径
COPY ./jar/couplet-visual-monitor.jar /home/couplet/couplet-visual-monitor.jar
# 启动系统服务
ENTRYPOINT ["java","-jar","couplet-visual-monitor.jar"]

View File

@ -1 +0,0 @@
存放监控中心打包好的jar文件用于docker启动应用。

View File

@ -1 +0,0 @@
存放sql目录下的所有脚本用于docker自动执行。

View File

@ -1,7 +0,0 @@
# 基础镜像
FROM mysql:5.7
# author
MAINTAINER couplet
# 执行sql脚本
ADD ./db/*.sql /docker-entrypoint-initdb.d/

View File

@ -1,32 +0,0 @@
spring.datasource.platform=mysql
db.num=1
db.url.0=jdbc:mysql://couplet-mysql:3306/ry-config?characterEncoding=utf8&connectTimeout=1000&socketTimeout=3000&autoReconnect=true&useUnicode=true&useSSL=false&serverTimezone=UTC
db.user=root
db.password=password
nacos.naming.empty-service.auto-clean=true
nacos.naming.empty-service.clean.initial-delay-ms=50000
nacos.naming.empty-service.clean.period-time-ms=30000
management.endpoints.web.exposure.include=*
management.metrics.export.elastic.enabled=false
management.metrics.export.influx.enabled=false
server.tomcat.accesslog.enabled=true
server.tomcat.accesslog.pattern=%h %l %u %t "%r" %s %b %D %{User-Agent}i %{Request-Source}i
server.tomcat.basedir=/home/couplet/nacos/tomcat/logs
nacos.security.ignore.urls=/,/error,/**/*.css,/**/*.js,/**/*.html,/**/*.map,/**/*.svg,/**/*.png,/**/*.ico,/console-ui/public/**,/v1/auth/**,/v1/console/health/**,/actuator/**,/v1/console/server/**
nacos.core.auth.system.type=nacos
nacos.core.auth.enabled=false
nacos.core.auth.default.token.expire.seconds=18000
nacos.core.auth.default.token.secret.key=SecretKey012345678901234567890123456789012345678901234567890123456789
nacos.core.auth.caching.enabled=true
nacos.core.auth.enable.userAgentAuthWhite=false
nacos.core.auth.server.identity.key=serverIdentity
nacos.core.auth.server.identity.value=security
nacos.istio.mcp.server.enabled=false

View File

@ -1,7 +0,0 @@
# 基础镜像
FROM nacos/nacos-server
# author
MAINTAINER couplet
# 复制conf文件到路径
COPY ./conf/application.properties /home/nacos/conf/application.properties

View File

@ -1,41 +0,0 @@
worker_processes 1;
events {
worker_connections 1024;
}
http {
include mime.types;
default_type application/octet-stream;
sendfile on;
keepalive_timeout 65;
server {
listen 80;
server_name localhost;
location / {
root /home/couplet/projects/couplet-ui;
try_files $uri $uri/ /index.html;
index index.html index.htm;
}
location /prod-api/{
proxy_set_header Host $http_host;
proxy_set_header X-Real-IP $remote_addr;
proxy_set_header REMOTE-HOST $remote_addr;
proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for;
proxy_pass http://couplet-gateway:8080/;
}
# 避免actuator暴露
if ($request_uri ~ "/actuator") {
return 403;
}
error_page 500 502 503 504 /50x.html;
location = /50x.html {
root html;
}
}
}

View File

@ -1,15 +0,0 @@
# 基础镜像
FROM nginx
# author
MAINTAINER couplet
# 挂载目录
VOLUME /home/couplet/projects/couplet-ui
# 创建目录
RUN mkdir -p /home/couplet/projects/couplet-ui
# 指定路径
WORKDIR /home/couplet/projects/couplet-ui
# 复制conf文件到路径
COPY ./conf/nginx.conf /etc/nginx/nginx.conf
# 复制html文件到路径
COPY ./html/dist /home/couplet/projects/couplet-ui

View File

@ -1 +0,0 @@
# requirepass 123456

View File

@ -1,13 +0,0 @@
# 基础镜像
FROM redis
# author
MAINTAINER couplet
# 挂载目录
VOLUME /home/couplet/redis
# 创建目录
RUN mkdir -p /home/couplet/redis
# 指定路径
WORKDIR /home/couplet/redis
# 复制conf文件到路径
COPY ./conf/redis.conf /home/couplet/redis/redis.conf