feat(REQ-7125) - 处理文档Tag同步
This commit is contained in:
parent
787cc567f1
commit
102b3e43dc
@ -51,4 +51,10 @@ public class DocQueryDTO {
|
||||
@ApiModelProperty(value = "是否包含临时文档")
|
||||
@Builder.Default
|
||||
private Boolean tempFile = false;
|
||||
|
||||
/**
|
||||
* 代运营模板通过公共模板同步过来的文档关联的公共文档 id
|
||||
*/
|
||||
@ApiModelProperty(value = "代运营模板通过公共模板同步过来的文档关联的公共文档 id")
|
||||
private Long originDocId;
|
||||
}
|
||||
|
||||
@ -8,6 +8,7 @@ import lombok.NoArgsConstructor;
|
||||
import lombok.experimental.Accessors;
|
||||
import lombok.experimental.SuperBuilder;
|
||||
|
||||
import javax.validation.constraints.NotNull;
|
||||
import java.io.Serializable;
|
||||
|
||||
/**
|
||||
@ -25,6 +26,7 @@ import java.io.Serializable;
|
||||
public class DocUpdateDTO extends DocCreateDTO implements Serializable {
|
||||
|
||||
@ApiModelProperty(value = "主键ID")
|
||||
@NotNull(message = "文档 ID 不能为空")
|
||||
private Long id;
|
||||
|
||||
}
|
||||
|
||||
@ -125,4 +125,6 @@ public interface ExtAxModelDocService {
|
||||
Boolean requireDoc(DocStatusDTO dto);
|
||||
|
||||
List<DocBaseVO> getIds(List<Long> ids);
|
||||
|
||||
List<DocBaseVO> getOriginDocId(Long id);
|
||||
}
|
||||
|
||||
@ -207,6 +207,26 @@ public class ExtAxModelDocServiceImpl implements ExtAxModelDocService {
|
||||
// 发送文档变更事件
|
||||
eventPublisher.publishEvent(new DocChangeEventImpl(dto.getModelKey(), dto.getTenantId(),
|
||||
querySetting(dto.getModelKey(), dto.getTenantId()), oldSettings));
|
||||
|
||||
// 更新代运营文档
|
||||
if (StringUtils.hasText(dto.getTenantId())) {
|
||||
return flat > 0;
|
||||
}
|
||||
List<DocBaseVO> docs = getOriginDocId(dto.getId());
|
||||
docs.forEach(i -> {
|
||||
List<ExtAxModelDoc> tenantDocs = querySetting(dto.getModelKey(), i.getTenantId());
|
||||
ExtAxModelDoc tenantDoc = tenantDocs.stream().filter(j -> Objects.equals(j.getOriginDocId(), dto.getId())).findFirst().orElse(null);
|
||||
if (Objects.isNull(tenantDoc)) {
|
||||
return;
|
||||
}
|
||||
tenantDoc.setTag(dto.getTag());
|
||||
extAxModelDocMapper.updateById(tenantDoc);
|
||||
|
||||
// 发送文档变更事件
|
||||
eventPublisher.publishEvent(new DocChangeEventImpl(dto.getModelKey(), i.getTenantId(),
|
||||
querySetting(dto.getModelKey(), i.getTenantId()), tenantDocs));
|
||||
});
|
||||
|
||||
return flat > 0;
|
||||
}
|
||||
|
||||
@ -269,7 +289,7 @@ public class ExtAxModelDocServiceImpl implements ExtAxModelDocService {
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public Boolean deleteDoc(Long docId) {
|
||||
ExtAxModelDoc origin = extAxModelDocMapper.selectById(docId);
|
||||
if(Objects.isNull(origin)) {
|
||||
if (Objects.isNull(origin)) {
|
||||
return false;
|
||||
}
|
||||
// 用于发送文档变更事件
|
||||
@ -389,4 +409,17 @@ public class ExtAxModelDocServiceImpl implements ExtAxModelDocService {
|
||||
return BeanMapper.copyList(docs, DocBaseVO.class,
|
||||
(s, t) -> t.setFileType(FileTypeEnum.valueOfType(s.getFileType())));
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<DocBaseVO> getOriginDocId(Long id) {
|
||||
if (Objects.isNull(id)) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<ExtAxModelDoc> docs = extAxModelDocMapper.selectList(new LambdaQueryWrapper<ExtAxModelDoc>()
|
||||
.eq(ExtAxModelDoc::getOriginDocId, id)
|
||||
.eq(ExtAxModelDoc::getIsDelete, 0)
|
||||
);
|
||||
return BeanMapper.copyList(docs, DocBaseVO.class,
|
||||
(s, t) -> t.setFileType(FileTypeEnum.valueOfType(s.getFileType())));
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
Reference in New Issue
Block a user