
10 changed files with 107 additions and 28 deletions
@ -0,0 +1,54 @@ |
|||||
|
package com.yxt.wms.biz.func.commonmethod; |
||||
|
|
||||
|
import com.yxt.common.base.utils.StringUtils; |
||||
|
import com.yxt.common.core.result.ResultBean; |
||||
|
import com.yxt.common.core.vo.PagerVo; |
||||
|
import com.yxt.wms.feign.portal.privilege.PrivilegeQuery; |
||||
|
import com.yxt.wms.feign.portal.sysuser.SysUserFeign; |
||||
|
import org.springframework.beans.factory.annotation.Autowired; |
||||
|
import org.springframework.stereotype.Service; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2024/7/11 10:35 |
||||
|
*/ |
||||
|
@Service |
||||
|
public class CommonMethod { |
||||
|
@Autowired |
||||
|
SysUserFeign sysUserFeign; |
||||
|
|
||||
|
/** |
||||
|
* 根据参数组装新的数据权限参数 |
||||
|
* @param orgPath |
||||
|
* @param menuUrl |
||||
|
* @param userSid |
||||
|
* @return |
||||
|
*/ |
||||
|
public ResultBean<DataRule> dataRule (String orgPath,String menuUrl,String userSid){ |
||||
|
ResultBean rb=new ResultBean().fail(); |
||||
|
PrivilegeQuery privilegeQuery = new PrivilegeQuery(); |
||||
|
privilegeQuery.setOrgPath(orgPath); |
||||
|
privilegeQuery.setMenuUrl(menuUrl); |
||||
|
privilegeQuery.setUserSid(userSid); |
||||
|
ResultBean<String> defaultIdReltBean = sysUserFeign.selectPrivilegeLevel(privilegeQuery); |
||||
|
DataRule dataRule=new DataRule(); |
||||
|
if (StringUtils.isNotBlank(defaultIdReltBean.getData())) { |
||||
|
//数据权限ID(1全部、2、本部门及子部门 3子部门、4本人数据)
|
||||
|
String orgSidPath = orgPath; |
||||
|
orgSidPath = orgSidPath + "/"; |
||||
|
int i1 = orgSidPath.indexOf("/"); |
||||
|
int i2 = orgSidPath.indexOf("/", i1 + 1); |
||||
|
// int i3 = orgSidPath.indexOf("/", i2 + 1);
|
||||
|
String orgLevelKey = defaultIdReltBean.getData(); |
||||
|
dataRule.setDataRuleId(orgLevelKey); |
||||
|
if ("1".equals(orgLevelKey)) { |
||||
|
dataRule.setIndex(i1); |
||||
|
} else if ("2".equals(orgLevelKey)) { |
||||
|
dataRule.setIndex(i2); |
||||
|
} else if ("3".equals(orgLevelKey)) { |
||||
|
dataRule.setIndex(i2); |
||||
|
} |
||||
|
} |
||||
|
return rb.success().setData(dataRule); |
||||
|
} |
||||
|
} |
@ -0,0 +1,13 @@ |
|||||
|
package com.yxt.wms.biz.func.commonmethod; |
||||
|
|
||||
|
import lombok.Data; |
||||
|
|
||||
|
/** |
||||
|
* @author wangpengfei |
||||
|
* @date 2024/7/11 10:54 |
||||
|
*/ |
||||
|
@Data |
||||
|
public class DataRule { |
||||
|
private String dataRuleId; |
||||
|
private int index; |
||||
|
} |
Loading…
Reference in new issue