From cdfb2935dcdbf07275cbc14c31a7e888ae688c09 Mon Sep 17 00:00:00 2001 From: zhangjunwen Date: Thu, 27 Jun 2024 11:00:32 +0800 Subject: [PATCH] =?UTF-8?q?=E8=AE=BE=E5=A4=87=E7=8A=B6=E6=80=81=E5=8F=98?= =?UTF-8?q?=E5=8C=96=E4=BF=A1=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../equip/IpcEquipInfoController.java | 17 ++++++++--- .../equip/mapper/IpcEquipInfoMapper.java | 4 +-- .../equip/service/IIpcEquipInfoService.java | 12 +++++--- .../service/impl/IpcEquipInfoServiceImpl.java | 30 ++++++++++++------- .../mapper/IpcRunningStatusRecordMapper.java | 8 ++++- .../IIpcRunningStatusRecordService.java | 6 ++++ .../IpcRunningStatusRecordServiceImpl.java | 8 +++++ .../mapper/equip/IpcEquipInfoMapper.xml | 2 -- .../IpcRunningStatusRecordMapper.xml | 7 +++++ 9 files changed, 70 insertions(+), 24 deletions(-) diff --git a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/equip/IpcEquipInfoController.java b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/equip/IpcEquipInfoController.java index 9702236..ca61abf 100644 --- a/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/equip/IpcEquipInfoController.java +++ b/zfipc-server/zfipc-admin/src/main/java/com/inspur/web/controller/equip/IpcEquipInfoController.java @@ -69,18 +69,27 @@ public class IpcEquipInfoController extends BaseController } @GetMapping("/getInfoByParentId") - public AjaxResult getInfoByParentId(@RequestParam String parentEquipId,String type,Long deptId) + public AjaxResult getInfoByParentId(@RequestParam String parentEquipId,String type) { - return AjaxResult.success(ipcEquipInfoService.selectIpcEquipInfoListByParentId(parentEquipId,type,deptId)); + return AjaxResult.success(ipcEquipInfoService.selectIpcEquipInfoListByParentId(parentEquipId,type)); } /** * 根据部门选择设备树 */ @GetMapping("/getEquipTreeByDept") - public AjaxResult getEquipTreeByDept(Long deptId) + public AjaxResult getEquipTreeByDept(Long DeptId) { - return AjaxResult.success(ipcEquipInfoService.selectIpcEquipInfoTreeByDeptId(deptId)); + return AjaxResult.success(ipcEquipInfoService.selectIpcEquipInfoTreeByDeptId(DeptId)); + } + + /** + * 根据设备id查询设备状态变化 + */ + @GetMapping("/listEquipStatus") + public AjaxResult listEquipStatus(String equipId) + { + return AjaxResult.success(ipcEquipInfoService.selectIpcEquipInfoStatusByEquipId(equipId)); } /** diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java index f82efdd..e8a4e21 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/mapper/IpcEquipInfoMapper.java @@ -6,7 +6,6 @@ import com.inspur.common.annotation.DataSource; import com.inspur.common.enums.DataSourceType; import com.inspur.equip.domain.EquipTreeSelect; import com.inspur.equip.domain.IpcEquipInfo; -import org.apache.ibatis.annotations.Param; public interface IpcEquipInfoMapper @@ -47,8 +46,7 @@ public interface IpcEquipInfoMapper /** * 通过父节点id获取设备信息 */ - public List selectIpcEquipInfoListByParentId(@Param("parentEquipId")String parentEquipId, - @Param("deptId")Long deptId); + public List selectIpcEquipInfoListByParentId(String parentEquipId); /** * 查询正常运行设备 diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/IIpcEquipInfoService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/IIpcEquipInfoService.java index 4f84539..d605bbe 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/IIpcEquipInfoService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/IIpcEquipInfoService.java @@ -1,9 +1,8 @@ package com.inspur.equip.service; import java.util.List; - -import com.inspur.equip.domain.EquipTreeSelect; import com.inspur.equip.domain.IpcEquipInfo; +import com.inspur.industrial.domain.IpcRunningStatusRecord; /** * 设备信息Service接口 @@ -44,12 +43,17 @@ public interface IIpcEquipInfoService /** * 通过父节点id获取设备信息 */ - public List selectIpcEquipInfoListByParentId(String parentEquipId,String type,Long deptId); + public List selectIpcEquipInfoListByParentId(String parentEquipId,String type); /** * 根据部门id获取设备树信息 */ - public List selectIpcEquipInfoTreeByDeptId(Long deptId); + public List selectIpcEquipInfoTreeByDeptId(Long deptId); + + /** + * 根据设备查询状态变化 + */ + public List selectIpcEquipInfoStatusByEquipId(String equipId); /** * 新增设备信息 diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/impl/IpcEquipInfoServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/impl/IpcEquipInfoServiceImpl.java index 5211d2b..ef2395e 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/impl/IpcEquipInfoServiceImpl.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/equip/service/impl/IpcEquipInfoServiceImpl.java @@ -3,9 +3,11 @@ package com.inspur.equip.service.impl; import java.util.*; import java.util.stream.Collectors; +import com.inspur.common.core.domain.entity.SysDept; import com.inspur.common.utils.StringUtils; import com.inspur.common.utils.uuid.IdUtils; -import com.inspur.equip.domain.EquipTreeSelect; +import com.inspur.industrial.domain.IpcRunningStatusRecord; +import com.inspur.industrial.service.IIpcRunningStatusRecordService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; import com.inspur.equip.mapper.IpcEquipInfoMapper; @@ -24,6 +26,9 @@ public class IpcEquipInfoServiceImpl implements IIpcEquipInfoService @Autowired private IpcEquipInfoMapper ipcEquipInfoMapper; + @Autowired + private IIpcRunningStatusRecordService ipcRunningStatusRecordService; + /** * 查询设备信息 * @@ -70,7 +75,6 @@ public class IpcEquipInfoServiceImpl implements IIpcEquipInfoService * @param ipcEquipInfo * @return */ - @Override public List selectQueryIpcEquipInfoList(IpcEquipInfo ipcEquipInfo){ return ipcEquipInfoMapper.selectQueryIpcEquipInfoList(ipcEquipInfo); } @@ -78,10 +82,10 @@ public class IpcEquipInfoServiceImpl implements IIpcEquipInfoService /** * 通过父节点id获取设备信息 */ - @Override - public List selectIpcEquipInfoListByParentId(String parentEquipId,String type,Long deptId){ + public List selectIpcEquipInfoListByParentId(String parentEquipId,String type){ + //TODO 需要根据当前登录用户部门来获取设备信息 if(type == null){ - return ipcEquipInfoMapper.selectIpcEquipInfoListByParentId(parentEquipId,deptId); + return ipcEquipInfoMapper.selectIpcEquipInfoListByParentId(parentEquipId); }else { return ipcEquipInfoMapper.selectRunningIpcEquipInfoListByParentId(parentEquipId); } @@ -92,13 +96,20 @@ public class IpcEquipInfoServiceImpl implements IIpcEquipInfoService * 根据部门id获取设备树信息 */ @Override - public List selectIpcEquipInfoTreeByDeptId(Long deptId){ + public List selectIpcEquipInfoTreeByDeptId(Long deptId){ //根据deptId查询设备信息 IpcEquipInfo query = new IpcEquipInfo(); query.setDeptId(deptId); List equipInfos = ipcEquipInfoMapper.selectIpcEquipInfoList(query); - List equipTrees = getEquipTree(equipInfos); - return equipTrees.stream().map(EquipTreeSelect :: new).collect(Collectors.toList()); + return equipTree(query); + } + + /** + * 根据设备查询状态变化 + */ + @Override + public List selectIpcEquipInfoStatusByEquipId(String equipId){ + return ipcRunningStatusRecordService.selectIpcRunningStatusRecordByEquipId(equipId); } /** @@ -218,7 +229,7 @@ public class IpcEquipInfoServiceImpl implements IIpcEquipInfoService returnList = equipInfos; } return returnList; - } +} /** * 递归列表 @@ -262,6 +273,5 @@ public class IpcEquipInfoServiceImpl implements IIpcEquipInfoService { return getChildList(list, t).size() > 0; } - } diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcRunningStatusRecordMapper.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcRunningStatusRecordMapper.java index 672dd88..c5931e2 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcRunningStatusRecordMapper.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/mapper/IpcRunningStatusRecordMapper.java @@ -12,7 +12,7 @@ import java.util.List; * @author inspur * @date 2024-04-09 */ -@DataSource(DataSourceType.SLAVE) + public interface IpcRunningStatusRecordMapper { /** @@ -31,6 +31,12 @@ public interface IpcRunningStatusRecordMapper */ public List selectIpcRunningStatusRecordList(IpcRunningStatusRecord ipcRunningStatusRecord); + /** + * 根据设备查询状态变化 + */ + public List selectIpcRunningStatusRecordByEquipId(String equipId); + + /** * 新增运行状态记录 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcRunningStatusRecordService.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcRunningStatusRecordService.java index 8554783..3db7785 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcRunningStatusRecordService.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/IIpcRunningStatusRecordService.java @@ -28,6 +28,12 @@ public interface IIpcRunningStatusRecordService */ public List selectIpcRunningStatusRecordList(IpcRunningStatusRecord ipcRunningStatusRecord); + /** + * 根据设备查询状态变化 + */ + public List selectIpcRunningStatusRecordByEquipId(String equipId); + + /** * 新增运行状态记录 * diff --git a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcRunningStatusRecordServiceImpl.java b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcRunningStatusRecordServiceImpl.java index 745d2c3..8701598 100644 --- a/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcRunningStatusRecordServiceImpl.java +++ b/zfipc-server/zfipc-system/src/main/java/com/inspur/industrial/service/impl/IpcRunningStatusRecordServiceImpl.java @@ -48,6 +48,14 @@ public class IpcRunningStatusRecordServiceImpl implements IIpcRunningStatusRecor return ipcRunningStatusRecordMapper.selectIpcRunningStatusRecordList(ipcRunningStatusRecord); } + /** + * 根据设备查询状态变化 + */ + @Override + public List selectIpcRunningStatusRecordByEquipId(String equipId){ + return ipcRunningStatusRecordMapper.selectIpcRunningStatusRecordByEquipId(equipId); + } + /** * 新增运行状态记录 * diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml index f466661..2199eec 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/equip/IpcEquipInfoMapper.xml @@ -59,7 +59,6 @@ and a.status = #{status} and a.equip_level = #{equipLevel} and a.parent_equip_id = #{parentEquipId} - and a.corp_id = #{corpId} and a.ancestors = #{ancestors} and a.equip_drawing_path = #{equipDrawingPath} and a.equip_files_path = #{equipFilesPath} @@ -136,7 +135,6 @@ SELECT a.*,(NOT EXISTS(SELECT * from `ipc_equip_info` b WHERE b.parent_equip_id = a.id )) as leaf FROM `ipc_equip_info` a WHERE parent_equip_id = #{parentEquipId} - and a.dept_id = #{deptId} diff --git a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcRunningStatusRecordMapper.xml b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcRunningStatusRecordMapper.xml index 0d128b7..419049b 100644 --- a/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcRunningStatusRecordMapper.xml +++ b/zfipc-server/zfipc-system/src/main/resources/mapper/industrial/IpcRunningStatusRecordMapper.xml @@ -27,6 +27,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" where id = #{id} + + + insert into ipc_running_status_record