forked from github/dataease
fix: 取消分享消息失效
This commit is contained in:
parent
3387ae9a15
commit
c5df08e485
backend/src/main/java/io/dataease
frontend/src/views/panel/GrantAuth/ShareHead
@ -15,4 +15,10 @@ public class PanelShareRemoveRequest implements Serializable {
|
|||||||
|
|
||||||
@ApiModelProperty("分享ID")
|
@ApiModelProperty("分享ID")
|
||||||
private String shareId;
|
private String shareId;
|
||||||
|
|
||||||
|
@ApiModelProperty("分享类型{0:用户,1:角色,2:组织}")
|
||||||
|
private Integer type;
|
||||||
|
|
||||||
|
@ApiModelProperty("目标ID")
|
||||||
|
private Long targetId;
|
||||||
}
|
}
|
||||||
|
@ -92,9 +92,9 @@ public class ShareService {
|
|||||||
} else {
|
} else {
|
||||||
shareNodes = typeSharedMap.get(key);
|
shareNodes = typeSharedMap.get(key);
|
||||||
}
|
}
|
||||||
|
List<Long> value = entry.getValue();
|
||||||
if (null != authURDMap.get(key)) {
|
if (null != value) {
|
||||||
Map<String, Object> dataMap = filterData(authURDMap.get(key), shareNodes);
|
Map<String, Object> dataMap = filterData(value, shareNodes);
|
||||||
List<Long> newIds = (List<Long>) dataMap.get("add");
|
List<Long> newIds = (List<Long>) dataMap.get("add");
|
||||||
for (int i = 0; i < newIds.size(); i++) {
|
for (int i = 0; i < newIds.size(); i++) {
|
||||||
Long id = newIds.get(i);
|
Long id = newIds.get(i);
|
||||||
@ -340,8 +340,29 @@ public class ShareService {
|
|||||||
.collect(Collectors.toList());
|
.collect(Collectors.toList());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Transactional
|
||||||
public void removeShares(PanelShareRemoveRequest removeRequest) {
|
public void removeShares(PanelShareRemoveRequest removeRequest) {
|
||||||
|
String panelId = removeRequest.getPanelId();
|
||||||
extPanelShareMapper.removeShares(removeRequest);
|
extPanelShareMapper.removeShares(removeRequest);
|
||||||
|
AuthURD sharedAuthURD = new AuthURD();
|
||||||
|
List<Long> removeIds = new ArrayList<Long>(){{add(removeRequest.getTargetId());}};
|
||||||
|
buildRedAuthURD(removeRequest.getType(), removeIds, sharedAuthURD);
|
||||||
|
CurrentUserDto user = AuthUtils.getUser();
|
||||||
|
Gson gson = new Gson();
|
||||||
|
PanelGroup panel = panelGroupMapper.selectByPrimaryKey(panelId);
|
||||||
|
|
||||||
|
String msg = panel.getName();
|
||||||
|
|
||||||
|
List<String> msgParam = new ArrayList<>();
|
||||||
|
msgParam.add(panelId);
|
||||||
|
Set<Long> redIds = AuthUtils.userIdsByURD(sharedAuthURD);
|
||||||
|
redIds.forEach(userId -> {
|
||||||
|
if (!user.getUserId().equals(userId)) {
|
||||||
|
DeMsgutil.sendMsg(userId, 3L, user.getNickName() + " 取消分享了仪表板【" + msg + "】,请查收!",
|
||||||
|
gson.toJson(msgParam));
|
||||||
|
}
|
||||||
|
});
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -110,7 +110,9 @@ export default {
|
|||||||
if (!tag || !tag.shareId) return
|
if (!tag || !tag.shareId) return
|
||||||
const param = {
|
const param = {
|
||||||
panelId: this.panelInfo.id,
|
panelId: this.panelInfo.id,
|
||||||
shareId: tag.shareId
|
shareId: tag.shareId,
|
||||||
|
targetId: tag.targetId,
|
||||||
|
type: tag.type
|
||||||
}
|
}
|
||||||
removeShares(param).then(res => {
|
removeShares(param).then(res => {
|
||||||
this.initTagDatas()
|
this.initTagDatas()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user