This commit is contained in:
daiqy88
2025-11-03 18:44:53 +08:00
parent 956a6a4cf3
commit fbdda30e48

View File

@@ -381,20 +381,24 @@ public class OfficeProxy{
*/ */
public boolean importFromJson(String filePath,int type) public boolean importFromJson(String filePath,int type)
{ {
log.info("importFromJson ");
String contents = readFileContents(filePath); String contents = readFileContents(filePath);
log.info("contents:" + contents);
if(contents == null || contents.isEmpty()) { if(contents == null || contents.isEmpty()) {
log.error("contents is empty"); log.error("contents is empty");
return false; return false;
} }
log.info("init head:");
initExcelHeader(type); initExcelHeader(type);
JSONArray componentArray = JSONArray.parseArray(contents); JSONArray componentArray = JSONArray.parseArray(contents);
log.info("componentArraySize:" + componentArray.size());
for(int i=0;i<componentArray.size();i++) for(int i=0;i<componentArray.size();i++)
{ {
JSONObject componentObj = componentArray.getJSONObject(i); JSONObject componentObj = componentArray.getJSONObject(i);
ObjectMapper objectMapper = new ObjectMapper(); ObjectMapper objectMapper = new ObjectMapper();
try { try {
Component component = objectMapper.convertValue(componentObj,Component.class); Component component = objectMapper.convertValue(componentObj,Component.class);
log.info("component:"+component); log.info("object mapper component:"+component);
componentToExcelRow(component,type); componentToExcelRow(component,type);
for(List<Object> row : rows) for(List<Object> row : rows)
{ {