修改
This commit is contained in:
@@ -3,6 +3,7 @@ package com.ccag.entity.bo.system.office;
|
||||
import com.alibaba.fastjson2.JSONArray;
|
||||
import com.alibaba.fastjson2.JSONObject;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
|
||||
import org.apache.poi.ss.usermodel.*;
|
||||
import org.apache.poi.ss.util.CellRangeAddress;
|
||||
@@ -14,7 +15,7 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@Slf4j
|
||||
public class OfficeProxy{
|
||||
private List<List<Object>> rows = new ArrayList<>();
|
||||
private String[] header;
|
||||
@@ -56,10 +57,14 @@ public class OfficeProxy{
|
||||
*/
|
||||
public String excelToJson(String excelPath,String dictPath){
|
||||
|
||||
if(!loadDictionary(dictPath,false))
|
||||
if(!loadDictionary(dictPath,false)) {
|
||||
log.error("load dirctory error");
|
||||
return "";
|
||||
if(!readExcelFile(excelPath))
|
||||
}
|
||||
if(!readExcelFile(excelPath)) {
|
||||
log.error("read excel file error");
|
||||
return "";
|
||||
}
|
||||
return exportToJson();
|
||||
}
|
||||
|
||||
|
||||
@@ -17,7 +17,7 @@ public class SystemLoadcaseBean {
|
||||
public String importer;
|
||||
public String componentCode;
|
||||
public String patent;
|
||||
public String patentInfo;
|
||||
//public String patentInfo;
|
||||
public String techSummary;
|
||||
public String inputFormTemplate;
|
||||
public String inputForm;
|
||||
@@ -31,7 +31,7 @@ public class SystemLoadcaseBean {
|
||||
public String analysis;
|
||||
public String submitter;
|
||||
public String standard;
|
||||
public String standardInfo;
|
||||
//public String standardInfo[];
|
||||
public String confidence;
|
||||
public String nodeType;
|
||||
public String code;
|
||||
@@ -45,6 +45,6 @@ public class SystemLoadcaseBean {
|
||||
public String updateTime;
|
||||
public String updateBy;
|
||||
public String tenantId;
|
||||
public String techSummaryInfo;
|
||||
//public String techSummaryInfo[];
|
||||
public String projectNode;// = new ArrayList<>();
|
||||
}
|
||||
|
||||
@@ -523,7 +523,10 @@ public class ProjectServiceImpl implements ProjectService {
|
||||
{
|
||||
String excelPath = cmdParams[2];
|
||||
String dictPath = cmdParams[4];
|
||||
log.info("excelPath:" + excelPath);
|
||||
log.info("dictPath:" + dictPath);
|
||||
String jsonContents = officeProxy.excelToJson(excelPath,dictPath);
|
||||
log.info("jsonContents:" + jsonContents);
|
||||
result.add(jsonContents);
|
||||
}
|
||||
else if(commands.contains("jsonToExcel.py"))//json库导出excel
|
||||
@@ -535,6 +538,9 @@ public class ProjectServiceImpl implements ProjectService {
|
||||
if(index > 0) {
|
||||
String savePath = dictPath.substring(0, index);
|
||||
String excelPath = savePath + File.separator + "分析项清单.xlsx";
|
||||
log.info("excelPath:" + excelPath);
|
||||
log.info("dictPath:" + dictPath);
|
||||
log.info("savePath:" + excelPath);
|
||||
officeProxy.jsonToExcel(jsonPath, dictPath, excelPath, type);
|
||||
result.add(excelPath);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user