update
This commit is contained in:
@@ -283,9 +283,6 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
|
||||
return new HashMap<>();
|
||||
}
|
||||
ExperimentReport latestReport = experimentReportService.getLatestReport(experimentId);
|
||||
if (Objects.isNull(latestReport)) {
|
||||
return new HashMap<>();
|
||||
}
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
if (Objects.nonNull(latestReport)) {
|
||||
params.put("审核人员姓名", Optional.ofNullable(sysUserService.getById(latestReport.getAuditor())).map(SysUser::getRealname)
|
||||
@@ -295,12 +292,13 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
|
||||
params.put("批准人员姓名", Optional.ofNullable(sysUserService.getById(latestReport.getConfirmer())).map(SysUser::getRealname)
|
||||
.orElse(""));
|
||||
params.put("报告生成日期", formatDate(latestReport.getCreateTime()));
|
||||
params.put("最后批准完成的日期", DateUtils.formatDate(latestReport.getUpdateTime(), "yyyy年MM月dd日"));
|
||||
|
||||
}
|
||||
params.put("试验报告名称", experiment.getName());
|
||||
params.put("试验编号", experiment.getExperimentNo());
|
||||
params.put("编制人员姓名", Optional.ofNullable(sysUserService.getUserByName(experiment.getCreateBy())).map(SysUser::getRealname)
|
||||
.orElse(""));
|
||||
params.put("最后批准完成的日期", DateUtils.formatDate(latestReport.getUpdateTime(), "yyyy年MM月dd日"));
|
||||
Client client = clientService.getOne(new LambdaQueryWrapper<Client>().eq(Client::getName, experiment.getClientName()), false);
|
||||
params.put("委托方单位名称", Optional.ofNullable(client).map(Client::getName).orElse(""));
|
||||
params.put("委托方单位地址", Optional.ofNullable(client).map(Client::getAddress).orElse(""));
|
||||
@@ -323,17 +321,24 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
|
||||
params.put("测试环境温度", experimentTestProcess.getEnvironmentalTemperature());
|
||||
params.put("测试环境湿度", experimentTestProcess.getEnvironmentalHumidity());
|
||||
}
|
||||
List<ExperimentSampleInfo> sampleInfoList = experiment.getSampleInfoList();
|
||||
String sampleInfo = latestReport.getSampleInfo();
|
||||
if (StringUtils.isNotBlank(sampleInfo)) {
|
||||
List<JSONObject> sampleInfoList = JSON.parseArray(sampleInfo, JSONObject.class);
|
||||
if (CollUtil.isNotEmpty(sampleInfoList)) {
|
||||
for (int i = 0; i < sampleInfoList.size(); i++) {
|
||||
ExperimentSampleInfo info = sampleInfoList.get(i);
|
||||
JSONObject info = sampleInfoList.get(i);
|
||||
params.put("table" + i, Tables.of(
|
||||
new String[][] {new String[] {"试验样品名称", info.getSampleName(), "试验样品型号", info.getSampleModel()},
|
||||
new String[] {"批 次", info.getSampleBatch(), "试验样品编号", info.getSampleType()},
|
||||
new String[] {"生产厂家", info.getSampleManufacturer(), "试验样品数量", sampleInfoList.size() + ""},
|
||||
new String[][] {new String[] {"试验样品名称", getStringOrDefault(info, "sampleName"), "试验样品型号",
|
||||
getStringOrDefault(info, "sampleModel")},
|
||||
new String[] {"批 次", getStringOrDefault(info, "sampleBatch"), "试验样品编号", getStringOrDefault(
|
||||
info,
|
||||
"sampleType")},
|
||||
new String[] {"生产厂家", getStringOrDefault(info, "sampleManufacturer"), "试验样品数量",
|
||||
sampleInfoList.size() + ""},
|
||||
new String[] {"放置地点", "", "接收日期", ""},}).border(BorderStyle.DEFAULT).create());
|
||||
}
|
||||
}
|
||||
}
|
||||
params.put("试验日期", formatDate(experiment.getStartDate()) + " ~ " + formatDate(experiment.getEndDate()));
|
||||
params.put("负责人名称", experiment.getSupervisorName());
|
||||
params.put("剂量管理员名称", "");
|
||||
@@ -466,4 +471,13 @@ public class ExperimentDocServiceImpl extends ServiceImpl<ExperimentDocMapper, E
|
||||
return getOne(new LambdaQueryWrapper<ExperimentDoc>().eq(ExperimentDoc::getExperimentId, experimentId)
|
||||
.eq(ExperimentDoc::getDocType, type).orderByDesc(ExperimentDoc::getVersion), false);
|
||||
}
|
||||
|
||||
private String getStringOrDefault(JSONObject jsonObject, String key) {
|
||||
String string = jsonObject.getString(key);
|
||||
if (StringUtils.isBlank(string)) {
|
||||
return "";
|
||||
}
|
||||
return string;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user