政企WPS
This commit is contained in:
@ -314,6 +314,7 @@ public class WpsController {
|
||||
}
|
||||
if(uploadB){
|
||||
buf = this.wpsService.uploadTempFile(fileId[0]);
|
||||
fileLength = String.valueOf(buf.length);
|
||||
//Optional<UploadObject> op=attachmentClient.upload(fileId[0],fileName,buf);
|
||||
}
|
||||
|
||||
|
@ -38,6 +38,8 @@ import com.chinaunicom.mall.ebtp.extend.wps.vo.*;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
import org.apache.commons.lang.StringUtils;
|
||||
import org.apache.poi.poifs.filesystem.POIFSFileSystem;
|
||||
import org.apache.poi.wp.usermodel.CharacterRun;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.beans.factory.annotation.Value;
|
||||
import org.springframework.data.redis.core.RedisTemplate;
|
||||
@ -722,19 +724,27 @@ public class WpsServiceImpl implements WpsService {
|
||||
}
|
||||
@Override
|
||||
public byte[] uploadTempFile(String fileExtension){
|
||||
String text = " ";
|
||||
String text = "1111";
|
||||
byte buf[] = text.getBytes();
|
||||
File tempFile = null;
|
||||
try {
|
||||
tempFile = File.createTempFile("tempDoc", "."+fileExtension);
|
||||
tempFile.deleteOnExit(); // 在程序退出时删除临时文件
|
||||
|
||||
byte[] b = "2222".getBytes();
|
||||
OutputStream out = new FileOutputStream(tempFile);
|
||||
out.write(b);
|
||||
out.close();
|
||||
|
||||
BufferedInputStream bis = new BufferedInputStream(new FileInputStream(tempFile));
|
||||
buf = IOUtils.toByteArray(bis);
|
||||
log.info("buf:"+buf.length);
|
||||
}catch (Exception e){
|
||||
log.error("读取异常",e);
|
||||
CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("模板文件读取异常",true);
|
||||
}finally {
|
||||
if(tempFile!=null) {
|
||||
tempFile.delete();
|
||||
tempFile.deleteOnExit();
|
||||
}
|
||||
}
|
||||
return buf;
|
||||
|
Reference in New Issue
Block a user