1.pmsBug修改

This commit is contained in:
2024-01-25 08:34:21 +08:00
parent 2c487a8242
commit c1d68009ca
6 changed files with 47 additions and 69 deletions

View File

@@ -9,7 +9,7 @@
</select>
<select id="selectTerminalList" resultType="com.njcn.device.pms.pojo.vo.RStatDevSignalVO">
SELECT
Id as terminalId,
terminal_Code as terminalId,
NAME as terminalName,
Org_Name as orgName,
Org_Id as orgId,
@@ -36,6 +36,7 @@
<if test="param.runStatus != null and param.runStatus !='' ">
and pms_terminal.Com_Flag = #{param.runStatus}
</if>
order by Org_Name
</where>
</select>

View File

@@ -48,9 +48,6 @@ public class RStatDevSignalDServiceImpl extends ServiceImpl<RStatDevSignalDMappe
public List<RStatDevSignalVO> getRStatDevSignalList(RStatDevSignalParam rStatDevSignalParam) {
//提取查询条件
String id = rStatDevSignalParam.getId(); //单位id
String deviceName = rStatDevSignalParam.getDeviceName(); //终端名称
String deviceStatus = rStatDevSignalParam.getDeviceStatus(); //终端状态
String runStatus = rStatDevSignalParam.getRunStatus(); //运行状态
if (StringUtils.isBlank(id)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "单位id不可为空");
@@ -58,69 +55,14 @@ public class RStatDevSignalDServiceImpl extends ServiceImpl<RStatDevSignalDMappe
//获取所有子部门信息
List<DeptDTO> deptDTOList = deptFeignClient.getDeptDescendantIndexes(id, WebUtil.filterDeptType()).getData();
// /*获取下一级子部门信息*/
// List<DeptDTO> deptDTOList = deptFeignClient.getDepSonDetailByDeptId (id).getData ( );
if (CollUtil.isEmpty(deptDTOList)) {
throw new BusinessException(CommonResponseEnum.NO_DATA, "部门不存在");
}
//单位id集合
List<String> orgCodeList = deptDTOList.stream().map(DeptDTO::getCode).collect(Collectors.toList());
return terminalMapper.selectTerminalList(orgCodeList, rStatDevSignalParam);
/*
//查询终端数据
LambdaQueryWrapper<PmsTerminal> terminalWrapper = new LambdaQueryWrapper<>();
terminalWrapper.in(PmsTerminal::getOrgId, orgCodeList)
.eq(PmsTerminal::getStatus, DataStateEnum.ENABLE.getCode())
.like(StringUtils.isNotBlank(deviceName), PmsTerminal::getName, deviceName);
List<PmsTerminal> terminalList = iTerminalService.list(terminalWrapper);
//提取终端id
List<String> terminalIdList = terminalList.stream().map(PmsTerminal::getId).collect(Collectors.toList());
//将终端信息转为map集合 key: 终端id value: 终端实体
Map<String, PmsTerminal> terminalMap = terminalList.stream().collect(Collectors.toMap(PmsTerminal::getId, terminal -> terminal));
if (CollUtil.isEmpty(terminalIdList)) {
return new ArrayList<>();
}
//查询业务数据
LambdaQueryWrapper<RStatDevSignalD> businessWrapper = new LambdaQueryWrapper<>();
businessWrapper.in(RStatDevSignalD::getDeviceId, terminalIdList)
.eq(StringUtils.isNotBlank(deviceStatus), RStatDevSignalD::getDeviceStatus, deviceStatus)
.eq(StringUtils.isNotBlank(runStatus), RStatDevSignalD::getRunStatus, runStatus);
List<RStatDevSignalD> list = this.list(businessWrapper);
//封装返回数据
List<RStatDevSignalVO> resultList = list.stream().map(item -> {
RStatDevSignalVO rStatDevSignalVO = new RStatDevSignalVO();
BeanUtils.copyProperties(item, rStatDevSignalVO); //设备状态、运行状态、最后通讯时间(更新时间)
rStatDevSignalVO.setTerminalId(item.getDeviceId()); //终端id(终端编号)
rStatDevSignalVO.setOrgId(terminalMap.get(item.getDeviceId()).getOrgId()); //单位id
rStatDevSignalVO.setOrgName(terminalMap.get(item.getDeviceId()).getOrgName()); //单位名称
rStatDevSignalVO.setTerminalName(terminalMap.get(item.getDeviceId()).getName()); //终端名称
rStatDevSignalVO.setIp(terminalMap.get(item.getDeviceId()).getIp()); //ip
rStatDevSignalVO.setPort(terminalMap.get(item.getDeviceId()).getPort()); //端口
return rStatDevSignalVO;
}).collect(Collectors.toList());
Map<String, RStatDevSignalD> signalMap = list.stream().collect(Collectors.toMap(RStatDevSignalD::getDeviceId, Function.identity(),(key1, key2)->key1));
List<PmsTerminal> notList = terminalList.stream().filter(r -> !signalMap.containsKey(r.getId()))
.collect(Collectors.toList());
if(CollectionUtil.isNotEmpty(notList)){
RStatDevSignalVO rStatDevSignalVO ;
for (PmsTerminal terminal : notList) {
rStatDevSignalVO = new RStatDevSignalVO();
rStatDevSignalVO.setTerminalId(terminal.getId());
rStatDevSignalVO.setOrgId(terminal.getOrgId());
rStatDevSignalVO.setOrgName(terminal.getOrgName());
rStatDevSignalVO.setTerminalName(terminal.getName());
rStatDevSignalVO.setDeviceStatus("/");
rStatDevSignalVO.setRunStatus("/");
rStatDevSignalVO.setIp(terminal.getIp());
rStatDevSignalVO.setPort(terminal.getPort());
rStatDevSignalVO.setUpdateTime("/");
resultList.add(rStatDevSignalVO);
}
}
return resultList;
*/
}
}