当前位置: 首页 > news >正文

wordpress会员下载功能seo分析工具有哪些

wordpress会员下载功能,seo分析工具有哪些,河南省建设厅证件证件查询网站,互联网项目名称大全java实现系统文件管理 环境:jdk17springbootVueElementUI 背景:公司所做的项目需要别的系统向我们服务器上传文件,当我们需要查看这些文件什么时候上传的、文件数据是怎样的,只能去机房,排查问题效率较低,…

java实现系统文件管理

环境:jdk17+springboot+Vue+ElementUI
背景:公司所做的项目需要别的系统向我们服务器上传文件,当我们需要查看这些文件什么时候上传的、文件数据是怎样的,只能去机房,排查问题效率较低,做此页面,可快速查看上传的文件信息,且可下载到本地查看。为了生产安全,不支持修改及上传文件,如果有的朋友想做,可自行查找资料。
需求:实现系统文件的查询及下载。展示系统的文件信息,如文件名、文件大小、最后更新时间及权限等。
注意本篇文章是以window系统做的样例,不过一般服务器都是在linux系统,只需将前端的初始地址换成linux地址,一般格式为:/home/app。
效果图
在这里插入图片描述
直接上代码,前端代码:

<template><div><div><el-col :xl="4" :lg="5"><el-input v-model="curPath" label-width='80px' size="small" type="text">当前位置:</el-input></el-col><el-button type="primary" size="small" @click="getParentData()" icon="el-icon-back">返回上级</el-button><el-button type="primary" size="small" @click="refresh()" icon="el-icon-refresh">刷新</el-button></div><el-table :data="fileList" v-loading="tableLoading"><el-table-column label="名称" prop="fileName"><!-- eslint-disable-next-line--><template slot-scope="scope"><el-button type="text" v-if="!scope.row.fileType" @click="getSonData(scope.row)">{{scope.row.fileName}}</el-button><span v-if="scope.row.fileType">{{ scope.row.fileName }}</span></template></el-table-column><el-table-column label="类型" align="center"><!-- eslint-disable-next-line--><template slot-scope="scope"><div>{{ typeName(scope.row.fileType) }}</div></template></el-table-column><el-table-column label="大小" prop="fileSize"></el-table-column><el-table-column label="更新时间" prop="lastModifiedDate"></el-table-column><el-table-column align="center" label="权限" width="120"><!-- eslint-disable-next-line--><template slot-scope="scope"><div>{{ getAuthority(scope.row) }}</div></template></el-table-column><el-table-column label="操作"><!-- eslint-disable-next-line--><template slot-scope="scope"><el-button size="mini" v-if="scope.row.fileType" type="text" @click="download(scope.row.path)">下载</el-button></template></el-table-column></el-table></div>
</template>
<script>
import axios from "axios";export default {name: 'App',data() {return {curPath: "D:\\",fileList: [],tableLoading: false,}},created() {this.getData()},methods: {getData: function () {const vm = thisconst params = {path: this.curPath}axios({method: 'get',url: "/sysFile/getSysFiles",params}).then(res => {const result = res.dataif (result && result.code === 200) {this.fileList = result.dataconsole.log(this.fileList)}vm.tableLoading = false})},getSonData(row) {this.curPath = row.paththis.getData()},getParentData() {if (this.curPath === '') {this.$message({type: 'warning',message: '没有上级!'})return}// linux系统中,将 \\ 改为 / 即可this.curPath = this.curPath.slice(0, this.curPath.lastIndexOf("\\"))this.getData()},refresh() {this.type = 0this.getData()},download(path) {const params = {path: path}axios({method: 'get',url: "/sysFile/downloadFile",responseType: 'blob',params}).then(res => {// linux系统中,将 \\ 改为 / 即可const fileName = path.slice(path.lastIndexOf("\\") + 1, path.length)const blob = new Blob([res.data])if ('download' in document.createElement('a')) {// 非IE下载console.log('非IE')const elink = document.createElement('a')elink.download = fileNameelink.style.display = 'none'elink.href = URL.createObjectURL(blob)document.body.appendChild(elink)elink.click()URL.revokeObjectURL(elink.href)// 释放URL 对象document.body.removeChild(elink)} else {// IE10+下载navigator.msSaveBlob(blob, fileName)}})},typeName(type) {if (type) {return "文件"}return "文件夹"},getAuthority(row) {let authority = ''if (row.canRead) {authority = authority + 'r'} else {authority = authority + '-'}if (row.canWrite) {authority = authority + 'w'} else {authority = authority + '-'}if (row.canExecute) {authority = authority + 'x'} else {authority = authority + '-'}return authority}}
}
</script><style>
.el-header, .el-footer {background-color: #B3C0D1;color: #333;text-align: center;line-height: 60px;
}.el-aside {background-color: #D3DCE6;color: #333;text-align: center;line-height: 200px;
}.el-main {background-color: #E9EEF3;color: #333;text-align: center;line-height: 160px;
}body > .el-container {margin-bottom: 40px;
}.el-container:nth-child(5) .el-aside,
.el-container:nth-child(6) .el-aside {line-height: 260px;
}.el-container:nth-child(7) .el-aside {line-height: 320px;
}
</style>

后端代码:

package org.wjg.onlinexml.controller;import org.apache.commons.io.FileUtils;
import org.springframework.http.HttpHeaders;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.util.StringUtils;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import org.wjg.onlinexml.po.Result;
import org.wjg.onlinexml.po.SysFileDo;import java.io.File;
import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.*;@RestController
public class SysFileController {private static final SimpleDateFormat simple = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");@GetMapping("/getSysFiles")public Result getSysFiles(@RequestParam String path) {try {File files = null;if (!StringUtils.isEmpty(path)) {files = new File(path);} else {return Result.builder().code(200).msg("路径为空").build();}if (!files.exists()) {return Result.builder().code(200).msg("文件不存在").build();}List<SysFileDo> result = new ArrayList<>();for (File file : files.listFiles()) {SysFileDo sysFileDo = new SysFileDo();//文件名sysFileDo.setFileName(file.getName());//是否为文件sysFileDo.setFileType(file.isFile());//文件大小,文件夹大小一般形式为0,不过可以自己遍历文件夹下的内容计算该文件夹的大小sysFileDo.setFileSize(file.length() / 1024 + "KB");//是否可执行sysFileDo.setCanExecute(file.canExecute());//是否可读sysFileDo.setCanRead(file.canRead());//是否可写(以上三种权限跟实际可能会有偏差的)sysFileDo.setCanWrite(file.canWrite());// 最后修改时间sysFileDo.setLastModifiedDate(simple.format(new Date(file.lastModified())));//最后修改时间的时间戳,方便排序sysFileDo.setLastModified(file.lastModified());//当前路径sysFileDo.setPath(file.getAbsolutePath());result.add(sysFileDo);}Collections.sort(result, Comparator.comparing(SysFileDo::getLastModified));Collections.reverse(result);return Result.builder().code(200).msg("查询成功").data(result).build();} catch (Exception e) {e.printStackTrace();}return Result.builder().build();}@RequestMapping("/downloadFile")public ResponseEntity<byte[]> download(@RequestParam String path) throws IOException {File file = new File(path);HttpHeaders httpHeaders = new HttpHeaders();httpHeaders.setContentDispositionFormData("attachment", "");return new ResponseEntity<byte[]>(FileUtils.readFileToByteArray(file), httpHeaders, HttpStatus.CREATED);}}

实体类:

@Data
@NoArgsConstructor
public class SysFileDo {private String fileName;private boolean fileType;private String fileSize;private boolean canRead;private boolean canExecute;private boolean canWrite;private String lastModifiedDate;private long lastModified;private String path;
}
package org.wjg.onlinexml.po;import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;@Data
@Builder(toBuilder = true)
@NoArgsConstructor
@AllArgsConstructor
public class Result<T> {private int code;private String msg;private T data;
}

好了,主要的代码就这些。还有两个依赖:

		<!-- 处理文件上传的 Java 库 --><dependency><groupId>commons-fileupload</groupId><artifactId>commons-fileupload</artifactId><version>1.5</version></dependency><!--  Apache 的开源工具库,包含了许多实用的文件操作、流操作相关的功能和工具类,比如文件读写、文件和目录的操作、流的处理和转换 --><dependency><groupId>commons-io</groupId><artifactId>commons-io</artifactId><version>2.5</version></dependency>
http://www.yidumall.com/news/35423.html

相关文章:

  • 广州做网站公司哪家比较好百度搜索关键词优化
  • 长沙做网站一般多少钱合适网站优化入门免费教程
  • 静态网站结构如何更新深圳seo优化seo优化
  • 网站建设常州公众号软文范例100
  • 湖南长沙seo吉林seo外包
  • 网站建设完善方案国内最新新闻事件今天
  • 网站建设要会哪些方面易搜搜索引擎
  • 维修网站源码武汉seo关键字推广
  • 移动端网站设计欣赏双11各大电商平台销售数据
  • 网站建设内容模板最新新闻事件
  • 高性能网站建设进阶指南:web开发者性能优化最佳实践 pdf制作免费个人网站
  • 河南网站制作公司哪家好搜索引擎优化的方式有哪些
  • 加大网站集约化建设管理做互联网推广的公司
  • 如何制作公司网站方案软文代写多少钱一篇
  • 医药类网站怎么做seo廊坊网络推广公司
  • 苏州做网站的专业公司无锡网站优化公司
  • 网站需要公安局备案吗怎么找百度客服
  • 网站的域名做邮箱网络营销主要干什么
  • 昆山seo网站优化软件品牌营销策划机构
  • 网站设置cookie什么意思描述建设一个网站的具体步骤
  • h5网站开发公司如何制作自己的网站教程
  • 前端网站搜索导航怎么做近期国际新闻
  • 遵义市政府网站建设概况专业搜索引擎seo服务
  • wordpress 整站源码最近时事新闻热点事件
  • 小县城做服务网站企业如何做好网络营销
  • 上海做网站的公黑科技引流推广神器免费
  • 英文手机商城网站建设长春最专业的seo公司
  • 锦州市城乡建设委员会官方网站百度云网页版入口
  • 秦皇岛城乡建设局网站百度打广告多少钱一个月
  • 哪里做网站网站seo李守洪排名大师