|
@@ -1211,34 +1211,16 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
}
|
|
|
return dto.getId().toString();
|
|
|
}
|
|
|
- private String saveTrialRecordTableIds(TrialSelfInspectionRecord obj, String tableIds , boolean isRecord){
|
|
|
+ private String saveTrialRecordTableIds(TrialSelfInspectionRecord obj, String tableIds){
|
|
|
if (obj.getTableIds() == null || obj.getTableIds().trim().isEmpty()) {
|
|
|
return tableIds;
|
|
|
}
|
|
|
- List<WbsTreePrivate> query = jdbcTemplate.query("select * from m_wbs_tree_private where p_key_id in (" + obj.getTableIds() + ")", new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
- List<String> recordIds = new ArrayList<>();
|
|
|
- List<String> reportIds = new ArrayList<>();
|
|
|
- for (WbsTreePrivate treePrivate : query) {
|
|
|
- Integer type = treePrivate.getTableType();
|
|
|
- if (type == null) {
|
|
|
- continue;
|
|
|
- }
|
|
|
- if (type == 1 || type == 9) {
|
|
|
- recordIds.add(treePrivate.getPKeyId() + "");
|
|
|
- } else if (type == 2 || type == 10) {
|
|
|
- reportIds.add(treePrivate.getPKeyId() + "");
|
|
|
- }
|
|
|
- }
|
|
|
- if (isRecord) {
|
|
|
- if (!reportIds.isEmpty()) {
|
|
|
- tableIds = tableIds + "," + String.join(",", reportIds);
|
|
|
- }
|
|
|
- } else {
|
|
|
- if (!recordIds.isEmpty()) {
|
|
|
- tableIds = tableIds + "," + String.join(",", recordIds);
|
|
|
- }
|
|
|
+ List<WbsTreePrivate> query = jdbcTemplate.query("SELECT a.p_key_id from m_wbs_tree_private a left join u_trial_self_data_record b on a.p_key_id = b.tab_id and b.record_id = " + obj.getId() +
|
|
|
+ "where a.p_id = "+ obj.getNodeId()+ " and (b.is_buss_show = 1 or b.is_buss_show is null)", new BeanPropertyRowMapper<>(WbsTreePrivate.class));
|
|
|
+ if (query.isEmpty()) {
|
|
|
+ return tableIds;
|
|
|
}
|
|
|
- return tableIds;
|
|
|
+ return query.stream().map(item -> item.getPKeyId() + "").collect(Collectors.joining( ","));
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -1436,13 +1418,12 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
}
|
|
|
}
|
|
|
String updateSql = null;
|
|
|
+ String tableIds = saveTrialRecordTableIds(obj, dto.getTableIds());
|
|
|
if (recordDataTable && !reportDataTable) {
|
|
|
//单独保存记录表 查询报告单pdf是否有值 如果有值就合并 合并存到pdf_url
|
|
|
- String tableIds = saveTrialRecordTableIds(obj, dto.getTableIds(), true);
|
|
|
updateSql = getUpdateSql(dto, pdfURL, listPdf, snowId, "report_pdf_url", 1, "record_pdf_url", tableIds);
|
|
|
} else if (!recordDataTable && reportDataTable) {
|
|
|
//单独保存报告表 查询记录表pdf是否有值 如果有值就合并 合并存到pdf_url
|
|
|
- String tableIds = saveTrialRecordTableIds(obj, dto.getTableIds(), false);
|
|
|
updateSql = getUpdateSql(dto, pdfURL, listPdf, snowId, "record_pdf_url", 2, "report_pdf_url", tableIds);
|
|
|
} else {
|
|
|
//一起保存的数据 只改变pdf_url
|
|
@@ -2260,7 +2241,7 @@ public class TrialSelfInspectionRecordServiceImpl extends BaseServiceImpl<TrialS
|
|
|
baseMapper.delSelfSample(record.getId());
|
|
|
info = null;
|
|
|
baseInfo.setTrialSampleInfo(null);
|
|
|
- entrustInfoService.update(Wrappers.<EntrustInfo>lambdaUpdate().eq(EntrustInfo::getId, record.getId()).set(EntrustInfo::getExpCount, 0));
|
|
|
+ entrustInfoService.update(Wrappers.<EntrustInfo>lambdaUpdate().eq(EntrustInfo::getId, oldEntrustInfo.getId()).set(EntrustInfo::getExpCount, 0));
|
|
|
}
|
|
|
}
|
|
|
if (entrustInfo != null && info == null && oldTrialSampleInfo != null) {
|