This commit is contained in:
ls
2025-07-11 23:58:33 +08:00
parent 3b2f4213a4
commit d7d22f058f

View File

@@ -476,19 +476,42 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
} }
List<ExperimentDeviationEquipment> deviationEquipmentList = experiment.getDeviationEquipmentList(); List<ExperimentDeviationEquipment> deviationEquipmentList = experiment.getDeviationEquipmentList();
String[][] strings = new String[deviationEquipmentList.size() + 1][5]; List<String[]> strings = new ArrayList<>();
strings[0] = new String[] {"序号", "名称", "编号", "计量有效期", "备注"}; strings.add(new String[] {"序号", "名称", "编号", "计量有效期", "备注"});
if (CollUtil.isNotEmpty(deviationEquipmentList)) { if (CollUtil.isNotEmpty(deviationEquipmentList)) {
for (int i = 0; i < deviationEquipmentList.size(); i++) { for (int i = 0; i < deviationEquipmentList.size(); i++) {
ExperimentDeviationEquipment deviationEquipment = deviationEquipmentList.get(i); ExperimentDeviationEquipment deviationEquipment = deviationEquipmentList.get(i);
strings[i + 1] = new String[] {(i + 1) + "", Optional.ofNullable(deviationEquipment.getEquipmentName()).orElse(""), strings.add(new String[] {(i + 1) + "", Optional.ofNullable(deviationEquipment.getEquipmentName()).orElse(""),
Optional.ofNullable(deviationEquipment.getManagementNo()).orElse(""), Optional.ofNullable( Optional.ofNullable(deviationEquipment.getManagementNo()).orElse(""), Optional.ofNullable(
deviationEquipment.getMeasurementValidity()).orElse(""), Optional.ofNullable(deviationEquipment.getRoomNo()).orElse( deviationEquipment.getMeasurementValidity()).orElse(""), Optional.ofNullable(deviationEquipment.getRoomNo()).orElse(
""),}; ""),});
} }
} }
params.put("装置表格", Tables.of(strings).border(BorderStyle.DEFAULT).create());
if (CollUtil.isNotEmpty(experimentTestProcesses)) {
List testParametersList = new ArrayList<>();
List EnvironmentalTemperature = new ArrayList<>();
List EnvironmentalHumidity = new ArrayList<>();
for (ExperimentTestProcess experimentTestProcess : experimentTestProcesses) {
String testEquipment = experimentTestProcess.getTestEquipment();
if (StringUtils.isNotBlank(testEquipment)) {
List<JSONObject> jsonArray = JSON.parseArray(testEquipment, JSONObject.class);
for (int i = 0; i < jsonArray.size(); i++) {
JSONObject o = jsonArray.get(i);
strings.add(new String[] {(strings.size() ) + "", Optional.ofNullable(
o.getString("equipment_name")).orElse(""),
Optional.ofNullable(o.getString("managementNo")).orElse(""), Optional.ofNullable(
o.getString("lifespan")).orElse(""), Optional.ofNullable(
o.getString("roomNo")).orElse(
""),});
}
}
}
}
String[][] array = strings.toArray(new String[strings.size()][]);
params.put("装置表格", Tables.of(array).border(BorderStyle.DEFAULT).create());
return params; return params;
} }
@@ -849,8 +872,12 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
} }
public static void main(String[] args) { public static void main(String[] args) {
System.out.println(fixChineseName("张三")); List<String[]> strings = new ArrayList<>();
System.out.println(fixChineseName("张站三")); strings.add(new String[] {"序号", "名称", "编号", "计量有效期", "备注"});
strings.add(new String[] {"1", "2", "3", "4", "5"});
String[][] array = strings.toArray(new String[strings.size()][]);
System.out.println(array.toString());
} }
} }