|
@@ -1,5 +1,6 @@
|
|
|
package cn.cslg.pas.service.business;
|
|
|
|
|
|
+import cn.cslg.pas.common.dto.customAnalyse.CustomAnalyseDTO;
|
|
|
import cn.cslg.pas.common.dto.customAnalyse.SelectCustomAnalyseDTO;
|
|
|
import cn.cslg.pas.common.dto.customAnalyse.SelectCustomAnalyseListDTO;
|
|
|
import cn.cslg.pas.common.model.cronModel.PersonnelVO;
|
|
@@ -27,6 +28,7 @@ import org.springframework.transaction.annotation.Transactional;
|
|
|
import java.util.ArrayList;
|
|
|
import java.util.Date;
|
|
|
import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
|
|
|
/**
|
|
|
* 自定义分析项目Service层
|
|
@@ -46,8 +48,13 @@ public class CustomAnalyseService extends ServiceImpl<CustomAnalysisItemMapper,
|
|
|
@Autowired
|
|
|
private CustomAnalysisItemMapper customAnalysisItemMapper;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private CustomAnalysisItemSchemaService itemSchemaService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private CustomAnalysisItemSettingService itemSettingService;
|
|
|
+
|
|
|
public List<SelectCustomAnalyseListDTO> queryAnalyseGroup(SelectCustomAnalyseVO vo) {
|
|
|
- List<SelectCustomAnalyseListDTO> list = new ArrayList<>();
|
|
|
//获取登陆人信息 用于设置创建人
|
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
|
try {
|
|
@@ -58,18 +65,21 @@ public class CustomAnalyseService extends ServiceImpl<CustomAnalysisItemMapper,
|
|
|
|
|
|
SelectAnalyseVO analyseVO = new SelectAnalyseVO();
|
|
|
analyseVO.setProjectId(vo.getProjectId());
|
|
|
- analyseVO.setType(vo.getType());
|
|
|
analyseVO.setTenantId(personnelVO.getTenantId());
|
|
|
analyseVO.setCreatorId(personnelVO.getId());
|
|
|
- list = customAnalysisItemMapper.queryAnalyseGroup(analyseVO);
|
|
|
- return list;
|
|
|
+ List<SelectCustomAnalyseListDTO> list = customAnalysisItemMapper.queryAnalyseGroup(analyseVO);
|
|
|
+ List<SelectCustomAnalyseListDTO> returnList = list.stream().filter(item -> item.getParentId().equals(0)).collect(Collectors.toList());
|
|
|
+ returnList.forEach(item -> {
|
|
|
+ item.setChildren(list.stream().filter(c -> c.getParentId().equals(item.getId())).collect(Collectors.toList()));
|
|
|
+ });
|
|
|
+ return returnList;
|
|
|
}
|
|
|
|
|
|
|
|
|
public SelectCustomAnalyseDTO queryAnalyseGroupDetail(CustomAnalyseIdVO vo) {
|
|
|
SelectCustomAnalyseDTO dto = new SelectCustomAnalyseDTO();
|
|
|
CustomAnalysisItem item = customAnalysisItemMapper.selectById(vo.getId());
|
|
|
- if (item.getParentId() != null) {
|
|
|
+ if (item.getParentId() != null && item.getParentId() != 0) {
|
|
|
CustomAnalysisItem parentItem = customAnalysisItemMapper.selectById(item.getParentId());
|
|
|
dto.setParentId(item.getParentId());
|
|
|
dto.setParentName(parentItem.getName());
|
|
@@ -78,8 +88,22 @@ public class CustomAnalyseService extends ServiceImpl<CustomAnalysisItemMapper,
|
|
|
return dto;
|
|
|
}
|
|
|
|
|
|
+ public CustomAnalyseDTO queryAnalyseDetail(CustomAnalyseIdVO vo) {
|
|
|
+ CustomAnalyseDTO dto = new CustomAnalyseDTO();
|
|
|
+ CustomAnalysisItem item = customAnalysisItemMapper.selectById(vo.getId());
|
|
|
+ if (item.getType().equals(2)) {
|
|
|
+ dto.setSchema(itemSchemaService.getItemSchemaByUid(item.getUid()));
|
|
|
+// dto.setSetting();
|
|
|
+ } else {
|
|
|
+ dto.setSchema(null);
|
|
|
+ dto.setSetting(null);
|
|
|
+ }
|
|
|
+ BeanUtils.copyProperties(item, dto);
|
|
|
+ return dto;
|
|
|
+ }
|
|
|
+
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
|
|
- public Integer addAnalyseGroup(CustomAnalyseVO vo) {
|
|
|
+ public Integer addAnalyseGroup(CustomAnalyseDTO vo) {
|
|
|
String uid = IdUtil.simpleUUID();
|
|
|
//获取登陆人信息 用于设置创建人
|
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
@@ -102,7 +126,7 @@ public class CustomAnalyseService extends ServiceImpl<CustomAnalysisItemMapper,
|
|
|
}
|
|
|
|
|
|
@Transactional(propagation = Propagation.REQUIRED, rollbackFor = Throwable.class)
|
|
|
- public Integer editAnalyseGroup(CustomAnalyseVO vo) {
|
|
|
+ public Integer editAnalyseGroup(CustomAnalyseDTO vo) {
|
|
|
|
|
|
//获取登陆人信息 用于设置创建人
|
|
|
PersonnelVO personnelVO = new PersonnelVO();
|
|
@@ -131,6 +155,8 @@ public class CustomAnalyseService extends ServiceImpl<CustomAnalysisItemMapper,
|
|
|
throw new Exception("删除失败,请先删除子节点");
|
|
|
}
|
|
|
this.removeById(vo.getId());
|
|
|
+ itemSchemaService.deleteByUid(item.getUid());
|
|
|
+ itemSettingService.deleteByUid(item.getUid());
|
|
|
return item.getId();
|
|
|
}
|
|
|
|