diff --git a/health_modules/health-doctor/pom.xml b/health_modules/health-doctor/pom.xml new file mode 100644 index 0000000..3c293d1 --- /dev/null +++ b/health_modules/health-doctor/pom.xml @@ -0,0 +1,90 @@ + + + 4.0.0 + + com.health + health_modules + 1.0-SNAPSHOT + + + health-doctor + + + 17 + 17 + UTF-8 + + + + + + + com.health + health_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 + + + + + com.github.tobato + fastdfs-client + 1.26.5 + + + + + com.github.xiaoymin + knife4j-spring-boot-starter + 2.0.9 + + + + + org.springframework.boot + spring-boot-starter-amqp + + + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + 2.9.10 + + + + + diff --git a/health_modules/health-doctor/src/main/java/com/health/doctor/config/FastUtil.java b/health_modules/health-doctor/src/main/java/com/health/doctor/config/FastUtil.java new file mode 100644 index 0000000..7dc7031 --- /dev/null +++ b/health_modules/health-doctor/src/main/java/com/health/doctor/config/FastUtil.java @@ -0,0 +1,55 @@ +package com.health.doctor.config; + +import org.springframework.stereotype.Component; +import com.github.tobato.fastdfs.domain.fdfs.StorePath; +import com.github.tobato.fastdfs.service.FastFileStorageClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; + +/** + * @BelongsProject: 0107day02 + * @BelongsPackage: com.bw.config + * @Author: zhupengfei + * @CreateTime: 2023-02-01 08:52 + */ +@Component +public class FastUtil { + private static final Logger log = LoggerFactory.getLogger(FastUtil.class); + + @Resource + private FastFileStorageClient storageClient ; + + /** + * 上传文件 图片 + */ + public String upload(MultipartFile multipartFile) throws Exception{ + String originalFilename = multipartFile.getOriginalFilename(). + substring(multipartFile.getOriginalFilename(). + lastIndexOf(".") + 1); + StorePath storePath = this.storageClient.uploadImageAndCrtThumbImage( + multipartFile.getInputStream(), + multipartFile.getSize(),originalFilename , null); + return storePath.getFullPath() ; + } + /** + * 删除文件 + */ + public String deleteFile(String fileUrl) { + if (StringUtils.isEmpty(fileUrl)) { + log.info("fileUrl == >>文件路径为空..."); + return "文件路径不能为空"; + } + try { + StorePath storePath = StorePath.parseFromUrl(fileUrl); + storageClient.deleteFile(storePath.getGroup(), storePath.getPath()); + } catch (Exception e) { + log.error(e.getMessage()); + } + return "删除成功"; + } + +} diff --git a/health_modules/health-doctor/src/main/resources/bootstrap.yml b/health_modules/health-doctor/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..8d45fcf --- /dev/null +++ b/health_modules/health-doctor/src/main/resources/bootstrap.yml @@ -0,0 +1,63 @@ +# 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: health_doctor + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 124.221.216.186:8848 + config: + # 配置中心地址 + server-addr: 124.221.216.186:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + rabbitmq: + host: 124.221.216.186 + port: 5672 + username: guest + password: guest + virtual-host: / + publisher-confirm-type: correlated #确认消息已发送到交换机(Exchange) + publisher-returns: true #确认消息已发送到队列(Queue) + listener: + simple: + prefetch: 1 # 每次只能获取一条,处理完成才能获取下一条 + # 设置消费端手动ack确认 + acknowledge-mode: manual + retry: + enabled: true # 是否支持重试 + template: + # 只要消息抵达Queue,就会异步发送优先回调return firm + mandatory: true + redis: + host: 124.221.216.186 +fdfs: + so-timeout: 1500 # socket 连接时长 + connect-timeout: 600 # 连接 tracker 服务器超时时长 upload + # 这两个是你服务器的 IP 地址,注意 23000 端口也要打开,阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流 + tracker-list: 124.221.216.186:22122 + web-server-url: 124.221.216.186:8888 + pool: + jmx-enabled: false + # 生成缩略图 + thumb-image: + height: 500 + width: 500 + + diff --git a/health_modules/health-patient/pom.xml b/health_modules/health-patient/pom.xml new file mode 100644 index 0000000..8f7186a --- /dev/null +++ b/health_modules/health-patient/pom.xml @@ -0,0 +1,20 @@ + + + 4.0.0 + + com.health + health_modules + 1.0-SNAPSHOT + + + health-patient + + + 17 + 17 + UTF-8 + + + diff --git a/health_modules/health-patient/src/main/java/com/healrh/patient/config/FastUtil.java b/health_modules/health-patient/src/main/java/com/healrh/patient/config/FastUtil.java new file mode 100644 index 0000000..ce39f75 --- /dev/null +++ b/health_modules/health-patient/src/main/java/com/healrh/patient/config/FastUtil.java @@ -0,0 +1,55 @@ +package com.healrh.patient.config; + +import org.springframework.stereotype.Component; +import com.github.tobato.fastdfs.domain.fdfs.StorePath; +import com.github.tobato.fastdfs.service.FastFileStorageClient; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.util.StringUtils; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; + +/** + * @BelongsProject: 0107day02 + * @BelongsPackage: com.bw.config + * @Author: zhupengfei + * @CreateTime: 2023-02-01 08:52 + */ +@Component +public class FastUtil { + private static final Logger log = LoggerFactory.getLogger(FastUtil.class); + + @Resource + private FastFileStorageClient storageClient ; + + /** + * 上传文件 图片 + */ + public String upload(MultipartFile multipartFile) throws Exception{ + String originalFilename = multipartFile.getOriginalFilename(). + substring(multipartFile.getOriginalFilename(). + lastIndexOf(".") + 1); + StorePath storePath = this.storageClient.uploadImageAndCrtThumbImage( + multipartFile.getInputStream(), + multipartFile.getSize(),originalFilename , null); + return storePath.getFullPath() ; + } + /** + * 删除文件 + */ + public String deleteFile(String fileUrl) { + if (StringUtils.isEmpty(fileUrl)) { + log.info("fileUrl == >>文件路径为空..."); + return "文件路径不能为空"; + } + try { + StorePath storePath = StorePath.parseFromUrl(fileUrl); + storageClient.deleteFile(storePath.getGroup(), storePath.getPath()); + } catch (Exception e) { + log.error(e.getMessage()); + } + return "删除成功"; + } + +} diff --git a/health_modules/health-patient/src/main/resources/bootstrap.yml b/health_modules/health-patient/src/main/resources/bootstrap.yml new file mode 100644 index 0000000..5bdf1dd --- /dev/null +++ b/health_modules/health-patient/src/main/resources/bootstrap.yml @@ -0,0 +1,63 @@ +# Tomcat +server: + port: 9005 +# Spring +spring: + main: + allow-circular-references: true + jackson: + date-format: yyyy-MM-dd HH:mm:ss + time-zone: GMT+8 + application: + # 应用名称 + name: health_patient + profiles: + # 环境配置 + active: dev + cloud: + nacos: + discovery: + # 服务注册地址 + server-addr: 124.221.216.186:8848 + config: + # 配置中心地址 + server-addr: 124.221.216.186:8848 + # 配置文件格式 + file-extension: yml + # 共享配置 + shared-configs: + - application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension} + rabbitmq: + host: 124.221.216.186 + port: 5672 + username: guest + password: guest + virtual-host: / + publisher-confirm-type: correlated #确认消息已发送到交换机(Exchange) + publisher-returns: true #确认消息已发送到队列(Queue) + listener: + simple: + prefetch: 1 # 每次只能获取一条,处理完成才能获取下一条 + # 设置消费端手动ack确认 + acknowledge-mode: manual + retry: + enabled: true # 是否支持重试 + template: + # 只要消息抵达Queue,就会异步发送优先回调return firm + mandatory: true + redis: + host: 124.221.216.186 +fdfs: + so-timeout: 1500 # socket 连接时长 + connect-timeout: 600 # 连接 tracker 服务器超时时长 upload + # 这两个是你服务器的 IP 地址,注意 23000 端口也要打开,阿里云服务器记得配置安全组。tracker 要和 stroage 服务进行交流 + tracker-list: 124.221.216.186:22122 + web-server-url: 124.221.216.186:8888 + pool: + jmx-enabled: false + # 生成缩略图 + thumb-image: + height: 500 + width: 500 + + diff --git a/health_modules/pom.xml b/health_modules/pom.xml index c3d0b67..d575fc2 100644 --- a/health_modules/pom.xml +++ b/health_modules/pom.xml @@ -13,6 +13,8 @@ pom base_system + health-doctor + health-patient @@ -20,5 +22,74 @@ 17 UTF-8 + + + + + com.health + health_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 + + + + + com.github.tobato + fastdfs-client + 1.26.5 + + + + + com.github.xiaoymin + knife4j-spring-boot-starter + 2.0.9 + + + + + org.springframework.boot + spring-boot-starter-amqp + + + + + com.fasterxml.jackson.dataformat + jackson-dataformat-xml + 2.9.10 + + +