fix:1.启用验证码 2.FTP目录创建问题
This commit is contained in:
parent
6c7c4d8724
commit
54d1e95474
|
@ -44,4 +44,6 @@ public interface Prompt {
|
|||
String FILE_IS_EMPTY = "The List Of Files You Uploaded Is Empty!";
|
||||
|
||||
String NEED_TIME = "The Start Time Or End Time Cannot Be Empty!";
|
||||
|
||||
String DIR_CREATE_FAIL = "Directory Creation Failure: ";
|
||||
}
|
||||
|
|
|
@ -7,6 +7,7 @@ import org.apache.commons.net.ftp.FTP;
|
|||
import org.apache.commons.net.ftp.FTPClient;
|
||||
import org.apache.commons.net.ftp.FTPFile;
|
||||
import org.apache.commons.net.ftp.FTPReply;
|
||||
import org.jeecg.common.constant.SymbolConstant;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
|
@ -279,4 +280,18 @@ public class FTPUtil {
|
|||
}
|
||||
}
|
||||
|
||||
public static boolean createDirs(FTPClient ftp , String path) throws IOException {
|
||||
/* 该部分为逐级创建 */
|
||||
String[] split = path.split(SymbolConstant.SINGLE_SLASH);
|
||||
for (String str : split) {
|
||||
if(StringUtils.isBlank(str))
|
||||
continue;
|
||||
if (!ftp.changeWorkingDirectory(str)) {
|
||||
boolean makeDir = ftp.makeDirectory(str);
|
||||
if (!makeDir) return false;
|
||||
ftp.changeWorkingDirectory(str);
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -80,9 +80,9 @@ public class SpectrumFileServiceImpl implements ISpectrumFileService {
|
|||
ftpClient = ftpUtil.LoginFTP();
|
||||
if (ObjectUtil.isNull(ftpClient))
|
||||
return Result.error(Prompt.FTP_ERR);
|
||||
// 如果指定目录不存在,创建目录
|
||||
boolean exist = ftpClient.changeWorkingDirectory(filePath);
|
||||
if (!exist) ftpClient.makeDirectory(filePath);
|
||||
// 如果指定目录不存在,逐级创建目录
|
||||
boolean created = FTPUtil.createDirs(ftpClient, filePath);
|
||||
if (!created) return Result.error(Prompt.DIR_CREATE_FAIL + filePath);
|
||||
// 上传所有文件
|
||||
for (File oneFile : fileList) {
|
||||
String fullFilePath = filePath + slash + oneFile.getName();
|
||||
|
|
|
@ -29,6 +29,7 @@ import org.jeecg.modules.system.service.impl.SysBaseApiImpl;
|
|||
import org.jeecg.modules.system.util.RandImageUtil;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.http.HttpStatus;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
@ -87,7 +88,7 @@ public class LoginController {
|
|||
|
||||
//update-begin-author:taoyan date:20190828 for:校验验证码
|
||||
|
||||
/* String captcha = sysLoginModel.getCaptcha();
|
||||
String captcha = sysLoginModel.getCaptcha();
|
||||
if(captcha==null){
|
||||
result.error500("验证码无效");
|
||||
return result;
|
||||
|
@ -106,7 +107,7 @@ public class LoginController {
|
|||
// 改成特殊的code 便于前端判断
|
||||
result.setCode(HttpStatus.PRECONDITION_FAILED.value());
|
||||
return result;
|
||||
}*/
|
||||
}
|
||||
//update-end-author:taoyan date:20190828 for:校验验证码
|
||||
|
||||
//1. 校验用户是否有效
|
||||
|
|
Loading…
Reference in New Issue
Block a user