Merge remote-tracking branch 'origin/test' into test
This commit is contained in:
@@ -62,16 +62,12 @@ public class ReportDocumentDataController extends AbstractFileUploadController i
|
||||
@GetMapping("/queryReportDetail")
|
||||
@Operation(summary = "查询报告明细数据")
|
||||
@Parameter(name = "mainId", description = "报告id", required = true, example = "1024")
|
||||
public CommonResult<List<JSONObject>> queryReportDetail(@RequestParam("mainId") Long mainId) {
|
||||
public CommonResult<?> queryReportDetail(@RequestParam("mainId") Long mainId, @RequestParam(name = "pageFlag", required = false) String pageFlag) {
|
||||
|
||||
ReportDocumentMainDO mainDO = reportDocumentMainService.getReportDocumentMain(mainId);
|
||||
Long typeId = mainDO.getReportDocumentTypeId();
|
||||
ReportDocumentTypeDO typeDO = reportDocumentTypeService.getReportDocumentType(typeId);
|
||||
Long confId = typeDO.getConfigReportTypeId();
|
||||
// Map<String, Object> param = new HashMap<>();
|
||||
// List<ReportDocumentDataDO> list = reportDocumentDataService.listByMainDataId(mainId).getData();
|
||||
// return success(BeanUtils.toBean(list, ReportDocumentDataRespVO.class));
|
||||
CommonResult<List<JSONObject>> result = reportDocumentDataService.assembleDynamicData(mainDO, typeDO);
|
||||
CommonResult<JSONArray> result = reportDocumentDataService.assembleDynamicData(mainDO, typeDO, pageFlag);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -19,7 +19,7 @@ import java.util.List;
|
||||
*/
|
||||
public interface ReportDocumentDataService {
|
||||
|
||||
CommonResult<List<JSONObject>> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO reportConfig);
|
||||
CommonResult<JSONArray> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO reportConfig, String pageFlag);
|
||||
|
||||
CommonResult<List<ReportDocumentDataDO>> listByMainDataId(Long mainDataId);
|
||||
CommonResult<Long> countMainDataId(Long mainDataId);
|
||||
|
||||
@@ -44,6 +44,13 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
private final String colPrefix = "col";
|
||||
private final String sampleCodeKey = "SMP_CD";
|
||||
private final String sampleNameKey = "SMP_NAME";
|
||||
private final String sampleNameAndCodeKey = "SMP_NAME_CD";
|
||||
private final String entrustSampleNameKey = "ENTT_SMP_NAME";
|
||||
private final String entrustSampleCodeKey = "ENTT_SMP_CD";
|
||||
private final String entrustSampleNameCodeKey = "ENTT_SMP_NAME_CD";
|
||||
private final String rowTypeKey = "rowType"; //行类型
|
||||
private final String rowTypeTitle = "title"; //行类型-标题
|
||||
private final String rowTypeLimit = "limit"; //行类型-检出限
|
||||
private final String rangeKey = "minLimitValue";
|
||||
private final String emptyText = "以下为空白";
|
||||
|
||||
@@ -52,11 +59,12 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
* 组装动态报表数据
|
||||
* */
|
||||
@Override
|
||||
public CommonResult<List<JSONObject>> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO typeDO) {
|
||||
public CommonResult<JSONArray> assembleDynamicData(ReportDocumentMainDO mainData, ReportDocumentTypeDO typeDO, String pageFlag) {
|
||||
if(typeDO == null || typeDO.getConfigReportTypeId() == null)
|
||||
return CommonResult.error(REPORT_DOCUMENT_TYPE_NOT_EXISTS.getCode(), "报告配置为空,或未配置报表类型,请联系管理员处理!");
|
||||
String customConfig = typeDO.getCustomConfig();
|
||||
JSONObject configJson = JSONObject.parseObject(customConfig);
|
||||
String verticalFlag = configJson.getString("verticalFlag");
|
||||
String maxRowCountStr = configJson.getString("maxRowCount"); //最大行数
|
||||
Integer maxRowCount = 3;
|
||||
if(!ObjectUtils.isEmpty(maxRowCountStr))
|
||||
@@ -85,7 +93,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
}
|
||||
if(dataListGroup.isEmpty())
|
||||
dataListGroup.add(dataList);
|
||||
List<JSONObject> rowList = new ArrayList<>();
|
||||
JSONArray rowList = new JSONArray();
|
||||
for(int i = 0; i < dataListGroup.size(); i++){
|
||||
List<ReportDocumentDataDO> dataListByKey = dataListGroup.get(i);
|
||||
//处理字段,提取有数据的字段
|
||||
@@ -118,11 +126,16 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
}
|
||||
assembleStep1(rowList, fieldList, dataListByKey, customConfig, i); //处理后的组数对象
|
||||
}
|
||||
if(!"1".equals(verticalFlag)){
|
||||
//处理空数据,填充/
|
||||
rowList = assembleEmpty(configJson, rowList);
|
||||
|
||||
//todo 处理数据分页
|
||||
|
||||
//处理数据分页
|
||||
if("1".equals(pageFlag)){
|
||||
JSONArray pageRowList = assemblePageRowList(rowList, configJson);
|
||||
return CommonResult.success(pageRowList);
|
||||
}
|
||||
}
|
||||
//以下为空白
|
||||
if(rowList.size() < maxRowCount){
|
||||
JSONObject t = new JSONObject();
|
||||
@@ -137,8 +150,70 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
return CommonResult.success(rowList);
|
||||
}
|
||||
|
||||
private List<JSONObject> assembleEmpty(JSONObject configJson, List<JSONObject> rowList){
|
||||
JSONArray fixedCol = configJson.getJSONArray("fixedCol"); //固定列,举例:["sampleName", "sampleCode"]
|
||||
/*
|
||||
* 处理分页
|
||||
*
|
||||
* */
|
||||
private JSONArray assemblePageRowList(JSONArray rowList, JSONObject configJson){
|
||||
JSONArray pageRowList = new JSONArray();
|
||||
Integer maxRowCount = 20;
|
||||
String maxRowCountStr = configJson.getString("maxRowCount"); //最大行数
|
||||
if(!ObjectUtils.isEmpty(maxRowCountStr)) maxRowCount = Integer.parseInt(maxRowCountStr);
|
||||
int rowLength = rowList.size();
|
||||
if(rowLength <= maxRowCount){
|
||||
pageRowList.add(rowList);
|
||||
return pageRowList;
|
||||
}
|
||||
JSONArray remainingRows = new JSONArray();
|
||||
remainingRows.addAll(rowList);
|
||||
while(remainingRows.size() > 0){
|
||||
JSONArray pageRow = new JSONArray();
|
||||
for(int i = 0; i < maxRowCount ; i++){
|
||||
if(remainingRows.isEmpty())
|
||||
break;
|
||||
pageRow.add(remainingRows.getJSONObject(0));
|
||||
remainingRows.remove(0);
|
||||
}
|
||||
/*
|
||||
在每页开头插入“标题行”
|
||||
如果最后一行是标题,直接移到下一页;如果不是,往上寻找最近的“标题行”
|
||||
*/
|
||||
JSONObject lastTitleRow = pageRow.getJSONObject(pageRow.size() - 1);
|
||||
String rowType = lastTitleRow.getString(rowTypeKey);
|
||||
if(rowTypeTitle.equals(rowType)){
|
||||
//如果最后一行是“标题行”,移除
|
||||
pageRow.remove(pageRow.size() - 1);
|
||||
}else {
|
||||
for(int i = pageRow.size() - 1; i >= 0; i--){
|
||||
JSONObject t = pageRow.getJSONObject(i);
|
||||
rowType = t.getString(rowTypeKey);
|
||||
if(rowTypeTitle.equals(rowType)){
|
||||
lastTitleRow = t;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!remainingRows.isEmpty()){
|
||||
JSONObject firstRemainingRow = remainingRows.getJSONObject(0);
|
||||
if(!rowTypeTitle.equals(firstRemainingRow.getString(rowTypeKey))){
|
||||
remainingRows.add(0, lastTitleRow);
|
||||
}
|
||||
}
|
||||
pageRowList.add(pageRow);
|
||||
}
|
||||
|
||||
//在最后一页插入“以下为空”
|
||||
JSONArray pageRow = pageRowList.getJSONArray(pageRowList.size() - 1);
|
||||
if(pageRow.size() < maxRowCount){
|
||||
JSONObject t = new JSONObject();
|
||||
t.put(colPrefix + "01", emptyText);
|
||||
pageRow.add(t.clone());
|
||||
}
|
||||
return pageRowList;
|
||||
}
|
||||
|
||||
private JSONArray assembleEmpty(JSONObject configJson, JSONArray rowList){
|
||||
JSONArray fixedCol = configJson.getJSONArray("fixedCol"); //固定列,举例:["SMP_NAME", "SMP_CD"]
|
||||
if(fixedCol == null) fixedCol = new JSONArray();
|
||||
JSONArray fixedColRight = configJson.getJSONArray("fixedColRight"); //右侧固定列
|
||||
if(fixedColRight == null) fixedColRight = new JSONArray();
|
||||
@@ -150,7 +225,8 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
fixedColCount_left = fixedCol.size();
|
||||
fixedColCount_right = fixedColRight.size();
|
||||
|
||||
for(JSONObject row : rowList){
|
||||
for(int i = 0; i < rowList.size(); i++){
|
||||
JSONObject row = rowList.getJSONObject(i);
|
||||
if(" ".equals(row.getString(colPrefix + "01")))
|
||||
continue;
|
||||
int colIndex = 1;
|
||||
@@ -169,15 +245,15 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
* @param fieldList 要显示的字段列表。固定字段在最前
|
||||
* @param customConfig 报告配置项
|
||||
* */
|
||||
private List<JSONObject> assembleStep1(List<JSONObject> rowList, List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig, int groupIndex){
|
||||
private JSONArray assembleStep1(JSONArray rowList, List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig, int groupIndex){
|
||||
if(dataList.isEmpty())
|
||||
return new ArrayList<>();
|
||||
return new JSONArray();
|
||||
JSONObject jsonObject = JSONObject.parseObject(customConfig);
|
||||
Integer dynamicColCount = 3;
|
||||
Integer fixedColCount_left = 0;
|
||||
|
||||
String dynamicColCountStr = jsonObject.getString("dynamicColCount"); //动态列(检测项)数量
|
||||
JSONArray fixedCol = jsonObject.getJSONArray("fixedCol"); //固定列,举例:["sampleName", "sampleCode"]
|
||||
JSONArray fixedCol = jsonObject.getJSONArray("fixedCol"); //固定列,举例:["SMP_NAME", "SMP_CD"]
|
||||
if(fixedCol == null) fixedCol = new JSONArray();
|
||||
JSONArray fixedColRight = jsonObject.getJSONArray("fixedColRight"); //右侧固定列
|
||||
if(fixedColRight == null) fixedColRight = new JSONArray();
|
||||
@@ -186,10 +262,10 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
String verticalFlag = jsonObject.getString("verticalFlag"); //vertical-纵表, 否则为横表
|
||||
String fixedFields = jsonObject.getString("fixedFields"); //固定检测项。如果固定检测项,则以检测项作为数据Key
|
||||
if("1".equals(verticalFlag)){ //纵表
|
||||
return assembleVerticalData(fieldList, dataList, customConfig);
|
||||
return assembleVerticalData(rowList, fieldList, dataList, customConfig);
|
||||
}
|
||||
if(!ObjectUtils.isEmpty(fixedFields)){ //固定列
|
||||
return assembleFixedFieldsData(fieldList, dataList, customConfig);
|
||||
return assembleFixedFieldsData(rowList, fieldList, dataList, customConfig);
|
||||
}
|
||||
if(!ObjectUtils.isEmpty(dynamicColCountStr)) dynamicColCount = Integer.parseInt(dynamicColCountStr);
|
||||
fixedColCount_left = fixedCol.size();
|
||||
@@ -225,7 +301,9 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
for(int i = 0; i < dynamicFieldListGroup.size(); i++){
|
||||
List<ConfigReportFieldDO> dynamicFieldList = dynamicFieldListGroup.get(i);
|
||||
t = new JSONObject();
|
||||
t.put(rowTypeKey, rowTypeTitle);
|
||||
r = new JSONObject();
|
||||
r.put(rowTypeKey, rowTypeLimit);
|
||||
colIndex = fixedColCount_left + 1; //第二组以后,从固定列数开始
|
||||
for(ConfigReportFieldDO fieldDO : dynamicFieldList) {
|
||||
String field = fieldDO.getField();
|
||||
@@ -267,7 +345,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
* @param
|
||||
*
|
||||
* */
|
||||
private void addTitleToRowList(JSONArray fixedCol, JSONArray fixedColRight, Integer dynamicColCount, JSONObject t, List<JSONObject> rowList, List<ConfigReportFieldDO> fieldList){
|
||||
private void addTitleToRowList(JSONArray fixedCol, JSONArray fixedColRight, Integer dynamicColCount, JSONObject t, JSONArray rowList, List<ConfigReportFieldDO> fieldList){
|
||||
//处理固定列
|
||||
int index = 1;
|
||||
String colKey = "";
|
||||
@@ -281,12 +359,12 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
String field = fieldDO.getField();
|
||||
if (FIELD_DYNAMIC.equals(fieldType) || FIELD_CALCULATED.equals(fieldType))
|
||||
continue;
|
||||
if("sampleNameCode".equals( col) && "SMP_NAME_CD".equals(field)
|
||||
|| "sampleName".equals( col) && "SMP_NAME".equals(field)
|
||||
|| "sampleCode".equals( col) && "SMP_CD".equals(field)
|
||||
|| "entrustSampleName".equals( col) && "ENTT_SMP_NAME".equals(field)
|
||||
|| "entrustSampleCode".equals( col) && "ENTT_SMP_CD".equals(field)
|
||||
|| "entrustSampleNameCode".equals( col) && "ENTT_SMP_NAME_CD".equals(field)){
|
||||
if(sampleNameAndCodeKey.equals( col) && sampleNameAndCodeKey.equals(field)
|
||||
|| sampleNameKey.equals( col) && sampleNameKey.equals(field)
|
||||
|| sampleCodeKey.equals( col) && sampleCodeKey.equals(field)
|
||||
|| entrustSampleNameKey.equals( col) && entrustSampleNameKey.equals(field)
|
||||
|| entrustSampleCodeKey.equals( col) && entrustSampleCodeKey.equals(field)
|
||||
|| entrustSampleNameCodeKey.equals( col) && entrustSampleNameCodeKey.equals(field)){
|
||||
colKey = parseNumToString(index, 2);
|
||||
}
|
||||
if(!ObjectUtils.isEmpty(colKey)){
|
||||
@@ -306,12 +384,12 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
String field = fieldDO.getField();
|
||||
if (FIELD_DYNAMIC.equals(fieldType) || FIELD_CALCULATED.equals(fieldType))
|
||||
continue;
|
||||
if("sampleNameCode".equals( col) && "SMP_NAME_CD".equals(field)
|
||||
|| "sampleName".equals( col) && "SMP_NAME".equals(field)
|
||||
|| "sampleCode".equals( col) && "SMP_CD".equals(field)
|
||||
|| "entrustSampleName".equals( col) && "ENTT_SMP_NAME".equals(field)
|
||||
|| "entrustSampleCode".equals( col) && "ENTT_SMP_CD".equals(field)
|
||||
|| "entrustSampleNameCode".equals( col) && "ENTT_SMP_NAME_CD".equals(field)){
|
||||
if(sampleNameAndCodeKey.equals( col) && sampleNameAndCodeKey.equals(field)
|
||||
|| sampleNameKey.equals( col) && sampleNameKey.equals(field)
|
||||
|| sampleCodeKey.equals( col) && sampleCodeKey.equals(field)
|
||||
|| entrustSampleNameKey.equals( col) && entrustSampleNameKey.equals(field)
|
||||
|| entrustSampleCodeKey.equals( col) && entrustSampleCodeKey.equals(field)
|
||||
|| entrustSampleNameCodeKey.equals( col) && entrustSampleNameCodeKey.equals(field)){
|
||||
colKey = parseNumToString(index, 2);
|
||||
}
|
||||
if(!ObjectUtils.isEmpty(colKey)){
|
||||
@@ -324,7 +402,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
}
|
||||
|
||||
//添加行数据
|
||||
private void addDataToRowList(JSONArray fixedCol, JSONArray fixedColRight, List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, List<JSONObject> rowList, int fixedColCount, int dynamicColCount, String hasRemark){
|
||||
private void addDataToRowList(JSONArray fixedCol, JSONArray fixedColRight, List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, JSONArray rowList, int fixedColCount, int dynamicColCount, String hasRemark){
|
||||
int colIndex = 0;
|
||||
JSONObject t = new JSONObject();
|
||||
for(ReportDocumentDataDO dataDO : dataList){
|
||||
@@ -385,19 +463,19 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
for(int i=0;i<fixedCol.size();i++){
|
||||
String col = fixedCol.getString(i);
|
||||
colKey = parseNumToString(index, 2);
|
||||
if("sampleName".equals(col)){
|
||||
if(sampleNameKey.equals(col)){
|
||||
t.put(colPrefix + colKey, dataDO.getSampleName());
|
||||
}
|
||||
else if("sampleCode".equals(col)){
|
||||
else if(sampleCodeKey.equals(col)){
|
||||
t.put(colPrefix + colKey, dataDO.getSampleCode());
|
||||
}
|
||||
else if("sampleNameCode".equals( col)){
|
||||
else if(sampleNameAndCodeKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getSampleName() + " " + dataDO.getSampleCode());
|
||||
}else if("entrustSampleName".equals( col)){
|
||||
}else if(entrustSampleNameKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getEntrustSampleName());
|
||||
}else if("entrustSampleCode".equals( col)){
|
||||
}else if(entrustSampleCodeKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getEntrustSampleCode());
|
||||
}else if("entrustSampleNameCode".equals( col)){
|
||||
}else if(entrustSampleNameCodeKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getEntrustSampleName() + " " + dataDO.getEntrustSampleCode());
|
||||
}
|
||||
index ++;
|
||||
@@ -407,19 +485,19 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
for(int i=0;i<fixedColRight.size();i++){
|
||||
String col = fixedColRight.getString(i);
|
||||
colKey = parseNumToString(index, 2);
|
||||
if("sampleName".equals(col)){
|
||||
if(sampleNameKey.equals(col)){
|
||||
t.put(colPrefix + colKey, dataDO.getSampleName());
|
||||
}
|
||||
else if("sampleCode".equals(col)){
|
||||
else if(sampleCodeKey.equals(col)){
|
||||
t.put(colPrefix + colKey, dataDO.getSampleCode());
|
||||
}
|
||||
else if("sampleNameCode".equals( col)){
|
||||
else if(sampleNameAndCodeKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getSampleName() + " " + dataDO.getSampleCode());
|
||||
}else if("entrustSampleName".equals( col)){
|
||||
}else if(entrustSampleNameKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getEntrustSampleName());
|
||||
}else if("entrustSampleCode".equals( col)){
|
||||
}else if(entrustSampleCodeKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getEntrustSampleCode());
|
||||
}else if("entrustSampleNameCode".equals( col)){
|
||||
}else if(entrustSampleNameCodeKey.equals( col)){
|
||||
t.put(colPrefix + colKey, dataDO.getEntrustSampleName() + " " + dataDO.getEntrustSampleCode());
|
||||
}
|
||||
index ++;
|
||||
@@ -429,13 +507,6 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 处理检出限
|
||||
* 如果是
|
||||
* */
|
||||
private void addRangeToRowList(JSONObject r, List<JSONObject> rowList){
|
||||
rowList.add(r.clone());
|
||||
}
|
||||
|
||||
private String parseNumToString(int num, int len){
|
||||
StringBuilder sb = new StringBuilder();
|
||||
@@ -448,7 +519,7 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
/**
|
||||
* 组装固定检测项的数据,以检测项作为数据Key
|
||||
* */
|
||||
private List<JSONObject> assembleFixedFieldsData(List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig){
|
||||
private JSONArray assembleFixedFieldsData(JSONArray rowList, List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig){
|
||||
JSONObject jsonObject = JSONObject.parseObject(customConfig);
|
||||
|
||||
Integer maxRowCount = 3;
|
||||
@@ -458,8 +529,6 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
String fixedFields = jsonObject.getString("fixedFields"); //固定检测项。如果固定检测项,则以检测项作为数据Key
|
||||
JSONArray fixedFieldsArray = JSONArray.parseArray(fixedFields);
|
||||
if(!ObjectUtils.isEmpty(maxRowCountStr)) maxRowCount = Integer.parseInt(maxRowCountStr);
|
||||
|
||||
List<JSONObject> rowList = new ArrayList<>();
|
||||
for(int i = 0; i < maxRowCount; i++){
|
||||
JSONObject row = new JSONObject();
|
||||
row.put("sampleNameCode", " ");
|
||||
@@ -520,17 +589,15 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
* 组装纵表数据
|
||||
* 第1列固定为:元素; 第2列:方法检出限(%);第三列开始为各个样品
|
||||
* */
|
||||
private List<JSONObject> assembleVerticalData(List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig){
|
||||
private JSONArray assembleVerticalData(JSONArray rowList, List<ConfigReportFieldDO> fieldList, List<ReportDocumentDataDO> dataList, String customConfig){
|
||||
JSONObject jsonObject = JSONObject.parseObject(customConfig);
|
||||
Integer dynamicColCount = 3;
|
||||
Integer fixedColCount = 2;
|
||||
Integer maxRowCount = 3;
|
||||
String dynamicColCountStr = jsonObject.getString("dynamicColCount"); //动态列(检测项)数量
|
||||
String fixedColCountStr = jsonObject.getString("fixedColCount"); //固定列(样品名称、样品编号等)数量
|
||||
String maxRowCountStr = jsonObject.getString("maxRowCount"); //最大行数
|
||||
String nameCodeType = jsonObject.getString("nameCodeType"); //名称、编号处理方式:merge-合并, name-只显示名称, code-只显示编号, split-2列分开显示
|
||||
Integer fixedColCount = 1;
|
||||
Integer maxRowCount = 20;
|
||||
String hasRemark = jsonObject.getString("hasRemark"); //是否有备注
|
||||
String hasRange = jsonObject.getString("hasRange"); //是否有检出限
|
||||
if("1".equals(hasRange))
|
||||
fixedColCount ++;
|
||||
//取数据第一行,用于处理方法检出限
|
||||
String content = "";
|
||||
if(!ObjectUtils.isEmpty(dataList))
|
||||
@@ -539,11 +606,14 @@ public class ReportDocumentDataServiceImpl implements ReportDocumentDataService
|
||||
if(!ObjectUtils.isEmpty(content)){
|
||||
firstData = JSONObject.parseObject(content);
|
||||
}
|
||||
List<JSONObject> rowList = new ArrayList<>();
|
||||
//处理第一行-样品编号
|
||||
int colIndex = fixedColCount + 1;
|
||||
int rowIndex = 1;
|
||||
JSONObject t = new JSONObject();
|
||||
t.put(colPrefix + "01", "元素");
|
||||
if("1".equals(hasRange)){
|
||||
t.put(colPrefix + "02", "方法检出限");
|
||||
}
|
||||
for(ReportDocumentDataDO dataDO : dataList){
|
||||
String colKey = parseNumToString(colIndex, 2);
|
||||
t.put(colPrefix + colKey, dataDO.getSampleCode());
|
||||
|
||||
Reference in New Issue
Block a user