| 
					
				 | 
			
			
				@@ -42,6 +42,7 @@ import java.io.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.*; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.function.Function; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 import java.util.stream.Collectors; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+import java.util.stream.Stream; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				  
			 | 
		
	
		
			
				 | 
				 | 
			
			
				 @RestController 
			 | 
		
	
	
		
			
				| 
					
				 | 
			
			
				@@ -256,37 +257,47 @@ public class TrialSummaryClassificationConfigurationController extends BladeCont 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 if (classificationConfiguration != null && ObjectUtil.isNotEmpty(classificationConfiguration.getExcelId())) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     List<TrialSummaryReflectionSaveDTO.ReflectionBean> reflectionBeanList = dto.getReflectionBeanList(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     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()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     List<String> keyNameList = collect.stream() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             .map(bean -> "'" + bean.getHtmlKeyName() + "'") 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                             .collect(Collectors.toList()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     if (keyNameList.size() <= 0) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                         throw new ServiceException("入参异常,未获取到htmlKeyName"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    String sqlDel = "DELETE FROM m_trial_summary_excel_tab_reflection WHERE excel_id = ? AND class_id = ? AND html_key_name IN (" + 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                            StringUtils.join(keyNameList, ",") + ")"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    List<Object> paramsDel = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    paramsDel.add(classificationConfiguration.getExcelId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    paramsDel.add(classificationConfiguration.getId()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-//                    jdbcTemplate.update(sqlDel, paramsDel.toArray()); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    String sqlInsert = "INSERT INTO m_trial_summary_excel_tab_reflection(id,class_id,excel_id,trial_tab_id,element_id,html_key_name,trial_tab_name,element_key) VALUES (?,?,?,?,?,?,?,?)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    List<Object[]> batchArgs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    for (TrialSummaryReflectionSaveDTO.ReflectionBean reflectionBean : collect) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        Object[] paramsInsert = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                SnowFlakeUtil.getId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                classificationConfiguration.getId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                classificationConfiguration.getExcelId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                reflectionBean.getTrialTabId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                reflectionBean.getElementId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                reflectionBean.getHtmlKeyName(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                reflectionBean.getTrialTabName(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                                reflectionBean.getElementKey() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                        batchArgs.add(paramsInsert); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    // 批量更新已有记录 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!updateList.isEmpty()) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        String sqlUpdate = "UPDATE m_trial_summary_excel_tab_reflection SET trial_tab_id = ?, element_id = ? WHERE id = ?"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<Object[]> updateBatchArgs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (TrialSummaryReflectionSaveDTO.ReflectionBean reflectionBean : updateList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Object[] paramsUpdate = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    reflectionBean.getTrialTabId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    reflectionBean.getElementId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    reflectionBean.getId() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            updateBatchArgs.add(paramsUpdate); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        jdbcTemplate.batchUpdate(sqlUpdate, updateBatchArgs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                    if (!insertList.isEmpty()){ 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        String sqlInsert = "INSERT INTO m_trial_summary_excel_tab_reflection(id,class_id,excel_id,trial_tab_id,element_id,html_key_name,trial_tab_name,element_key) VALUES (?,?,?,?,?,?,?,?)"; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        List<Object[]> batchArgs = new ArrayList<>(); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        for (TrialSummaryReflectionSaveDTO.ReflectionBean reflectionBean : insertList) { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            Object[] paramsInsert = { 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    SnowFlakeUtil.getId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    classificationConfiguration.getId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    classificationConfiguration.getExcelId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    reflectionBean.getTrialTabId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    reflectionBean.getElementId(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    reflectionBean.getHtmlKeyName(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    reflectionBean.getTrialTabName(), 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                                    reflectionBean.getElementKey() 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            }; 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                            batchArgs.add(paramsInsert); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				+                        jdbcTemplate.batchUpdate(sqlInsert, batchArgs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				-                    jdbcTemplate.batchUpdate(sqlInsert, batchArgs); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				- 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                     return R.success("操作成功"); 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				                 } 
			 | 
		
	
		
			
				 | 
				 | 
			
			
				             } 
			 |