master
philip 3 years ago
parent 7c14b9ab98
commit 29e51c9f05

@ -70,7 +70,7 @@ public class FileController {
//服务器发布 //服务器发布
String coderPath = new String(path.getBytes("ISO8859_1")); String coderPath = new String(path.getBytes("ISO8859_1"));
String newPath = new String(coderPath.getBytes("GBK"), FTPClient.DEFAULT_CONTROL_ENCODING); String newPath = new String(coderPath.getBytes("GBK"), FTPClient.DEFAULT_CONTROL_ENCODING);
in = ftpClient.getFtp(newPath); in = ftpClient.getFtp(path);
if(null == in){ if(null == in){
in = ftpClient.getFtp(new String(coderPath.getBytes("UTF-8"), FTPClient.DEFAULT_CONTROL_ENCODING)); in = ftpClient.getFtp(new String(coderPath.getBytes("UTF-8"), FTPClient.DEFAULT_CONTROL_ENCODING));
} }

@ -311,7 +311,7 @@ public class CappFtpClient {
* @throws Exception * @throws Exception
*/ */
public InputStream getFtp(String path) throws Exception { public InputStream getFtp(String path) throws Exception {
connect(); login();
InputStream in = ftp.retrieveFileStream(path); InputStream in = ftp.retrieveFileStream(path);
return in; return in;
} }

@ -12,7 +12,6 @@ import com.foreverwin.modular.core.util.CommonMethods;
import org.apache.commons.net.ftp.FTPClient; import org.apache.commons.net.ftp.FTPClient;
import org.apache.commons.net.ftp.FTPFile; import org.apache.commons.net.ftp.FTPFile;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.io.IOException; import java.io.IOException;
@ -21,8 +20,6 @@ import java.util.Map;
@Service @Service
public class FileServiceImpl implements FileService { public class FileServiceImpl implements FileService {
@Value("${cappftp.server}")
private String address;
@Autowired @Autowired
private SfcService sfcService; private SfcService sfcService;
@Autowired @Autowired
@ -47,7 +44,7 @@ public class FileServiceImpl implements FileService {
for (int i = 0; i < files.length; i++) { for (int i = 0; i < files.length; i++) {
if(files[i].isFile()){ if(files[i].isFile()){
String filename=files[i].getName(); String filename=files[i].getName();
pathMap.put(filename,address+path+filename); pathMap.put(filename,path+filename);
} }
} }
} }

Loading…
Cancel
Save