|
|
@ -7,7 +7,9 @@ import com.project.information.application.InformationApplicationService; |
|
|
import com.project.information.application.ProductLineApplicationService; |
|
|
import com.project.information.application.ProductLineApplicationService; |
|
|
import com.project.information.domain.dto.InformationDTO; |
|
|
import com.project.information.domain.dto.InformationDTO; |
|
|
import com.project.information.domain.dto.ProductLineDTO; |
|
|
import com.project.information.domain.dto.ProductLineDTO; |
|
|
|
|
|
import com.project.information.domain.entity.ProductLineEntity; |
|
|
import com.project.information.domain.param.ProductLineParam; |
|
|
import com.project.information.domain.param.ProductLineParam; |
|
|
|
|
|
import com.project.information.domain.service.ProductLineBaseService; |
|
|
import com.project.operation.domain.dto.OperationLogDTO; |
|
|
import com.project.operation.domain.dto.OperationLogDTO; |
|
|
import com.project.operation.domain.enums.ModuleEnum; |
|
|
import com.project.operation.domain.enums.ModuleEnum; |
|
|
import com.project.operation.domain.service.DescriptionStrategy; |
|
|
import com.project.operation.domain.service.DescriptionStrategy; |
|
|
@ -31,7 +33,7 @@ import java.util.stream.Collectors; |
|
|
@Component |
|
|
@Component |
|
|
public class DataDescriptionStrategy implements DescriptionStrategy { |
|
|
public class DataDescriptionStrategy implements DescriptionStrategy { |
|
|
@Autowired |
|
|
@Autowired |
|
|
private ProductLineApplicationService productLineApplicationService; |
|
|
private ProductLineBaseService productLineBaseService; |
|
|
@Autowired |
|
|
@Autowired |
|
|
private InformationApplicationService informationApplicationService; |
|
|
private InformationApplicationService informationApplicationService; |
|
|
|
|
|
|
|
|
@ -60,34 +62,12 @@ public class DataDescriptionStrategy implements DescriptionStrategy { |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
operationLogDTO.setAction("删除"); |
|
|
operationLogDTO.setAction("删除"); |
|
|
List<ProductLineDTO> treeList = productLineApplicationService.treeList(new ProductLineParam()).getData(); |
|
|
ProductLineEntity productLineEntity = productLineBaseService.getById(id); |
|
|
|
|
|
|
|
|
//查找匹配的父节点
|
|
|
if (productLineEntity == null){ |
|
|
Optional<String> parentName = treeList.stream() |
|
|
return false; |
|
|
.filter(parent -> id.equals(parent.getId())) |
|
|
|
|
|
.map(ProductLineDTO::getName) |
|
|
|
|
|
.findFirst(); |
|
|
|
|
|
|
|
|
|
|
|
// 父节点匹配成功,直接返回名称
|
|
|
|
|
|
if (parentName.isPresent()) { |
|
|
|
|
|
String name = parentName.get(); |
|
|
|
|
|
operationLogDTO.setDescription("【"+ name+"】"); |
|
|
|
|
|
return true; |
|
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//查找匹配的子节点(拼接父+子名称)
|
|
|
|
|
|
Optional<String> childName = treeList.stream() |
|
|
|
|
|
// 过滤掉子节点为空的父节点
|
|
|
|
|
|
.filter(parent -> parent.getChildrenList() != null && !parent.getChildrenList().isEmpty()) |
|
|
|
|
|
.flatMap(parent -> parent.getChildrenList().stream() |
|
|
|
|
|
.map(child -> new AbstractMap.SimpleEntry<>(parent, child))) |
|
|
|
|
|
.filter(entry -> id.equals(entry.getValue().getId())) |
|
|
|
|
|
.map(entry ->"【"+entry.getKey().getName()+"】" + "/" + "【"+entry.getValue().getName()+"】") |
|
|
|
|
|
.findFirst(); |
|
|
|
|
|
|
|
|
|
|
|
if (childName.isPresent()) { |
|
|
|
|
|
operationLogDTO.setDescription(childName.get()); |
|
|
|
|
|
} |
|
|
} |
|
|
|
|
|
operationLogDTO.setDescription("【"+ productLineEntity.getName()+"】"); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
if (methodName.equals("batchDelete") && ObjectUtils.isNotEmpty(args) && args[0] instanceof String) { |
|
|
if (methodName.equals("batchDelete") && ObjectUtils.isNotEmpty(args) && args[0] instanceof String) { |
|
|
|