master
冯凯 2023-11-21 14:17:36 +08:00
commit 555698236d
19 changed files with 712 additions and 0 deletions

46
.gitignore vendored 100644
View File

@ -0,0 +1,46 @@
######################################################################
# Build Tools
.gradle
/build/
!gradle/wrapper/gradle-wrapper.jar
target/
!.mvn/wrapper/maven-wrapper.jar
######################################################################
# IDE
### STS ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
### IntelliJ IDEA ###
.idea
*.iws
*.iml
*.ipr
### JRebel ###
rebel.xml
### NetBeans ###
nbproject/private/
build/*
nbbuild/
dist/
nbdist/
.nb-gradle/
######################################################################
# Others
*.log
*.xml.versionsBackup
*.swp
!*/build/*.java
!*/build/*.html
!*/build/*.xml

18
Dockerfile 100644
View File

@ -0,0 +1,18 @@
#起始镜像
FROM anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/openjdk:17-8.6
#暴露端口号
EXPOSE 10014
#挂载目录的位置
VOLUME /home/logs/vehicle-firm-server
#构建复制外部文件到docker
COPY vehicle-firm-server/target/vehicle-firm-server.jar /home/app.jar
#工作目录 exec -it 进入容器内部后的默认的起始目录
WORKDIR /home
ENV TIME_ZONE Asia/Shanghai
#指定东八区
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > /etc/timezone
#启动java 程序
ENTRYPOINT ["java","-Dfile.encoding=UTF-8","-jar","/home/app.jar"]

27
pom.xml 100644
View File

@ -0,0 +1,27 @@
<?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>
<parent>
<groupId>com.dragon</groupId>
<artifactId>dragon-modules</artifactId>
<version>3.6.3</version>
</parent>
<groupId>com.dragon</groupId>
<artifactId>dragon-vehicle-firm</artifactId>
<version>3.6.3</version>
<packaging>pom</packaging>
<description>dragon-vehicle-firm车辆公司管理模块</description>
<modules>
<module>vehicle-firm-common</module>
<module>vehicle-firm-remote</module>
<module>vehicle-firm-server</module>
</modules>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
</project>

View File

@ -0,0 +1,26 @@
<?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>
<parent>
<groupId>com.dragon</groupId>
<artifactId>dragon-vehicle-firm</artifactId>
<version>3.6.3</version>
</parent>
<version>3.6.3</version>
<artifactId>vehicle-firm-common</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.dragon</groupId>
<artifactId>dragon-common-core</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,85 @@
package com.dragon.vehicle.firm.domain.cache;
import com.dragon.common.core.annotation.Excel;
import com.dragon.common.core.web.domain.BaseEntity;
import com.dragon.vehicle.firm.domain.common.FirmInfo;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/21 10:51
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class FirmInfoCache{
/**
*
*/
private String firmId;
/**
*
*/
private String firmName;
/**
*
*/
private String firmTel;
/**
*
*/
@Excel(name = "企业联系地址")
private String firmAddress;
/**
*
*/
private String firmRepresentative;
/**
*
*/
private String firmRepresentativePhone;
/**
*
*/
private String firmRepresentativeId;
/**
*
*/
private String firmBank;
/**
*
*/
private String firmBankBranch;
/**
*
*/
private String firmBankAccount;
/**
*
*/
private String firmBusinessLicense;
/**
*
*/
private String firmSocialCredit;
/**
* id
*/
private Long createBy;
public static FirmInfoCache getCache(FirmInfo firmInfo) {
return FirmInfoCache.builder()
.firmName(firmInfo.getFirmName())
.firmTel(firmInfo.getFirmTel())
.firmAddress(firmInfo.getFirmAddress()).
build();
}
}

View File

@ -0,0 +1,85 @@
package com.dragon.vehicle.firm.domain.common;
import com.dragon.common.core.annotation.Excel;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/21 10:41
*/
@Data
@Builder
@AllArgsConstructor
@NoArgsConstructor
public class FirmInfo {
/**
*
*/
@Excel(name = "编号")
private String firmId;
/**
*
*/
@Excel(name = "企业名称")
private String firmName;
/**
*
*/
@Excel(name = "企业联系方式")
private String firmTel;
/**
*
*/
@Excel(name = "企业联系地址")
private String firmAddress;
/**
*
*/
@Excel(name = "法定代表人")
private String firmRepresentative;
/**
*
*/
@Excel(name = "法人联系方式")
private String firmRepresentativePhone;
/**
*
*/
@Excel(name = "法人身份证号")
private String firmRepresentativeId;
/**
*
*/
@Excel(name = "公司开户银行")
private String firmBank;
/**
*
*/
@Excel(name = "开户行支行")
private String firmBankBranch;
/**
*
*/
@Excel(name = "银行账户")
private String firmBankAccount;
/**
*
*/
@Excel(name = "企业营业执照号")
private String firmBusinessLicense;
/**
*
*/
@Excel(name = "统一社会信用代码")
private String firmSocialCredit;
/**
*id
*/
private Long createBy;
}

View File

@ -0,0 +1,26 @@
<?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>
<parent>
<groupId>com.dragon</groupId>
<artifactId>dragon-vehicle-firm</artifactId>
<version>3.6.3</version>
</parent>
<version>3.6.3</version>
<artifactId>vehicle-firm-remote</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.dragon</groupId>
<artifactId>vehicle-firm-common</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,10 @@
package dragon.vehicle.firm.remote;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/20 13:40
*/
public interface RemoteFirmService {
}

View File

@ -0,0 +1,14 @@
package dragon.vehicle.firm.remote.factory;
import dragon.vehicle.firm.remote.RemoteFirmService;
import org.springframework.stereotype.Component;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/20 13:40
*/
@Component
public class RemoteFirmServiceFallbackFactory implements RemoteFirmService {
}

View File

@ -0,0 +1 @@
dragon.vehicle.firm.remote.factory.RemoteFirmServiceFallbackFactory

View File

@ -0,0 +1,118 @@
<?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>
<parent>
<groupId>com.dragon</groupId>
<artifactId>dragon-vehicle-firm</artifactId>
<version>3.6.3</version>
</parent>
<version>3.6.3</version>
<artifactId>vehicle-firm-server</artifactId>
<properties>
<maven.compiler.source>17</maven.compiler.source>
<maven.compiler.target>17</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
</properties>
<dependencies>
<dependency>
<groupId>com.dragon</groupId>
<artifactId>vehicle-firm-common</artifactId>
<version>3.6.3</version>
</dependency>
<!-- SpringCloud Alibaba Nacos -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-discovery</artifactId>
</dependency>
<!-- SpringCloud Alibaba Nacos Config -->
<dependency>
<groupId>com.alibaba.cloud</groupId>
<artifactId>spring-cloud-starter-alibaba-nacos-config</artifactId>
</dependency>
<!-- SpringCloud Alibaba 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>
<!-- Swagger UI -->
<dependency>
<groupId>io.springfox</groupId>
<artifactId>springfox-swagger-ui</artifactId>
<version>${swagger.fox.version}</version>
</dependency>
<!-- Mysql Connector -->
<dependency>
<groupId>com.mysql</groupId>
<artifactId>mysql-connector-j</artifactId>
</dependency>
<!-- Dragon Common DataSource -->
<dependency>
<groupId>com.dragon</groupId>
<artifactId>dragon-common-datasource</artifactId>
</dependency>
<!-- Dragon Common DataScope -->
<dependency>
<groupId>com.dragon</groupId>
<artifactId>dragon-common-datascope</artifactId>
</dependency>
<!-- Dragon Common Log -->
<dependency>
<groupId>com.dragon</groupId>
<artifactId>dragon-common-log</artifactId>
</dependency>
<!-- Dragon Common Swagger -->
<dependency>
<groupId>com.dragon</groupId>
<artifactId>dragon-common-swagger</artifactId>
</dependency>
<dependency>
<groupId>com.dragon</groupId>
<artifactId>dragon-file-remote</artifactId>
</dependency>
<dependency>
<groupId>com.dragon</groupId>
<artifactId>dragon-system-remote</artifactId>
</dependency>
</dependencies>
<build>
<finalName>${project.artifactId}</finalName>
<plugins>
<plugin>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-maven-plugin</artifactId>
<executions>
<execution>
<goals>
<goal>repackage</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-deploy-plugin</artifactId>
<configuration>
<skip>true</skip>
</configuration>
</plugin>
<plugin><groupId>org.apache.maven.plugins</groupId><artifactId>maven-compiler-plugin</artifactId><configuration><source>16</source><target>16</target></configuration></plugin>
</plugins>
</build>
</project>

View File

@ -0,0 +1,24 @@
package dragon.vehicle.firm.server;
import com.dragon.common.security.annotation.EnableCustomConfig;
import com.dragon.common.security.annotation.EnableDragonFeignClients;
import com.dragon.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/20 9:01
*/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableDragonFeignClients
@SpringBootApplication
public class DragonVehicleFirmApplication {
public static void main(String[] args) {
SpringApplication.run(DragonVehicleFirmApplication.class, args);
System.out.println("车辆firm模块启动成功=====================");
}
}

View File

@ -0,0 +1,41 @@
package dragon.vehicle.firm.server.controller;
import com.dragon.common.core.domain.Result;
import com.dragon.common.security.utils.SecurityUtils;
import com.dragon.vehicle.firm.domain.cache.FirmInfoCache;
import dragon.vehicle.firm.server.service.FirmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/21 13:52
*/
@RestController
@RequestMapping("/firm")
public class FirmController {
/**
*service
*/
@Autowired
private FirmService firmService;
/***
* @description: userId
* @param: * @param userId
* @return: Result<FirmInfoCache>
* @author
* @date: 2023/11/21 13:55
*/
@GetMapping("/by/userId")
public Result<FirmInfoCache> getFirmInfoByUserId(){
Long userId = SecurityUtils.getUserId();
FirmInfoCache firmInfoCache=firmService.getFirmInfoByUserId(userId);
return Result.success(firmInfoCache);
}
}

View File

@ -0,0 +1,15 @@
package dragon.vehicle.firm.server.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.dragon.vehicle.firm.domain.common.FirmInfo;
import org.apache.ibatis.annotations.Mapper;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/21 13:57
*/
@Mapper
public interface FirmMapper extends BaseMapper<FirmInfo> {
}

View File

@ -0,0 +1,24 @@
package dragon.vehicle.firm.server.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.dragon.vehicle.firm.domain.cache.FirmInfoCache;
import com.dragon.vehicle.firm.domain.common.FirmInfo;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/21 13:57
*/
public interface FirmService extends IService<FirmInfo> {
/***
* @description: userId
* @param: * @param userId
* @return: Result<FirmInfoCache>
* @author
* @date: 2023/11/21 13:55
*/
FirmInfoCache getFirmInfoByUserId(Long userId);
}

View File

@ -0,0 +1,48 @@
package dragon.vehicle.firm.server.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.dragon.common.redis.service.RedisService;
import com.dragon.vehicle.firm.domain.cache.FirmInfoCache;
import com.dragon.vehicle.firm.domain.common.FirmInfo;
import dragon.vehicle.firm.server.mapper.FirmMapper;
import dragon.vehicle.firm.server.service.FirmService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.Assert;
/**
* @author
* @version 1.0
* @description:
* @date 2023/11/21 13:57
*/
@Service
public class FirmServiceImpl extends ServiceImpl<FirmMapper, FirmInfo> implements FirmService {
@Autowired
private FirmMapper firmMapper;
@Autowired
private RedisService redisService;
/***
* @description: userId
* @param: * @param userId
* @return: Result<FirmInfoCache>
* @author
* @date: 2023/11/21 13:55
*/
@Override
public FirmInfoCache getFirmInfoByUserId(Long userId) {
FirmInfoCache firmInfoCache=null;
if (redisService.hasKey("firm"+userId)){
firmInfoCache=redisService.getCacheObject("firm"+userId);
}
LambdaQueryWrapper<FirmInfo> queryWrapper = new LambdaQueryWrapper<>();
Assert.notNull(userId,"用户不能为空");
queryWrapper.eq(FirmInfo::getCreateBy,userId);
firmInfoCache= FirmInfoCache.getCache(firmMapper.selectOne(queryWrapper));
return firmInfoCache;
}
}

View File

@ -0,0 +1,2 @@
Spring Boot Version: ${spring-boot.version}
Spring Application Name: ${spring.application.name}

View File

@ -0,0 +1,28 @@
# Tomcat
server:
port: 10014
# Spring
spring:
application:
# 应用名称
name: dragon-vehicle-firm
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 10.100.1.5:8848
config:
# 配置中心地址
server-addr: 10.100.1.5:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
mybatis-plus:
configuration:
log-impl: org.apache.ibatis.logging.stdout.StdOutImpl

View File

@ -0,0 +1,74 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration scan="true" scanPeriod="60 seconds" debug="false">
<!-- 日志存放路径 -->
<property name="log.path" value="./logs/dragon-vehicle-firm"/>
<!-- 日志输出格式 -->
<property name="log.pattern" value="%d{HH:mm:ss.SSS} [%thread] %-5level %logger{20} - [%method,%line] - %msg%n"/>
<!-- 控制台输出 -->
<appender name="console" class="ch.qos.logback.core.ConsoleAppender">
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
</appender>
<!-- 系统日志输出 -->
<appender name="file_info" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/info.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/info.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>INFO</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<appender name="file_error" class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>${log.path}/error.log</file>
<!-- 循环政策:基于时间创建日志文件 -->
<rollingPolicy class="ch.qos.logback.core.rolling.TimeBasedRollingPolicy">
<!-- 日志文件名格式 -->
<fileNamePattern>${log.path}/error.%d{yyyy-MM-dd}.log</fileNamePattern>
<!-- 日志最大的历史 60天 -->
<maxHistory>60</maxHistory>
</rollingPolicy>
<encoder>
<pattern>${log.pattern}</pattern>
</encoder>
<filter class="ch.qos.logback.classic.filter.LevelFilter">
<!-- 过滤的级别 -->
<level>ERROR</level>
<!-- 匹配时的操作:接收(记录) -->
<onMatch>ACCEPT</onMatch>
<!-- 不匹配时的操作:拒绝(不记录) -->
<onMismatch>DENY</onMismatch>
</filter>
</appender>
<!-- 系统模块日志级别控制 -->
<logger name="com.dragon" level="info"/>
<!-- Spring日志级别控制 -->
<logger name="org.springframework" level="warn"/>
<root level="info">
<appender-ref ref="console"/>
</root>
<!--系统操作日志-->
<root level="info">
<appender-ref ref="file_info"/>
<appender-ref ref="file_error"/>
</root>
</configuration>