From 7178e8e0d172494f31328d79b2b68ef60125777c Mon Sep 17 00:00:00 2001 From: dhy1725534722 <1725534722@qq.com> Date: Thu, 18 Jan 2024 15:24:18 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E4=B8=8A=E4=BC=A0=E6=96=87?= =?UTF-8?q?=E4=BB=B6=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 50 ++++++------- pom.xml | 4 +- ruoyi-admin/pom.xml | 7 ++ .../ruoyi/tcZz/controller/httpController.java | 70 +++++++++++++++++++ .../com/ruoyi/tcZz/domain/httpsRequest.java | 20 ++++++ .../framework/config/SecurityConfig.java | 2 +- 6 files changed, 125 insertions(+), 28 deletions(-) create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/httpController.java create mode 100644 ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/httpsRequest.java diff --git a/README.md b/README.md index ffc8e0b3..3ae9ca6f 100644 --- a/README.md +++ b/README.md @@ -1,12 +1,12 @@

- logo + logo

RuoYi v3.8.6

基于SpringBoot+Vue前后端分离的Java快速开发框架

- - - + + +

## 平台简介 @@ -18,11 +18,11 @@ * 权限认证使用Jwt,支持多终端认证系统。 * 支持加载动态权限菜单,多方式轻松权限控制。 * 高效率开发,使用代码生成器可以一键生成前后端代码。 -* 提供了技术栈([Vue3](https://v3.cn.vuejs.org) [Element Plus](https://element-plus.org/zh-CN) [Vite](https://cn.vitejs.dev))版本[RuoYi-Vue3](https://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。 -* 提供了单应用版本[RuoYi-Vue-fast](https://github.com/yangzongzhuan/RuoYi-Vue-fast),Oracle版本[RuoYi-Vue-Oracle](https://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。 -* 不分离版本,请移步[RuoYi](https://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](https://gitee.com/y_project/RuoYi-Cloud) +* 提供了技术栈([Vue3](httpsRequest://v3.cn.vuejs.org) [Element Plus](httpsRequest://element-plus.org/zh-CN) [Vite](httpsRequest://cn.vitejs.dev))版本[RuoYi-Vue3](httpsRequest://github.com/yangzongzhuan/RuoYi-Vue3),保持同步更新。 +* 提供了单应用版本[RuoYi-Vue-fast](httpsRequest://github.com/yangzongzhuan/RuoYi-Vue-fast),Oracle版本[RuoYi-Vue-Oracle](httpsRequest://github.com/yangzongzhuan/RuoYi-Vue-Oracle),保持同步更新。 +* 不分离版本,请移步[RuoYi](httpsRequest://gitee.com/y_project/RuoYi),微服务版本,请移步[RuoYi-Cloud](httpsRequest://gitee.com/y_project/RuoYi-Cloud) * 阿里云折扣场:[点我进入](http://aly.ruoyi.vip),腾讯云秒杀场:[点我进入](http://txy.ruoyi.vip)   -* 阿里云优惠券:[点我领取](https://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](https://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)   +* 阿里云优惠券:[点我领取](httpsRequest://www.aliyun.com/minisite/goods?userCode=brki8iof&share_source=copy_link),腾讯云优惠券:[点我领取](httpsRequest://cloud.tencent.com/redirect.php?redirect=1025&cps_key=198c8df2ed259157187173bc7f4f32fd&from=console)   ## 内置功能 @@ -57,40 +57,40 @@ - - + + - - + + - - + + - - + + - - + + - - + + - - + + - - + +
## 若依前后端分离交流群 -QQ群: [![加入QQ群](https://img.shields.io/badge/已满-937441-blue.svg)](https://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](https://img.shields.io/badge/已满-887144332-blue.svg)](https://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](https://img.shields.io/badge/已满-180251782-blue.svg)](https://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](https://img.shields.io/badge/已满-104180207-blue.svg)](https://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](https://img.shields.io/badge/已满-186866453-blue.svg)](https://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](https://img.shields.io/badge/已满-201396349-blue.svg)](https://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](https://img.shields.io/badge/已满-101456076-blue.svg)](https://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](https://img.shields.io/badge/已满-101539465-blue.svg)](https://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](https://img.shields.io/badge/已满-264312783-blue.svg)](https://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](https://img.shields.io/badge/已满-167385320-blue.svg)](https://jq.qq.com/?_wv=1027&k=SWCtLnMz) [![加入QQ群](https://img.shields.io/badge/已满-104748341-blue.svg)](https://jq.qq.com/?_wv=1027&k=96Dkdq0k) [![加入QQ群](https://img.shields.io/badge/已满-160110482-blue.svg)](https://jq.qq.com/?_wv=1027&k=0fsNiYZt) [![加入QQ群](https://img.shields.io/badge/已满-170801498-blue.svg)](https://jq.qq.com/?_wv=1027&k=7xw4xUG1) [![加入QQ群](https://img.shields.io/badge/已满-108482800-blue.svg)](https://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [![加入QQ群](https://img.shields.io/badge/已满-101046199-blue.svg)](https://jq.qq.com/?_wv=1027&k=SpyH2875) [![加入QQ群](https://img.shields.io/badge/已满-136919097-blue.svg)](https://jq.qq.com/?_wv=1027&k=tKEt51dz) [![加入QQ群](https://img.shields.io/badge/已满-143961921-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921) [![加入QQ群](https://img.shields.io/badge/174951577-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=ZFAPAbp09S2ltvwrJzp7wGlbopsc0rwi&authKey=HB2cxpxP2yspk%2Bo3WKTBfktRCccVkU26cgi5B16u0KcAYrVu7sBaE7XSEqmMdFQp&noverify=0&group_code=174951577) 点击按钮入群。 \ No newline at end of file +QQ群: [![加入QQ群](httpsRequest://img.shields.io/badge/已满-937441-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=5bVB1og) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-887144332-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=5eiA4DH) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-180251782-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=5AxMKlC) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-104180207-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=51G72yr) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-186866453-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=VvjN2nvu) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-201396349-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=5vYAqA05) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-101456076-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=kOIINEb5) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-101539465-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=UKtX5jhs) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-264312783-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=EI9an8lJ) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-167385320-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=SWCtLnMz) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-104748341-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=96Dkdq0k) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-160110482-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=0fsNiYZt) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-170801498-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=7xw4xUG1) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-108482800-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=eCx8eyoJ) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-101046199-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=SpyH2875) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-136919097-blue.svg)](httpsRequest://jq.qq.com/?_wv=1027&k=tKEt51dz) [![加入QQ群](httpsRequest://img.shields.io/badge/已满-143961921-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=0vBbSb0ztbBgVtn3kJS-Q4HUNYwip89G&authKey=8irq5PhutrZmWIvsUsklBxhj57l%2F1nOZqjzigkXZVoZE451GG4JHPOqW7AW6cf0T&noverify=0&group_code=143961921) [![加入QQ群](httpsRequest://img.shields.io/badge/174951577-blue.svg)](http://qm.qq.com/cgi-bin/qm/qr?_wv=1027&k=ZFAPAbp09S2ltvwrJzp7wGlbopsc0rwi&authKey=HB2cxpxP2yspk%2Bo3WKTBfktRCccVkU26cgi5B16u0KcAYrVu7sBaE7XSEqmMdFQp&noverify=0&group_code=174951577) 点击按钮入群。 \ No newline at end of file diff --git a/pom.xml b/pom.xml index 62806cc5..eeb65221 100644 --- a/pom.xml +++ b/pom.xml @@ -193,7 +193,7 @@ public aliyun nexus - https://maven.aliyun.com/repository/public + httpsRequest://maven.aliyun.com/repository/public true @@ -204,7 +204,7 @@ public aliyun nexus - https://maven.aliyun.com/repository/public + httpsRequest://maven.aliyun.com/repository/public true diff --git a/ruoyi-admin/pom.xml b/ruoyi-admin/pom.xml index d486a484..7bdb0918 100644 --- a/ruoyi-admin/pom.xml +++ b/ruoyi-admin/pom.xml @@ -39,6 +39,13 @@ ruoyi-framework + + + cn.hutool + hutool-all + 5.8.16 + + com.ruoyi diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/httpController.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/httpController.java new file mode 100644 index 00000000..422c8b82 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/controller/httpController.java @@ -0,0 +1,70 @@ +package com.ruoyi.tcZz.controller; + +import cn.hutool.core.io.FileUtil; +import cn.hutool.http.HttpUtil; +import com.ruoyi.common.core.domain.AjaxResult; +import com.ruoyi.common.utils.file.FileUtils; +import com.ruoyi.framework.config.ServerConfig; +import com.ruoyi.tcZz.domain.httpsRequest; +import io.swagger.annotations.Api; +import io.swagger.annotations.ApiOperation; +import org.apache.commons.io.FilenameUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RestController; + +import java.io.IOException; +import java.net.URL; + +/** + * @author du + * @since 2024/1/17 16:04 + */ +@Api(tags = "文件通用包装") +@RestController +@RequestMapping("/tcZz/networkEcology/getHttp") +public class httpController { + + @Value("${ruoyi.profile}") + private String profile; + + @Autowired + private ServerConfig serverConfig; + + /** + * 根据文件地址去请求该地址的数据 + */ + @ApiOperation(value = "根据文件地址去请求该地址的数据") + @PostMapping + public AjaxResult screenSupervision(@RequestBody httpsRequest httpsRequest) throws IOException { + URL url1 = new URL(httpsRequest.getUrls()); +// if (FilenameUtils.getExtension(url.getPath()).equals("docx") || FilenameUtils.getExtension(url.getPath()).equals("doc")) { +// long l = HttpUtil.downloadFile(httpsRequest.getUrls(), FileUtil.file(this.profile)); +// // 设置响应头,用于告诉浏览器该响应是一个文件下载 +// response.setContentType("application/octet-stream"); +// response.setHeader("Content-Disposition", "attachment; filename=" + URLEncoder.encode(FilenameUtils.getName(url.getPath()), "UTF-8")); +// // 获取文件流 +// InputStream inputStream = FileUtil.getInputStream(this.profile + "/" + FilenameUtils.getName(url.getPath())); +// // 将文件流写入响应体中 +// ServletOutputStream outputStream = response.getOutputStream(); +// byte[] buffer = new byte[1024]; +// int bytesRead; +// while ((bytesRead = inputStream.read(buffer)) != -1) { +// outputStream.write(buffer, 0, bytesRead); +// } +// inputStream.close(); +// outputStream.flush(); +// outputStream.close(); +// boolean success = FileUtil.del(this.profile + "/" + FilenameUtils.getName(url.getPath())); +// } else if (FilenameUtils.getExtension(url.getPath()).equals("pdf")) { +// } + long l = HttpUtil.downloadFile(httpsRequest.getUrls(), FileUtil.file(this.profile)); + String https = "/profile/"+FilenameUtils.getName(url1.getPath()); + AjaxResult ajax = AjaxResult.success(); + ajax.put("url", https); + return ajax; + } +} diff --git a/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/httpsRequest.java b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/httpsRequest.java new file mode 100644 index 00000000..78509bc2 --- /dev/null +++ b/ruoyi-admin/src/main/java/com/ruoyi/tcZz/domain/httpsRequest.java @@ -0,0 +1,20 @@ +package com.ruoyi.tcZz.domain; + +import io.swagger.annotations.ApiModel; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; + +/** + * @author du + * @since 2024/1/17 18:22 + */ +@Data +@ApiModel("http实体类") +public class httpsRequest { + + /** + * url地址 + */ + @ApiModelProperty(value = "url地址") + private String urls; +} diff --git a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java index 4a9f4b3d..e9fa6a9a 100644 --- a/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java +++ b/ruoyi-framework/src/main/java/com/ruoyi/framework/config/SecurityConfig.java @@ -110,7 +110,7 @@ public class SecurityConfig extends WebSecurityConfigurerAdapter { // 对于登录login 注册register 验证码captchaImage 允许匿名访问 .antMatchers("/login", "/register", "/captchaImage").permitAll() // 静态资源,可匿名访问 - .antMatchers(HttpMethod.GET, "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**", + .antMatchers(HttpMethod.GET,"/tcZz/networkEcology/getHttp", "/", "/*.html", "/**/*.html", "/**/*.css", "/**/*.js", "/profile/**", "/tcZz/netWorkYq/yqzs/ListNoToken", "/tcZz/netWorkYq/cy/ListNoToken", "/tcZz/networkSecurity/cybersecurity/ListNoToken", "/tcZz/networkSecurity/cybersecurity/ListNoToken", "/tcZz/networkSecurity/jgdw/ListNoToken",