BMS计费引擎模块数据权限隔离修改调整
This commit is contained in:
+34
-4
@@ -45,10 +45,40 @@ public class BillingRulesApplicationService {
|
|||||||
|
|
||||||
public List<BillingRulesPO> queryList(BillingRulesDO billingRulesDO) {
|
public List<BillingRulesPO> queryList(BillingRulesDO billingRulesDO) {
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
if (loginUser != null){
|
if (loginUser != null && loginUser.getUserPo() != null) {
|
||||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
|
||||||
if (topOrganizationId != null && topOrganizationId != 1){
|
Long frontendOrganizationId = billingRulesDO.getOrganizationId(); // 前端传递的 organizationId
|
||||||
billingRulesDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
|
||||||
|
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己且 topOrganizationId=2827
|
||||||
|
if (userOrganizationId != null && userOrganizationId == 2827L) {
|
||||||
|
// 南光组织(organizationId=2827):可以查询所有组织的数据
|
||||||
|
if (frontendOrganizationId != null) {
|
||||||
|
// 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
|
||||||
|
billingRulesDO.setOrganizationId(frontendOrganizationId);
|
||||||
|
billingRulesDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件
|
||||||
|
} else {
|
||||||
|
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
|
||||||
|
billingRulesDO.setOrganizationId(null);
|
||||||
|
billingRulesDO.setTopOrganizationId(null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 其他组织:设置organizationId为当前组织ID,并且设置topOrganizationId=2827
|
||||||
|
// 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
|
||||||
|
if (frontendOrganizationId != null && userOrganizationId != null) {
|
||||||
|
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
|
||||||
|
if (!frontendOrganizationId.equals(userOrganizationId)) {
|
||||||
|
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
|
||||||
|
billingRulesDO.setOrganizationId(userOrganizationId);
|
||||||
|
}
|
||||||
|
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
|
||||||
|
} else {
|
||||||
|
// 前端没有传递 organizationId,使用当前登录用户的组织ID
|
||||||
|
if (userOrganizationId != null) {
|
||||||
|
billingRulesDO.setOrganizationId(userOrganizationId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 对于非2827组织,必须设置 topOrganizationId=2827
|
||||||
|
billingRulesDO.setTopOrganizationId(2827L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return billingRulesDomainService.queryList(billingRulesDO);
|
return billingRulesDomainService.queryList(billingRulesDO);
|
||||||
|
|||||||
+34
-4
@@ -48,10 +48,40 @@ public class DocumentTypeApplicationService {
|
|||||||
|
|
||||||
public List<DocumentTypePO> queryList(DocumentTypeDO documentTypeDO) {
|
public List<DocumentTypePO> queryList(DocumentTypeDO documentTypeDO) {
|
||||||
LoginUser loginUser = SecurityUtils.getLoginUser();
|
LoginUser loginUser = SecurityUtils.getLoginUser();
|
||||||
if (loginUser != null){
|
if (loginUser != null && loginUser.getUserPo() != null) {
|
||||||
Long topOrganizationId = loginUser.getUserPo().getTopOrganizationId();
|
Long userOrganizationId = loginUser.getUserPo().getOrganizationId();
|
||||||
if (topOrganizationId != null && topOrganizationId != 1){
|
Long frontendOrganizationId = documentTypeDO.getOrganizationId(); // 前端传递的 organizationId
|
||||||
documentTypeDO.setTopOrganizationId(loginUser.getUserPo().getTopOrganizationId());
|
|
||||||
|
// 当前登录用户的 organizationId 为 2827 时,可查全部组织数据;其他组织只能查自己且 topOrganizationId=2827
|
||||||
|
if (userOrganizationId != null && userOrganizationId == 2827L) {
|
||||||
|
// 南光组织(organizationId=2827):可以查询所有组织的数据
|
||||||
|
if (frontendOrganizationId != null) {
|
||||||
|
// 前端传递了 organizationId(包括2827或其他组织),使用前端传递的值进行过滤
|
||||||
|
documentTypeDO.setOrganizationId(frontendOrganizationId);
|
||||||
|
documentTypeDO.setTopOrganizationId(null); // 明确设置为 null,避免使用 topOrganizationId 条件
|
||||||
|
} else {
|
||||||
|
// 前端没有传递 organizationId,清空组织过滤条件,查询所有组织的数据
|
||||||
|
documentTypeDO.setOrganizationId(null);
|
||||||
|
documentTypeDO.setTopOrganizationId(null);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// 其他组织:设置organizationId为当前组织ID,并且设置topOrganizationId=2827
|
||||||
|
// 如果前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
|
||||||
|
if (frontendOrganizationId != null && userOrganizationId != null) {
|
||||||
|
// 前端传递了 organizationId,验证是否与当前登录用户的组织ID一致
|
||||||
|
if (!frontendOrganizationId.equals(userOrganizationId)) {
|
||||||
|
// 前端传递了其他组织的 organizationId,强制使用当前登录用户的组织ID,防止越权查询
|
||||||
|
documentTypeDO.setOrganizationId(userOrganizationId);
|
||||||
|
}
|
||||||
|
// 如果前端传递的 organizationId 与当前登录用户的组织ID一致,使用前端传递的值
|
||||||
|
} else {
|
||||||
|
// 前端没有传递 organizationId,使用当前登录用户的组织ID
|
||||||
|
if (userOrganizationId != null) {
|
||||||
|
documentTypeDO.setOrganizationId(userOrganizationId);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
// 对于非2827组织,必须设置 topOrganizationId=2827
|
||||||
|
documentTypeDO.setTopOrganizationId(2827L);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return documentTypeDomainService.queryList(documentTypeDO);
|
return documentTypeDomainService.queryList(documentTypeDO);
|
||||||
|
|||||||
@@ -100,6 +100,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
<if test="billingRulesDO.createByName != null and billingRulesDO.createByName != ''">
|
<if test="billingRulesDO.createByName != null and billingRulesDO.createByName != ''">
|
||||||
AND create_by_name like concat('%', #{billingRulesDO.createByName}, '%')
|
AND create_by_name like concat('%', #{billingRulesDO.createByName}, '%')
|
||||||
</if>
|
</if>
|
||||||
|
<if test="billingRulesDO.organizationId != null">
|
||||||
|
and organization_id = #{billingRulesDO.organizationId}
|
||||||
|
</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
@@ -89,6 +89,9 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
|||||||
#{code}
|
#{code}
|
||||||
</foreach>
|
</foreach>
|
||||||
</if>
|
</if>
|
||||||
|
<if test="documentTypeDO.organizationId != null">
|
||||||
|
and organization_id = #{documentTypeDO.organizationId}
|
||||||
|
</if>
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
</mapper>
|
</mapper>
|
||||||
|
|||||||
Reference in New Issue
Block a user