diff --git a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/controller/WpsController.java b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/controller/WpsController.java index 576bafd..6d7d087 100644 --- a/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/controller/WpsController.java +++ b/src/main/java/com/chinaunicom/mall/ebtp/extend/wps/controller/WpsController.java @@ -24,6 +24,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; +import org.apache.commons.io.IOUtils; import org.apache.commons.lang3.StringEscapeUtils; import org.apache.commons.lang3.StringUtils; import org.springframework.beans.factory.annotation.Autowired; @@ -271,6 +272,13 @@ public class WpsController { String fileName = fileIdName; String text = " "; byte buf[] = text.getBytes(); + try { + BufferedInputStream bis = new BufferedInputStream(new FileInputStream("text.doc")); + buf = IOUtils.toByteArray(bis); + }catch (Exception e){ + CommonExceptionEnum.FRAME_EXCEPTION_COMMON_DATA_OTHER_ERROR.customValidName("模板文件读取异常",true); + } + String fileLength = String.valueOf(buf.length); if(optional!=null&&optional.get()!=null){ diff --git a/src/main/resources/text.doc b/src/main/resources/text.doc new file mode 100644 index 0000000..405671c Binary files /dev/null and b/src/main/resources/text.doc differ