mirror of
https://gitee.com/dromara/RuoYi-Vue-Plus.git
synced 2026-09-18 09:35:29 +08:00
设备分享问题修改
This commit is contained in:
parent
f65fc0df5c
commit
a11f8ef493
@ -4,6 +4,7 @@ import cn.dev33.satoken.annotation.SaCheckPermission;
|
||||
import cn.dev33.satoken.annotation.SaIgnore;
|
||||
import cn.dev33.satoken.secure.BCrypt;
|
||||
import cn.hutool.core.bean.BeanUtil;
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import jakarta.validation.constraints.NotEmpty;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.dromara.common.core.domain.R;
|
||||
@ -250,17 +251,27 @@ public class EqHomeController extends BaseController {
|
||||
SysUserVo sysUserVo = userService.selectUserByUserName(bo.getSharedUserName());
|
||||
if (sysUserVo==null) throw new RuntimeException("被分享者用户名不存在");
|
||||
|
||||
if (bo.getShareUserId() == null){
|
||||
String currentUserName = LoginHelper.getUsername();
|
||||
if (currentUserName.equals(bo.getSharedUserName())) throw new RuntimeException("不能分享给自己");
|
||||
bo.setShareUserId(LoginHelper.getUserId());
|
||||
/*if (bo.getShareUserId() == null){
|
||||
bo.setShareUserId(LoginHelper.getUserId());
|
||||
String currentUserName = LoginHelper.getUsername();
|
||||
if (currentUserName.equals(bo.getSharedUserName())) throw new RuntimeException("不能分享给自己");
|
||||
bo.setShareUserName(currentUserName);
|
||||
}
|
||||
}*/
|
||||
bo.setSharedUserId(sysUserVo.getUserId());
|
||||
List<EqShareVo> eqShareVos = shareService.queryList(bo);
|
||||
bo.setShareUserName(currentUserName);
|
||||
bo.setSharedUserName(sysUserVo.getUserName());
|
||||
// List<EqShareVo> eqShareVos = shareService.queryList(bo);
|
||||
// if (!eqShareVos.isEmpty()) throw new RuntimeException("该成员已被分享");
|
||||
return toAjax(shareService.insertByBo(bo));
|
||||
if (CollUtil.isEmpty(eqShareVos)){
|
||||
return toAjax(shareService.insertByBo(bo));
|
||||
}else{
|
||||
EqShareVo eqShareVo = eqShareVos.get(0);
|
||||
String sharedEquipmentIds = eqShareVo.getSharedEquipmentIds();
|
||||
if (sharedEquipmentIds.contains(bo.getSharedEquipmentIds())) throw new RuntimeException("该设备已经分享到该成员");
|
||||
sharedEquipmentIds = sharedEquipmentIds + "," + bo.getSharedEquipmentIds();
|
||||
eqShareVo.setSharedEquipmentIds(sharedEquipmentIds);
|
||||
return toAjax(shareService.updateByBo(bo));
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Loading…
Reference in New Issue
Block a user