From 3fd0ce2baa638658078fa8f3a7e2b54858921065 Mon Sep 17 00:00:00 2001 From: sikadi <13315935+sikadi_love@user.noreply.gitee.com> Date: Sun, 19 Nov 2023 21:39:38 +0800 Subject: [PATCH] =?UTF-8?q?=E5=88=9D=E5=A7=8B=E5=8C=96?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 38 ++++++ Dockerfile | 20 +++ fate-firm-common/.gitignore | 38 ++++++ fate-firm-common/pom.xml | 44 ++++++ .../main/java/com/fate/firm/domain/Firm.java | 68 ++++++++++ fate-firm-remote/.gitignore | 38 ++++++ fate-firm-remote/pom.xml | 27 ++++ ...ot.autoconfigure.AutoConfiguration.imports | 0 fate-firm-server/.gitignore | 38 ++++++ fate-firm-server/pom.xml | 127 ++++++++++++++++++ .../java/com/fate/firm/FirmApplication.java | 26 ++++ .../fate/firm/controller/FirmController.java | 65 +++++++++ .../java/com/fate/firm/mapper/FirmMapper.java | 23 ++++ .../com/fate/firm/service/FirmService.java | 28 ++++ .../firm/service/impl/FirmServiceImpl.java | 72 ++++++++++ .../src/main/resources/banner.txt | 2 + .../src/main/resources/bootstrap.yml | 28 ++++ .../src/main/resources/logback.xml | 74 ++++++++++ .../src/main/resources/mapper/FirmXml.xml | 9 ++ pom.xml | 32 +++++ 20 files changed, 797 insertions(+) create mode 100644 .gitignore create mode 100644 Dockerfile create mode 100644 fate-firm-common/.gitignore create mode 100644 fate-firm-common/pom.xml create mode 100644 fate-firm-common/src/main/java/com/fate/firm/domain/Firm.java create mode 100644 fate-firm-remote/.gitignore create mode 100644 fate-firm-remote/pom.xml create mode 100644 fate-firm-remote/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports create mode 100644 fate-firm-server/.gitignore create mode 100644 fate-firm-server/pom.xml create mode 100644 fate-firm-server/src/main/java/com/fate/firm/FirmApplication.java create mode 100644 fate-firm-server/src/main/java/com/fate/firm/controller/FirmController.java create mode 100644 fate-firm-server/src/main/java/com/fate/firm/mapper/FirmMapper.java create mode 100644 fate-firm-server/src/main/java/com/fate/firm/service/FirmService.java create mode 100644 fate-firm-server/src/main/java/com/fate/firm/service/impl/FirmServiceImpl.java create mode 100644 fate-firm-server/src/main/resources/banner.txt create mode 100644 fate-firm-server/src/main/resources/bootstrap.yml create mode 100644 fate-firm-server/src/main/resources/logback.xml create mode 100644 fate-firm-server/src/main/resources/mapper/FirmXml.xml create mode 100644 pom.xml diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/.gitignore @@ -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 \ No newline at end of file diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..c7f5eda --- /dev/null +++ b/Dockerfile @@ -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"] diff --git a/fate-firm-common/.gitignore b/fate-firm-common/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/fate-firm-common/.gitignore @@ -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 \ No newline at end of file diff --git a/fate-firm-common/pom.xml b/fate-firm-common/pom.xml new file mode 100644 index 0000000..27e6229 --- /dev/null +++ b/fate-firm-common/pom.xml @@ -0,0 +1,44 @@ + + + 4.0.0 + + com.fate + fate-modules-firm + 3.6.3 + + + firm-modules-firm-common + + + 17 + 17 + UTF-8 + + + + + com.fate + fate-common-core + 3.6.3 + + + com.fate + fate-common-redis + 3.6.3 + + + org.projectlombok + lombok + + + com.fasterxml.jackson.core + jackson-annotations + + + org.springframework.boot + spring-boot-actuator-autoconfigure + + + diff --git a/fate-firm-common/src/main/java/com/fate/firm/domain/Firm.java b/fate-firm-common/src/main/java/com/fate/firm/domain/Firm.java new file mode 100644 index 0000000..3b9d0ff --- /dev/null +++ b/fate-firm-common/src/main/java/com/fate/firm/domain/Firm.java @@ -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; + +/** + *

+ * 企业公司 + *

+ * + * @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; + +} diff --git a/fate-firm-remote/.gitignore b/fate-firm-remote/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/fate-firm-remote/.gitignore @@ -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 \ No newline at end of file diff --git a/fate-firm-remote/pom.xml b/fate-firm-remote/pom.xml new file mode 100644 index 0000000..75959dc --- /dev/null +++ b/fate-firm-remote/pom.xml @@ -0,0 +1,27 @@ + + + 4.0.0 + + com.fate + fate-modules-firm + 3.6.3 + + + fate-modules-firm-remote + + + 17 + 17 + UTF-8 + + + + com.fate + firm-modules-firm-common + 3.6.3 + + + + diff --git a/fate-firm-remote/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports b/fate-firm-remote/src/main/resources/META-INF/spring/org.springframework.boot.autoconfigure.AutoConfiguration.imports new file mode 100644 index 0000000..e69de29 diff --git a/fate-firm-server/.gitignore b/fate-firm-server/.gitignore new file mode 100644 index 0000000..5ff6309 --- /dev/null +++ b/fate-firm-server/.gitignore @@ -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 \ No newline at end of file diff --git a/fate-firm-server/pom.xml b/fate-firm-server/pom.xml new file mode 100644 index 0000000..4705870 --- /dev/null +++ b/fate-firm-server/pom.xml @@ -0,0 +1,127 @@ + + + 4.0.0 + + com.fate + fate-modules-firm + 3.6.3 + + + fate-modules-firm-server + + + 17 + 17 + UTF-8 + + + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-discovery + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-nacos-config + + + + + com.alibaba.cloud + spring-cloud-starter-alibaba-sentinel + + + + + org.springframework.boot + spring-boot-starter-actuator + + + + + io.springfox + springfox-swagger-ui + ${swagger.fox.version} + + + + + mysql + mysql-connector-java + + + + + com.fate + fate-common-datasource + 3.6.3 + + + + + com.fate + fate-common-datascope + 3.6.3 + + + + + com.fate + fate-common-log + 3.6.3 + + + + + com.fate + fate-common-swagger + 3.6.3 + + + + + com.fate + fate-common-security + 3.6.3 + + + + + + com.fate + firm-modules-firm-common + 3.6.3 + + + + + com.fate + fate-modules-firm-remote + 3.6.3 + + + + + ${project.artifactId} + + + org.springframework.boot + spring-boot-maven-plugin + + + + repackage + + + + + + + + diff --git a/fate-firm-server/src/main/java/com/fate/firm/FirmApplication.java b/fate-firm-server/src/main/java/com/fate/firm/FirmApplication.java new file mode 100644 index 0000000..a49c36a --- /dev/null +++ b/fate-firm-server/src/main/java/com/fate/firm/FirmApplication.java @@ -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); + } +} diff --git a/fate-firm-server/src/main/java/com/fate/firm/controller/FirmController.java b/fate-firm-server/src/main/java/com/fate/firm/controller/FirmController.java new file mode 100644 index 0000000..485e00d --- /dev/null +++ b/fate-firm-server/src/main/java/com/fate/firm/controller/FirmController.java @@ -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; + +/** + *

+ * 企业公司 前端控制器 + *

+ * + * @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(@RequestBody Firm firm){ + List list = firmService.listSel(firm); + return Result.success(list); + } + + @GetMapping("/listAll") + public Result> listAll(){ + + List list = firmService.listAll(); + + return Result.success(list); + } + + + + +} + diff --git a/fate-firm-server/src/main/java/com/fate/firm/mapper/FirmMapper.java b/fate-firm-server/src/main/java/com/fate/firm/mapper/FirmMapper.java new file mode 100644 index 0000000..05b7e5b --- /dev/null +++ b/fate-firm-server/src/main/java/com/fate/firm/mapper/FirmMapper.java @@ -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; + +/** + *

+ * 企业公司 Mapper 接口 + *

+ * + * @author sikadi + * @since 2023-11-18 06:27:02 + */ +@Mapper +public interface FirmMapper extends BaseMapper { + + List listAll(); + +} diff --git a/fate-firm-server/src/main/java/com/fate/firm/service/FirmService.java b/fate-firm-server/src/main/java/com/fate/firm/service/FirmService.java new file mode 100644 index 0000000..16af196 --- /dev/null +++ b/fate-firm-server/src/main/java/com/fate/firm/service/FirmService.java @@ -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; + + +/** + *

+ * 企业公司 服务类 + *

+ * + * @author sikadi + * @since 2023-11-18 06:27:02 + */ +public interface FirmService extends IService { + + Result addList(Firm firm); + + Result updateLL(Firm firm); + + List listSel(Firm firm); + + + List listAll(); +} diff --git a/fate-firm-server/src/main/java/com/fate/firm/service/impl/FirmServiceImpl.java b/fate-firm-server/src/main/java/com/fate/firm/service/impl/FirmServiceImpl.java new file mode 100644 index 0000000..e8cd023 --- /dev/null +++ b/fate-firm-server/src/main/java/com/fate/firm/service/impl/FirmServiceImpl.java @@ -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; + +/** + *

+ * 企业公司 服务实现类 + *

+ * + * @author sikadi + * @since 2023-11-18 06:27:02 + */ +@Service +public class FirmServiceImpl extends ServiceImpl 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 listSel(Firm firm) { + LambdaQueryWrapper 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 list = firmMapper.selectList(queryWrapper); + return list; + } + + @Override + public List listAll() { + return firmMapper.listAll(); + } +} diff --git a/fate-firm-server/src/main/resources/banner.txt b/fate-firm-server/src/main/resources/banner.txt new file mode 100644 index 0000000..0dd5eee --- /dev/null +++ b/fate-firm-server/src/main/resources/banner.txt @@ -0,0 +1,2 @@ +Spring Boot Version: ${spring-boot.version} +Spring Application Name: ${spring.application.name} diff --git a/fate-firm-server/src/main/resources/bootstrap.yml b/fate-firm-server/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..fcbdcfe --- /dev/null +++ b/fate-firm-server/src/main/resources/bootstrap.yml @@ -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 diff --git a/fate-firm-server/src/main/resources/logback.xml b/fate-firm-server/src/main/resources/logback.xml new file mode 100644 index 0000000..6bb7325 --- /dev/null +++ b/fate-firm-server/src/main/resources/logback.xml @@ -0,0 +1,74 @@ + + + + + + + + + + + ${log.pattern} + + + + + + ${log.path}/info.log + + + + ${log.path}/info.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + INFO + + ACCEPT + + DENY + + + + + ${log.path}/error.log + + + + ${log.path}/error.%d{yyyy-MM-dd}.log + + 60 + + + ${log.pattern} + + + + ERROR + + ACCEPT + + DENY + + + + + + + + + + + + + + + + + + diff --git a/fate-firm-server/src/main/resources/mapper/FirmXml.xml b/fate-firm-server/src/main/resources/mapper/FirmXml.xml new file mode 100644 index 0000000..7141104 --- /dev/null +++ b/fate-firm-server/src/main/resources/mapper/FirmXml.xml @@ -0,0 +1,9 @@ + + + + + + diff --git a/pom.xml b/pom.xml new file mode 100644 index 0000000..d17e291 --- /dev/null +++ b/pom.xml @@ -0,0 +1,32 @@ + + + 4.0.0 + + + com.fate + fate-modules + 3.6.3 + + + 3.6.3 + + + + fate-modules-firm + pom + + fate-firm-common + fate-firm-server + fate-firm-remote + + + + + 17 + 17 + UTF-8 + + +