|
@@ -5,8 +5,7 @@ import edu.math.diagnosis.entity.PaperTemplate;
|
|
import edu.math.diagnosis.entity.Question;
|
|
import edu.math.diagnosis.entity.Question;
|
|
import edu.math.diagnosis.entity.QuestionOption;
|
|
import edu.math.diagnosis.entity.QuestionOption;
|
|
import edu.math.diagnosis.config.Constants;
|
|
import edu.math.diagnosis.config.Constants;
|
|
-import edu.math.diagnosis.service.FileService;
|
|
|
|
-import edu.math.diagnosis.service.LocalFileService;
|
|
|
|
|
|
+import edu.math.diagnosis.file.FileService;
|
|
import edu.math.diagnosis.util.CommonUtil;
|
|
import edu.math.diagnosis.util.CommonUtil;
|
|
import edu.math.diagnosis.util.ObjectUtil;
|
|
import edu.math.diagnosis.util.ObjectUtil;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
@@ -34,8 +33,6 @@ public class WordService {
|
|
@Resource
|
|
@Resource
|
|
private FileService fileService;
|
|
private FileService fileService;
|
|
@Resource
|
|
@Resource
|
|
- private LocalFileService localFileService;
|
|
|
|
- @Resource
|
|
|
|
private FormulaService formulaService;
|
|
private FormulaService formulaService;
|
|
|
|
|
|
private static final Logger logger = LoggerFactory.getLogger(WordService.class);
|
|
private static final Logger logger = LoggerFactory.getLogger(WordService.class);
|
|
@@ -203,7 +200,7 @@ public class WordService {
|
|
List<XWPFParagraph> ps = map.get(tag);
|
|
List<XWPFParagraph> ps = map.get(tag);
|
|
//标签不对
|
|
//标签不对
|
|
if (ps == null) {
|
|
if (ps == null) {
|
|
- logger.error("unknown tag");
|
|
|
|
|
|
+ logger.error("unknown tag {}", tag);
|
|
continue;
|
|
continue;
|
|
}
|
|
}
|
|
ps.add(p);
|
|
ps.add(p);
|
|
@@ -280,7 +277,7 @@ public class WordService {
|
|
int width = Constants.DEFAULT_WIDTH, height = Constants.DEFAULT_HEIGHT;
|
|
int width = Constants.DEFAULT_WIDTH, height = Constants.DEFAULT_HEIGHT;
|
|
try {
|
|
try {
|
|
BufferedImage image = ImageIO.read(new ByteArrayInputStream(pData));
|
|
BufferedImage image = ImageIO.read(new ByteArrayInputStream(pData));
|
|
- width = image.getWidth() > Constants.MAX_WIDTH ? Constants.MAX_WIDTH : image.getWidth();
|
|
|
|
|
|
+ width = Math.min(image.getWidth(), Constants.MAX_WIDTH);
|
|
//设置临界值
|
|
//设置临界值
|
|
// width = setBound(width, Constants.MIN_WIDTH, Constants.MAX_WIDTH);
|
|
// width = setBound(width, Constants.MIN_WIDTH, Constants.MAX_WIDTH);
|
|
// if(width > Constants.MAX_WIDTH){
|
|
// if(width > Constants.MAX_WIDTH){
|
|
@@ -296,11 +293,12 @@ public class WordService {
|
|
//上传照片到阿里云,后续考虑不上传,存储到本地
|
|
//上传照片到阿里云,后续考虑不上传,存储到本地
|
|
// String url = aliyunFileService.putFile(pData, pName);
|
|
// String url = aliyunFileService.putFile(pData, pName);
|
|
// String url = fileService.upload(pData, UploadProperties.IMAGE_PATH, saveName);
|
|
// String url = fileService.upload(pData, UploadProperties.IMAGE_PATH, saveName);
|
|
- String url = localFileService.upload(pData, saveName);
|
|
|
|
|
|
+// String url = localFileService.upload(pData, saveName);
|
|
|
|
+ String url = fileService.upload(pData, saveName);
|
|
// String url = "temp url";
|
|
// String url = "temp url";
|
|
|
|
|
|
insert.put(i, String.format(img, url, width));
|
|
insert.put(i, String.format(img, url, width));
|
|
- logger.debug("picture des " + pp.getDescription());
|
|
|
|
|
|
+ logger.debug("picture url is {}, des is {} ", url, pp.getDescription());
|
|
}
|
|
}
|
|
}
|
|
}
|
|
insert.forEach((k, v) -> {
|
|
insert.forEach((k, v) -> {
|