From 5cff2196313f92de3fba849fce02eac74ebb0cf0 Mon Sep 17 00:00:00 2001 From: wenjy Date: Fri, 11 Mar 2022 17:26:24 +0800 Subject: [PATCH] =?UTF-8?q?change=20-=20=E7=9B=91=E6=8E=A7=E4=B8=BB?= =?UTF-8?q?=E9=A1=B5=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=E5=A4=84=E7=90=86?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../web/controller/iot/IndexController.java | 156 ++++++++- .../resources/static/js/Iot-ui/iotIndex.js | 18 +- .../resources/templates/iot-ui/index.html | 4 +- .../ruoyi/system/domain/BaseSensorInfo.java | 5 + .../ruoyi/system/domain/dto/BarChatsDto.java | 25 ++ .../impl/BaseMonitorunitInfoServiceImpl.java | 320 +++++++++--------- 6 files changed, 352 insertions(+), 176 deletions(-) create mode 100644 ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BarChatsDto.java diff --git a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/IndexController.java b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/IndexController.java index e5d6cd2..f87a3cb 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/IndexController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/web/controller/iot/IndexController.java @@ -1,13 +1,20 @@ package com.ruoyi.web.controller.iot; +import com.alibaba.fastjson.JSON; import com.alibaba.fastjson.JSONArray; import com.ruoyi.common.core.domain.entity.SysMenu; import com.ruoyi.system.domain.BaseMonitorunitInfo; import com.ruoyi.system.domain.BaseMonitorunitType; +import com.ruoyi.system.domain.BaseSensorInfo; +import com.ruoyi.system.domain.BaseSensorType; +import com.ruoyi.system.domain.dto.BarChatsDto; import com.ruoyi.system.domain.dto.BaseMonitorunitInfoDto; +import com.ruoyi.system.domain.dto.BaseSensorInfoDto; import com.ruoyi.system.domain.dto.ScrollTableDto; import com.ruoyi.system.service.IBaseMonitorunitInfoService; import com.ruoyi.system.service.IBaseMonitorunitTypeService; +import com.ruoyi.system.service.IBaseSensorInfoService; +import com.ruoyi.system.service.IBaseSensorTypeService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Controller; import org.springframework.web.bind.annotation.GetMapping; @@ -30,6 +37,10 @@ public class IndexController { @Autowired private IBaseMonitorunitInfoService baseMonitorunitInfoService; + @Autowired private IBaseSensorTypeService baseSensorTypeService; + + @Autowired private IBaseSensorInfoService baseSensorInfoService; + @GetMapping() public String index() { return "iot-ui/index"; @@ -57,7 +68,10 @@ public class IndexController { x -> { List collect = baseMonitorunitInfoDtos.stream() - .filter(y -> y.getMonitorunitType().equals(x.getMonitorunittypeId())) + .filter( + y -> + !y.getParentId().isEmpty() + && y.getMonitorunitType().equals(x.getMonitorunittypeId())) .collect(Collectors.toList()); BaseMonitorunitInfoDto info = new BaseMonitorunitInfoDto(); info.setName(x.getMonitorunittypeName()); @@ -127,14 +141,21 @@ public class IndexController { x -> { List collect = baseMonitorunitInfoDtos.stream() - .filter(y -> y.getMonitorunitType().equals(x.getMonitorunittypeId())) + .filter( + y -> + !y.getParentId().isEmpty() + && y.getMonitorunitType().equals(x.getMonitorunittypeId())) + .collect(Collectors.toList()); + List collect2 = + collect.stream() + .filter(z -> z.getMonitorunitStatus().equals(0)) .collect(Collectors.toList()); data.add( new ArrayList() { { this.add(x.getMonitorunittypeName()); this.add(collect.size() + ""); - this.add(collect.size() + ""); + this.add(collect2.size() + ""); } }); }); @@ -165,10 +186,46 @@ public class IndexController { @GetMapping("/getSensorStateCharts") @ResponseBody public String getSensorStateCharts() { - return "{\n" - + " \"yAxis\": [\"在线\", \"离线\", \"告警\"],\n" - + " \"data\": [60, 132, 89]\n" - + "}"; + try { + List baseSensorInfoDtos = + baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo()); + List yAxis = + new ArrayList() { + { + this.add("在线"); + this.add("离线"); + this.add("告警"); + } + }; + + List data = + new ArrayList() { + { + this.add( + baseSensorInfoDtos.stream() + .filter(x -> x.getSensorStatus() == 0) + .collect(Collectors.toList()) + .size()); // 在线 + this.add( + baseSensorInfoDtos.stream() + .filter(x -> x.getSensorStatus() == 1) + .collect(Collectors.toList()) + .size()); // 离线 + this.add( + baseSensorInfoDtos.stream() + .filter(x -> x.getSensorStatus() == 2) + .collect(Collectors.toList()) + .size()); // 告警 + } + }; + + return JSONArray.toJSONString(new BarChatsDto(yAxis, data)); + } catch (Exception ex) { + return "{\n" + + " \"yAxis\": [\"在线\", \"离线\", \"告警\"],\n" + + " \"data\": [0, 132, 89]\n" + + "}"; + } } /** @@ -181,17 +238,80 @@ public class IndexController { @GetMapping("/getSensorStateInfo") @ResponseBody public String getSensorStateInfo() { - return "{\n" - + " \"header\": [\"名称\", \"安装数量\", \"离线数量\"],\n" - + " \"data\": [\n" - + " [\"温度\", \"30\", \"30\"],\n" - + " [\"湿度\", \"14\", \"14\"],\n" - + " [\"振动\", \"26\", \"26\"],\n" - + " [\"烟雾\", \"20\", \"20\"],\n" - + " [\"倾斜\", \"10\", \"10\"],\n" - + " [\"拉力\", \"10\", \"10\"]\n" - + " ]\n" - + "}"; + try { + List> data = new ArrayList<>(); + + List header = + new ArrayList() { + { + this.add("名称"); + this.add("安装数量"); + this.add("离线数量"); + } + }; + List baseSensorTypeList = + baseSensorTypeService.selectBaseSensorTypeList(new BaseSensorType()); + baseSensorTypeList.forEach( + x -> { + List baseSensorInfoDtos = + baseSensorInfoService.selectBaseSensorInfoList( + new BaseSensorInfo(x.getSensortypeId(), 0L)); + data.add( + new ArrayList() { + { + this.add(x.getSensortypeName()); + this.add(baseSensorInfoDtos.size() + ""); + this.add( + baseSensorInfoDtos.stream() + .filter(z -> z.getSensorStatus() == 1) + .collect(Collectors.toList()) + .size() + + ""); + } + }); + }); + return JSONArray.toJSONString(new ScrollTableDto(header, data)); + } catch (Exception ex) { + return "{\n" + + " \"header\": [\"名称\", \"安装数量\", \"离线数量\"],\n" + + " \"data\": [\n" + + " [\"温度\", \"30\", \"30\"],\n" + + " [\"湿度\", \"14\", \"14\"],\n" + + " [\"振动\", \"26\", \"26\"],\n" + + " [\"烟雾\", \"20\", \"20\"],\n" + + " [\"倾斜\", \"10\", \"10\"],\n" + + " [\"拉力\", \"10\", \"10\"]\n" + + " ]\n" + + "}"; + } + } + + /** + * 数量统计:传感器数量、监控单元数量 + * + * @author WenJY + * @date 2022/3/11 17:08 + * @return java.lang.String + */ + @GetMapping("/quantityStatistics") + @ResponseBody + public String quantityStatistics() { + List baseSensorInfoDtos = + baseSensorInfoService.selectBaseSensorInfoList(new BaseSensorInfo("", 0L)); + List baseMonitorunitInfos = + baseMonitorunitInfoService.selectBaseMonitorunitInfoList(new BaseMonitorunitInfo()); + List result = + new ArrayList() { + { + this.add(baseSensorInfoDtos.size()); + this.add( + baseMonitorunitInfos.stream() + .filter(x -> !x.getParentId().isEmpty() && x.getEnableFlag() == 0L) + .collect(Collectors.toList()) + .size()); + } + }; + return JSONArray.toJSONString(result); } /** diff --git a/ruoyi-admin/src/main/resources/static/js/Iot-ui/iotIndex.js b/ruoyi-admin/src/main/resources/static/js/Iot-ui/iotIndex.js index adf181a..9f21025 100644 --- a/ruoyi-admin/src/main/resources/static/js/Iot-ui/iotIndex.js +++ b/ruoyi-admin/src/main/resources/static/js/Iot-ui/iotIndex.js @@ -1,3 +1,19 @@ +//数量统计,传感器数量、监控单元数量 +$(() => { + $.ajax({ + url: '/iot/index/quantityStatistics', + type: 'GET', + dataType: 'JSON', + success: function (datas) { + $("#sensorAmount").text(datas[0]); + $("#monitorunitAmount").text(datas[1]); + }, + error: function (e) { + console.log("异常:" + e) + } + }) +}) + //监控单元列表 $(() => { @@ -181,7 +197,7 @@ function barChats(datas, id) { }, show: true, }, - boundaryGap: ['5%', '5%'], + boundaryGap: ['0%', '5%'], }, yAxis: [{ type: 'category', diff --git a/ruoyi-admin/src/main/resources/templates/iot-ui/index.html b/ruoyi-admin/src/main/resources/templates/iot-ui/index.html index c7a9410..fb495f8 100644 --- a/ruoyi-admin/src/main/resources/templates/iot-ui/index.html +++ b/ruoyi-admin/src/main/resources/templates/iot-ui/index.html @@ -24,11 +24,11 @@
- 123 + 123
- 123 + 123
diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseSensorInfo.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseSensorInfo.java index f5b0503..e538383 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseSensorInfo.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/BaseSensorInfo.java @@ -22,6 +22,11 @@ public class BaseSensorInfo extends BaseEntity this.sensorId = sensorId; } + public BaseSensorInfo(String sensorType, Long enableFlag) { + this.sensorType = sensorType; + this.enableFlag = enableFlag; + } + /** 主键标识 */ private Long objId; diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BarChatsDto.java b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BarChatsDto.java new file mode 100644 index 0000000..6c82ae8 --- /dev/null +++ b/ruoyi-system/src/main/java/com/ruoyi/system/domain/dto/BarChatsDto.java @@ -0,0 +1,25 @@ +package com.ruoyi.system.domain.dto; + +import lombok.Data; + +import java.util.List; + +/** + * @author WenJY + * @date 2022年03月11日 16:41 + */ +@Data +public class BarChatsDto { + + public BarChatsDto() { + } + + public BarChatsDto(List yAxis, List data) { + this.yAxis = yAxis; + this.data = data; + } + + private List yAxis; + + private List data; +} diff --git a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseMonitorunitInfoServiceImpl.java b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseMonitorunitInfoServiceImpl.java index 26f1ff8..f72af88 100644 --- a/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseMonitorunitInfoServiceImpl.java +++ b/ruoyi-system/src/main/java/com/ruoyi/system/service/impl/BaseMonitorunitInfoServiceImpl.java @@ -19,177 +19,187 @@ import com.ruoyi.common.core.text.Convert; /** * 监控单元信息Service业务层处理 - * + * * @author wenjy * @date 2022-01-27 */ @Service -public class BaseMonitorunitInfoServiceImpl implements IBaseMonitorunitInfoService -{ - @Autowired - private BaseMonitorunitInfoMapper baseMonitorunitInfoMapper; +public class BaseMonitorunitInfoServiceImpl implements IBaseMonitorunitInfoService { + @Autowired private BaseMonitorunitInfoMapper baseMonitorunitInfoMapper; - /** - * 查询监控单元信息 - * - * @param ObjId 监控单元信息主键 - * @return 监控单元信息 - */ - @Override - public BaseMonitorunitInfo selectBaseMonitorunitInfoByObjId(Long ObjId) - { - return baseMonitorunitInfoMapper.selectBaseMonitorunitInfoByObjId(ObjId); - } + /** + * 查询监控单元信息 + * + * @param ObjId 监控单元信息主键 + * @return 监控单元信息 + */ + @Override + public BaseMonitorunitInfo selectBaseMonitorunitInfoByObjId(Long ObjId) { + return baseMonitorunitInfoMapper.selectBaseMonitorunitInfoByObjId(ObjId); + } - /** - * 查询监控单元信息列表 - * - * @param baseMonitorunitInfo 监控单元信息 - * @return 监控单元信息 - */ - @Override - public List selectBaseMonitorunitInfoList(BaseMonitorunitInfo baseMonitorunitInfo) - { - return baseMonitorunitInfoMapper.selectBaseMonitorunitInfoList(baseMonitorunitInfo); - } + /** + * 查询监控单元信息列表 + * + * @param baseMonitorunitInfo 监控单元信息 + * @return 监控单元信息 + */ + @Override + public List selectBaseMonitorunitInfoList( + BaseMonitorunitInfo baseMonitorunitInfo) { + return baseMonitorunitInfoMapper.selectBaseMonitorunitInfoList(baseMonitorunitInfo); + } - /** - * 查询监控单元信息列表 - * - * @param baseMonitorunitInfo 监控单元信息 - * @return 监控单元信息 - */ - @Override - public List selectBaseMonitorunitInfoDtoList(BaseMonitorunitInfo baseMonitorunitInfo) - { - return baseMonitorunitInfoMapper.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo); - } + /** + * 查询监控单元信息列表 + * + * @param baseMonitorunitInfo 监控单元信息 + * @return 监控单元信息 + */ + @Override + public List selectBaseMonitorunitInfoDtoList( + BaseMonitorunitInfo baseMonitorunitInfo) { + return baseMonitorunitInfoMapper.selectBaseMonitorunitInfoDtoList(baseMonitorunitInfo); + } - /** - * 导入监控单元信息 - * @author WenJY - * @date 2022/2/7 9:53 - * @param baseMonitorunitInfos - * @param updateSupport - * @return java.lang.String - */ - @Override - public String importMould(List baseMonitorunitInfos, boolean updateSupport) { - if (StringUtils.isNull(baseMonitorunitInfos) || baseMonitorunitInfos.size() == 0) { - throw new BusinessException("导入标准数据不能为空!"); - } - int successNum = 0; - int failureNum = 0; - StringBuilder successMsg = new StringBuilder(); - StringBuilder failureMsg = new StringBuilder(); - for (BaseMonitorunitInfo baseMonitorunitInfo : baseMonitorunitInfos) { - try { - List baseMonitorunitInfoList = - baseMonitorunitInfoMapper.selectBaseMonitorunitInfoList(new BaseMonitorunitInfo(baseMonitorunitInfo.getMonitorunitId())); + /** + * 导入监控单元信息 + * + * @author WenJY + * @date 2022/2/7 9:53 + * @param baseMonitorunitInfos + * @param updateSupport + * @return java.lang.String + */ + @Override + public String importMould(List baseMonitorunitInfos, boolean updateSupport) { + if (StringUtils.isNull(baseMonitorunitInfos) || baseMonitorunitInfos.size() == 0) { + throw new BusinessException("导入标准数据不能为空!"); + } + int successNum = 0; + int failureNum = 0; + StringBuilder successMsg = new StringBuilder(); + StringBuilder failureMsg = new StringBuilder(); + for (BaseMonitorunitInfo baseMonitorunitInfo : baseMonitorunitInfos) { + try { + List baseMonitorunitInfoList = + baseMonitorunitInfoMapper.selectBaseMonitorunitInfoList( + new BaseMonitorunitInfo(baseMonitorunitInfo.getMonitorunitId())); - if (baseMonitorunitInfoList.size() == 0) { - baseMonitorunitInfo.setCreateBy(ShiroUtils.getLoginName()); - baseMonitorunitInfo.setCreateTime(new Date()); - baseMonitorunitInfoMapper.insertBaseMonitorunitInfo(baseMonitorunitInfo); - successNum++; - successMsg.append("
" + successNum + "、 " + baseMonitorunitInfo.getMonitorunitName() + " 导入成功"); - } else if (updateSupport) { - for (BaseMonitorunitInfo unitInfo : baseMonitorunitInfoList) { - baseMonitorunitInfo.setObjId(unitInfo.getObjId()); - baseMonitorunitInfo.setUpdateBy(ShiroUtils.getLoginName()); - baseMonitorunitInfo.setUpdateTime(new Date()); - baseMonitorunitInfoMapper.updateBaseMonitorunitInfo(baseMonitorunitInfo); - successNum++; - } - successMsg.append("
" + successNum + "、" + baseMonitorunitInfo.getMonitorunitName() + " 更新成功"); - } else { - failureNum++; - failureMsg.append("
" + failureNum + "、" + baseMonitorunitInfo.getMonitorunitId() + "、" + baseMonitorunitInfo.getMonitorunitName() + " 已存在"); - } - } catch (Exception e) { - failureNum++; - String msg = "
" + failureNum + "、标准: " + baseMonitorunitInfo.getMonitorunitId() + "、" + baseMonitorunitInfo.getMonitorunitName() + " 导入失败:"; - failureMsg.append(msg + e.getMessage()); - } - } - if (failureNum > 0) { - failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); - throw new BusinessException(failureMsg.toString()); + if (baseMonitorunitInfoList.size() == 0) { + baseMonitorunitInfo.setCreateBy(ShiroUtils.getLoginName()); + baseMonitorunitInfo.setCreateTime(new Date()); + baseMonitorunitInfoMapper.insertBaseMonitorunitInfo(baseMonitorunitInfo); + successNum++; + successMsg.append( + "
" + successNum + "、 " + baseMonitorunitInfo.getMonitorunitName() + " 导入成功"); + } else if (updateSupport) { + for (BaseMonitorunitInfo unitInfo : baseMonitorunitInfoList) { + baseMonitorunitInfo.setObjId(unitInfo.getObjId()); + baseMonitorunitInfo.setUpdateBy(ShiroUtils.getLoginName()); + baseMonitorunitInfo.setUpdateTime(new Date()); + baseMonitorunitInfoMapper.updateBaseMonitorunitInfo(baseMonitorunitInfo); + successNum++; + } + successMsg.append( + "
" + successNum + "、" + baseMonitorunitInfo.getMonitorunitName() + " 更新成功"); } else { - successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); + failureNum++; + failureMsg.append( + "
" + + failureNum + + "、" + + baseMonitorunitInfo.getMonitorunitId() + + "、" + + baseMonitorunitInfo.getMonitorunitName() + + " 已存在"); } - return successMsg.toString(); + } catch (Exception e) { + failureNum++; + String msg = + "
" + + failureNum + + "、标准: " + + baseMonitorunitInfo.getMonitorunitId() + + "、" + + baseMonitorunitInfo.getMonitorunitName() + + " 导入失败:"; + failureMsg.append(msg + e.getMessage()); + } } - - /** - * 新增监控单元信息 - * - * @param baseMonitorunitInfo 监控单元信息 - * @return 结果 - */ - @Override - public int insertBaseMonitorunitInfo(BaseMonitorunitInfo baseMonitorunitInfo) - { - baseMonitorunitInfo.setCreateTime(DateUtils.getNowDate()); - return baseMonitorunitInfoMapper.insertBaseMonitorunitInfo(baseMonitorunitInfo); + if (failureNum > 0) { + failureMsg.insert(0, "很抱歉,导入失败!共 " + failureNum + " 条数据格式不正确,错误如下:"); + throw new BusinessException(failureMsg.toString()); + } else { + successMsg.insert(0, "恭喜您,数据已全部导入成功!共 " + successNum + " 条,数据如下:"); } + return successMsg.toString(); + } - /** - * 修改监控单元信息 - * - * @param baseMonitorunitInfo 监控单元信息 - * @return 结果 - */ - @Override - public int updateBaseMonitorunitInfo(BaseMonitorunitInfo baseMonitorunitInfo) - { - baseMonitorunitInfo.setUpdateTime(DateUtils.getNowDate()); - return baseMonitorunitInfoMapper.updateBaseMonitorunitInfo(baseMonitorunitInfo); - } + /** + * 新增监控单元信息 + * + * @param baseMonitorunitInfo 监控单元信息 + * @return 结果 + */ + @Override + public int insertBaseMonitorunitInfo(BaseMonitorunitInfo baseMonitorunitInfo) { + baseMonitorunitInfo.setCreateTime(DateUtils.getNowDate()); + return baseMonitorunitInfoMapper.insertBaseMonitorunitInfo(baseMonitorunitInfo); + } - /** - * 批量删除监控单元信息 - * - * @param ObjIds 需要删除的监控单元信息主键 - * @return 结果 - */ - @Override - public int deleteBaseMonitorunitInfoByObjIds(String ObjIds) - { - return baseMonitorunitInfoMapper.deleteBaseMonitorunitInfoByObjIds(Convert.toStrArray(ObjIds)); - } + /** + * 修改监控单元信息 + * + * @param baseMonitorunitInfo 监控单元信息 + * @return 结果 + */ + @Override + public int updateBaseMonitorunitInfo(BaseMonitorunitInfo baseMonitorunitInfo) { + baseMonitorunitInfo.setUpdateTime(DateUtils.getNowDate()); + return baseMonitorunitInfoMapper.updateBaseMonitorunitInfo(baseMonitorunitInfo); + } - /** - * 删除监控单元信息信息 - * - * @param ObjId 监控单元信息主键 - * @return 结果 - */ - @Override - public int deleteBaseMonitorunitInfoByObjId(Long ObjId) - { - return baseMonitorunitInfoMapper.deleteBaseMonitorunitInfoByObjId(ObjId); - } + /** + * 批量删除监控单元信息 + * + * @param ObjIds 需要删除的监控单元信息主键 + * @return 结果 + */ + @Override + public int deleteBaseMonitorunitInfoByObjIds(String ObjIds) { + return baseMonitorunitInfoMapper.deleteBaseMonitorunitInfoByObjIds(Convert.toStrArray(ObjIds)); + } - /** - * 查询监控单元信息树列表 - * - * @return 所有监控单元信息信息 - */ - @Override - public List selectBaseMonitorunitInfoTree() - { - List baseMonitorunitInfoList = baseMonitorunitInfoMapper.selectBaseMonitorunitInfoList(new BaseMonitorunitInfo()); - List ztrees = new ArrayList(); - for (BaseMonitorunitInfo baseMonitorunitInfo : baseMonitorunitInfoList) - { - Ztree ztree = new Ztree(); - ztree.setId(baseMonitorunitInfo.getMonitorunitId()); - ztree.setpId(baseMonitorunitInfo.getParentId()); - ztree.setName(baseMonitorunitInfo.getMonitorunitName()); - ztree.setTitle(baseMonitorunitInfo.getMonitorunitName()); - ztrees.add(ztree); - } - return ztrees; + /** + * 删除监控单元信息信息 + * + * @param ObjId 监控单元信息主键 + * @return 结果 + */ + @Override + public int deleteBaseMonitorunitInfoByObjId(Long ObjId) { + return baseMonitorunitInfoMapper.deleteBaseMonitorunitInfoByObjId(ObjId); + } + + /** + * 查询监控单元信息树列表 + * + * @return 所有监控单元信息信息 + */ + @Override + public List selectBaseMonitorunitInfoTree() { + List baseMonitorunitInfoList = + baseMonitorunitInfoMapper.selectBaseMonitorunitInfoList(new BaseMonitorunitInfo()); + List ztrees = new ArrayList(); + for (BaseMonitorunitInfo baseMonitorunitInfo : baseMonitorunitInfoList) { + Ztree ztree = new Ztree(); + ztree.setId(baseMonitorunitInfo.getMonitorunitId()); + ztree.setpId(baseMonitorunitInfo.getParentId()); + ztree.setName(baseMonitorunitInfo.getMonitorunitName()); + ztree.setTitle(baseMonitorunitInfo.getMonitorunitName()); + ztrees.add(ztree); } + return ztrees; + } }