commit 5951164610471f3070c8cabc0f5d998bcbeee281
Author: bai <173792339@qq.com>
Date: Fri Jul 26 09:12:12 2024 +0800
1
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/.idea/.gitignore b/.idea/.gitignore
new file mode 100644
index 0000000..35410ca
--- /dev/null
+++ b/.idea/.gitignore
@@ -0,0 +1,8 @@
+# 默认忽略的文件
+/shelf/
+/workspace.xml
+# 基于编辑器的 HTTP 客户端请求
+/httpRequests/
+# Datasource local storage ignored files
+/dataSources/
+/dataSources.local.xml
diff --git a/.idea/encodings.xml b/.idea/encodings.xml
new file mode 100644
index 0000000..cd2a4b4
--- /dev/null
+++ b/.idea/encodings.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/Project_Default.xml b/.idea/inspectionProfiles/Project_Default.xml
new file mode 100644
index 0000000..48522cb
--- /dev/null
+++ b/.idea/inspectionProfiles/Project_Default.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/misc.xml b/.idea/misc.xml
new file mode 100644
index 0000000..132404b
--- /dev/null
+++ b/.idea/misc.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/vcs.xml b/.idea/vcs.xml
new file mode 100644
index 0000000..94a25f7
--- /dev/null
+++ b/.idea/vcs.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/bwie-bill/pom.xml b/bwie-bill/pom.xml
new file mode 100644
index 0000000..260283f
--- /dev/null
+++ b/bwie-bill/pom.xml
@@ -0,0 +1,82 @@
+
+
+ 4.0.0
+
+ com.bwie
+ billManager
+ 1.0-SNAPSHOT
+
+
+ bwie-bill
+
+
+
+
+ com.bwie
+ bwie-common
+
+
+
+ org.springframework.boot
+ spring-boot-starter-web
+
+
+
+ com.alibaba
+ druid-spring-boot-starter
+ 1.2.8
+
+
+
+ mysql
+ mysql-connector-java
+
+
+
+ org.mybatis.spring.boot
+ mybatis-spring-boot-starter
+ 2.2.2
+
+
+
+ com.github.pagehelper
+ pagehelper-spring-boot-starter
+ 1.4.1
+
+
+
+ org.springframework.boot
+ spring-boot-starter-amqp
+
+
+
+ org.elasticsearch.client
+ elasticsearch-rest-high-level-client
+
+
+
+ org.springframework
+ spring-web
+ 5.3.14
+
+
+ org.springframework.boot
+ spring-boot-starter-test
+ test
+
+
+ com.github.tobato
+ fastdfs-client
+ 1.26.5
+
+
+
+ com.aliyun.oss
+ aliyun-sdk-oss
+ 3.16.3
+
+
+
+
diff --git a/bwie-bill/src/main/java/com/bwie/bill/Application.java b/bwie-bill/src/main/java/com/bwie/bill/Application.java
new file mode 100644
index 0000000..6a5a293
--- /dev/null
+++ b/bwie-bill/src/main/java/com/bwie/bill/Application.java
@@ -0,0 +1,14 @@
+package com.bwie.bill;
+
+import com.bwie.bill.service.impl.BillServiceImpl;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.boot.autoconfigure.SpringBootApplication;
+
+@SpringBootApplication
+public class Application {
+ @Autowired
+ private BillServiceImpl billService;
+ public static void main(String[] args) {
+
+ }
+}
diff --git a/bwie-bill/src/main/java/com/bwie/bill/Bill.java b/bwie-bill/src/main/java/com/bwie/bill/Bill.java
new file mode 100644
index 0000000..5979f19
--- /dev/null
+++ b/bwie-bill/src/main/java/com/bwie/bill/Bill.java
@@ -0,0 +1,12 @@
+package com.bwie.bill;
+
+import lombok.Data;
+
+import java.util.Date;
+
+@Data
+public class Bill {
+ private Integer billid;
+ private Date billdate;
+ private Double billmonery;
+}
diff --git a/bwie-bill/src/main/java/com/bwie/bill/mapper/BillMapper.java b/bwie-bill/src/main/java/com/bwie/bill/mapper/BillMapper.java
new file mode 100644
index 0000000..67e6eb9
--- /dev/null
+++ b/bwie-bill/src/main/java/com/bwie/bill/mapper/BillMapper.java
@@ -0,0 +1,13 @@
+package com.bwie.bill.mapper;
+
+import com.bwie.bill.Bill;
+import org.apache.ibatis.annotations.Mapper;
+
+import java.util.List;
+
+@Mapper
+public interface BillMapper {
+ void addBill(Bill bill);
+ List selectAll();
+
+}
diff --git a/bwie-bill/src/main/java/com/bwie/bill/service/BillService.java b/bwie-bill/src/main/java/com/bwie/bill/service/BillService.java
new file mode 100644
index 0000000..7e72be9
--- /dev/null
+++ b/bwie-bill/src/main/java/com/bwie/bill/service/BillService.java
@@ -0,0 +1,10 @@
+package com.bwie.bill.service;
+
+import com.bwie.bill.Bill;
+
+import java.util.List;
+
+public interface BillService {
+ void addBill(Bill bill);
+ List selectAll();
+}
diff --git a/bwie-bill/src/main/java/com/bwie/bill/service/impl/BillServiceImpl.java b/bwie-bill/src/main/java/com/bwie/bill/service/impl/BillServiceImpl.java
new file mode 100644
index 0000000..f0f1e5a
--- /dev/null
+++ b/bwie-bill/src/main/java/com/bwie/bill/service/impl/BillServiceImpl.java
@@ -0,0 +1,25 @@
+package com.bwie.bill.service.impl;
+
+import com.bwie.bill.Bill;
+import com.bwie.bill.mapper.BillMapper;
+import com.bwie.bill.service.BillService;
+import org.springframework.beans.factory.annotation.Autowired;
+import org.springframework.stereotype.Service;
+
+import java.util.List;
+
+@Service
+public class BillServiceImpl implements BillService {
+ @Autowired
+ private BillMapper billMapper;
+ @Override
+ public void addBill(Bill bill) {
+ billMapper.addBill( bill );
+
+ }
+
+ @Override
+ public List selectAll() {
+ return billMapper.selectAll();
+ }
+}
diff --git a/bwie-bill/src/main/java/com/bwie/bill/util/OssUtil.java b/bwie-bill/src/main/java/com/bwie/bill/util/OssUtil.java
new file mode 100644
index 0000000..d6a7fb1
--- /dev/null
+++ b/bwie-bill/src/main/java/com/bwie/bill/util/OssUtil.java
@@ -0,0 +1,162 @@
+package com.bwie.bill.util;
+
+import com.aliyun.oss.OSS;
+import com.aliyun.oss.OSSClientBuilder;
+import com.aliyun.oss.model.GetObjectRequest;
+import com.aliyun.oss.model.PutObjectRequest;
+import lombok.extern.log4j.Log4j2;
+import org.springframework.web.multipart.MultipartFile;
+
+import java.io.*;
+import java.time.LocalDateTime;
+import java.util.UUID;
+
+/**
+ * Oss服务调用
+ */
+@Log4j2
+public class OssUtil {
+
+ /**
+ * Endpoint 存储对象概述 阿里云主账号AccessKey,accessKeySecret拥有所有API的访问权限 访问路径前缀 存储对象概述
+ */
+ private static String endPoint = "oss-cn-shanghai.aliyuncs.com";
+ private static String accessKeyId = "LTAI5tDbRqXkC5i3SMrCSDcX";
+ private static String accessKeySecret = "XUzMZoHPLsjNLafHsdQnMElBWZATsu";
+ private static String accessPre = "https://mall-bw.oss-cn-shanghai.aliyuncs.com/";
+
+ /**
+ * bucket名称
+ *
+ * @return
+ */
+ private static String bucketName = "mall-bw";
+
+ private static OSS ossClient;
+
+ static {
+ ossClient = new OSSClientBuilder().build(
+ endPoint,
+ accessKeyId,
+ accessKeySecret);
+ log.info("oss服务连接成功!");
+ }
+
+ /**
+ * 默认路径上传本地文件
+ *
+ * @param filePath
+ */
+ public static String uploadFile(String filePath) {
+ return uploadFileForBucket(bucketName, getOssFilePath(filePath), filePath);
+ }
+
+ /**
+ * 默认路径上传multipartFile文件
+ *
+ * @param multipartFile
+ */
+ public static String uploadMultipartFile(MultipartFile multipartFile) {
+ return uploadMultipartFile(bucketName, getOssFilePath(multipartFile.getOriginalFilename()), multipartFile);
+ }
+
+ /**
+ * 上传 multipartFile 类型文件
+ *
+ * @param bucketName
+ * @param ossPath
+ * @param multipartFile
+ */
+ public static String uploadMultipartFile(String bucketName, String ossPath, MultipartFile multipartFile) {
+ InputStream inputStream = null;
+ try {
+ inputStream = multipartFile.getInputStream();
+ } catch (IOException e) {
+ e.printStackTrace();
+ }
+ uploadFileInputStreamForBucket(bucketName, ossPath, inputStream);
+ return accessPre + ossPath;
+ }
+
+ /**
+ * 使用File上传PutObject上传文件 ** 程序默认使用次方法上传
+ *
+ * @param bucketName 实例名称
+ * @param ossPath oss存储路径
+ * @param filePath 本地文件路径
+ */
+ public static String uploadFileForBucket(String bucketName, String ossPath, String filePath) {
+ // 创建PutObjectRequest对象。
+ PutObjectRequest putObjectRequest = new PutObjectRequest(bucketName, ossPath, new File(filePath));
+
+ // 上传
+ ossClient.putObject(putObjectRequest);
+ return accessPre + ossPath;
+ }
+
+ /**
+ * 使用文件流上传到指定的bucket实例
+ *
+ * @param bucketName 实例名称
+ * @param ossPath oss存储路径
+ * @param filePath 本地文件路径
+ */
+ public static String uploadFileInputStreamForBucket(String bucketName, String ossPath, String filePath) {
+
+ // 填写本地文件的完整路径。如果未指定本地路径,则默认从示例程序所属项目对应本地路径中上传文件流。
+ InputStream inputStream = null;
+ try {
+ inputStream = new FileInputStream(filePath);
+ } catch (FileNotFoundException e) {
+ e.printStackTrace();
+ }
+ // 填写Bucket名称和Object完整路径。Object完整路径中不能包含Bucket名称。
+ uploadFileInputStreamForBucket(bucketName, ossPath, inputStream);
+ return accessPre + ossPath;
+ }
+
+ public static void uploadFileInputStreamForBucket(String bucketName, String ossPath, InputStream inputStream) {
+ ossClient.putObject(bucketName, ossPath, inputStream);
+ }
+
+ /**
+ * 下载
+ *
+ * @param ossFilePath
+ * @param filePath
+ */
+ public static void downloadFile(String ossFilePath, String filePath) {
+ downloadFileForBucket(bucketName, ossFilePath, filePath);
+ }
+
+ /**
+ * 下载
+ *
+ * @param bucketName 实例名称
+ * @param ossFilePath oss存储路径
+ * @param filePath 本地文件路径
+ */
+ public static void downloadFileForBucket(String bucketName, String ossFilePath, String filePath) {
+ ossClient.getObject(new GetObjectRequest(bucketName, ossFilePath), new File(filePath));
+ }
+
+ /**
+ * @return
+ */
+ public static String getOssDefaultPath() {
+ LocalDateTime now = LocalDateTime.now();
+ String url =
+ now.getYear() + "/" +
+ now.getMonth() + "/" +
+ now.getDayOfMonth() + "/" +
+ now.getHour() + "/" +
+ now.getMinute() + "/";
+ return url;
+ }
+
+ public static String getOssFilePath(String filePath) {
+ String fileSuf = filePath.substring(filePath.indexOf(".") + 1);
+ return getOssDefaultPath() + UUID.randomUUID().toString() + "." + fileSuf;
+ }
+
+}
diff --git a/bwie-bill/src/main/resources/bootstrap.yml b/bwie-bill/src/main/resources/bootstrap.yml
new file mode 100644
index 0000000..01850af
--- /dev/null
+++ b/bwie-bill/src/main/resources/bootstrap.yml
@@ -0,0 +1,41 @@
+# Tomcat
+server:
+ port: 9004
+# Spring
+spring:
+ main:
+ allow-circular-references: true
+ jackson:
+ date-format: yyyy-MM-dd HH:mm:ss
+ time-zone: GMT+8
+ application:
+ # 应用名称
+ name: bwie-名字补全
+ profiles:
+ # 环境配置
+ active: dev
+ cloud:
+ nacos:
+ discovery:
+ # 服务注册地址
+ server-addr: 150.158.33.234:8848
+ config:
+ # 配置中心地址
+ server-addr: 150.158.33.234:8848
+ # 配置文件格式
+ file-extension: yml
+ # 共享配置
+ shared-configs:
+ - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
+fdfs:
+ so-timeout: 1500 # socket 连接时长
+ connect-timeout: 600 # 连接 tracker 服务器超时时长
+ # 这两个是你服务器的 IP 地址,注意 23000 端口也要打开,阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流
+ tracker-list: 150.158.33.234:22122
+ web-server-url: 150.158.33.234:8888
+ pool:
+ jmx-enabled: false
+ # 生成缩略图
+ thumb-image:
+ height: 500
+ width: 500
diff --git a/bwie-bill/src/main/resources/mapper/BillMapper.xml b/bwie-bill/src/main/resources/mapper/BillMapper.xml
new file mode 100644
index 0000000..b2792d9
--- /dev/null
+++ b/bwie-bill/src/main/resources/mapper/BillMapper.xml
@@ -0,0 +1,13 @@
+
+
+
+
+
+ INSERT INTO `bill`.`bill` (`billid`, `billdate`, `billmonery`)
+ VALUES (NULL, #{billdate}, #{billmonery});
+
+
+
diff --git a/pom.xml b/pom.xml
new file mode 100644
index 0000000..db7d935
--- /dev/null
+++ b/pom.xml
@@ -0,0 +1,58 @@
+
+
+ 4.0.0
+
+ com.bwie
+ billManager
+ 1.0-SNAPSHOT
+ pom
+
+ bwie-bill
+
+
+
+
+
+ spring-boot-starter-parent
+ org.springframework.boot
+ 2.6.2
+
+
+
+
+
+
+
+ org.springframework.cloud
+ spring-cloud-dependencies
+ 2021.0.0
+ pom
+ import
+
+
+
+ com.alibaba.cloud
+ spring-cloud-alibaba-dependencies
+ 2021.1
+ pom
+ import
+
+
+
+ com.alibaba.nacos
+ nacos-client
+ 2.0.4
+
+
+
+
+ com.bwie
+ bwie-common
+ 1.0-SNAPSHOT
+
+
+
+
+