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