|
|
@@ -259,6 +259,15 @@ public class TrialSummaryClassificationConfigurationController extends BladeCont
|
|
|
TrialSummaryClassificationConfiguration classificationConfiguration = iTrialSummaryClassificationConfigurationService.getById(dto.getClassId());
|
|
|
if (classificationConfiguration != null && ObjectUtil.isNotEmpty(classificationConfiguration.getExcelId())) {
|
|
|
List<TrialSummaryReflectionSaveDTO.ReflectionBean> reflectionBeanList = dto.getReflectionBeanList();
|
|
|
+ Set<Long> elementIds = reflectionBeanList.stream().map(TrialSummaryReflectionSaveDTO.ReflectionBean::getElementId).collect(Collectors.toSet());
|
|
|
+ if (!elementIds.isEmpty()) {
|
|
|
+ List<WbsFormElement> list = wbsFormElementService.list(Wrappers.<WbsFormElement>lambdaQuery().select(WbsFormElement::getId, WbsFormElement::getEKey)
|
|
|
+ .in(WbsFormElement::getId, elementIds));
|
|
|
+ if (list != null && !list.isEmpty()) {
|
|
|
+ Map<Long, String> elementMap = list.stream().collect(Collectors.toMap(WbsFormElement::getId, WbsFormElement::getEKey));
|
|
|
+ reflectionBeanList.forEach(bean -> bean.setElementKey(elementMap.get(bean.getElementId())));
|
|
|
+ }
|
|
|
+ }
|
|
|
Set<TrialSummaryReflectionSaveDTO.ReflectionBean> collect = new HashSet<>(reflectionBeanList);
|
|
|
Set<TrialSummaryReflectionSaveDTO.ReflectionBean> updateList = collect.stream().filter(bean -> ObjectUtil.isNotEmpty(bean.getId())).collect(Collectors.toSet());
|
|
|
Set<TrialSummaryReflectionSaveDTO.ReflectionBean> insertList = collect.stream().filter(bean -> ObjectUtil.isEmpty(bean.getId())).collect(Collectors.toSet());
|
|
|
@@ -271,12 +280,15 @@ public class TrialSummaryClassificationConfigurationController extends BladeCont
|
|
|
}
|
|
|
// 批量更新已有记录
|
|
|
if (!updateList.isEmpty()) {
|
|
|
- String sqlUpdate = "UPDATE m_trial_summary_excel_tab_reflection SET trial_tab_id = ?, element_id = ? WHERE id = ?";
|
|
|
+ String sqlUpdate = "UPDATE m_trial_summary_excel_tab_reflection SET trial_tab_id = ?, element_id = ?, trial_tab_name = ?, element_key = ?, html_key_name = ? WHERE id = ?";
|
|
|
List<Object[]> updateBatchArgs = new ArrayList<>();
|
|
|
for (TrialSummaryReflectionSaveDTO.ReflectionBean reflectionBean : updateList) {
|
|
|
Object[] paramsUpdate = {
|
|
|
reflectionBean.getTrialTabId(),
|
|
|
reflectionBean.getElementId(),
|
|
|
+ reflectionBean.getTrialTabName(),
|
|
|
+ reflectionBean.getElementKey(),
|
|
|
+ reflectionBean.getHtmlKeyName(),
|
|
|
reflectionBean.getId()
|
|
|
};
|
|
|
updateBatchArgs.add(paramsUpdate);
|