Merge remote-tracking branch 'origin/fix-bug-202303' into fix-bug-202303

This commit is contained in:
梁琦涛
2023-03-03 16:57:53 +08:00
6 changed files with 28 additions and 27 deletions
@@ -3,14 +3,14 @@ package com.jero.modules.system.controller;
import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject; import com.alibaba.fastjson.JSONObject;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.jero.common.api.vo.Result;
import com.jero.common.constant.CommonConstant;
import com.jero.common.exception.JeroBootException; import com.jero.common.exception.JeroBootException;
import com.jero.common.system.api.ISysBaseAPI;
import com.jero.common.util.*; import com.jero.common.util.*;
import com.jero.modules.oss.entity.OSSFile; import com.jero.modules.oss.entity.OSSFile;
import com.jero.modules.oss.service.IOSSFileService; import com.jero.modules.oss.service.IOSSFileService;
import lombok.extern.slf4j.Slf4j; import lombok.extern.slf4j.Slf4j;
import com.jero.common.api.vo.Result;
import com.jero.common.constant.CommonConstant;
import com.jero.common.system.api.ISysBaseAPI;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.HttpHeaders; import org.springframework.http.HttpHeaders;
@@ -18,7 +18,6 @@ import org.springframework.http.HttpMethod;
import org.springframework.http.ResponseEntity; import org.springframework.http.ResponseEntity;
import org.springframework.http.server.ServletServerHttpRequest; import org.springframework.http.server.ServletServerHttpRequest;
import org.springframework.util.AntPathMatcher; import org.springframework.util.AntPathMatcher;
import org.springframework.util.FileCopyUtils;
import org.springframework.web.bind.annotation.*; import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile; import org.springframework.web.multipart.MultipartFile;
import org.springframework.web.multipart.MultipartHttpServletRequest; import org.springframework.web.multipart.MultipartHttpServletRequest;
@@ -30,6 +29,8 @@ import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse; import javax.servlet.http.HttpServletResponse;
import java.io.*; import java.io.*;
import java.net.URLDecoder; import java.net.URLDecoder;
import java.nio.charset.StandardCharsets;
/** /**
* <p> * <p>
* 用户表 前端控制器 * 用户表 前端控制器
@@ -63,12 +64,14 @@ public class CommonController {
@Value(value="${jero.fileSuffixLimits}") @Value(value="${jero.fileSuffixLimits}")
private String[] fileSuffixLimits; private String[] fileSuffixLimits;
private static String UTF8 ="UTF-8";
/** /**
* @Author 政辉 * @Author 政辉
* @return * @return
*/ */
@GetMapping("/403") @GetMapping("/403")
public Result<?> noauth() { public Result<String> noauth() {
return Result.error("没有权限,请联系管理员授权"); return Result.error("没有权限,请联系管理员授权");
} }
@@ -92,6 +95,8 @@ public class CommonController {
MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request; MultipartHttpServletRequest multipartRequest = (MultipartHttpServletRequest) request;
// 获取上传文件对象 // 获取上传文件对象
MultipartFile file = multipartRequest.getFile("file"); MultipartFile file = multipartRequest.getFile("file");
if(file==null)
return result;
// 文件类型是否处于黑名单 // 文件类型是否处于黑名单
if(CommonUtils.limitFileSuffix(file.getOriginalFilename(),fileSuffixLimits)){ if(CommonUtils.limitFileSuffix(file.getOriginalFilename(),fileSuffixLimits)){
result.setMessage("该文件类型不允许上传"); result.setMessage("该文件类型不允许上传");
@@ -171,11 +176,13 @@ public class CommonController {
fileName = ossFile.getFileName(); fileName = ossFile.getFileName();
inputStream = MinioUtil.getMinioFile(MinioUtil.getBucketName(), url); inputStream = MinioUtil.getMinioFile(MinioUtil.getBucketName(), url);
} }
response.addHeader("Content-Disposition", "attachment;fileName=" + new String(fileName.getBytes("UTF-8"),"iso-8859-1")); response.addHeader("Content-Disposition", "attachment;fileName=" + new String(fileName.getBytes(UTF8),StandardCharsets.ISO_8859_1));
response.setContentType("application/force-download");// 设置强制下载不打开 response.setContentType("application/force-download");// 设置强制下载不打开
outputStream = response.getOutputStream(); outputStream = response.getOutputStream();
byte[] buf = new byte[1024]; byte[] buf = new byte[1024];
int len; int len;
if(inputStream==null)
return;
while ((len = inputStream.read(buf)) > 0) { while ((len = inputStream.read(buf)) > 0) {
outputStream.write(buf, 0, len); outputStream.write(buf, 0, len);
} }
@@ -252,7 +259,7 @@ public class CommonController {
HttpHeaders headers = new HttpHeaders(); HttpHeaders headers = new HttpHeaders();
headers.set("X-Access-Token", token); headers.set("X-Access-Token", token);
// 发送请求 // 发送请求
String httpURL = URLDecoder.decode(url, "UTF-8"); String httpURL = URLDecoder.decode(url, UTF8);
ResponseEntity<String> response = RestUtil.request(httpURL, method, headers , variables, params, String.class); ResponseEntity<String> response = RestUtil.request(httpURL, method, headers , variables, params, String.class);
// 封装返回结果 // 封装返回结果
Result<Object> result = new Result<>(); Result<Object> result = new Result<>();
@@ -286,7 +293,7 @@ public class CommonController {
public void view(HttpServletRequest request, HttpServletResponse response) { public void view(HttpServletRequest request, HttpServletResponse response) {
// ISO-8859-1 ==> UTF-8 进行编码转换 // ISO-8859-1 ==> UTF-8 进行编码转换
String imgPath = extractPathFromPattern(request); String imgPath = extractPathFromPattern(request);
if(oConvertUtils.isEmpty(imgPath) || imgPath=="null"){ if(oConvertUtils.isEmpty(imgPath) || "null".equals(imgPath)){
return; return;
} }
// 其余处理略 // 其余处理略
@@ -304,7 +311,7 @@ public class CommonController {
throw new RuntimeException("文件["+imgPath+"]不存在.."); throw new RuntimeException("文件["+imgPath+"]不存在..");
} }
response.setContentType("application/force-download");// 设置强制下载不打开 response.setContentType("application/force-download");// 设置强制下载不打开
response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes("UTF-8"),"iso-8859-1")); response.addHeader("Content-Disposition", "attachment;fileName=" + new String(file.getName().getBytes(UTF8), StandardCharsets.ISO_8859_1));
inputStream = new BufferedInputStream(new FileInputStream(filePath)); inputStream = new BufferedInputStream(new FileInputStream(filePath));
outputStream = response.getOutputStream(); outputStream = response.getOutputStream();
byte[] buf = new byte[1024]; byte[] buf = new byte[1024];
@@ -128,11 +128,7 @@ export default {
handleScroll () { handleScroll () {
if (this.autoHideHeader) { if (this.autoHideHeader) {
const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop const scrollTop = window.pageYOffset || document.documentElement.scrollTop || document.body.scrollTop
if (scrollTop > 100) { this.headerBarFixed = scrollTop > 100
this.headerBarFixed = true
} else {
this.headerBarFixed = false
}
} else { } else {
this.headerBarFixed = false this.headerBarFixed = false
} }
@@ -74,7 +74,7 @@
</a-layout-content> </a-layout-content>
<!-- layout footer --> <!-- layout footer -->
<a-layout-footer style="padding: 0px"> <a-layout-footer style="padding: 0">
<global-footer/> <global-footer/>
</a-layout-footer> </a-layout-footer>
</a-layout> </a-layout>
@@ -166,7 +166,7 @@ export default {
}, },
findMenuBykey (menus, key) { findMenuBykey (menus, key) {
for (const i of menus) { for (const i of menus) {
if (i.path == key) { if (i.path === key) {
this.activeMenu = { ...i } this.activeMenu = { ...i }
} else if (i.children && i.children.length > 0) { } else if (i.children && i.children.length > 0) {
this.findMenuBykey(i.children, key) this.findMenuBykey(i.children, key)
@@ -529,7 +529,7 @@ export default {
// 内容区 // 内容区
.layout-content { .layout-content {
margin: 24px 24px 0px; margin: 24px 24px 0;
height: 64px; height: 64px;
padding: 0 12px 0 0; padding: 0 12px 0 0;
} }
@@ -635,7 +635,7 @@ export default {
.ant-dropdown-menu-item > .anticon:first-child, .ant-dropdown-menu-item > .anticon:first-child,
.ant-dropdown-menu-item > a > .anticon:first-child, .ant-dropdown-menu-item > a > .anticon:first-child,
.ant-dropdown-menu-submenu-title > .anticon:first-child .ant-dropdown-menu-submenu-title > .anticon:first-child,
.ant-dropdown-menu-submenu-title > a > .anticon:first-child { .ant-dropdown-menu-submenu-title > a > .anticon:first-child {
min-width: 12px; min-width: 12px;
margin-right: 8px; margin-right: 8px;
+4 -6
View File
@@ -3,7 +3,7 @@
<div class="page-header-index-wide"> <div class="page-header-index-wide">
<a-breadcrumb class="breadcrumb"> <a-breadcrumb class="breadcrumb">
<a-breadcrumb-item v-for="(item, index) in breadList" :key="index"> <a-breadcrumb-item v-for="(item, index) in breadList" :key="index">
<router-link v-if="item.name != name" :to="{ path: item.path }"> <router-link v-if="item.name !== name" :to="{ path: item.path }">
{{ item.meta.title }} {{ item.meta.title }}
</router-link> </router-link>
<span v-else>{{ item.meta.title }}</span> <span v-else>{{ item.meta.title }}</span>
@@ -13,7 +13,7 @@
<div class="detail"> <div class="detail">
<div class="main" v-if="!$route.meta.hiddenHeaderContent"> <div class="main" v-if="!$route.meta.hiddenHeaderContent">
<div class="row"> <div class="row">
<img v-if="logo" :src="logo" class="logo"/> <img v-if="logo" :src="logo" class="logo" alt="logo"/>
<h1 v-if="title" class="title">{{ title }}</h1> <h1 v-if="title" class="title">{{ title }}</h1>
<div class="action"> <div class="action">
<slot name="action"></slot> <slot name="action"></slot>
@@ -41,12 +41,12 @@
</template> </template>
<script> <script>
import Breadcrumb from '@/components/tools/Breadcrumb' // import Breadcrumb from '@/components/tools/Breadcrumb'
export default { export default {
name: 'PageHeader', name: 'PageHeader',
components: { components: {
's-breadcrumb': Breadcrumb // 's-breadcrumb': Breadcrumb
}, },
props: { props: {
title: { title: {
@@ -143,9 +143,7 @@ export default {
font-size: 20px; font-size: 20px;
font-weight: 500; font-weight: 500;
font-size: 20px;
line-height: 28px; line-height: 28px;
font-weight: 500;
color: rgba(0,0,0,.85); color: rgba(0,0,0,.85);
margin-bottom: 16px; margin-bottom: 16px;
flex: auto; flex: auto;
+1 -1
View File
@@ -122,6 +122,6 @@ export default {
margin-top: 48px; margin-top: 48px;
} }
.page-header[data-v-6740ec88] { .page-header[data-v-6740ec88] {
margin: 0px 24px 0; margin: 0 24px 0;
} }
</style> </style>
@@ -1,7 +1,7 @@
<template> <template>
<a-popover trigger="click" placement="bottomRight" :overlayStyle="{ width: '300px' }"> <a-popover trigger="click" placement="bottomRight" :overlayStyle="{ width: '300px' }">
<template slot="content"> <template slot="content">
<a-spin :spinning="loadding"> <a-spin :spinning="loading">
<a-tabs> <a-tabs>
<a-tab-pane v-for="(tab, k) in tabs" :tab="tab.title" :key="k"> <a-tab-pane v-for="(tab, k) in tabs" :tab="tab.title" :key="k">
@@ -29,7 +29,7 @@ export default {
}, },
data () { data () {
return { return {
loadding: false loading: false
} }
}, },
methods: { methods: {