java110
2020-04-23 5bd79abfedcfb1cc4bfe06e2d68456e410f73cb9
CommonService/src/main/java/com/java110/common/smo/impl/FileInnerServiceSMOImpl.java
@@ -3,11 +3,10 @@
import com.java110.common.dao.IFileServiceDao;
import com.java110.config.properties.code.Java110Properties;
import com.java110.core.base.smo.BaseServiceSMO;
import com.java110.core.client.JSchFtpUploadTemplate;
import com.java110.core.smo.file.IFileInnerServiceSMO;
import com.java110.dto.file.FileDto;
import com.java110.utils.util.Base64Convert;
import com.java110.utils.util.BeanConvertUtil;
import com.java110.utils.util.FtpUpload;
import com.java110.core.client.FtpUploadTemplate;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
@@ -25,6 +24,12 @@
    @Autowired
    private Java110Properties java110Properties;
    @Autowired
    private FtpUploadTemplate ftpUploadTemplate;
    @Autowired
    private JSchFtpUploadTemplate jSchFtpUploadTemplate;
    @Override
    public String saveFile(@RequestBody FileDto fileDto) {
@@ -32,10 +37,13 @@
        //int saveFileFlag = fileServiceDaoImpl.saveFile(BeanConvertUtil.beanCovertMap(fileDto));
        String fileName = FtpUpload.upload(fileDto.getContext(), java110Properties.getFtpServer(),
        String fileName = ftpUploadTemplate.upload(fileDto.getContext(), java110Properties.getFtpServer(),
                java110Properties.getFtpPort(), java110Properties.getFtpUserName(),
                java110Properties.getFtpUserPassword(), java110Properties.getFtpPath());
//        String fileName = jSchFtpUploadTemplate.upload(fileDto.getContext(), java110Properties.getFtpServer(),
//                java110Properties.getFtpPort(), java110Properties.getFtpUserName(),
//                java110Properties.getFtpUserPassword(), java110Properties.getFtpPath());
        return fileName;
    }
@@ -49,7 +57,7 @@
            ftpPath += fileName.substring(0, fileName.lastIndexOf("/")+1);
            fileName = fileName.substring(fileName.lastIndexOf("/")+1, fileName.length());
        }
        byte[] fileImg = FtpUpload.downFileByte(ftpPath, fileName, java110Properties.getFtpServer(),
        byte[] fileImg = ftpUploadTemplate.downFileByte(ftpPath, fileName, java110Properties.getFtpServer(),
                java110Properties.getFtpPort(), java110Properties.getFtpUserName(),
                java110Properties.getFtpUserPassword());