初始化

master
sikadi 2023-11-19 21:39:38 +08:00
commit 3fd0ce2baa
20 changed files with 797 additions and 0 deletions

38
.gitignore vendored 100644
View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

20
Dockerfile 100644
View File

@ -0,0 +1,20 @@
FROM anolis-registry.cn-zhangjiakou.cr.aliyuncs.com/openanolis/openjdk:17-8.6
# 暴露端口号
EXPOSE 10005/tcp
# 挂载目录位置
VOLUME /home/logs/fate-firm
#构造 复制外部文件到docker 内部
COPY fate-firm-server/target/fate-modules-firm-server.jar /home/app.jar
# 工作目录 exec -it 进来就是默认这个目录1gitn1
WORKDIR /home
RUN ln -snf /usr/share/zoneinfo/$TZ /etc/localtime && echo $TZ > .etc.timezone
# 启动java程序
CMD ["java","-Dfile.encoding=UTF-8","-jar","/home/app.jar"]

38
fate-firm-common/.gitignore vendored 100644
View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

View File

@ -0,0 +1,44 @@
<?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.fate</groupId>
<artifactId>fate-modules-firm</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>firm-modules-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.fate</groupId>
<artifactId>fate-common-core</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>com.fate</groupId>
<artifactId>fate-common-redis</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>
<dependency>
<groupId>com.fasterxml.jackson.core</groupId>
<artifactId>jackson-annotations</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-actuator-autoconfigure</artifactId>
</dependency>
</dependencies>
</project>

View File

@ -0,0 +1,68 @@
package com.fate.firm.domain;
import com.baomidou.mybatisplus.annotation.*;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.*;
import lombok.experimental.SuperBuilder;
import java.util.Date;
/**
* <p>
*
* </p>
*
* @author sikadi
* @since 2023-11-18 06:27:02
*/
@Data
@SuperBuilder
@NoArgsConstructor
@AllArgsConstructor
@TableName("t_firm")
@ApiModel(value = "Firm对象", description = "企业公司")
@EqualsAndHashCode(callSuper = false)
public class Firm {
@ApiModelProperty("企业主键")
@TableId(value = "firm_id", type = IdType.AUTO)
private Integer firmId;
@ApiModelProperty("企业名称")
@TableField("firm_name")
private String firmName;
@ApiModelProperty("企业地址")
@TableField("firm_address")
private String firmAddress;
@ApiModelProperty("企业电话")
@TableField("firm_phone")
private String firmPhone;
@ApiModelProperty("企业类型")
@TableField("firm_right")
private Integer firmRight;
@ApiModelProperty("企业状态")
@TableField("firm_staus")
private Integer firmStaus;
@ApiModelProperty("创建人")
@TableField("create_id")
private Integer createId;
@ApiModelProperty("创建时间")
@TableField(value = "create_time", fill = FieldFill.INSERT)
private Date createTime;
@ApiModelProperty("修改人")
@TableField("update_id")
private Integer updateId;
@ApiModelProperty("修改时间")
@TableField(value = "update_time",fill = FieldFill.INSERT)
private Date updateTime;
}

38
fate-firm-remote/.gitignore vendored 100644
View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

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.fate</groupId>
<artifactId>fate-modules-firm</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>fate-modules-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.fate</groupId>
<artifactId>firm-modules-firm-common</artifactId>
<version>3.6.3</version>
</dependency>
</dependencies>
</project>

38
fate-firm-server/.gitignore vendored 100644
View File

@ -0,0 +1,38 @@
target/
!.mvn/wrapper/maven-wrapper.jar
!**/src/main/**/target/
!**/src/test/**/target/
### IntelliJ IDEA ###
.idea/modules.xml
.idea/jarRepositories.xml
.idea/compiler.xml
.idea/libraries/
*.iws
*.iml
*.ipr
### Eclipse ###
.apt_generated
.classpath
.factorypath
.project
.settings
.springBeans
.sts4-cache
### NetBeans ###
/nbproject/private/
/nbbuild/
/dist/
/nbdist/
/.nb-gradle/
build/
!**/src/main/**/build/
!**/src/test/**/build/
### VS Code ###
.vscode/
### Mac OS ###
.DS_Store

View File

@ -0,0 +1,127 @@
<?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.fate</groupId>
<artifactId>fate-modules-firm</artifactId>
<version>3.6.3</version>
</parent>
<artifactId>fate-modules-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>
<!-- 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>mysql</groupId>
<artifactId>mysql-connector-java</artifactId>
</dependency>
<!-- fate Common DataSource -->
<dependency>
<groupId>com.fate</groupId>
<artifactId>fate-common-datasource</artifactId>
<version>3.6.3</version>
</dependency>
<!-- fate Common DataScope -->
<dependency>
<groupId>com.fate</groupId>
<artifactId>fate-common-datascope</artifactId>
<version>3.6.3</version>
</dependency>
<!-- fate Common Log -->
<dependency>
<groupId>com.fate</groupId>
<artifactId>fate-common-log</artifactId>
<version>3.6.3</version>
</dependency>
<!-- fate Common Swagger -->
<dependency>
<groupId>com.fate</groupId>
<artifactId>fate-common-swagger</artifactId>
<version>3.6.3</version>
</dependency>
<!-- fate Common Swagger -->
<dependency>
<groupId>com.fate</groupId>
<artifactId>fate-common-security</artifactId>
<version>3.6.3</version>
</dependency>
<!-- 商品服务公共11依赖 -->
<dependency>
<groupId>com.fate</groupId>
<artifactId>firm-modules-firm-common</artifactId>
<version>3.6.3</version>
</dependency>
<dependency>
<groupId>com.fate</groupId>
<artifactId>fate-modules-firm-remote</artifactId>
<version>3.6.3</version>
</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>
</plugins>
</build>
</project>

View File

@ -0,0 +1,26 @@
package com.fate.firm;
import com.fate.common.security.annotation.EnableCustomConfig;
import com.fate.common.security.annotation.EnableMyFeignClients;
import com.fate.common.swagger.annotation.EnableCustomSwagger2;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration;
import javax.swing.*;
/**
* @description: TODO
* @author: SIKADI
* @date: 2023/11/19 14:40
**/
@EnableCustomConfig
@EnableCustomSwagger2
@EnableMyFeignClients
@SpringBootApplication(exclude = {DataSourceAutoConfiguration.class})
public class FirmApplication {
public static void main(String[] args) {
SpringApplication.run(FirmApplication.class);
}
}

View File

@ -0,0 +1,65 @@
package com.fate.firm.controller;
import com.fate.common.core.domain.Result;
import com.fate.firm.domain.Firm;
import com.fate.firm.service.FirmService;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import lombok.Getter;
import lombok.extern.log4j.Log4j2;
import org.apache.http.HttpHeaders;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
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;
/**
* <p>
*
* </p>
*
* @author sikadi
* @since 2023-11-18 06:27:02
*/
@RestController
@RequestMapping("/firm")
@Log4j2
public class FirmController {
@Autowired
private FirmService firmService;
@PostMapping("/addList")
public Result addList(@RequestBody Firm firm) {
Result result = firmService.addList(firm);
return Result.success("成功");
}
@PostMapping("/update")
public Result updateLL(@RequestBody Firm firm){
Result result =firmService.updateLL(firm);
return result;
}
@PostMapping("/list")
public Result<List<Firm>> list(@RequestBody Firm firm){
List<Firm> list = firmService.listSel(firm);
return Result.success(list);
}
@GetMapping("/listAll")
public Result<List<Firm>> listAll(){
List<Firm> list = firmService.listAll();
return Result.success(list);
}
}

View File

@ -0,0 +1,23 @@
package com.fate.firm.mapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.fate.firm.domain.Firm;
import org.apache.ibatis.annotations.Mapper;
import java.util.List;
/**
* <p>
* Mapper
* </p>
*
* @author sikadi
* @since 2023-11-18 06:27:02
*/
@Mapper
public interface FirmMapper extends BaseMapper<Firm> {
List<Firm> listAll();
}

View File

@ -0,0 +1,28 @@
package com.fate.firm.service;
import com.baomidou.mybatisplus.extension.service.IService;
import com.fate.common.core.domain.Result;
import com.fate.firm.domain.Firm;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author sikadi
* @since 2023-11-18 06:27:02
*/
public interface FirmService extends IService<Firm> {
Result addList(Firm firm);
Result updateLL(Firm firm);
List<Firm> listSel(Firm firm);
List<Firm> listAll();
}

View File

@ -0,0 +1,72 @@
package com.fate.firm.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fate.common.core.domain.Result;
import com.fate.common.core.utils.StringUtils;
import com.fate.common.security.utils.SecurityUtils;
import com.fate.firm.domain.Firm;
import com.fate.firm.mapper.FirmMapper;
import com.fate.firm.service.FirmService;
import org.apache.poi.util.StringUtil;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Date;
import java.util.List;
/**
* <p>
*
* </p>
*
* @author sikadi
* @since 2023-11-18 06:27:02
*/
@Service
public class FirmServiceImpl extends ServiceImpl<FirmMapper, Firm> implements FirmService {
@Autowired
private FirmMapper firmMapper;
@Override
public Result addList(Firm firm) {
firm.setCreateId(Math.toIntExact(SecurityUtils.getUserId()));
firm.setCreateTime(new Date());
firm.setUpdateId(0);
firm.setUpdateTime(null);
firm.setFirmStaus(1);
int insert = firmMapper.insert(firm);
return insert>0?Result.success("成功"):Result.error("失败");
}
@Override
public Result updateLL(Firm firm) {
firm.setUpdateId(Math.toIntExact(SecurityUtils.getUserId()));
firm.setCreateTime(new Date());
int i = firmMapper.updateById(firm);
return i>0?Result.success("成功"):Result.error("失败");
}
@Override
public List<Firm> listSel(Firm firm) {
LambdaQueryWrapper<Firm> queryWrapper = new LambdaQueryWrapper<>();
if(StringUtils.isNotEmpty(firm.getFirmAddress())){
queryWrapper.like(Firm::getFirmAddress,firm.getFirmAddress());
}
if(StringUtils.isNotEmpty(firm.getFirmPhone())){
queryWrapper.like(Firm::getFirmPhone,firm.getFirmPhone());
}
if(StringUtils.isNotEmpty(firm.getFirmName())){
queryWrapper.like(Firm::getFirmName,firm.getFirmName());
}
List<Firm> list = firmMapper.selectList(queryWrapper);
return list;
}
@Override
public List<Firm> listAll() {
return firmMapper.listAll();
}
}

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: 10005
# Spring
spring:
application:
# 应用名称
name: fate-firm
profiles:
# 环境配置
active: dev
cloud:
nacos:
discovery:
# 服务注册地址
server-addr: 182.254.222.21:8848
config:
# 配置中心地址
server-addr: 184.254.222.21:8848
# 配置文件格式
file-extension: yml
# 共享配置
shared-configs:
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
mybatis:
configuration:
map-underscore-to-camel-case: true

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/fate/firm/wallet" />
<!-- 日志输出格式 -->
<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.bawei" 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>

View File

@ -0,0 +1,9 @@
<?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.fate.firm.mapper.FirmMapper">
<select id="listAll" resultType="com.fate.firm.domain.Firm">
select *
from t_firm
</select>
</mapper>

32
pom.xml 100644
View File

@ -0,0 +1,32 @@
<?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.fate</groupId>
<artifactId>fate-modules</artifactId>
<version>3.6.3</version>
</parent>
<version>3.6.3</version>
<artifactId>fate-modules-firm</artifactId>
<packaging>pom</packaging>
<modules>
<module>fate-firm-common</module>
<module>fate-firm-server</module>
<module>fate-firm-remote</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>