forked from github/dataease
fix: 取消分享消息失效
This commit is contained in:
parent
3387ae9a15
commit
c5df08e485
@ -15,4 +15,10 @@ public class PanelShareRemoveRequest implements Serializable {
|
||||
|
||||
@ApiModelProperty("分享ID")
|
||||
private String shareId;
|
||||
|
||||
@ApiModelProperty("分享类型{0:用户,1:角色,2:组织}")
|
||||
private Integer type;
|
||||
|
||||
@ApiModelProperty("目标ID")
|
||||
private Long targetId;
|
||||
}
|
||||
|
@ -92,9 +92,9 @@ public class ShareService {
|
||||
} else {
|
||||
shareNodes = typeSharedMap.get(key);
|
||||
}
|
||||
|
||||
if (null != authURDMap.get(key)) {
|
||||
Map<String, Object> dataMap = filterData(authURDMap.get(key), shareNodes);
|
||||
List<Long> value = entry.getValue();
|
||||
if (null != value) {
|
||||
Map<String, Object> dataMap = filterData(value, shareNodes);
|
||||
List<Long> newIds = (List<Long>) dataMap.get("add");
|
||||
for (int i = 0; i < newIds.size(); i++) {
|
||||
Long id = newIds.get(i);
|
||||
@ -340,8 +340,29 @@ public class ShareService {
|
||||
.collect(Collectors.toList());
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public void removeShares(PanelShareRemoveRequest removeRequest) {
|
||||
String panelId = removeRequest.getPanelId();
|
||||
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
|
||||
const param = {
|
||||
panelId: this.panelInfo.id,
|
||||
shareId: tag.shareId
|
||||
shareId: tag.shareId,
|
||||
targetId: tag.targetId,
|
||||
type: tag.type
|
||||
}
|
||||
removeShares(param).then(res => {
|
||||
this.initTagDatas()
|
||||
|
Loading…
Reference in New Issue
Block a user