fix:报告数据组装
This commit is contained in:
@@ -96,7 +96,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
|||||||
if(!dataListByKey.isEmpty())
|
if(!dataListByKey.isEmpty())
|
||||||
dataListGroup.add(dataListByKey);
|
dataListGroup.add(dataListByKey);
|
||||||
}
|
}
|
||||||
if(dataListGroup.isEmpty())
|
if(dataListGroup.isEmpty() && !dataList.isEmpty())
|
||||||
dataListGroup.add(dataList);
|
dataListGroup.add(dataList);
|
||||||
JSONArray rowList = new JSONArray();
|
JSONArray rowList = new JSONArray();
|
||||||
for(int i = 0; i < dataListGroup.size(); i++){
|
for(int i = 0; i < dataListGroup.size(); i++){
|
||||||
@@ -141,7 +141,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
//以下为空白
|
//以下为空白
|
||||||
if(rowList.size() < maxRowCount){
|
if(rowList.size() < maxRowCount && !rowList.isEmpty()){
|
||||||
JSONObject t = new JSONObject();
|
JSONObject t = new JSONObject();
|
||||||
t.put(colPrefix + "01", emptyText);
|
t.put(colPrefix + "01", emptyText);
|
||||||
putEmptyData(t, 2,10);
|
putEmptyData(t, 2,10);
|
||||||
@@ -199,7 +199,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
|||||||
int rowLength = rowList.size();
|
int rowLength = rowList.size();
|
||||||
if(rowLength <= maxRowCount){
|
if(rowLength <= maxRowCount){
|
||||||
pageRowList.add(rowList);
|
pageRowList.add(rowList);
|
||||||
return pageRowList;
|
return assemblePageResult(mainData, pageRowList, maxRowCount);
|
||||||
}
|
}
|
||||||
JSONArray remainingRows = new JSONArray();
|
JSONArray remainingRows = new JSONArray();
|
||||||
remainingRows.addAll(rowList);
|
remainingRows.addAll(rowList);
|
||||||
@@ -244,18 +244,20 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
|||||||
if(pageRow.size() < maxRowCount){
|
if(pageRow.size() < maxRowCount){
|
||||||
JSONObject t = new JSONObject();
|
JSONObject t = new JSONObject();
|
||||||
t.put(colPrefix + "01", emptyText);
|
t.put(colPrefix + "01", emptyText);
|
||||||
|
putEmptyData(t, 2,10);
|
||||||
pageRow.add(t.clone());
|
pageRow.add(t.clone());
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
return assemblePageResult(mainData, pageRowList, maxRowCount);
|
||||||
|
}
|
||||||
|
/*
|
||||||
* 修改数据结构
|
* 修改数据结构
|
||||||
[
|
[{
|
||||||
{
|
|
||||||
"headerData": {},
|
"headerData": {},
|
||||||
"tableList": [{},]
|
"tableList": [{},]
|
||||||
},
|
},]
|
||||||
]
|
|
||||||
* */
|
* */
|
||||||
|
private JSONArray assemblePageResult(ReportDocumentMainDO mainData, JSONArray pageRowList, Integer maxRowCount){
|
||||||
JSONArray result = new JSONArray();
|
JSONArray result = new JSONArray();
|
||||||
String formData = mainData.getFormData();
|
String formData = mainData.getFormData();
|
||||||
String signatureData = mainData.getDocumentSignature();
|
String signatureData = mainData.getDocumentSignature();
|
||||||
@@ -266,6 +268,13 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
|||||||
formDataJson = JSONObject.parseObject(formData);
|
formDataJson = JSONObject.parseObject(formData);
|
||||||
if(!ObjectUtils.isEmpty(signatureJsonStr))
|
if(!ObjectUtils.isEmpty(signatureJsonStr))
|
||||||
hasSignatureData = true;
|
hasSignatureData = true;
|
||||||
|
//在最后一页填充空行
|
||||||
|
JSONArray pageRow = pageRowList.getJSONArray(pageRowList.size() - 1);
|
||||||
|
while(pageRow.size() < maxRowCount){
|
||||||
|
JSONObject t = new JSONObject();
|
||||||
|
putEmptyData(t, 1,10);
|
||||||
|
pageRow.add(t.clone());
|
||||||
|
}
|
||||||
for(int i=0;i<pageRowList.size();i++){
|
for(int i=0;i<pageRowList.size();i++){
|
||||||
JSONArray rows = pageRowList.getJSONArray(i);
|
JSONArray rows = pageRowList.getJSONArray(i);
|
||||||
JSONObject resultData = new JSONObject();
|
JSONObject resultData = new JSONObject();
|
||||||
@@ -287,6 +296,8 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
|||||||
}
|
}
|
||||||
|
|
||||||
private JSONArray assembleEmpty(JSONObject configJson, JSONArray rowList){
|
private JSONArray assembleEmpty(JSONObject configJson, JSONArray rowList){
|
||||||
|
if(rowList.isEmpty())
|
||||||
|
return rowList;
|
||||||
JSONArray fixedCol = configJson.getJSONArray("fixedCol"); //固定列,举例:["SMP_NAME", "SMP_CD"]
|
JSONArray fixedCol = configJson.getJSONArray("fixedCol"); //固定列,举例:["SMP_NAME", "SMP_CD"]
|
||||||
if(fixedCol == null) fixedCol = new JSONArray();
|
if(fixedCol == null) fixedCol = new JSONArray();
|
||||||
JSONArray fixedColRight = configJson.getJSONArray("fixedColRight"); //右侧固定列
|
JSONArray fixedColRight = configJson.getJSONArray("fixedColRight"); //右侧固定列
|
||||||
|
|||||||
Reference in New Issue
Block a user