fix: 取消分享消息失效

This commit is contained in:
fit2cloud-chenyw 2022-04-28 11:11:53 +08:00
parent 3387ae9a15
commit c5df08e485
3 changed files with 33 additions and 4 deletions

View File

@ -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;
}

View File

@ -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));
}
});
}
}

View File

@ -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()