fix(文档拆分): 78581

This commit is contained in:
yjz
2023-11-20 09:38:12 +08:00
parent acc9634e73
commit 7320a136d4
@@ -176,6 +176,9 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
List<DocumentSplitInfo> documentSplitInfos = queryByList(documentSplitInfo);
ids = documentSplitInfos.stream().map(DocumentSplitInfo::getId).collect(Collectors.toList());
}
// 校验权限
checkOut(ids);
updateWrapper.in(SarFileSplitInfoEO::getId, ids);
SysUser sysUser = sysUserService.getById(documentSplitInfo.getCreateBy());
updateWrapper.set(SarFileSplitInfoEO::getAuthor, documentSplitInfo.getCreateBy());
@@ -183,6 +186,26 @@ public class DocumentSplitServiceImpl implements IDocumentSplitService {
sarFileSplitInfoService.update(updateWrapper);
}
private void checkOut(List<String> ids) {
// 登陆人信息
LoginUser sysUser = (LoginUser) SecurityUtils.getSubject().getPrincipal();
if (sysUser.getRoleIds().contains("admin")){
return;
}
List<SarFileSplitInfoEO> sarFileSplitInfoEOS = sarFileSplitInfoService.listByIds(ids);
for (SarFileSplitInfoEO sarFileSplitInfoEO : sarFileSplitInfoEOS) {
String createBy = sarFileSplitInfoEO.getCreateBy();
String author = sarFileSplitInfoEO.getAuthor();
if (!sysUser.getUsername().equals(createBy) || !sysUser.getId().equals(author)){
if(LanguageEnum.CN.getValue().equals(MessageUtils.getLanguage().getValue())) {
throw new JeroBootException("只能更改有操作权限的数据!");
}else{
throw new JeroBootException("You can change only the data that you have permission to operate!");
}
}
}
}
@Override
public IPage<Map<String, Object>> queryDocumentSplitDetail(Map<String, Object> parameter) {
// 查询全部字段列表