|
|
@@ -1,14 +1,19 @@
|
|
|
package com.zd.laboratory.controller;
|
|
|
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.io.IOException;
|
|
|
+import java.util.stream.Collectors;
|
|
|
import javax.servlet.http.HttpServletRequest;
|
|
|
import javax.servlet.http.HttpServletResponse;
|
|
|
|
|
|
+import com.zd.laboratory.domain.LabRiskPlanjoinsub;
|
|
|
+import com.zd.laboratory.service.ILabRiskPlanService;
|
|
|
import com.zd.model.domain.per.PerFun;
|
|
|
import com.zd.model.domain.per.PerPrefix;
|
|
|
import com.zd.model.domain.ResultData;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.util.CollectionUtils;
|
|
|
+import org.springframework.util.ObjectUtils;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.PostMapping;
|
|
|
import org.springframework.web.bind.annotation.PutMapping;
|
|
|
@@ -42,6 +47,8 @@ public class LabAudioSynthesisController extends BaseController<LabAudioSynthesi
|
|
|
{
|
|
|
@Autowired
|
|
|
private ILabAudioSynthesisService labAudioSynthesisService;
|
|
|
+ @Autowired
|
|
|
+ private ILabRiskPlanService labRiskPlanService;
|
|
|
|
|
|
/**
|
|
|
* 查询音乐合成列表
|
|
|
@@ -112,8 +119,34 @@ public class LabAudioSynthesisController extends BaseController<LabAudioSynthesi
|
|
|
@PreAuthorize(hasPermi = PerPrefix.LABORATORY_SYNTHESIS + PerFun.REMOVE)
|
|
|
@Log(title = "音乐合成", businessType = BusinessType.DELETE)
|
|
|
@DeleteMapping("/{ids}")
|
|
|
- public ResultData remove(@PathVariable Long[] ids)
|
|
|
- {
|
|
|
+ public ResultData remove(@PathVariable Long[] ids){
|
|
|
+
|
|
|
+ try {
|
|
|
+ List<Long> idList = Arrays.asList(ids);
|
|
|
+ List<LabAudioSynthesis> syntheses = labAudioSynthesisService.getListByIds(idList);
|
|
|
+
|
|
|
+ Set<Long> riskPlanIds = syntheses.stream()
|
|
|
+ .map(LabAudioSynthesis::getRiskPlanId)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ if (!riskPlanIds.isEmpty()) {
|
|
|
+ List<LabRiskPlanjoinsub> labRiskPlanjoinsubs = labRiskPlanService.selectLabRiskPlanjoinsubsByPlanIds(riskPlanIds);
|
|
|
+ Set<Long> invalidPlanIds = labRiskPlanjoinsubs.stream()
|
|
|
+ .map(LabRiskPlanjoinsub::getRiskPlanId)
|
|
|
+ .filter(Objects::nonNull)
|
|
|
+ .collect(Collectors.toSet());
|
|
|
+
|
|
|
+ // 过滤 已经绑定实验室预案的相关配置
|
|
|
+ List<Long> validIds = syntheses.stream()
|
|
|
+ .filter(s -> !invalidPlanIds.contains(s.getRiskPlanId()))
|
|
|
+ .map(LabAudioSynthesis::getId)
|
|
|
+ .collect(Collectors.toList());
|
|
|
+ ids = validIds.toArray(new Long[0]);
|
|
|
+ }
|
|
|
+ } catch (Exception e) {
|
|
|
+ logger.error("删除音乐合成失败: ids={}", Arrays.toString(ids), e);
|
|
|
+ }
|
|
|
return ResultData.result(labAudioSynthesisService.deleteLabAudioSynthesisByIds(ids));
|
|
|
}
|
|
|
}
|