1、新增部门校验问题修复;2、自定义板编号跨单导入问题修复;

This commit is contained in:
gaoqr
2024-12-02 17:44:23 +08:00
parent 73d31dbf8c
commit 0effec4479
7 changed files with 33 additions and 17 deletions
@@ -1,6 +1,7 @@
package com.cf.imes.framework.organ.core.security;
import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.util.ObjectUtil;
import com.cf.imes.framework.common.exception.ServiceException;
import com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants;
import com.cf.imes.framework.common.pojo.CommonResult;
@@ -93,14 +94,14 @@ public class OrganSecurityWebFilter extends ApiRequestFilter {
try {
// 校验组织
organFrameworkService.validOrgan(organId);
// 校验部门
organFrameworkService.validDept(deptId);
if (ObjectUtil.isNotNull(deptId)) {
// 校验部门
organFrameworkService.validDept(deptId);
}
} catch (Throwable ex) {
CommonResult<?> result = globalExceptionHandler.allExceptionHandler(request, ex);
// 组织失效返回401踢出系统
if (needUnauthorizedWhenOrgExpired(ex)) {
result.setCode(GlobalErrorCodeConstants.UNAUTHORIZED.getCode());
}
needUnauthorizedWhenOrgExpired(ex, result);
ServletUtils.writeJSON(response, result);
return;
}
@@ -134,15 +135,14 @@ public class OrganSecurityWebFilter extends ApiRequestFilter {
* @param ex
* @return
*/
private boolean needUnauthorizedWhenOrgExpired(Throwable ex) {
private void needUnauthorizedWhenOrgExpired(Throwable ex, CommonResult<?> result) {
if (ex instanceof ServiceException) {
ServiceException serviceException = (ServiceException) ex;
if (Objects.equals(serviceException.getCode(), ErrorCodeConstants.ORGAN_EXPIRE.getCode())
|| Objects.equals(serviceException.getCode(), ErrorCodeConstants.ORGAN_DISABLE.getCode())
|| Objects.equals(serviceException.getCode(), ErrorCodeConstants.ORGAN_NOT_EXISTS.getCode())) {
return true;
result.setCode(GlobalErrorCodeConstants.UNAUTHORIZED.getCode());
}
}
return false;
}
}
@@ -51,6 +51,6 @@ public class OrganFrameworkServiceImpl implements OrganFrameworkService {
@Override
public void validDept(Long id) {
deptApi.validateDept(id);
deptApi.validateDept(id).checkError();
}
}