This commit is contained in:
wangjinlei
2022-07-31 21:27:33 +08:00
parent 8df1f1536e
commit b88dfc54f5
4 changed files with 356 additions and 761 deletions

View File

@@ -1,6 +1,8 @@
package com.example.ts_obj.controller;
import cn.hutool.core.io.FileUtil;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONArray;
import com.deepoove.poi.XWPFTemplate;
import com.example.ts_obj.bean.ReturnCodeAndMsgEnum;
import com.example.ts_obj.bean.ReturnValue;
@@ -32,16 +34,19 @@ public class DataapiController {
/**
* 模板生成work文档
* @param map
* @return 文档路径
*/
@PostMapping("/createTemplate")
public ReturnValue createTemplate (Map<String, Object> map){
public ReturnValue createTemplate (String issue,String date_list){
JSONArray ja = (JSONArray) JSON.parse(date_list);
HashMap<String, Object> result = Maps.newHashMap();
if (map.size() == 0) {
return new ReturnValue(ReturnCodeAndMsgEnum.No_Data);
}
XWPFTemplate template = XWPFTemplate.compile(BASE_DIR + "data_template").render(map);
HashMap<String, Object> map = new HashMap<>();
map.put("date",issue);
map.put("list",ja);
XWPFTemplate template = XWPFTemplate.compile(BASE_DIR + "data_template.docx").render(map);
try {
Date date = new Date();
String dirpath = BASE_DIR + new SimpleDateFormat("yyyyMMdd").format(date);
@@ -53,6 +58,6 @@ public class DataapiController {
} catch (IOException e) {
e.printStackTrace();
}
return new ReturnValue(ReturnCodeAndMsgEnum.Success, result);
return new ReturnValue(ReturnCodeAndMsgEnum.Success,result);
}
}

View File

@@ -135,41 +135,6 @@ public class TypesetInfo implements Serializable {
return traditon;
}
@Override
public String toString() {
return "TypesetInfo{" +
"typesetInfoId=" + typesetInfoId +
", typesetId=" + typesetId +
", info_title='" + info_title + '\'' +
", info_type='" + info_type + '\'' +
", doi='" + doi + '\'' +
", topic='" + topic + '\'' +
", mainText='" + mainText + '\'' +
", author='" + author + '\'' +
", authorAddress='" + authorAddress + '\'' +
", authorContribution='" + authorContribution + '\'' +
", authorCorresponding='" + authorCorresponding + '\'' +
", authorCorrespondingEmail='" + authorCorrespondingEmail + '\'' +
", traditon='" + traditon + '\'' +
", journal='" + journal + '\'' +
", jabbr='" + jabbr + '\'' +
", stage='" + stage + '\'' +
", little_author='" + little_author + '\'' +
", website='" + website + '\'' +
", acknowledgment='" + acknowledgment + '\'' +
", received_date='" + received_date + '\'' +
", accepted_date='" + accepted_date + '\'' +
", online_date='" + online_date + '\'' +
", abbreviation='" + abbreviation + '\'' +
", abstractText='" + abstractText + '\'' +
", keywords='" + keywords + '\'' +
", filename='" + filename + '\'' +
", refers='" + refers + '\'' +
", info_state=" + info_state +
", userAccount='" + userAccount + '\'' +
'}';
}
public String getUserAccount() {
return userAccount;
}
@@ -334,4 +299,38 @@ public class TypesetInfo implements Serializable {
this.abbreviation = abbreviation;
}
@Override
public String toString() {
return "TypesetInfo{" +
"typesetInfoId=" + typesetInfoId +
", typesetId=" + typesetId +
", info_title='" + info_title + '\'' +
", info_type='" + info_type + '\'' +
", doi='" + doi + '\'' +
", topic='" + topic + '\'' +
", mainText='" + mainText + '\'' +
", author='" + author + '\'' +
", authorAddress='" + authorAddress + '\'' +
", authorContribution='" + authorContribution + '\'' +
", authorCorresponding='" + authorCorresponding + '\'' +
", authorCorrespondingEmail='" + authorCorrespondingEmail + '\'' +
", traditon='" + traditon + '\'' +
", journal='" + journal + '\'' +
", jabbr='" + jabbr + '\'' +
", stage='" + stage + '\'' +
", little_author='" + little_author + '\'' +
", website='" + website + '\'' +
", acknowledgment='" + acknowledgment + '\'' +
", received_date='" + received_date + '\'' +
", accepted_date='" + accepted_date + '\'' +
", online_date='" + online_date + '\'' +
", abbreviation='" + abbreviation + '\'' +
", abstractText='" + abstractText + '\'' +
", keywords='" + keywords + '\'' +
", filename='" + filename + '\'' +
", refers='" + refers + '\'' +
", info_state=" + info_state +
", userAccount='" + userAccount + '\'' +
'}';
}
}

View File

@@ -1,5 +1,5 @@
server:
port: 8080
port: 8081
spring:
datasource: