代码优化
This commit is contained in:
parent
199bb81633
commit
4c9a3bcbe2
@ -8,6 +8,16 @@ import org.springframework.stereotype.Component;
|
|||||||
public class QiwenFileConfig {
|
public class QiwenFileConfig {
|
||||||
private boolean remoteLogin;
|
private boolean remoteLogin;
|
||||||
|
|
||||||
|
private boolean shareMode;
|
||||||
|
|
||||||
|
public boolean isShareMode() {
|
||||||
|
return shareMode;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setShareMode(boolean shareMode) {
|
||||||
|
this.shareMode = shareMode;
|
||||||
|
}
|
||||||
|
|
||||||
public boolean isRemoteLogin() {
|
public boolean isRemoteLogin() {
|
||||||
return remoteLogin;
|
return remoteLogin;
|
||||||
}
|
}
|
||||||
|
@ -36,11 +36,6 @@ public class FileController {
|
|||||||
@Autowired
|
@Autowired
|
||||||
QiwenFileConfig qiwenFileConfig;
|
QiwenFileConfig qiwenFileConfig;
|
||||||
|
|
||||||
/**
|
|
||||||
* 是否开启共享文件模式
|
|
||||||
*/
|
|
||||||
public static Boolean isShareFile = true;
|
|
||||||
|
|
||||||
public static long treeid = 0;
|
public static long treeid = 0;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -123,7 +118,7 @@ public class FileController {
|
|||||||
@ResponseBody
|
@ResponseBody
|
||||||
public RestResult<List<FileBean>> getFileList(FileBean fileBean, @RequestHeader("token") String token){
|
public RestResult<List<FileBean>> getFileList(FileBean fileBean, @RequestHeader("token") String token){
|
||||||
RestResult<List<FileBean>> restResult = new RestResult<>();
|
RestResult<List<FileBean>> restResult = new RestResult<>();
|
||||||
if(isShareFile){
|
if(qiwenFileConfig.isShareMode()){
|
||||||
fileBean.setUserId(2L);
|
fileBean.setUserId(2L);
|
||||||
}else {
|
}else {
|
||||||
//UserBean sessionUserBean = (UserBean) SecurityUtils.getSubject().getPrincipal();
|
//UserBean sessionUserBean = (UserBean) SecurityUtils.getSubject().getPrincipal();
|
||||||
@ -365,7 +360,7 @@ public class FileController {
|
|||||||
result.setErrorMessage("未登录");
|
result.setErrorMessage("未登录");
|
||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
if (isShareFile){
|
if (qiwenFileConfig.isShareMode()){
|
||||||
if (sessionUserBean.getUserId() > 2){
|
if (sessionUserBean.getUserId() > 2){
|
||||||
result.setSuccess(false);
|
result.setSuccess(false);
|
||||||
result.setErrorMessage("没权限,请联系管理员!");
|
result.setErrorMessage("没权限,请联系管理员!");
|
||||||
@ -396,7 +391,7 @@ public class FileController {
|
|||||||
sessionUserBean = (UserBean) SecurityUtils.getSubject().getPrincipal();
|
sessionUserBean = (UserBean) SecurityUtils.getSubject().getPrincipal();
|
||||||
}
|
}
|
||||||
long userId = sessionUserBean.getUserId();
|
long userId = sessionUserBean.getUserId();
|
||||||
if (isShareFile){
|
if (qiwenFileConfig.isShareMode()){
|
||||||
userId = 2;
|
userId = 2;
|
||||||
}
|
}
|
||||||
List<FileBean> file = fileService.selectFileByExtendName(getFileExtendsByType(fileBean.getFileType()), userId);
|
List<FileBean> file = fileService.selectFileByExtendName(getFileExtendsByType(fileBean.getFileType()), userId);
|
||||||
@ -424,7 +419,7 @@ public class FileController {
|
|||||||
} else {
|
} else {
|
||||||
sessionUserBean = (UserBean) SecurityUtils.getSubject().getPrincipal();
|
sessionUserBean = (UserBean) SecurityUtils.getSubject().getPrincipal();
|
||||||
}
|
}
|
||||||
if (isShareFile){
|
if (qiwenFileConfig.isShareMode()){
|
||||||
fileBean.setUserId(2L);
|
fileBean.setUserId(2L);
|
||||||
}else{
|
}else{
|
||||||
fileBean.setUserId(sessionUserBean.getUserId());
|
fileBean.setUserId(sessionUserBean.getUserId());
|
||||||
|
@ -29,8 +29,6 @@ public class FiletransferController {
|
|||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
IFiletransferService filetransferService;
|
IFiletransferService filetransferService;
|
||||||
@Resource
|
|
||||||
IFileService fileService;
|
|
||||||
|
|
||||||
@Resource
|
@Resource
|
||||||
FileController fileController;
|
FileController fileController;
|
||||||
@ -148,7 +146,7 @@ public class FiletransferController {
|
|||||||
RestResult<StorageBean> restResult = new RestResult<StorageBean>();
|
RestResult<StorageBean> restResult = new RestResult<StorageBean>();
|
||||||
UserBean sessionUserBean = (UserBean) SecurityUtils.getSubject().getPrincipal();
|
UserBean sessionUserBean = (UserBean) SecurityUtils.getSubject().getPrincipal();
|
||||||
StorageBean storageBean = new StorageBean();
|
StorageBean storageBean = new StorageBean();
|
||||||
if (FileController.isShareFile){
|
if (qiwenFileConfig.isShareMode()){
|
||||||
storageBean.setUserId(2L);
|
storageBean.setUserId(2L);
|
||||||
}else{
|
}else{
|
||||||
storageBean.setUserId(sessionUserBean.getUserId());
|
storageBean.setUserId(sessionUserBean.getUserId());
|
||||||
|
@ -1,35 +0,0 @@
|
|||||||
//package com.mac.scp.controller;
|
|
||||||
//
|
|
||||||
//import org.springframework.web.bind.annotation.RequestMapping;
|
|
||||||
//import org.springframework.web.bind.annotation.ResponseBody;
|
|
||||||
//import org.springframework.web.bind.annotation.RestController;
|
|
||||||
//import org.springframework.web.servlet.ModelAndView;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// * 用户控制类
|
|
||||||
// *
|
|
||||||
// * @author ma116
|
|
||||||
// */
|
|
||||||
//@RestController
|
|
||||||
//public class RouterController {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @RequestMapping("/file")
|
|
||||||
// @ResponseBody
|
|
||||||
// public ModelAndView file() {
|
|
||||||
// return new ModelAndView("/file.html");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @RequestMapping("/login")
|
|
||||||
// @ResponseBody
|
|
||||||
// public ModelAndView login() {
|
|
||||||
// return new ModelAndView("/login");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// @RequestMapping("/register")
|
|
||||||
// @ResponseBody
|
|
||||||
// public ModelAndView register() {
|
|
||||||
// return new ModelAndView("/register");
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
@ -33,8 +33,7 @@ import java.util.Map;
|
|||||||
public class UserController {
|
public class UserController {
|
||||||
@Resource
|
@Resource
|
||||||
IUserService userService;
|
IUserService userService;
|
||||||
@Resource
|
|
||||||
IFiletransferService filetransferService;
|
|
||||||
@Autowired
|
@Autowired
|
||||||
IRemoteUserService remoteUserService;
|
IRemoteUserService remoteUserService;
|
||||||
@Autowired
|
@Autowired
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
server.port=8080
|
server.port=8080
|
||||||
#eureka.client.register-with-eureka=false
|
eureka.client.register-with-eureka=false
|
||||||
#eureka.client.fetchRegistry=false
|
eureka.client.fetchRegistry=false
|
||||||
#eureka.client.server.waitTimeInMsWhenSyncEmpty=0
|
#eureka.client.server.waitTimeInMsWhenSyncEmpty=0
|
||||||
eureka.instance.hostname=localhost
|
eureka.instance.hostname=localhost
|
||||||
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:8761/eureka/
|
eureka.client.serviceUrl.defaultZone=http://${eureka.instance.hostname}:8761/eureka/
|
||||||
@ -46,3 +46,4 @@ mybatis-plus.configuration.map-underscore-to-camel-case=false
|
|||||||
mybatis-plus.global-config.banner=false
|
mybatis-plus.global-config.banner=false
|
||||||
|
|
||||||
qiwen-file.remote-login=false
|
qiwen-file.remote-login=false
|
||||||
|
qiwen-file.share-mode=false
|
||||||
|
Loading…
Reference in New Issue
Block a user