设备状态变化信息

This commit is contained in:
zhangjunwen 2024-06-27 11:00:32 +08:00
parent 16faf09f46
commit cdfb2935dc
9 changed files with 70 additions and 24 deletions

View File

@ -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));
}
/**

View File

@ -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<IpcEquipInfo> selectIpcEquipInfoListByParentId(@Param("parentEquipId")String parentEquipId,
@Param("deptId")Long deptId);
public List<IpcEquipInfo> selectIpcEquipInfoListByParentId(String parentEquipId);
/**
* 查询正常运行设备

View File

@ -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<IpcEquipInfo> selectIpcEquipInfoListByParentId(String parentEquipId,String type,Long deptId);
public List<IpcEquipInfo> selectIpcEquipInfoListByParentId(String parentEquipId,String type);
/**
* 根据部门id获取设备树信息
*/
public List<EquipTreeSelect> selectIpcEquipInfoTreeByDeptId(Long deptId);
public List<IpcEquipInfo> selectIpcEquipInfoTreeByDeptId(Long deptId);
/**
* 根据设备查询状态变化
*/
public List<IpcRunningStatusRecord> selectIpcEquipInfoStatusByEquipId(String equipId);
/**
* 新增设备信息

View File

@ -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<IpcEquipInfo> selectQueryIpcEquipInfoList(IpcEquipInfo ipcEquipInfo){
return ipcEquipInfoMapper.selectQueryIpcEquipInfoList(ipcEquipInfo);
}
@ -78,10 +82,10 @@ public class IpcEquipInfoServiceImpl implements IIpcEquipInfoService
/**
* 通过父节点id获取设备信息
*/
@Override
public List<IpcEquipInfo> selectIpcEquipInfoListByParentId(String parentEquipId,String type,Long deptId){
public List<IpcEquipInfo> 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<EquipTreeSelect> selectIpcEquipInfoTreeByDeptId(Long deptId){
public List<IpcEquipInfo> selectIpcEquipInfoTreeByDeptId(Long deptId){
//根据deptId查询设备信息
IpcEquipInfo query = new IpcEquipInfo();
query.setDeptId(deptId);
List<IpcEquipInfo> equipInfos = ipcEquipInfoMapper.selectIpcEquipInfoList(query);
List<IpcEquipInfo> equipTrees = getEquipTree(equipInfos);
return equipTrees.stream().map(EquipTreeSelect :: new).collect(Collectors.toList());
return equipTree(query);
}
/**
* 根据设备查询状态变化
*/
@Override
public List<IpcRunningStatusRecord> selectIpcEquipInfoStatusByEquipId(String equipId){
return ipcRunningStatusRecordService.selectIpcRunningStatusRecordByEquipId(equipId);
}
/**
@ -262,6 +273,5 @@ public class IpcEquipInfoServiceImpl implements IIpcEquipInfoService
{
return getChildList(list, t).size() > 0;
}
}

View File

@ -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<IpcRunningStatusRecord> selectIpcRunningStatusRecordList(IpcRunningStatusRecord ipcRunningStatusRecord);
/**
* 根据设备查询状态变化
*/
public List<IpcRunningStatusRecord> selectIpcRunningStatusRecordByEquipId(String equipId);
/**
* 新增运行状态记录
*

View File

@ -28,6 +28,12 @@ public interface IIpcRunningStatusRecordService
*/
public List<IpcRunningStatusRecord> selectIpcRunningStatusRecordList(IpcRunningStatusRecord ipcRunningStatusRecord);
/**
* 根据设备查询状态变化
*/
public List<IpcRunningStatusRecord> selectIpcRunningStatusRecordByEquipId(String equipId);
/**
* 新增运行状态记录
*

View File

@ -48,6 +48,14 @@ public class IpcRunningStatusRecordServiceImpl implements IIpcRunningStatusRecor
return ipcRunningStatusRecordMapper.selectIpcRunningStatusRecordList(ipcRunningStatusRecord);
}
/**
* 根据设备查询状态变化
*/
@Override
public List<IpcRunningStatusRecord> selectIpcRunningStatusRecordByEquipId(String equipId){
return ipcRunningStatusRecordMapper.selectIpcRunningStatusRecordByEquipId(equipId);
}
/**
* 新增运行状态记录
*

View File

@ -59,7 +59,6 @@
<if test="status != null "> and a.status = #{status}</if>
<if test="equipLevel != null and equipLevel != ''"> and a.equip_level = #{equipLevel}</if>
<if test="parentEquipId != null and parentEquipId != ''"> and a.parent_equip_id = #{parentEquipId}</if>
<if test="corpId != null "> and a.corp_id = #{corpId}</if>
<if test="ancestors != null and ancestors != ''"> and a.ancestors = #{ancestors}</if>
<if test="equipDrawingPath != null and equipDrawingPath != ''"> and a.equip_drawing_path = #{equipDrawingPath}</if>
<if test="equipFilesPath != null and equipFilesPath != ''"> and a.equip_files_path = #{equipFilesPath}</if>
@ -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}
<if test="deptId != null and deptId != ''">and a.dept_id = #{deptId}</if>
</select>
<!-- 查询正常运行设备 selectRunningIpcEquipInfoListByParentId-->

View File

@ -27,6 +27,13 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
where id = #{id}
</select>
<!-- 根据设备查询状态变化 selectIpcRunningStatusRecordByEquipId-->
<select id="selectIpcRunningStatusRecordByEquipId" parameterType="String" resultMap="IpcRunningStatusRecordResult">
<include refid="selectIpcRunningStatusRecordVo"/>
where equip_id = #{equipId}
order by start_time desc
</select>
<insert id="insertIpcRunningStatusRecord" parameterType="IpcRunningStatusRecord" useGeneratedKeys="true" keyProperty="id">
insert into ipc_running_status_record
<trim prefix="(" suffix=")" suffixOverrides=",">