mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-12 21:02:08 +08:00
1、新增部门校验问题修复;2、自定义板编号跨单导入问题修复;
This commit is contained in:
+8
-8
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -51,6 +51,6 @@ public class OrganFrameworkServiceImpl implements OrganFrameworkService {
|
||||
|
||||
@Override
|
||||
public void validDept(Long id) {
|
||||
deptApi.validateDept(id);
|
||||
deptApi.validateDept(id).checkError();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user