mirror of
http://192.168.1.205:9980/cf_devdept2/cf_imes_server.git
synced 2026-08-14 13:42:07 +08:00
新增-es查询缺少字段判断,部门不存在时也可以登录
This commit is contained in:
+1
@@ -28,6 +28,7 @@ public class ErrorCodeConstants {
|
|||||||
// public static final ErrorCode ORDER_PLAN_ERROR = new ErrorCode(1_001_109_001, "选中删除对象有已开料板件,请联系管理员修改开料状态后再删除!");
|
// public static final ErrorCode ORDER_PLAN_ERROR = new ErrorCode(1_001_109_001, "选中删除对象有已开料板件,请联系管理员修改开料状态后再删除!");
|
||||||
public static final ErrorCode PLATE_IS_PLAN = new ErrorCode(1_001_109_002, "删除对象中有已排单板件,请将该对象从排单中移除后再选择删除!");
|
public static final ErrorCode PLATE_IS_PLAN = new ErrorCode(1_001_109_002, "删除对象中有已排单板件,请将该对象从排单中移除后再选择删除!");
|
||||||
public static final ErrorCode ORDER_ERROR = new ErrorCode(1_001_109_003, "当前生产单柜体,房间已全部删除!");
|
public static final ErrorCode ORDER_ERROR = new ErrorCode(1_001_109_003, "当前生产单柜体,房间已全部删除!");
|
||||||
|
public static final ErrorCode ORDER_DATA_ERROR = new ErrorCode(1_001_109_004, "生产单/排单的数据已无法使用,请删除重新");
|
||||||
|
|
||||||
// ========== 生产单 TODO 补充编号 ==========
|
// ========== 生产单 TODO 补充编号 ==========
|
||||||
public static final ErrorCode MODULE_NOT_EXISTS = new ErrorCode(1_001_110_000, "模块不存在");
|
public static final ErrorCode MODULE_NOT_EXISTS = new ErrorCode(1_001_110_000, "模块不存在");
|
||||||
|
|||||||
+20
@@ -12,6 +12,7 @@ import co.elastic.clients.elasticsearch.core.SearchRequest;
|
|||||||
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
import co.elastic.clients.elasticsearch.core.SearchResponse;
|
||||||
import co.elastic.clients.elasticsearch.core.search.Hit;
|
import co.elastic.clients.elasticsearch.core.search.Hit;
|
||||||
import co.elastic.clients.elasticsearch.indices.RefreshRequest;
|
import co.elastic.clients.elasticsearch.indices.RefreshRequest;
|
||||||
|
import co.elastic.clients.json.JsonpMappingException;
|
||||||
import com.cf.imes.framework.common.exception.ServiceException;
|
import com.cf.imes.framework.common.exception.ServiceException;
|
||||||
import com.cf.imes.framework.es.core.dal.ESDocument;
|
import com.cf.imes.framework.es.core.dal.ESDocument;
|
||||||
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
import com.cf.imes.framework.es.core.service.ESDocumentService;
|
||||||
@@ -25,6 +26,7 @@ import java.util.List;
|
|||||||
|
|
||||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.DATA_DATA_ERROR;
|
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.DATA_DATA_ERROR;
|
||||||
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_DATA_ERROR;
|
import static com.cf.imes.framework.common.exception.enums.GlobalErrorCodeConstants.ES_DATA_ERROR;
|
||||||
|
import static com.cf.imes.module.executor.enums.ErrorCodeConstants.ORDER_DATA_ERROR;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author ES 工具类
|
* @author ES 工具类
|
||||||
@@ -67,6 +69,9 @@ public class EsUtils {
|
|||||||
return hits.stream().map(Hit::source).toList();
|
return hits.stream().map(Hit::source).toList();
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
}catch (JsonpMappingException e){
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw new ServiceException(ORDER_DATA_ERROR);
|
||||||
}catch (IOException | ElasticsearchException e) {
|
}catch (IOException | ElasticsearchException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw new ServiceException(DATA_DATA_ERROR);
|
throw new ServiceException(DATA_DATA_ERROR);
|
||||||
@@ -89,6 +94,9 @@ public class EsUtils {
|
|||||||
return hits.stream().map(Hit::source).toList();
|
return hits.stream().map(Hit::source).toList();
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
}catch (JsonpMappingException e){
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw new ServiceException(ORDER_DATA_ERROR);
|
||||||
} catch (IOException | ElasticsearchException e) {
|
} catch (IOException | ElasticsearchException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw new ServiceException(DATA_DATA_ERROR);
|
throw new ServiceException(DATA_DATA_ERROR);
|
||||||
@@ -116,6 +124,9 @@ public class EsUtils {
|
|||||||
return hits.stream().map(Hit::source).toList();
|
return hits.stream().map(Hit::source).toList();
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
}catch (JsonpMappingException e){
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw new ServiceException(ORDER_DATA_ERROR);
|
||||||
}catch (IOException | ElasticsearchException e) {
|
}catch (IOException | ElasticsearchException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw new ServiceException(DATA_DATA_ERROR);
|
throw new ServiceException(DATA_DATA_ERROR);
|
||||||
@@ -138,6 +149,9 @@ public class EsUtils {
|
|||||||
return hits.stream().map(Hit::source).toList();
|
return hits.stream().map(Hit::source).toList();
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
}catch (JsonpMappingException e){
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw new ServiceException(ORDER_DATA_ERROR);
|
||||||
}catch (IOException | ElasticsearchException e) {
|
}catch (IOException | ElasticsearchException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw new ServiceException(DATA_DATA_ERROR);
|
throw new ServiceException(DATA_DATA_ERROR);
|
||||||
@@ -165,6 +179,9 @@ public class EsUtils {
|
|||||||
return hits.stream().map(Hit::source).toList();
|
return hits.stream().map(Hit::source).toList();
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
}catch (JsonpMappingException e){
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw new ServiceException(ORDER_DATA_ERROR);
|
||||||
}catch (IOException | ElasticsearchException e) {
|
}catch (IOException | ElasticsearchException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw new ServiceException(DATA_DATA_ERROR);
|
throw new ServiceException(DATA_DATA_ERROR);
|
||||||
@@ -192,6 +209,9 @@ public class EsUtils {
|
|||||||
return hits.stream().map(Hit::source).toList();
|
return hits.stream().map(Hit::source).toList();
|
||||||
}
|
}
|
||||||
return new ArrayList<>();
|
return new ArrayList<>();
|
||||||
|
}catch (JsonpMappingException e){
|
||||||
|
log.error(e.getMessage());
|
||||||
|
throw new ServiceException(ORDER_DATA_ERROR);
|
||||||
}catch (IOException | ElasticsearchException e) {
|
}catch (IOException | ElasticsearchException e) {
|
||||||
log.error(e.getMessage());
|
log.error(e.getMessage());
|
||||||
throw new ServiceException(DATA_DATA_ERROR);
|
throw new ServiceException(DATA_DATA_ERROR);
|
||||||
|
|||||||
+1
-1
@@ -99,7 +99,7 @@ public class RemainPlateController {
|
|||||||
|
|
||||||
@GetMapping("/page")
|
@GetMapping("/page")
|
||||||
@Operation(summary = "获得生产单余料板表分页")
|
@Operation(summary = "获得生产单余料板表分页")
|
||||||
@PreAuthorize("@ss.hasAnyPermissions('manage:remain-plate:query','placeorder:optimize','placeorder:remain-insert')")
|
@PreAuthorize("@ss.hasAnyPermissions('manage:remain-plate:query','placeorder:optimize','placeorder:remain-insert','production:manager-list:calculate')")
|
||||||
public CommonResult<PageResult<RemainPlateRespVO>> getRemainPlatePage(@Valid RemainPlatePageReqVO pageReqVO) {
|
public CommonResult<PageResult<RemainPlateRespVO>> getRemainPlatePage(@Valid RemainPlatePageReqVO pageReqVO) {
|
||||||
PageResult<RemainPlateDO> pageResult = remainPlateService.getRemainPlatePage(pageReqVO);
|
PageResult<RemainPlateDO> pageResult = remainPlateService.getRemainPlatePage(pageReqVO);
|
||||||
return success(BeanUtils.toBean(pageResult, RemainPlateRespVO.class));
|
return success(BeanUtils.toBean(pageResult, RemainPlateRespVO.class));
|
||||||
|
|||||||
+1
-1
@@ -111,7 +111,7 @@ public class AdminAuthServiceImpl implements AdminAuthService {
|
|||||||
// 校验机构有效性
|
// 校验机构有效性
|
||||||
organService.validOrgan(user.getOrganId());
|
organService.validOrgan(user.getOrganId());
|
||||||
// 校验部门有效性
|
// 校验部门有效性
|
||||||
deptService.validDept(user.getDeptId());
|
deptService.validUserLoginDept(user.getDeptId());
|
||||||
// 校验密码
|
// 校验密码
|
||||||
if (!userService.isPasswordMatch(password, user.getPassword())) {
|
if (!userService.isPasswordMatch(password, user.getPassword())) {
|
||||||
createLoginLog(user.getId(), username, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS);
|
createLoginLog(user.getId(), username, logTypeEnum, LoginResultEnum.BAD_CREDENTIALS);
|
||||||
|
|||||||
+7
@@ -106,6 +106,13 @@ public interface DeptService {
|
|||||||
*/
|
*/
|
||||||
void validDept(Long deptId);
|
void validDept(Long deptId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户登陆时部门校验
|
||||||
|
*
|
||||||
|
* @param deptId
|
||||||
|
*/
|
||||||
|
void validUserLoginDept(Long deptId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移除没有归属(上级)的部门
|
* 移除没有归属(上级)的部门
|
||||||
*
|
*
|
||||||
|
|||||||
+19
@@ -309,6 +309,25 @@ public class DeptServiceImpl implements DeptService {
|
|||||||
validParentDept(deptDO);
|
validParentDept(deptDO);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
// 用户登陆时部门校验,部门不存在时也可以进行登录
|
||||||
|
@Override
|
||||||
|
public void validUserLoginDept(Long deptId){
|
||||||
|
DeptDO deptDO = deptMapper.selectById(deptId);
|
||||||
|
if (deptDO == null) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
if (!CommonStatusEnum.ENABLE.getStatus().equals(deptDO.getStatus())) {
|
||||||
|
throw ServiceExceptionUtil.exception(ErrorCodeConstants.DEPT_DISABLE, deptDO.getName());
|
||||||
|
}
|
||||||
|
// 递归校验上级部门
|
||||||
|
validParentDept(deptDO);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 递归校验上级部门
|
* 递归校验上级部门
|
||||||
*
|
*
|
||||||
|
|||||||
Reference in New Issue
Block a user