1
This commit is contained in:
@@ -59,7 +59,7 @@ public class TypesetController {
|
||||
|
||||
private final static Logger logger = LoggerFactory.getLogger(UserController.class);
|
||||
|
||||
// private String BASE_DIR = "E:/";
|
||||
// private String BASE_DIR = "E:/";
|
||||
// private static String IMG_DIR = "E:/";
|
||||
private String BASE_DIR = "/home/wwwroot/ts.tmrjournals.com/upload/";
|
||||
private String IMG_DIR = "/home/wwwroot/ts.tmrjournals.com/upload/pictures/";
|
||||
@@ -273,24 +273,24 @@ public class TypesetController {
|
||||
}
|
||||
|
||||
@PostMapping("/readPic")
|
||||
public ReturnValue readPicNum(String fileRoute, HttpServletRequest request, HttpServletResponse response){
|
||||
public ReturnValue readPicNum(String fileRoute, HttpServletRequest request, HttpServletResponse response) {
|
||||
Integer num = 0;
|
||||
Integer table_num = 0;
|
||||
Map<String,Integer> m = new HashMap();
|
||||
Map<String, Integer> m = new HashMap();
|
||||
try {
|
||||
InputStream inputStream = FileDownloadUtil.getInputStream(fileRoute);
|
||||
XWPFDocument xdoc = new XWPFDocument(inputStream);
|
||||
List<XWPFPictureData> allPictures = xdoc.getAllPictures();
|
||||
List<XWPFTable> tables = xdoc.getTables();
|
||||
num = allPictures.size();
|
||||
table_num =tables.size();
|
||||
m.put("pic",num);
|
||||
m.put("table",table_num);
|
||||
table_num = tables.size();
|
||||
m.put("pic", num);
|
||||
m.put("table", table_num);
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return new ReturnValue(ReturnCodeAndMsgEnum.Success,m);
|
||||
return new ReturnValue(ReturnCodeAndMsgEnum.Success, m);
|
||||
}
|
||||
|
||||
|
||||
@@ -446,9 +446,9 @@ public class TypesetController {
|
||||
return new ReturnValue(ReturnCodeAndMsgEnum.Success, frag);
|
||||
}
|
||||
|
||||
@ApiOperation(value="ceshi")
|
||||
@ApiOperation(value = "ceshi")
|
||||
@PostMapping("/webtest")
|
||||
public ReturnValue webtest(@RequestBody TypesetInfo typesetInfo){
|
||||
public ReturnValue webtest(@RequestBody TypesetInfo typesetInfo) {
|
||||
JSONArray ja = (JSONArray) JSON.parse(typesetInfo.getRefers());
|
||||
List<ParagraphRenderData> refsl = new ArrayList<ParagraphRenderData>();
|
||||
for (Object tif : ja) {
|
||||
@@ -492,7 +492,7 @@ public class TypesetController {
|
||||
Style doi_s = new Style();
|
||||
doi_s.setColor("FF0000");
|
||||
ParagraphRenderData doi_p = new ParagraphRenderData();
|
||||
doi_p.addText(new TextRenderData("input doi",doi_s));
|
||||
doi_p.addText(new TextRenderData("input doi", doi_s));
|
||||
map.put("doi", doi_p);
|
||||
// map.put("doi", typesetInfo.getDoi());
|
||||
map.put("topic", typesetInfo.getTopic());
|
||||
@@ -500,11 +500,11 @@ public class TypesetController {
|
||||
ParagraphRenderData peer_p = new ParagraphRenderData();
|
||||
Style Italic_sty = new Style();
|
||||
Italic_sty.setItalic(true);
|
||||
peer_p.addText(new TextRenderData(typesetInfo.getJournal(),Italic_sty));
|
||||
peer_p.addText(new TextRenderData(typesetInfo.getJournal(), Italic_sty));
|
||||
peer_p.addText(" thanks all ");
|
||||
peer_p.addText(new TextRenderData("XXXXXXXXXXXXXXXX",doi_s));
|
||||
peer_p.addText(new TextRenderData("XXXXXXXXXXXXXXXX", doi_s));
|
||||
peer_p.addText("anonymous reviewers for their contribution to the peer review of this paper.");
|
||||
map.put("peer",peer_p);
|
||||
map.put("peer", peer_p);
|
||||
map.put("articletitle", typesetInfo.getInfo_title().replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", ""));
|
||||
//解决作者小标问题
|
||||
String author = typesetInfo.getAuthor();
|
||||
@@ -517,7 +517,7 @@ public class TypesetController {
|
||||
String[] cache_author = s_author[i].split("<q>");
|
||||
String au = cache_author[0];
|
||||
author_p.addText(au);
|
||||
if(cache_author.length>1){
|
||||
if (cache_author.length > 1) {
|
||||
String bu = cache_author[1];
|
||||
Style ca_sty = new Style();
|
||||
ca_sty.setVertAlign("superscript");
|
||||
@@ -553,13 +553,13 @@ public class TypesetController {
|
||||
map.put("accept_date", typesetInfo.getAccepted_date());
|
||||
|
||||
ParagraphRenderData od_p = new ParagraphRenderData();
|
||||
od_p.addText(new TextRenderData("input online_date",doi_s));
|
||||
od_p.addText(new TextRenderData("input online_date", doi_s));
|
||||
map.put("online_date", od_p);
|
||||
// map.put("online_date", typesetInfo.getOnline_date());
|
||||
map.put("ye", typesetInfo.getStage().substring(0, 4));
|
||||
|
||||
ParagraphRenderData abstract_p = new ParagraphRenderData();
|
||||
abstract_p.addText(new TextRenderData("input abstract",doi_s));
|
||||
abstract_p.addText(new TextRenderData("input abstract", doi_s));
|
||||
map.put("abstract", abstract_p);
|
||||
// map.put("abstract", this.crowStr(typesetInfo.getAbstractText()));
|
||||
map.put("keywords", typesetInfo.getKeywords().replace("<b>", "").replace("</b>", ""));
|
||||
@@ -596,7 +596,7 @@ public class TypesetController {
|
||||
// System.out.println(a.getString("author"));
|
||||
// String tttt = String.valueOf(tif).replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", "").trim().toUpperCase();
|
||||
|
||||
if(!a.getString("title").isEmpty()){
|
||||
if (!a.getString("title").isEmpty()) {
|
||||
ParagraphRenderData chc_pdd = new ParagraphRenderData();
|
||||
Style chch = new Style();
|
||||
chch.setFontFamily("Charis SIL");
|
||||
@@ -606,7 +606,7 @@ public class TypesetController {
|
||||
cheche.setItalic(true);
|
||||
cheche.setFontFamily("Charis SIL");
|
||||
cheche.setFontSize(7.5);
|
||||
if(a.getString("is_ja").equals("0")){
|
||||
if (a.getString("is_ja").equals("0")) {
|
||||
cheche.setColor("f98f36");
|
||||
}
|
||||
|
||||
@@ -614,35 +614,35 @@ public class TypesetController {
|
||||
lstitle.setFontFamily("Charis SIL");
|
||||
lstitle.setFontSize(7.5);
|
||||
lstitle.setColor("0082AA");
|
||||
chc_pdd.addText(new TextRenderData(a.getString("author")+" ", chch));
|
||||
chc_pdd.addText(new TextRenderData(a.getString("title")+". ",chch));
|
||||
chc_pdd.addText(new TextRenderData(a.getString("joura")+" ",cheche));
|
||||
chc_pdd.addText(new TextRenderData(a.getString("dateno")+". Available at:",chch));
|
||||
chc_pdd.addText(new TextRenderData(a.getString("author") + " ", chch));
|
||||
chc_pdd.addText(new TextRenderData(a.getString("title") + ". ", chch));
|
||||
chc_pdd.addText(new TextRenderData(a.getString("joura") + " ", cheche));
|
||||
chc_pdd.addText(new TextRenderData(a.getString("dateno") + ". Available at:", chch));
|
||||
chc_pdd.addText("\n");
|
||||
chc_pdd.addText(new TextRenderData(a.getString("doilink"),lstitle));
|
||||
chc_pdd.addText(new TextRenderData(a.getString("doilink"), lstitle));
|
||||
refsl.add(chc_pdd);
|
||||
}else{
|
||||
ParagraphRenderData chc_pd = new ParagraphRenderData();
|
||||
} else {
|
||||
ParagraphRenderData chc_pd = new ParagraphRenderData();
|
||||
|
||||
// String tgh_title = String.valueOf(tif).replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", "");
|
||||
String tgh_title = a.getString("refer_frag").replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", "");
|
||||
String[] split = tgh_title.split("\n");
|
||||
String tgh_title = a.getString("refer_frag").replace("<b>", "").replace("</b>", "").replace("<i>", "").replace("</i>", "");
|
||||
String[] split = tgh_title.split("\n");
|
||||
|
||||
Style chch = new Style();
|
||||
chch.setFontFamily("Charis SIL");
|
||||
chch.setFontSize(7.5);
|
||||
chch.setColor("f98f36");
|
||||
chc_pd.addText(new TextRenderData(split[0], chch));
|
||||
Style chch = new Style();
|
||||
chch.setFontFamily("Charis SIL");
|
||||
chch.setFontSize(7.5);
|
||||
chch.setColor("f98f36");
|
||||
chc_pd.addText(new TextRenderData(split[0], chch));
|
||||
|
||||
if(split.length>1){
|
||||
chc_pd.addText("\n");
|
||||
Style lstitle = new Style();
|
||||
lstitle.setFontFamily("Charis SIL");
|
||||
lstitle.setFontSize(7.5);
|
||||
lstitle.setColor("0082AA");
|
||||
chc_pd.addText(new TextRenderData(split[1],lstitle));
|
||||
}
|
||||
refsl.add(chc_pd);
|
||||
if (split.length > 1) {
|
||||
chc_pd.addText("\n");
|
||||
Style lstitle = new Style();
|
||||
lstitle.setFontFamily("Charis SIL");
|
||||
lstitle.setFontSize(7.5);
|
||||
lstitle.setColor("0082AA");
|
||||
chc_pd.addText(new TextRenderData(split[1], lstitle));
|
||||
}
|
||||
refsl.add(chc_pd);
|
||||
|
||||
}
|
||||
}
|
||||
@@ -669,7 +669,7 @@ public class TypesetController {
|
||||
template.writeAndClose(new FileOutputStream(dirpath + "/" + goFileName));
|
||||
String filePath = addPic1(typesetInfo.getFilename(), dirpath + "/" + goFileName);
|
||||
// frag.put("file", filePath);
|
||||
frag.put("file",goFileName);
|
||||
frag.put("file", goFileName);
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -1092,8 +1092,8 @@ public class TypesetController {
|
||||
String randomFix = String.valueOf(System.currentTimeMillis()) + "/";
|
||||
|
||||
String path = IMG_DIR + randomFix;
|
||||
File folder = new File(IMG_DIR + randomFix );
|
||||
if (!folder.exists()){
|
||||
File folder = new File(IMG_DIR + randomFix);
|
||||
if (!folder.exists()) {
|
||||
folder.mkdirs();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user