|
@@ -9,6 +9,8 @@ import com.diagbot.dto.QuestionPageDTO;
|
|
import com.diagbot.dto.RespDTO;
|
|
import com.diagbot.dto.RespDTO;
|
|
import com.diagbot.entity.CommonParam;
|
|
import com.diagbot.entity.CommonParam;
|
|
import com.diagbot.entity.DeptInfo;
|
|
import com.diagbot.entity.DeptInfo;
|
|
|
|
+import com.diagbot.entity.ModuleDetail;
|
|
|
|
+import com.diagbot.entity.ModuleInfo;
|
|
import com.diagbot.entity.QuestionDetail;
|
|
import com.diagbot.entity.QuestionDetail;
|
|
import com.diagbot.entity.QuestionInfo;
|
|
import com.diagbot.entity.QuestionInfo;
|
|
import com.diagbot.entity.QuestionMapping;
|
|
import com.diagbot.entity.QuestionMapping;
|
|
@@ -72,6 +74,8 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
|
|
DeptInfoFacade deptInfoFacade;
|
|
DeptInfoFacade deptInfoFacade;
|
|
@Autowired
|
|
@Autowired
|
|
UserServiceClient userServiceClient;
|
|
UserServiceClient userServiceClient;
|
|
|
|
+ @Autowired
|
|
|
|
+ ModuleInfoFacade moduleInfoFacade;
|
|
|
|
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -319,28 +323,48 @@ public class QuestionInfoFacade extends QuestionInfoServiceImpl {
|
|
* @return
|
|
* @return
|
|
*/
|
|
*/
|
|
public Boolean deleteByIdsFac(String ids) {
|
|
public Boolean deleteByIdsFac(String ids) {
|
|
-
|
|
|
|
if (StringUtil.isEmpty(ids)) {
|
|
if (StringUtil.isEmpty(ids)) {
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
+ List<String> idList = Arrays.asList(ids.split(","));
|
|
|
|
+ for (String id : idList) {
|
|
|
|
+ // 查询映射关系中是否存在父级
|
|
|
|
+ List<QuestionMapping> questionMappings = questionMappingFacade.list(new QueryWrapper<QuestionMapping>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("son_question", id));
|
|
|
|
+ if (ListUtil.isNotEmpty(questionMappings)) {
|
|
|
|
+ List<Long> questionIds = questionMappings.stream().map(row -> row.getParentQuestion()).collect(Collectors.toList());
|
|
|
|
+ List<String> tagName = this.list(new QueryWrapper<QuestionInfo>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .in("id", questionIds))
|
|
|
|
+ .stream().map(row -> "【" + row.getTagName() + "】").collect(Collectors.toList());
|
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请先删除标签的关联:" + String.join("、", tagName));
|
|
|
|
+ }
|
|
|
|
+ // 查询模板中是否存在
|
|
|
|
+ List<ModuleDetail> moduleDetails = moduleDetailFacade.list(new QueryWrapper<ModuleDetail>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .eq("question_id", id));
|
|
|
|
+ if (ListUtil.isNotEmpty(moduleDetails)) {
|
|
|
|
+ List<Long> moduleIds = moduleDetails.stream().map(row -> row.getModuleId()).collect(Collectors.toList());
|
|
|
|
+ List<String> moduleName = moduleInfoFacade.list(new QueryWrapper<ModuleInfo>()
|
|
|
|
+ .eq("is_deleted", IsDeleteEnum.N.getKey())
|
|
|
|
+ .in("id", moduleIds))
|
|
|
|
+ .stream().map(row -> "{" + row.getName() + "}").collect(Collectors.toList());
|
|
|
|
+ throw new CommonException(CommonErrorCode.SERVER_IS_ERROR, "请先删除模板的关联:" + String.join("、", moduleName));
|
|
|
|
+ }
|
|
|
|
|
|
- Map paramMap = new HashMap<>();
|
|
|
|
- paramMap.put("delete", IsDeleteEnum.Y.getKey());
|
|
|
|
- paramMap.put("ids", Arrays.asList(ids.split(",")));
|
|
|
|
- paramMap.put("gmtModified", DateUtil.now());
|
|
|
|
- paramMap.put("modifier", UserUtils.getCurrentPrincipleID());
|
|
|
|
-
|
|
|
|
- //删除自身
|
|
|
|
- this.deleteByIds(paramMap);
|
|
|
|
-
|
|
|
|
- //删除明细
|
|
|
|
- questionDetailFacade.deleteByQuestionIdFac(paramMap);
|
|
|
|
-
|
|
|
|
- //删除映射关系
|
|
|
|
- questionMappingFacade.deleteByIdsFac(paramMap);
|
|
|
|
-
|
|
|
|
- //删除模板中的标签
|
|
|
|
- moduleDetailFacade.deleteByQuestionIdFac(paramMap);
|
|
|
|
|
|
+ Map paramMap = new HashMap<>();
|
|
|
|
+ paramMap.put("delete", IsDeleteEnum.Y.getKey());
|
|
|
|
+ paramMap.put("ids", Arrays.asList(ids.split(",")));
|
|
|
|
+ paramMap.put("gmtModified", DateUtil.now());
|
|
|
|
+ paramMap.put("modifier", UserUtils.getCurrentPrincipleID());
|
|
|
|
+ //删除自身
|
|
|
|
+ this.deleteByIds(paramMap);
|
|
|
|
+ //删除明细
|
|
|
|
+ questionDetailFacade.deleteByQuestionIdFac(paramMap);
|
|
|
|
+ //删除映射关系
|
|
|
|
+ questionMappingFacade.deleteByIdsFac(paramMap);
|
|
|
|
+ }
|
|
return true;
|
|
return true;
|
|
}
|
|
}
|
|
|
|
|