diff --git a/mh-admin/src/main/java/com/mh/web/controller/monitor/HotWaterMonitorController.java b/mh-admin/src/main/java/com/mh/web/controller/monitor/HotWaterMonitorController.java index 862cba6..ec5aab1 100644 --- a/mh-admin/src/main/java/com/mh/web/controller/monitor/HotWaterMonitorController.java +++ b/mh-admin/src/main/java/com/mh/web/controller/monitor/HotWaterMonitorController.java @@ -3,6 +3,7 @@ package com.mh.web.controller.monitor; import com.mh.common.core.controller.BaseController; import com.mh.common.core.domain.ColumnData; import com.mh.common.core.domain.ColumnFilter; +import com.mh.common.core.domain.dto.HotWaterControlDTO; import com.mh.common.core.domain.dto.HotWaterNowDataDTO; import com.mh.common.core.domain.dto.PumpInfoDTO; import com.mh.common.core.domain.entity.ChillersEntity; @@ -34,18 +35,42 @@ public class HotWaterMonitorController extends BaseController { this.iCollectionParamsManageService = iCollectionParamsManageService; } + /** + * 获取生活热水监控公共信息内容 + * @param systemType + * @param floorId + * @return + */ @GetMapping("/monitorPublic") public TableDataInfo monitorPublic(@RequestParam("systemType") String systemType, @RequestParam("floorId") String floorId) { List list = iCollectionParamsManageService.monitorPublic(systemType, floorId); return getDataTable(list); } + /** + * 获取生活热水监控公共信息列表 + * @param systemType + * @param floorId + * @return + */ @GetMapping("/monitorList") public TableDataInfo monitorList(@RequestParam("systemType") String systemType, @RequestParam("floorId") String floorId) { List list = iCollectionParamsManageService.monitorList(systemType, floorId); return getDataTable(list); } + /** + * 获取生活热水监控操作信息内容 + * @param systemType + * @param floorId + * @return + */ + @GetMapping("/operateList") + public TableDataInfo operateList(@RequestParam("systemType") String systemType, @RequestParam("floorId") String floorId) { + List list = iCollectionParamsManageService.operateList(systemType, floorId); + return getDataTable(list); + } + @GetMapping("/pumpListInfo") public TableDataInfo list(@RequestParam("registerAddr") String registerAddr, @RequestParam("mtType") String mtType) { diff --git a/mh-admin/src/main/java/com/mh/web/controller/monitor/IndoorTempMonitorController.java b/mh-admin/src/main/java/com/mh/web/controller/monitor/IndoorTempMonitorController.java index 4cdf497..81ebaf9 100644 --- a/mh-admin/src/main/java/com/mh/web/controller/monitor/IndoorTempMonitorController.java +++ b/mh-admin/src/main/java/com/mh/web/controller/monitor/IndoorTempMonitorController.java @@ -3,12 +3,17 @@ package com.mh.web.controller.monitor; import com.fasterxml.jackson.core.JsonProcessingException; import com.mh.common.core.controller.BaseController; import com.mh.common.core.domain.AjaxResult; +import com.mh.common.core.domain.dto.HouseGroupDTO; +import com.mh.common.core.page.TableDataInfo; import com.mh.system.service.device.IIndoorTempMonitorService; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; +import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; +import java.util.List; + /** * @author LJF * @version 1.0 @@ -30,9 +35,11 @@ public class IndoorTempMonitorController extends BaseController { /** * 根据楼层查询每一个房间的温度 */ - @GetMapping("/temp") - public AjaxResult getIndoorTempByFloor(String floorId) throws JsonProcessingException { - return AjaxResult.success(indoorTempMonitorService.getIndoorTempByFloor(floorId)); + @GetMapping("/tempList") + public TableDataInfo getIndoorTempByFloor(@RequestParam(value = "systemType") String systemType, + @RequestParam(value = "floorId") String floorId) throws JsonProcessingException { + List indoorTempByFloor = indoorTempMonitorService.getIndoorTempByFloor(systemType, floorId); + return getDataTable(indoorTempByFloor); } @GetMapping("/tempHis") diff --git a/mh-admin/src/main/java/com/mh/web/controller/space/SpaceController.java b/mh-admin/src/main/java/com/mh/web/controller/space/SpaceController.java index 85d1b04..fc05d71 100644 --- a/mh-admin/src/main/java/com/mh/web/controller/space/SpaceController.java +++ b/mh-admin/src/main/java/com/mh/web/controller/space/SpaceController.java @@ -25,8 +25,8 @@ public class SpaceController extends BaseController { } @GetMapping("/tree") - public AjaxResult tree() { - return AjaxResult.success(houseInfoService.buildTree()); + public AjaxResult tree(@RequestParam(value = "systemType", required = false) String systemType) { + return AjaxResult.success(houseInfoService.buildTree(systemType)); } } diff --git a/mh-common/src/main/java/com/mh/common/core/domain/dto/DeviceDTO.java b/mh-common/src/main/java/com/mh/common/core/domain/dto/DeviceDTO.java index 7d5aea8..dec1057 100644 --- a/mh-common/src/main/java/com/mh/common/core/domain/dto/DeviceDTO.java +++ b/mh-common/src/main/java/com/mh/common/core/domain/dto/DeviceDTO.java @@ -8,6 +8,9 @@ import java.util.Date; @JsonInclude(JsonInclude.Include.NON_NULL) class DeviceDTO { + + private String cpmId; + private int orderNum; private String otherName; private String curValue; /** diff --git a/mh-common/src/main/java/com/mh/common/core/domain/dto/HotWaterControlDTO.java b/mh-common/src/main/java/com/mh/common/core/domain/dto/HotWaterControlDTO.java new file mode 100644 index 0000000..57a61cf --- /dev/null +++ b/mh-common/src/main/java/com/mh/common/core/domain/dto/HotWaterControlDTO.java @@ -0,0 +1,38 @@ +package com.mh.common.core.domain.dto; + +import com.mh.common.core.domain.vo.HotWaterControlVO; +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import java.util.List; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 生活热水监控dto + * @date 2025-03-14 09:13:19 + */ +@Setter +@Getter +public class HotWaterControlDTO { + + private String id; + + private String name; + + private int orderNum; + + private List children; + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("id", id) + .append("name", name) + .append("orderNum", orderNum) + .append("children", children) + .toString(); + } +} diff --git a/mh-common/src/main/java/com/mh/common/core/domain/dto/TempHumidityDTO.java b/mh-common/src/main/java/com/mh/common/core/domain/dto/TempHumidityDTO.java index 18fc992..d7857e0 100644 --- a/mh-common/src/main/java/com/mh/common/core/domain/dto/TempHumidityDTO.java +++ b/mh-common/src/main/java/com/mh/common/core/domain/dto/TempHumidityDTO.java @@ -31,6 +31,16 @@ public class TempHumidityDTO { private Integer status; + private int orderNum; + + public int getOrderNum() { + return orderNum; + } + + public void setOrderNum(int orderNum) { + this.orderNum = orderNum; + } + public String getOtherName() { return otherName; } diff --git a/mh-common/src/main/java/com/mh/common/core/domain/entity/AreaInfo.java b/mh-common/src/main/java/com/mh/common/core/domain/entity/AreaInfo.java index 8fdddb7..6baac0b 100644 --- a/mh-common/src/main/java/com/mh/common/core/domain/entity/AreaInfo.java +++ b/mh-common/src/main/java/com/mh/common/core/domain/entity/AreaInfo.java @@ -48,6 +48,19 @@ public class AreaInfo extends BaseEntity { @JsonInclude(JsonInclude.Include.NON_EMPTY) private Map params; + /** + * 系统类型 + */ + private String systemType; + + public String getSystemType() { + return systemType; + } + + public void setSystemType(String systemType) { + this.systemType = systemType; + } + public String getId() { return id; } @@ -109,6 +122,7 @@ public class AreaInfo extends BaseEntity { .append("parentId", parentId) .append("searchValue", searchValue) .append("params", params) + .append("systemType", systemType) .toString(); } } diff --git a/mh-common/src/main/java/com/mh/common/core/domain/entity/CollectionParamsManage.java b/mh-common/src/main/java/com/mh/common/core/domain/entity/CollectionParamsManage.java index 32ef0e5..2b626c3 100644 --- a/mh-common/src/main/java/com/mh/common/core/domain/entity/CollectionParamsManage.java +++ b/mh-common/src/main/java/com/mh/common/core/domain/entity/CollectionParamsManage.java @@ -7,6 +7,8 @@ import com.baomidou.mybatisplus.annotation.TableName; import com.fasterxml.jackson.annotation.JsonFormat; import com.fasterxml.jackson.annotation.JsonIgnore; import com.mh.common.core.domain.BaseEntity; +import lombok.Getter; +import lombok.Setter; import org.apache.commons.lang3.builder.ToStringBuilder; import java.math.BigDecimal; @@ -20,6 +22,8 @@ import java.util.Map; * @description 数据采集参数配置管理 * @date 2025-01-13 15:23:40 */ +@Setter +@Getter @TableName("collection_params_manage") public class CollectionParamsManage extends BaseEntity { @@ -118,7 +122,7 @@ public class CollectionParamsManage extends BaseEntity { /** * 排序 */ - private Integer sort; + private Integer orderNum; /** * 网关id @@ -188,274 +192,6 @@ public class CollectionParamsManage extends BaseEntity { */ private String terminalDeviceType; - public String getTerminalDeviceType() { - return terminalDeviceType; - } - - public void setTerminalDeviceType(String terminalDeviceType) { - this.terminalDeviceType = terminalDeviceType; - } - - public String getCollectionType() { - return collectionType; - } - - public void setCollectionType(String collectionType) { - this.collectionType = collectionType; - } - - public String getParamType() { - return paramType; - } - - public void setParamType(String paramType) { - this.paramType = paramType; - } - - public String getSystemType() { - return systemType; - } - - public void setSystemType(String systemType) { - this.systemType = systemType; - } - - @Override - public Map getParams() { - return params; - } - - @Override - public void setParams(Map params) { - this.params = params; - } - - @Override - public String getSearchValue() { - return searchValue; - } - - @Override - public void setSearchValue(String searchValue) { - this.searchValue = searchValue; - } - - public Integer getGrade() { - return grade; - } - - public void setGrade(Integer grade) { - this.grade = grade; - } - - public String getOtherName() { - return otherName; - } - - public void setOtherName(String otherName) { - this.otherName = otherName; - } - - public String getId() { - return id; - } - - public void setId(String id) { - this.id = id; - } - - public String getDeviceLedgerId() { - return deviceLedgerId; - } - - public void setDeviceLedgerId(String deviceLedgerId) { - this.deviceLedgerId = deviceLedgerId; - } - - public String getMtType() { - return mtType; - } - - public void setMtType(String mtType) { - this.mtType = mtType; - } - - public String getMtNum() { - return mtNum; - } - - public void setMtNum(String mtNum) { - this.mtNum = mtNum; - } - - public String getMtCode() { - return mtCode; - } - - public void setMtCode(String mtCode) { - this.mtCode = mtCode; - } - - public String getRegisterAddr() { - return registerAddr; - } - - public void setRegisterAddr(String registerAddr) { - this.registerAddr = registerAddr; - } - - public String getFuncCode() { - return funcCode; - } - - public void setFuncCode(String funcCode) { - this.funcCode = funcCode; - } - - public String getIdentifyCode() { - return identifyCode; - } - - public void setIdentifyCode(String identifyCode) { - this.identifyCode = identifyCode; - } - - public String getMtCaliberPulse() { - return mtCaliberPulse; - } - - public void setMtCaliberPulse(String mtCaliberPulse) { - this.mtCaliberPulse = mtCaliberPulse; - } - - public BigDecimal getMtRange() { - return mtRange; - } - - public void setMtRange(BigDecimal mtRange) { - this.mtRange = mtRange; - } - - public Integer getMtRatio() { - return mtRatio; - } - - public void setMtRatio(Integer mtRatio) { - this.mtRatio = mtRatio; - } - - public BigDecimal getMtInitValue() { - return mtInitValue; - } - - public void setMtInitValue(BigDecimal mtInitValue) { - this.mtInitValue = mtInitValue; - } - - public Integer getDigits() { - return digits; - } - - public void setDigits(Integer digits) { - this.digits = digits; - } - - public Integer getDataType() { - return dataType; - } - - public void setDataType(Integer dataType) { - this.dataType = dataType; - } - - public BigDecimal getCurValue() { - return curValue; - } - - public void setCurValue(BigDecimal curValue) { - this.curValue = curValue; - } - - public Date getCurTime() { - return curTime; - } - - public void setCurTime(Date curTime) { - this.curTime = curTime; - } - - public Integer getMtIsSum() { - return mtIsSum; - } - - public void setMtIsSum(Integer mtIsSum) { - this.mtIsSum = mtIsSum; - } - - public String getUnit() { - return unit; - } - - public void setUnit(String unit) { - this.unit = unit; - } - - public Integer getSort() { - return sort; - } - - public void setSort(Integer sort) { - this.sort = sort; - } - - public String getGatewayId() { - return gatewayId; - } - - public void setGatewayId(String gatewayId) { - this.gatewayId = gatewayId; - } - - public String getCommunicationParamId() { - return communicationParamId; - } - - public void setCommunicationParamId(String communicationParamId) { - this.communicationParamId = communicationParamId; - } - - public String getProtocolType() { - return protocolType; - } - - public void setProtocolType(String protocolType) { - this.protocolType = protocolType; - } - - public String getCommunicationType() { - return communicationType; - } - - public void setCommunicationType(String communicationType) { - this.communicationType = communicationType; - } - - public Integer getRegisterSize() { - return registerSize; - } - - public void setRegisterSize(Integer registerSize) { - this.registerSize = registerSize; - } - - public Integer getIsUse() { - return isUse; - } - - public void setIsUse(Integer isUse) { - this.isUse = isUse; - } - @Override public String toString() { return new ToStringBuilder(this) @@ -477,7 +213,7 @@ public class CollectionParamsManage extends BaseEntity { .append("curTime", curTime) .append("mtIsSum", mtIsSum) .append("unit", unit) - .append("sort", sort) + .append("orderNum", orderNum) .append("gatewayId", gatewayId) .append("communicationParamId", communicationParamId) .append("protocolType", protocolType) diff --git a/mh-common/src/main/java/com/mh/common/core/domain/vo/HotWaterControlListVO.java b/mh-common/src/main/java/com/mh/common/core/domain/vo/HotWaterControlListVO.java new file mode 100644 index 0000000..08d8286 --- /dev/null +++ b/mh-common/src/main/java/com/mh/common/core/domain/vo/HotWaterControlListVO.java @@ -0,0 +1,63 @@ +package com.mh.common.core.domain.vo; + +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 生活热水监控需要的列表信息 + * @date 2025-03-14 09:07:46 + */ +@Setter +@Getter +public class HotWaterControlListVO { + + private String cpmId; + + private String houseId; + + private String houseName; + + private String dlId; + + private String deviceName; + + private BigDecimal curValue; + + private Date curTime; + + private String paramType; + + private String otherName; + + private int hiOrderNum; + + private int dlOrderNum; + + private int cpmOrderNum; + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("cpmId", cpmId) + .append("houseId", houseId) + .append("houseName", houseName) + .append("dlId", dlId) + .append("deviceName", deviceName) + .append("curValue", curValue) + .append("curTime", curTime) + .append("paramType", paramType) + .append("otherName", otherName) + .append("hiOrderNum", hiOrderNum) + .append("dlOrderNum", dlOrderNum) + .append("cpmOrderNum", cpmOrderNum) + .toString(); + } + +} diff --git a/mh-common/src/main/java/com/mh/common/core/domain/vo/HotWaterControlVO.java b/mh-common/src/main/java/com/mh/common/core/domain/vo/HotWaterControlVO.java new file mode 100644 index 0000000..bd09b99 --- /dev/null +++ b/mh-common/src/main/java/com/mh/common/core/domain/vo/HotWaterControlVO.java @@ -0,0 +1,70 @@ +package com.mh.common.core.domain.vo; + +import com.fasterxml.jackson.annotation.JsonFormat; +import lombok.Getter; +import lombok.Setter; +import org.apache.commons.lang3.builder.ToStringBuilder; + +import java.math.BigDecimal; +import java.util.Date; + +/** + * @author LJF + * @version 1.0 + * @project EEMCS + * @description 生活热水系统控制界面VO + * @date 2025-03-14 09:00:37 + */ +@Setter +@Getter +public class HotWaterControlVO { + + private String id; + + private String name; + + private String alarmStatus; + + private String switchStatus; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") + private BigDecimal temp; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") + private BigDecimal tempSet; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") + private BigDecimal frequency; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0") + private BigDecimal frequencySet; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0.0") + private BigDecimal waterLevel; + + @JsonFormat(shape = JsonFormat.Shape.STRING, pattern = "0.0") + private BigDecimal waterLevelSet; + + @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") + private Date curTime; + + private int orderNum; + + @Override + public String toString() { + return new ToStringBuilder(this) + .append("id", id) + .append("name", name) + .append("alarmStatus", alarmStatus) + .append("switchStatus", switchStatus) + .append("temp", temp) + .append("tempSet", tempSet) + .append("frequency", frequency) + .append("frequencySet", frequencySet) + .append("waterLevel", waterLevel) + .append("waterLevelSet", waterLevelSet) + .append("curTime", curTime) + .append("orderNum", orderNum) + .toString(); + } +} diff --git a/mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java b/mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java index 9347582..4c55624 100644 --- a/mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java +++ b/mh-system/src/main/java/com/mh/system/mapper/device/CollectionParamsManageMapper.java @@ -5,6 +5,7 @@ import com.mh.common.core.domain.dto.TempHumidityDTO; import com.mh.common.core.domain.entity.CollectionParamsManage; import com.mh.common.core.domain.vo.CollectionParamsManageVO; import com.mh.common.core.domain.vo.DeviceMonitorVO; +import com.mh.common.core.domain.vo.HotWaterControlListVO; import org.apache.ibatis.annotations.*; import java.util.List; @@ -114,21 +115,24 @@ public interface CollectionParamsManageMapper extends BaseMapper selectByParamType(@Param("floorId") String floorId, + " and cpm.param_type = #{paramType}" + + " and cpm.system_type = #{systemType} ") + List selectByParamType(@Param("systemType") String systemType, + @Param("floorId") String floorId, @Param("paramType") String paramType); @Select("select " + @@ -214,4 +218,39 @@ public interface CollectionParamsManageMapper extends BaseMapper selectHotWaterBySystemTypeAndBuildingIdAndDeviceType(@Param("systemType") String systemType, @Param("floorId") String floorId, @Param("deviceType") String deviceType); + + /** + * 查询热s热水控制列表 + * @param systemType + * @param floorId + * @return + */ + @Select("select " + + " cpm.id as cpm_id, " + + " hi.id as house_id, " + + " hi.house_name, " + + " dl.device_name, " + + " dl.id as dl_id, " + + " cpm.cur_value, " + + " cpm.cur_time, " + + " cpm.param_type, " + + " cpm.other_name, " + + " hi.order_num as hi_order_num, " + + " dl.order_num as dl_order_num, " + + " cpm.order_num as cpm_order_num " + + "from " + + " collection_params_manage cpm " + + "left join device_ledger dl on " + + " cpm.device_ledger_id = dl.id " + + "left join cpm_space_relation csr on " + + " cpm.id = csr.cpm_id " + + "left join house_info hi on " + + " csr.house_id = hi.id " + + "where " + + " (dl.device_type = '10' or dl.device_type = '11' or dl.device_type = '12' ) " + + " and csr.floor_id = #{floorId} " + + " and cpm.system_type = #{systemType} " + + " order by dl.order_num ") + List selectHotWaterBySystemTypeAndBuildingId(@Param("systemType") String systemType, + @Param("floorId") String floorId); } diff --git a/mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java b/mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java index 3ba2336..206f864 100644 --- a/mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java +++ b/mh-system/src/main/java/com/mh/system/service/device/ICollectionParamsManageService.java @@ -2,6 +2,7 @@ package com.mh.system.service.device; import com.mh.common.core.domain.ColumnFilter; import com.mh.common.core.domain.dto.DeviceMonitorDTO; +import com.mh.common.core.domain.dto.HotWaterControlDTO; import com.mh.common.core.domain.dto.HotWaterNowDataDTO; import com.mh.common.core.domain.dto.PumpInfoDTO; import com.mh.common.core.domain.entity.ChillersEntity; @@ -59,4 +60,12 @@ public interface ICollectionParamsManageService { * @return */ List monitorList(String systemType, String floorId); + + /** + * 获取生活热水系统设备操作信息列表 + * @param systemType + * @param floorId + * @return + */ + List operateList(String systemType, String floorId); } diff --git a/mh-system/src/main/java/com/mh/system/service/device/IIndoorTempMonitorService.java b/mh-system/src/main/java/com/mh/system/service/device/IIndoorTempMonitorService.java index 7525ed8..12eb681 100644 --- a/mh-system/src/main/java/com/mh/system/service/device/IIndoorTempMonitorService.java +++ b/mh-system/src/main/java/com/mh/system/service/device/IIndoorTempMonitorService.java @@ -16,7 +16,7 @@ import java.util.List; */ public interface IIndoorTempMonitorService { - List getIndoorTempByFloor(String floorId) throws JsonProcessingException; + List getIndoorTempByFloor(String systemType, String floorId) throws JsonProcessingException; List getIndoorTempHisByHouseId(String houseId); } diff --git a/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java index 2083d5f..2e275d7 100644 --- a/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/device/impl/CollectionParamsManageServiceImpl.java @@ -3,14 +3,13 @@ package com.mh.system.service.device.impl; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.mh.common.core.domain.ColumnFilter; import com.mh.common.core.domain.dto.DeviceMonitorDTO; +import com.mh.common.core.domain.dto.HotWaterControlDTO; import com.mh.common.core.domain.dto.HotWaterNowDataDTO; import com.mh.common.core.domain.dto.PumpInfoDTO; import com.mh.common.core.domain.entity.ChillersEntity; import com.mh.common.core.domain.entity.CollectionParamsManage; import com.mh.common.core.domain.entity.DeviceLedger; -import com.mh.common.core.domain.vo.CollectionParamsManageVO; -import com.mh.common.core.domain.vo.DeviceMonitorVO; -import com.mh.common.core.domain.vo.DeviceOperateMonitorVO; +import com.mh.common.core.domain.vo.*; import com.mh.common.utils.DateUtils; import com.mh.common.utils.StringUtils; import com.mh.system.mapper.device.CollectionParamsManageMapper; @@ -364,7 +363,7 @@ public class CollectionParamsManageServiceImpl implements ICollectionParamsManag dto.setCurDate(DateUtils.parseDateToStr("yyyy-MM-dd HH:mm:ss", vo.getCollectTime())); dto.setOrderNum(vo.getOrderNum()); - switch(vo.getParamType()) { + switch (vo.getParamType()) { case "2": // 运行状态 dto.setRunState(vo.getCollectValue()); break; @@ -434,4 +433,77 @@ public class CollectionParamsManageServiceImpl implements ICollectionParamsManag .sorted(Comparator.comparingInt(HotWaterNowDataDTO::getOrderNum)) .collect(Collectors.toList()); } + + @Override + public List operateList(String systemType, String floorId) { + List hotWaterControlListVOS = collectionParamsManageMapper.selectHotWaterBySystemTypeAndBuildingId(systemType, floorId); + if (hotWaterControlListVOS.isEmpty()) { + return List.of(); + } + + return hotWaterControlListVOS.stream() + .peek(vo -> System.out.println(vo.getHiOrderNum())) + .collect(Collectors.groupingBy(HotWaterControlListVO::getHouseId)) + .entrySet().stream() + .map(houseEntry -> { + HotWaterControlDTO dto = new HotWaterControlDTO(); + dto.setId(houseEntry.getKey()); + dto.setName(houseEntry.getValue().getFirst().getHouseName()); + dto.setOrderNum(houseEntry.getValue().getFirst().getHiOrderNum()); + + List children = houseEntry.getValue().stream() + .collect(Collectors.groupingBy(HotWaterControlListVO::getDlId)) + .entrySet().stream() + .map(dlEntry -> { + HotWaterControlVO vo = new HotWaterControlVO(); + List dlItems = dlEntry.getValue(); + vo.setId(dlEntry.getKey()); + vo.setName(dlItems.getFirst().getDeviceName()); + vo.setOrderNum(dlItems.getFirst().getDlOrderNum()); + + dlItems.forEach(item -> { + switch (item.getParamType()) { + case "2": + vo.setSwitchStatus(String.valueOf(item.getCurValue())); + break; + case "5": + vo.setAlarmStatus(String.valueOf(item.getCurValue())); + break; + case "14": + vo.setTempSet(item.getCurValue()); + break; + case "12": + vo.setTemp(item.getCurValue()); + break; + case "4": + vo.setFrequency(item.getCurValue()); + break; + case "3": + vo.setFrequencySet(item.getCurValue()); + break; + case "11": + vo.setWaterLevel(item.getCurValue()); + vo.setCurTime(item.getCurTime()); + break; + case "10": + vo.setWaterLevelSet(item.getCurValue()); + break; + default: + // 处理未识别的paramType或忽略 + break; + } + }); + return vo; + }) + .sorted(Comparator.comparingInt(HotWaterControlVO::getOrderNum)) + .collect(Collectors.toList()); + + dto.setChildren(children); + return dto; + }) + // 添加排序操作 + .sorted(Comparator.comparingInt(HotWaterControlDTO::getOrderNum)) + .collect(Collectors.toList()); + } + } diff --git a/mh-system/src/main/java/com/mh/system/service/device/impl/IndoorTempMonitorServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/device/impl/IndoorTempMonitorServiceImpl.java index bf3d398..f220e82 100644 --- a/mh-system/src/main/java/com/mh/system/service/device/impl/IndoorTempMonitorServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/device/impl/IndoorTempMonitorServiceImpl.java @@ -38,9 +38,9 @@ public class IndoorTempMonitorServiceImpl implements IIndoorTempMonitorService { private DataProcessMapper dataProcessMapper; @Override - public List getIndoorTempByFloor(String floorId) throws JsonProcessingException { + public List getIndoorTempByFloor(String systemType, String floorId) throws JsonProcessingException { // 查询采集类型是温度的参数,采集参数是99 - List collectionParamsManages = collectionParamsManageMapper.selectByParamType(floorId,"99"); + List collectionParamsManages = collectionParamsManageMapper.selectByParamType(systemType, floorId, "12"); return convert(collectionParamsManages); } diff --git a/mh-system/src/main/java/com/mh/system/service/operation/impl/OperationDeviceServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/operation/impl/OperationDeviceServiceImpl.java index 4e52b46..513d70f 100644 --- a/mh-system/src/main/java/com/mh/system/service/operation/impl/OperationDeviceServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/operation/impl/OperationDeviceServiceImpl.java @@ -2,11 +2,15 @@ package com.mh.system.service.operation.impl; import com.alibaba.fastjson2.JSONObject; import com.mh.common.constant.Constants; +import com.mh.common.core.domain.entity.CollectionParamsManage; import com.mh.common.core.domain.entity.OrderEntity; import com.mh.common.model.request.AdvantechDatas; import com.mh.common.model.response.AdvantechResponse; import com.mh.common.utils.DateUtils; +import com.mh.common.utils.StringUtils; +import com.mh.system.mapper.device.CollectionParamsManageMapper; import com.mh.system.service.operation.IOperationDeviceService; +import jakarta.annotation.Resource; import lombok.extern.slf4j.Slf4j; import org.springframework.stereotype.Service; @@ -24,12 +28,18 @@ import java.util.List; @Service public class OperationDeviceServiceImpl implements IOperationDeviceService { + @Resource + private CollectionParamsManageMapper collectionParamsManageMapper; + @Override public String operationDevice(List changeValues) { // 拼接发送的报文 AdvantechResponse sendData = new AdvantechResponse<>(); try { List advantechDatas = getAdvantechDatas(changeValues); + if (null == advantechDatas) { + return Constants.FAIL; + } sendData.setW(advantechDatas); sendData.setTs(DateUtils.dateToTsStr()); } catch (Exception e) { @@ -39,7 +49,7 @@ public class OperationDeviceServiceImpl implements IOperationDeviceService { return JSONObject.toJSONString(sendData); } - private static List getAdvantechDatas(List changeValues) { + public List getAdvantechDatas(List changeValues) { List advantechDatas = new ArrayList<>(); for (OrderEntity changeValue : changeValues) { // 获取报文 @@ -48,6 +58,15 @@ public class OperationDeviceServiceImpl implements IOperationDeviceService { Integer type = changeValue.getType(); // 获取报文其他信息 String otherName = changeValue.getOtherName(); + if (StringUtils.isEmpty(otherName)) { + // 从数据库id获取设备名称 + CollectionParamsManage collectionParamsManage = collectionParamsManageMapper.selectById(changeValue.getId()); + if (null != collectionParamsManage) { + otherName = collectionParamsManage.getOtherName(); + } else { + return null; + } + } // 发送报文 AdvantechDatas data = new AdvantechDatas(); data.setTag(otherName); diff --git a/mh-system/src/main/java/com/mh/system/service/space/IHouseInfoService.java b/mh-system/src/main/java/com/mh/system/service/space/IHouseInfoService.java index da8eef5..ec37a29 100644 --- a/mh-system/src/main/java/com/mh/system/service/space/IHouseInfoService.java +++ b/mh-system/src/main/java/com/mh/system/service/space/IHouseInfoService.java @@ -24,6 +24,6 @@ public interface IHouseInfoService { int deleteHouseInfoByIds(String[] buildingIds); - List buildTree(); + List buildTree(String systemType); } diff --git a/mh-system/src/main/java/com/mh/system/service/space/impl/AreaInfoServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/space/impl/AreaInfoServiceImpl.java index 07c5d9e..a6aea6e 100644 --- a/mh-system/src/main/java/com/mh/system/service/space/impl/AreaInfoServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/space/impl/AreaInfoServiceImpl.java @@ -38,6 +38,10 @@ public class AreaInfoServiceImpl implements IAreaInfoService { if (!StringUtils.isEmpty(areaInfo.getRemark())) { queryWrapper.like("remark", areaInfo.getRemark()); } + // 系统各类型 + if (!StringUtils.isEmpty(areaInfo.getSystemType())) { + queryWrapper.eq("system_type", areaInfo.getSystemType()); + } queryWrapper.orderByAsc("order_num"); return areaInfoMapper.selectList(queryWrapper); } diff --git a/mh-system/src/main/java/com/mh/system/service/space/impl/FloorInfoServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/space/impl/FloorInfoServiceImpl.java index ca447ac..8311f64 100644 --- a/mh-system/src/main/java/com/mh/system/service/space/impl/FloorInfoServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/space/impl/FloorInfoServiceImpl.java @@ -77,7 +77,7 @@ public class FloorInfoServiceImpl implements IFloorInfoService { private void getAreaId(FloorInfo floorInfo) { if(StringUtils.isEmpty(floorInfo.getAreaId())) { // 获取完整的空间树结构 - List spaceTree = houseInfoService.buildTree(); + List spaceTree = houseInfoService.buildTree(null); // 递归查找目标楼栋节点 SpaceTreeSelect buildingNode = findBuildingNode(spaceTree, floorInfo.getBuildingId()); diff --git a/mh-system/src/main/java/com/mh/system/service/space/impl/HouseInfoServiceImpl.java b/mh-system/src/main/java/com/mh/system/service/space/impl/HouseInfoServiceImpl.java index e61a1d6..10b9c1b 100644 --- a/mh-system/src/main/java/com/mh/system/service/space/impl/HouseInfoServiceImpl.java +++ b/mh-system/src/main/java/com/mh/system/service/space/impl/HouseInfoServiceImpl.java @@ -111,7 +111,7 @@ public class HouseInfoServiceImpl implements IHouseInfoService { private void getAreaIdAndBuildingId(HouseInfo houseInfo) { if(StringUtils.isEmpty(houseInfo.getBuildingId())) { // 获取完整的空间树结构 - List spaceTree = buildTree(); + List spaceTree = buildTree(null); // 递归查找目标楼栋节点 SpaceTreeSelect buildNode = findNode(spaceTree, houseInfo.getFloorId(), 3); @@ -124,7 +124,7 @@ public class HouseInfoServiceImpl implements IHouseInfoService { } if(StringUtils.isEmpty(houseInfo.getAreaId())) { // 获取完整的空间树结构 - List spaceTree = buildTree(); + List spaceTree = buildTree(null); // 递归查找目标楼栋节点 SpaceTreeSelect areaNode = findNode(spaceTree, houseInfo.getBuildingId(), 2); @@ -152,8 +152,13 @@ public class HouseInfoServiceImpl implements IHouseInfoService { } @Override - public List buildTree() { - List areaInfos = areaInfoMapper.selectList(new QueryWrapper().orderByAsc("order_num")); + public List buildTree(String systemType) { + QueryWrapper areaInfoQueryWrapper = new QueryWrapper<>(); + if (!StringUtils.isEmpty(systemType)) { + areaInfoQueryWrapper.eq("system_type", systemType); + } + areaInfoQueryWrapper.orderByAsc("order_num"); + List areaInfos = areaInfoMapper.selectList(areaInfoQueryWrapper); if (areaInfos != null && !areaInfos.isEmpty()) { List buildingInfos = buildingInfoMapper.selectList(new QueryWrapper().orderByAsc("order_num")); List floorInfos = floorInfoMapper.selectList(new QueryWrapper().orderByAsc("order_num"));