36 changed files with 2477 additions and 32 deletions
@ -0,0 +1,109 @@
|
||||
package com.mh.web.controller.energy; |
||||
|
||||
import com.mh.common.core.controller.BaseController; |
||||
import com.mh.common.core.domain.entity.WaterLevel; |
||||
import com.mh.common.core.domain.entity.WaterTemp; |
||||
import com.mh.common.core.page.TableDataInfo; |
||||
import com.mh.system.service.energy.IEnergyQueryService; |
||||
import org.springframework.beans.factory.annotation.Autowired; |
||||
import org.springframework.web.bind.annotation.*; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 生活热水能耗分析 |
||||
* @date 2025-06-18 17:49:49 |
||||
*/ |
||||
@RestController |
||||
@RequestMapping("/hot_energy") |
||||
public class HotWaterEnergyController extends BaseController { |
||||
|
||||
private final IEnergyQueryService energyQueryService; |
||||
|
||||
public HotWaterEnergyController(IEnergyQueryService iEnergyQueryService) { |
||||
this.energyQueryService = iEnergyQueryService; |
||||
} |
||||
|
||||
@GetMapping("/query") |
||||
public TableDataInfo queryEnergy(@RequestParam(value = "buildingId", required = false) String buildingId, |
||||
@RequestParam(value = "startDate", required = false) String startDate, |
||||
@RequestParam(value = "endDate", required = false) String endDate, |
||||
@RequestParam(value = "type") int type) { |
||||
startPage(); |
||||
List<?> result = energyQueryService.queryEnergyDataList(buildingId, startDate, endDate, type); |
||||
return getDataTable(result); |
||||
} |
||||
|
||||
//查询日月年用量汇总
|
||||
@GetMapping(value = "/energySum") |
||||
public TableDataInfo queryEnergySum(@RequestParam(value = "buildingId", required = false) String buildingId, |
||||
@RequestParam(value = "curDate", required = false) String curDate, |
||||
@RequestParam(value = "type", required = true) Integer type) { |
||||
startPage(); |
||||
List<?> result = energyQueryService.queryEnergyDataSumList(buildingId, curDate, type); |
||||
return getDataTable(result); |
||||
} |
||||
|
||||
/** |
||||
* 温度变化表 |
||||
* |
||||
* @param buildingId |
||||
* @param curDate |
||||
* @return |
||||
*/ |
||||
@GetMapping("/waterTemp") |
||||
public TableDataInfo queryWaterTemp(@RequestParam(value = "buildingId", required = false) String buildingId, |
||||
@RequestParam(value = "curDate", required = false) String curDate) { |
||||
startPage(); |
||||
List<WaterTemp> result = energyQueryService.queryWaterTemp(buildingId, curDate); |
||||
return getDataTable(result); |
||||
} |
||||
|
||||
/** |
||||
* 水位变化表 |
||||
* |
||||
* @param buildingId |
||||
* @param curDate |
||||
* @return |
||||
*/ |
||||
@GetMapping("/waterLevel") |
||||
public TableDataInfo queryWaterLevel(@RequestParam(value = "buildingId", required = false) String buildingId, |
||||
@RequestParam(value = "curDate", required = false) String curDate) { |
||||
startPage(); |
||||
List<WaterLevel> result = energyQueryService.queryWaterLevel(buildingId, curDate); |
||||
return getDataTable(result); |
||||
} |
||||
|
||||
@GetMapping("/queryDeviceDatas") |
||||
public TableDataInfo queryDeviceDatas(@RequestParam(value = "buildingId", required = false) String buildingId, |
||||
@RequestParam(value = "startDate", required = false) String startDate, |
||||
@RequestParam(value = "endDate", required = false) String endDate, |
||||
@RequestParam(value = "deviceType", required = false) String deviceType) { |
||||
startPage(); |
||||
List<?> result = energyQueryService.queryDeviceDatas(buildingId, startDate, endDate, deviceType); |
||||
return getDataTable(result); |
||||
} |
||||
|
||||
@GetMapping("/analysis/queryYear") //type=1(水),2(电),3(能耗),4(维保)
|
||||
public TableDataInfo queryAnalysisYear(@RequestParam(value = "curDate",required = true) String curDate, |
||||
@RequestParam(value = "buildingId",required = true) String buildingId, |
||||
@RequestParam(value = "type",defaultValue = "3") int type) { |
||||
startPage(); |
||||
List<?> result = energyQueryService.queryAnalysisYear(curDate, buildingId, type); |
||||
return getDataTable(result); |
||||
|
||||
} |
||||
|
||||
@GetMapping("/analysis/queryMonth") //type=1(水),2(电),3(能耗),4(维保),5(使用时间)
|
||||
public TableDataInfo queryAnalysisMonth(@RequestParam(value = "curDate",required = true) String curDate, |
||||
@RequestParam(value = "buildingId",required = true) String buildingId, |
||||
@RequestParam(value = "type",defaultValue = "3") int type) { |
||||
startPage(); |
||||
List<?> result = energyQueryService.queryAnalysisMonth(curDate, buildingId, type); |
||||
return getDataTable(result); |
||||
} |
||||
|
||||
} |
@ -0,0 +1,25 @@
|
||||
package com.mh.common.constant; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description |
||||
* @date 2025-06-18 16:32:56 |
||||
*/ |
||||
public enum EnergyType { |
||||
HOUR("hour"), |
||||
DAY("day"), |
||||
MONTH("month"), |
||||
YEAR("year"); |
||||
|
||||
private final String code; |
||||
|
||||
EnergyType(String code) { |
||||
this.code = code; |
||||
} |
||||
|
||||
public String getCode() { |
||||
return code; |
||||
} |
||||
} |
@ -0,0 +1,68 @@
|
||||
package com.mh.common.core.domain.dto; |
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Data; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
|
||||
@Data |
||||
public class DataResultDTO { |
||||
|
||||
private Long id; |
||||
|
||||
private String buildingId; |
||||
|
||||
private String buildingName; |
||||
|
||||
private String deviceNum; |
||||
|
||||
private String deviceName; |
||||
|
||||
private String deviceCode; |
||||
|
||||
private String deviceType; |
||||
|
||||
private BigDecimal lastValue; |
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date lastTime; |
||||
|
||||
private double curValue; |
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date curTime; |
||||
|
||||
private BigDecimal usedValue; |
||||
|
||||
private int ratio; |
||||
|
||||
private BigDecimal calcValue; |
||||
|
||||
private int grade; |
||||
|
||||
private String registerAddr; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this) |
||||
.append("id", id) |
||||
.append("buildingId", buildingId) |
||||
.append("buildingName", buildingName) |
||||
.append("deviceNum", deviceNum) |
||||
.append("deviceName", deviceName) |
||||
.append("deviceCode", deviceCode) |
||||
.append("deviceType", deviceType) |
||||
.append("lastValue", lastValue) |
||||
.append("lastTime", lastTime) |
||||
.append("curValue", curValue) |
||||
.append("curTime", curTime) |
||||
.append("usedValue", usedValue) |
||||
.append("ratio", ratio) |
||||
.append("calcValue", calcValue) |
||||
.append("grade", grade) |
||||
.append("registerAddr", registerAddr) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,46 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class AnalysisMonth { |
||||
|
||||
private Long id; |
||||
private String curDate; |
||||
private String itemType; |
||||
private String day01; |
||||
private String day02; |
||||
private String day03; |
||||
private String day04; |
||||
private String day05; |
||||
private String day06; |
||||
private String day07; |
||||
private String day08; |
||||
private String day09; |
||||
private String day10; |
||||
private String day11; |
||||
private String day12; |
||||
private String day13; |
||||
private String day14; |
||||
private String day15; |
||||
private String day16; |
||||
private String day17; |
||||
private String day18; |
||||
private String day19; |
||||
private String day20; |
||||
private String day21; |
||||
private String day22; |
||||
private String day23; |
||||
private String day24; |
||||
private String day25; |
||||
private String day26; |
||||
private String day27; |
||||
private String day28; |
||||
private String day29; |
||||
private String day30; |
||||
private String day31; |
||||
private String day32; |
||||
private String totalValue; |
||||
private String buildingId; |
||||
private String buildingName; |
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import lombok.Data; |
||||
|
||||
@Data |
||||
public class AnalysisYear { |
||||
|
||||
private Long id; |
||||
private String curDate; |
||||
private String itemType; |
||||
private String month01; |
||||
private String month02; |
||||
private String month03; |
||||
private String month04; |
||||
private String month05; |
||||
private String month06; |
||||
private String month07; |
||||
private String month08; |
||||
private String month09; |
||||
private String month10; |
||||
private String month11; |
||||
private String month12; |
||||
private String totalValue; |
||||
private String buildingId; |
||||
private String buildingName; |
||||
|
||||
} |
@ -0,0 +1,89 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水时间能耗实体类 |
||||
* @date 2025-06-18 14:28:30 |
||||
*/ |
||||
@Data |
||||
@TableName("energy_day") |
||||
public class EnergyDay { |
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||
private String id; |
||||
|
||||
/** |
||||
* 时间 |
||||
*/ |
||||
private String curDate; |
||||
|
||||
/** |
||||
* 建筑id |
||||
*/ |
||||
private String buildingId; |
||||
|
||||
/** |
||||
* 产热量 |
||||
*/ |
||||
private BigDecimal hotWaterValue; |
||||
|
||||
/** |
||||
* 使用用量 |
||||
*/ |
||||
private BigDecimal useHotWater; |
||||
|
||||
/** |
||||
* 用电量 |
||||
*/ |
||||
private BigDecimal electValue; |
||||
|
||||
/** |
||||
* 单耗 |
||||
*/ |
||||
private BigDecimal electWater; |
||||
|
||||
/** |
||||
* 入住人数 |
||||
*/ |
||||
private int checkInCount; |
||||
|
||||
/** |
||||
* 人均用电 |
||||
*/ |
||||
private BigDecimal perElect; |
||||
|
||||
/** |
||||
* 人均用水 |
||||
*/ |
||||
private BigDecimal perWater; |
||||
|
||||
/** |
||||
* 更新标志 |
||||
*/ |
||||
private String updateFlag; |
||||
|
||||
/** |
||||
* 建筑名称 |
||||
*/ |
||||
private String buildingName; |
||||
|
||||
/** |
||||
* 当前电表读数 |
||||
*/ |
||||
private BigDecimal electCurValue; |
||||
|
||||
/** |
||||
* 当前水表读数 |
||||
*/ |
||||
private BigDecimal wtCurValue; |
||||
|
||||
} |
@ -0,0 +1,74 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水时间能耗实体类 |
||||
* @date 2025-06-18 14:28:30 |
||||
*/ |
||||
@Data |
||||
@TableName("energy_day_sum") |
||||
public class EnergyDaySum { |
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||
private String id; |
||||
|
||||
/** |
||||
* 时间 |
||||
*/ |
||||
private String curDate; |
||||
|
||||
/** |
||||
* 建筑id |
||||
*/ |
||||
private String buildingId; |
||||
|
||||
/** |
||||
* 补水 |
||||
*/ |
||||
private BigDecimal fillWater; |
||||
|
||||
/** |
||||
* 补水与昨日比 |
||||
*/ |
||||
private String fillWaterP; |
||||
|
||||
/** |
||||
* 用水 |
||||
*/ |
||||
private BigDecimal waterValue; |
||||
|
||||
/** |
||||
* 用水与昨日比 |
||||
*/ |
||||
private String waterP; |
||||
|
||||
/** |
||||
* 用电量 |
||||
*/ |
||||
private BigDecimal electValue; |
||||
|
||||
/** |
||||
* 用电与昨日比 |
||||
*/ |
||||
private String electP; |
||||
|
||||
/** |
||||
* 单耗 |
||||
*/ |
||||
private BigDecimal electWater; |
||||
|
||||
/** |
||||
* 单耗与昨日比 |
||||
*/ |
||||
private String electWaterP; |
||||
|
||||
} |
@ -0,0 +1,220 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水时间能耗实体类 |
||||
* @date 2025-06-18 14:28:30 |
||||
*/ |
||||
@TableName("energy_hour") |
||||
public class EnergyHour { |
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||
private String id; |
||||
|
||||
/** |
||||
* 时间 |
||||
*/ |
||||
private String curDate; |
||||
|
||||
/** |
||||
* 建筑id |
||||
*/ |
||||
private String buildingId; |
||||
|
||||
/** |
||||
* 产热量 |
||||
*/ |
||||
private BigDecimal hotWaterValue; |
||||
|
||||
/** |
||||
* 使用用量 |
||||
*/ |
||||
private BigDecimal useHotWater; |
||||
|
||||
/** |
||||
* 用电量 |
||||
*/ |
||||
private BigDecimal electValue; |
||||
|
||||
/** |
||||
* 单耗 |
||||
*/ |
||||
private BigDecimal electWater; |
||||
|
||||
/** |
||||
* 入住人数 |
||||
*/ |
||||
private int checkInCount; |
||||
|
||||
/** |
||||
* 人均用电 |
||||
*/ |
||||
private BigDecimal perElect; |
||||
|
||||
/** |
||||
* 人均用水 |
||||
*/ |
||||
private BigDecimal perWater; |
||||
|
||||
/** |
||||
* 更新标志 |
||||
*/ |
||||
private String updateFlag; |
||||
|
||||
/** |
||||
* 建筑名称 |
||||
*/ |
||||
private String buildingName; |
||||
|
||||
/** |
||||
* 当前电表读数 |
||||
*/ |
||||
private BigDecimal electCurValue; |
||||
|
||||
/** |
||||
* 当前水表读数 |
||||
*/ |
||||
private BigDecimal wtCurValue; |
||||
|
||||
public String getId() { |
||||
return id; |
||||
} |
||||
|
||||
public void setId(String id) { |
||||
this.id = id; |
||||
} |
||||
|
||||
public String getCurDate() { |
||||
return curDate; |
||||
} |
||||
|
||||
public void setCurDate(String curDate) { |
||||
this.curDate = curDate; |
||||
} |
||||
|
||||
public String getBuildingId() { |
||||
return buildingId; |
||||
} |
||||
|
||||
public void setBuildingId(String buildingId) { |
||||
this.buildingId = buildingId; |
||||
} |
||||
|
||||
public BigDecimal getHotWaterValue() { |
||||
return hotWaterValue; |
||||
} |
||||
|
||||
public void setHotWaterValue(BigDecimal hotWaterValue) { |
||||
this.hotWaterValue = hotWaterValue; |
||||
} |
||||
|
||||
public BigDecimal getUseHotWater() { |
||||
return useHotWater; |
||||
} |
||||
|
||||
public void setUseHotWater(BigDecimal useHotWater) { |
||||
this.useHotWater = useHotWater; |
||||
} |
||||
|
||||
public BigDecimal getElectValue() { |
||||
return electValue; |
||||
} |
||||
|
||||
public void setElectValue(BigDecimal electValue) { |
||||
this.electValue = electValue; |
||||
} |
||||
|
||||
public BigDecimal getElectWater() { |
||||
return electWater; |
||||
} |
||||
|
||||
public void setElectWater(BigDecimal electWater) { |
||||
this.electWater = electWater; |
||||
} |
||||
|
||||
public int getCheckInCount() { |
||||
return checkInCount; |
||||
} |
||||
|
||||
public void setCheckInCount(int checkInCount) { |
||||
this.checkInCount = checkInCount; |
||||
} |
||||
|
||||
public BigDecimal getPerElect() { |
||||
return perElect; |
||||
} |
||||
|
||||
public void setPerElect(BigDecimal perElect) { |
||||
this.perElect = perElect; |
||||
} |
||||
|
||||
public BigDecimal getPerWater() { |
||||
return perWater; |
||||
} |
||||
|
||||
public void setPerWater(BigDecimal perWater) { |
||||
this.perWater = perWater; |
||||
} |
||||
|
||||
public String getUpdateFlag() { |
||||
return updateFlag; |
||||
} |
||||
|
||||
public void setUpdateFlag(String updateFlag) { |
||||
this.updateFlag = updateFlag; |
||||
} |
||||
|
||||
public String getBuildingName() { |
||||
return buildingName; |
||||
} |
||||
|
||||
public void setBuildingName(String buildingName) { |
||||
this.buildingName = buildingName; |
||||
} |
||||
|
||||
public BigDecimal getElectCurValue() { |
||||
return electCurValue; |
||||
} |
||||
|
||||
public void setElectCurValue(BigDecimal electCurValue) { |
||||
this.electCurValue = electCurValue; |
||||
} |
||||
|
||||
public BigDecimal getWtCurValue() { |
||||
return wtCurValue; |
||||
} |
||||
|
||||
public void setWtCurValue(BigDecimal wtCurValue) { |
||||
this.wtCurValue = wtCurValue; |
||||
} |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this) |
||||
.append("id", id) |
||||
.append("curDate", curDate) |
||||
.append("buildingId", buildingId) |
||||
.append("hotWaterValue", hotWaterValue) |
||||
.append("useHotWater", useHotWater) |
||||
.append("electValue", electValue) |
||||
.append("electWater", electWater) |
||||
.append("checkInCount", checkInCount) |
||||
.append("perElect", perElect) |
||||
.append("perWater", perWater) |
||||
.append("updateFlag", updateFlag) |
||||
.append("buildingName", buildingName) |
||||
.append("electCurValue", electCurValue) |
||||
.append("wtCurValue", wtCurValue) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,89 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水时间能耗实体类 |
||||
* @date 2025-06-18 14:28:30 |
||||
*/ |
||||
@Data |
||||
@TableName("energy_month") |
||||
public class EnergyMonth { |
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||
private String id; |
||||
|
||||
/** |
||||
* 时间 |
||||
*/ |
||||
private String curDate; |
||||
|
||||
/** |
||||
* 建筑id |
||||
*/ |
||||
private String buildingId; |
||||
|
||||
/** |
||||
* 产热量 |
||||
*/ |
||||
private BigDecimal hotWaterValue; |
||||
|
||||
/** |
||||
* 使用用量 |
||||
*/ |
||||
private BigDecimal useHotWater; |
||||
|
||||
/** |
||||
* 用电量 |
||||
*/ |
||||
private BigDecimal electValue; |
||||
|
||||
/** |
||||
* 单耗 |
||||
*/ |
||||
private BigDecimal electWater; |
||||
|
||||
/** |
||||
* 入住人数 |
||||
*/ |
||||
private int checkInCount; |
||||
|
||||
/** |
||||
* 人均用电 |
||||
*/ |
||||
private BigDecimal perElect; |
||||
|
||||
/** |
||||
* 人均用水 |
||||
*/ |
||||
private BigDecimal perWater; |
||||
|
||||
/** |
||||
* 更新标志 |
||||
*/ |
||||
private String updateFlag; |
||||
|
||||
/** |
||||
* 建筑名称 |
||||
*/ |
||||
private String buildingName; |
||||
|
||||
/** |
||||
* 当前电表读数 |
||||
*/ |
||||
private BigDecimal electCurValue; |
||||
|
||||
/** |
||||
* 当前水表读数 |
||||
*/ |
||||
private BigDecimal wtCurValue; |
||||
|
||||
} |
@ -0,0 +1,74 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水时间能耗实体类 |
||||
* @date 2025-06-18 14:28:30 |
||||
*/ |
||||
@Data |
||||
@TableName("energy_month_sum") |
||||
public class EnergyMonthSum { |
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||
private String id; |
||||
|
||||
/** |
||||
* 时间 |
||||
*/ |
||||
private String curDate; |
||||
|
||||
/** |
||||
* 建筑id |
||||
*/ |
||||
private String buildingId; |
||||
|
||||
/** |
||||
* 补水 |
||||
*/ |
||||
private BigDecimal fillWater; |
||||
|
||||
/** |
||||
* 补水与昨日比 |
||||
*/ |
||||
private String fillWaterP; |
||||
|
||||
/** |
||||
* 用水 |
||||
*/ |
||||
private BigDecimal waterValue; |
||||
|
||||
/** |
||||
* 用水与昨日比 |
||||
*/ |
||||
private String waterP; |
||||
|
||||
/** |
||||
* 用电量 |
||||
*/ |
||||
private BigDecimal electValue; |
||||
|
||||
/** |
||||
* 用电与昨日比 |
||||
*/ |
||||
private String electP; |
||||
|
||||
/** |
||||
* 单耗 |
||||
*/ |
||||
private BigDecimal electWater; |
||||
|
||||
/** |
||||
* 单耗与昨日比 |
||||
*/ |
||||
private String electWaterP; |
||||
|
||||
} |
@ -0,0 +1,89 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水时间能耗实体类 |
||||
* @date 2025-06-18 14:28:30 |
||||
*/ |
||||
@Data |
||||
@TableName("energy_year") |
||||
public class EnergyYear { |
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||
private String id; |
||||
|
||||
/** |
||||
* 时间 |
||||
*/ |
||||
private String curDate; |
||||
|
||||
/** |
||||
* 建筑id |
||||
*/ |
||||
private String buildingId; |
||||
|
||||
/** |
||||
* 产热量 |
||||
*/ |
||||
private BigDecimal hotWaterValue; |
||||
|
||||
/** |
||||
* 使用用量 |
||||
*/ |
||||
private BigDecimal useHotWater; |
||||
|
||||
/** |
||||
* 用电量 |
||||
*/ |
||||
private BigDecimal electValue; |
||||
|
||||
/** |
||||
* 单耗 |
||||
*/ |
||||
private BigDecimal electWater; |
||||
|
||||
/** |
||||
* 入住人数 |
||||
*/ |
||||
private int checkInCount; |
||||
|
||||
/** |
||||
* 人均用电 |
||||
*/ |
||||
private BigDecimal perElect; |
||||
|
||||
/** |
||||
* 人均用水 |
||||
*/ |
||||
private BigDecimal perWater; |
||||
|
||||
/** |
||||
* 更新标志 |
||||
*/ |
||||
private String updateFlag; |
||||
|
||||
/** |
||||
* 建筑名称 |
||||
*/ |
||||
private String buildingName; |
||||
|
||||
/** |
||||
* 当前电表读数 |
||||
*/ |
||||
private BigDecimal electCurValue; |
||||
|
||||
/** |
||||
* 当前水表读数 |
||||
*/ |
||||
private BigDecimal wtCurValue; |
||||
|
||||
} |
@ -0,0 +1,74 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.IdType; |
||||
import com.baomidou.mybatisplus.annotation.TableId; |
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import lombok.Data; |
||||
|
||||
import java.math.BigDecimal; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水时间能耗实体类 |
||||
* @date 2025-06-18 14:28:30 |
||||
*/ |
||||
@Data |
||||
@TableName("energy_month_sum") |
||||
public class EnergyYearSum { |
||||
|
||||
@TableId(value = "id", type = IdType.ASSIGN_UUID) |
||||
private String id; |
||||
|
||||
/** |
||||
* 时间 |
||||
*/ |
||||
private String curDate; |
||||
|
||||
/** |
||||
* 建筑id |
||||
*/ |
||||
private String buildingId; |
||||
|
||||
/** |
||||
* 补水 |
||||
*/ |
||||
private BigDecimal fillWater; |
||||
|
||||
/** |
||||
* 补水与昨日比 |
||||
*/ |
||||
private String fillWaterP; |
||||
|
||||
/** |
||||
* 用水 |
||||
*/ |
||||
private BigDecimal waterValue; |
||||
|
||||
/** |
||||
* 用水与昨日比 |
||||
*/ |
||||
private String waterP; |
||||
|
||||
/** |
||||
* 用电量 |
||||
*/ |
||||
private BigDecimal electValue; |
||||
|
||||
/** |
||||
* 用电与昨日比 |
||||
*/ |
||||
private String electP; |
||||
|
||||
/** |
||||
* 单耗 |
||||
*/ |
||||
private BigDecimal electWater; |
||||
|
||||
/** |
||||
* 单耗与昨日比 |
||||
*/ |
||||
private String electWaterP; |
||||
|
||||
} |
@ -0,0 +1,117 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Data; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水液位 |
||||
* @date 2025-06-19 16:18:12 |
||||
*/ |
||||
@Data |
||||
@TableName("water_level") |
||||
public class WaterLevel { |
||||
|
||||
private String id; |
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date curDate; |
||||
|
||||
private String buildingId; |
||||
|
||||
private String buildingName; |
||||
|
||||
private String deviceNum; |
||||
|
||||
private String deviceName; |
||||
|
||||
private String temp00; |
||||
|
||||
private String temp01; |
||||
|
||||
private String temp02; |
||||
|
||||
private String temp03; |
||||
|
||||
private String temp04; |
||||
|
||||
private String temp05; |
||||
|
||||
private String temp06; |
||||
|
||||
private String temp07; |
||||
|
||||
private String temp08; |
||||
|
||||
private String temp09; |
||||
|
||||
private String temp10; |
||||
|
||||
private String temp11; |
||||
|
||||
private String temp12; |
||||
|
||||
private String temp13; |
||||
|
||||
private String temp14; |
||||
|
||||
private String temp15; |
||||
|
||||
private String temp16; |
||||
|
||||
private String temp17; |
||||
|
||||
private String temp18; |
||||
|
||||
private String temp19; |
||||
|
||||
private String temp20; |
||||
|
||||
private String temp21; |
||||
|
||||
private String temp22; |
||||
|
||||
private String temp23; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this) |
||||
.append("id", id) |
||||
.append("curDate", curDate) |
||||
.append("buildingId", buildingId) |
||||
.append("buildingName", buildingName) |
||||
.append("deviceNum", deviceNum) |
||||
.append("deviceName", deviceName) |
||||
.append("temp00", temp00) |
||||
.append("temp01", temp01) |
||||
.append("temp02", temp02) |
||||
.append("temp03", temp03) |
||||
.append("temp04", temp04) |
||||
.append("temp05", temp05) |
||||
.append("temp06", temp06) |
||||
.append("temp07", temp07) |
||||
.append("temp08", temp08) |
||||
.append("temp09", temp09) |
||||
.append("temp10", temp10) |
||||
.append("temp11", temp11) |
||||
.append("temp12", temp12) |
||||
.append("temp13", temp13) |
||||
.append("temp14", temp14) |
||||
.append("temp15", temp15) |
||||
.append("temp16", temp16) |
||||
.append("temp17", temp17) |
||||
.append("temp18", temp18) |
||||
.append("temp19", temp19) |
||||
.append("temp20", temp20) |
||||
.append("temp21", temp21) |
||||
.append("temp22", temp22) |
||||
.append("temp23", temp23) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,117 @@
|
||||
package com.mh.common.core.domain.entity; |
||||
|
||||
import com.baomidou.mybatisplus.annotation.TableName; |
||||
import com.fasterxml.jackson.annotation.JsonFormat; |
||||
import lombok.Data; |
||||
import org.apache.commons.lang3.builder.ToStringBuilder; |
||||
|
||||
import java.util.Date; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水温度 |
||||
* @date 2025-06-19 16:18:12 |
||||
*/ |
||||
@Data |
||||
@TableName("water_temp") |
||||
public class WaterTemp { |
||||
|
||||
private String id; |
||||
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") |
||||
private Date curDate; |
||||
|
||||
private String buildingId; |
||||
|
||||
private String buildingName; |
||||
|
||||
private String deviceNum; |
||||
|
||||
private String deviceName; |
||||
|
||||
private String temp00; |
||||
|
||||
private String temp01; |
||||
|
||||
private String temp02; |
||||
|
||||
private String temp03; |
||||
|
||||
private String temp04; |
||||
|
||||
private String temp05; |
||||
|
||||
private String temp06; |
||||
|
||||
private String temp07; |
||||
|
||||
private String temp08; |
||||
|
||||
private String temp09; |
||||
|
||||
private String temp10; |
||||
|
||||
private String temp11; |
||||
|
||||
private String temp12; |
||||
|
||||
private String temp13; |
||||
|
||||
private String temp14; |
||||
|
||||
private String temp15; |
||||
|
||||
private String temp16; |
||||
|
||||
private String temp17; |
||||
|
||||
private String temp18; |
||||
|
||||
private String temp19; |
||||
|
||||
private String temp20; |
||||
|
||||
private String temp21; |
||||
|
||||
private String temp22; |
||||
|
||||
private String temp23; |
||||
|
||||
@Override |
||||
public String toString() { |
||||
return new ToStringBuilder(this) |
||||
.append("id", id) |
||||
.append("curDate", curDate) |
||||
.append("buildingId", buildingId) |
||||
.append("buildingName", buildingName) |
||||
.append("deviceNum", deviceNum) |
||||
.append("deviceName", deviceName) |
||||
.append("temp00", temp00) |
||||
.append("temp01", temp01) |
||||
.append("temp02", temp02) |
||||
.append("temp03", temp03) |
||||
.append("temp04", temp04) |
||||
.append("temp05", temp05) |
||||
.append("temp06", temp06) |
||||
.append("temp07", temp07) |
||||
.append("temp08", temp08) |
||||
.append("temp09", temp09) |
||||
.append("temp10", temp10) |
||||
.append("temp11", temp11) |
||||
.append("temp12", temp12) |
||||
.append("temp13", temp13) |
||||
.append("temp14", temp14) |
||||
.append("temp15", temp15) |
||||
.append("temp16", temp16) |
||||
.append("temp17", temp17) |
||||
.append("temp18", temp18) |
||||
.append("temp19", temp19) |
||||
.append("temp20", temp20) |
||||
.append("temp21", temp21) |
||||
.append("temp22", temp22) |
||||
.append("temp23", temp23) |
||||
.toString(); |
||||
} |
||||
} |
@ -0,0 +1,56 @@
|
||||
package com.mh.system.mapper.energy; |
||||
|
||||
import com.mh.common.core.domain.entity.AnalysisMonth; |
||||
import com.mh.common.core.domain.entity.AnalysisYear; |
||||
import org.apache.ibatis.annotations.*; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 用能分析 |
||||
* @date 2025-06-24 15:10:04 |
||||
*/ |
||||
@Mapper |
||||
public interface AnalysisMapper { |
||||
|
||||
/** |
||||
* 分析查询 |
||||
* 根据日期、楼栋查询 |
||||
* @param curDate |
||||
* @param buildingId |
||||
* @return |
||||
*/ |
||||
@Select("select * from analysis_elect_year where cur_date=#{curDate} and building_id=#{buildingId}") |
||||
List<AnalysisYear> queryAnalysisElectYear(@Param("curDate") String curDate, @Param("buildingId") String buildingId); |
||||
|
||||
@Select("select * from analysis_Water_year where cur_date=#{curDate} and building_id=#{buildingId}") |
||||
List<AnalysisYear> queryAnalysisWaterYear(@Param("curDate") String curDate, @Param("buildingId") String buildingId); |
||||
|
||||
@Select("select * from analysis_Energy_year where cur_date=#{curDate} and building_id=#{buildingId}") |
||||
List<AnalysisYear> queryAnalysisEnergyYear(@Param("curDate") String curDate, @Param("buildingId") String buildingId); |
||||
|
||||
@Select("select * from analysis_Maintain_year where cur_date=#{curDate} and building_id=#{buildingId}") |
||||
List<AnalysisYear> queryAnalysisMaintainYear(@Param("curDate") String curDate, @Param("buildingId") String buildingId); |
||||
|
||||
@Select("select * from analysis_runtime_year where cur_date=#{curDate} and building_id=#{buildingId}") |
||||
List<AnalysisYear> queryAnalysisRuntimeYear(@Param("curDate") String curDate, @Param("buildingId") String buildingId); |
||||
|
||||
@Select("select * from analysis_elect_month where cur_date=#{curDate} and building_id=#{buildingId}") |
||||
List<AnalysisMonth> queryAnalysisElectMonth(@Param("curDate") String curDate, @Param("buildingId") String buildingId); |
||||
|
||||
@Select("select * from analysis_Water_month where cur_date=#{curDate} and building_id=#{buildingId}") |
||||
List<AnalysisMonth> queryAnalysisWaterMonth(@Param("curDate") String curDate, @Param("buildingId") String buildingId); |
||||
|
||||
@Select("select * from analysis_Energy_month where cur_date=#{curDate} and building_id=#{buildingId}") |
||||
List<AnalysisMonth> queryAnalysisEnergyMonth(@Param("curDate") String curDate, @Param("buildingId") String buildingId); |
||||
|
||||
@Select("select * from analysis_maintain_month where cur_date=#{curDate} and building_id=#{buildingId}") |
||||
List<AnalysisMonth> queryAnalysisMaintainMonth(@Param("curDate") String curDate, @Param("buildingId") String buildingId); |
||||
|
||||
@Select("select * from analysis_runtime_month where cur_date=#{curDate} and building_id=#{buildingId}") |
||||
List<AnalysisMonth> queryAnalysisRuntimeMonth(@Param("curDate") String curDate, @Param("buildingId") String buildingId); |
||||
|
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.mh.system.mapper.energy; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.mh.common.core.domain.entity.EnergyDay; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.Update; |
||||
import org.apache.poi.ss.formula.functions.T; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水小时 |
||||
* @date 2025-06-18 15:37:04 |
||||
*/ |
||||
@Mapper |
||||
public interface EnergyDayMapper extends BaseMapper<EnergyDay> { |
||||
|
||||
@Update("update energy_day set elect_value = #{electricity}, use_hot_water = #{water}, elect_water = #{consumption} where building_id = #{buildingId} and cur_date = #{curDate}") |
||||
void updateByOther(String buildingId, String curDate, BigDecimal electricity, BigDecimal water, BigDecimal consumption); |
||||
|
||||
@Select("select * from energy_day where building_id = #{buildingId} and cur_date >= #{startDate} and cur_date <= #{endDate} order by cur_date desc ") |
||||
List<EnergyDay> queryEnergyDay(String buildingId, String startDate, String endDate); |
||||
} |
@ -0,0 +1,22 @@
|
||||
package com.mh.system.mapper.energy; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.mh.common.core.domain.entity.EnergyDaySum; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Select; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水小时 |
||||
* @date 2025-06-18 15:37:04 |
||||
*/ |
||||
@Mapper |
||||
public interface EnergyDaySumMapper extends BaseMapper<EnergyDaySum> { |
||||
|
||||
@Select("select * from energy_day_sum where building_id = #{buildingId} and cur_date = #{startDate} ") |
||||
List<EnergyDaySum> queryEnergyDaySum(String buildingId, String startDate); |
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.mh.system.mapper.energy; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.mh.common.core.domain.entity.EnergyHour; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.Update; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水小时 |
||||
* @date 2025-06-18 15:37:04 |
||||
*/ |
||||
@Mapper |
||||
public interface EnergyHourMapper extends BaseMapper<EnergyHour> { |
||||
|
||||
@Update("update energy_hour set elect_value = #{electricity}, use_hot_water = #{water}, elect_water = #{consumption} where building_id = #{buildingId} and cur_date = #{curDate}") |
||||
void updateByOther(String buildingId, String curDate, BigDecimal electricity, BigDecimal water, BigDecimal consumption); |
||||
|
||||
@Select("select * from energy_hour where building_id = #{buildingId} and cur_date >= #{startDate} and cur_date <= #{endDate} order by cur_date desc ") |
||||
List<EnergyHour> queryEnergyHour(String buildingId, String startDate, String endDate); |
||||
} |
@ -0,0 +1,28 @@
|
||||
package com.mh.system.mapper.energy; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.mh.common.core.domain.entity.EnergyMonth; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.Update; |
||||
import org.apache.poi.ss.formula.functions.T; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水小时 |
||||
* @date 2025-06-18 15:37:04 |
||||
*/ |
||||
@Mapper |
||||
public interface EnergyMonthMapper extends BaseMapper<EnergyMonth> { |
||||
|
||||
@Update("update energy_month set elect_value = #{electricity}, use_hot_water = #{water}, elect_water = #{consumption} where building_id = #{buildingId} and cur_date = #{curDate}") |
||||
void updateByOther(String buildingId, String curDate, BigDecimal electricity, BigDecimal water, BigDecimal consumption); |
||||
|
||||
@Select("select * from energy_month where building_id = #{buildingId} and cur_date >= #{startDate} and cur_date <= #{endDate} order by cur_date desc ") |
||||
List<EnergyMonth> queryEnergyMonth(String buildingId, String startDate, String endDate); |
||||
} |
@ -0,0 +1,23 @@
|
||||
package com.mh.system.mapper.energy; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.mh.common.core.domain.entity.EnergyMonthSum; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Select; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水小时 |
||||
* @date 2025-06-18 15:37:04 |
||||
*/ |
||||
@Mapper |
||||
public interface EnergyMonthSumMapper extends BaseMapper<EnergyMonthSum> { |
||||
|
||||
@Select("select * from energy_month_sum where building_id = #{buildingId} and cur_date = #{startDate} ") |
||||
List<EnergyMonthSum> queryEnergyMonthSum(String buildingId, String startDate); |
||||
|
||||
} |
@ -0,0 +1,27 @@
|
||||
package com.mh.system.mapper.energy; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.mh.common.core.domain.entity.EnergyYear; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Select; |
||||
import org.apache.ibatis.annotations.Update; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水小时 |
||||
* @date 2025-06-18 15:37:04 |
||||
*/ |
||||
@Mapper |
||||
public interface EnergyYearMapper extends BaseMapper<EnergyYear> { |
||||
|
||||
@Update("update energy_year set elect_value = #{electricity}, use_hot_water = #{water}, elect_water = #{consumption} where building_id = #{buildingId} and cur_date = #{curDate}") |
||||
void updateByOther(String buildingId, String curDate, BigDecimal electricity, BigDecimal water, BigDecimal consumption); |
||||
|
||||
@Select("select * from energy_year where building_id = #{buildingId} and cur_date >= #{startDate} and cur_date <= #{endDate} order by cur_date desc ") |
||||
List<EnergyYear> queryEnergyYear(String buildingId, String startDate, String endDate); |
||||
} |
@ -0,0 +1,24 @@
|
||||
package com.mh.system.mapper.energy; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.mh.common.core.domain.entity.EnergyMonthSum; |
||||
import com.mh.common.core.domain.entity.EnergyYearSum; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Select; |
||||
|
||||
import java.util.List; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水小时 |
||||
* @date 2025-06-18 15:37:04 |
||||
*/ |
||||
@Mapper |
||||
public interface EnergyYearSumMapper extends BaseMapper<EnergyYearSum> { |
||||
|
||||
@Select("select * from energy_year_sum where building_id = #{buildingId} and cur_date = #{startDate} ") |
||||
List<EnergyYearSum> queryEnergyYearSum(String buildingId, String startDate); |
||||
|
||||
} |
@ -0,0 +1,118 @@
|
||||
package com.mh.system.mapper.energy; |
||||
|
||||
import com.mh.common.core.domain.dto.DataResultDTO; |
||||
import com.mh.common.core.domain.entity.DataMonth; |
||||
import org.apache.ibatis.annotations.Mapper; |
||||
import org.apache.ibatis.annotations.Param; |
||||
import org.apache.ibatis.annotations.Select; |
||||
|
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project NewZhujiang_Server |
||||
* @description 热水能耗查询 |
||||
* @date 2023-12-13 16:00:01 |
||||
*/ |
||||
@Mapper |
||||
public interface HotEnergyQueryMapper { |
||||
|
||||
@Select("select " + |
||||
" t1.id, SUBSTRING(t1.floor_name FROM '(-?\\d+楼)') as building_name " + |
||||
"from " + |
||||
" ( " + |
||||
" select " + |
||||
" distinct fi.id,fi.floor_name " + |
||||
" from " + |
||||
" floor_info fi " + |
||||
" join " + |
||||
"building_info bi " + |
||||
"on " + |
||||
" fi.building_id = bi.id " + |
||||
" join area_info ai on " + |
||||
" bi.area_id = ai.id " + |
||||
" where " + |
||||
" ai.system_type = '1' " + |
||||
" ) t1 " + |
||||
"join cpm_space_relation csr on " + |
||||
" csr.floor_id = t1.id " + |
||||
"where " + |
||||
" csr.house_id = '' " + |
||||
"group by " + |
||||
" t1.id,t1.floor_name order by building_name") |
||||
List<Map<String, Object>> queryFloorInfo(); |
||||
|
||||
@Select("<script>" + |
||||
"select " + |
||||
" dh.* " + |
||||
"from " + |
||||
" ${tableName} dh " + |
||||
"join ( " + |
||||
" select " + |
||||
" mt_num " + |
||||
" from " + |
||||
" collection_params_manage cpm " + |
||||
" where " + |
||||
" id in( " + |
||||
" select " + |
||||
" cpm_id " + |
||||
" from " + |
||||
" cpm_space_relation csr " + |
||||
" where " + |
||||
" floor_id = #{buildingId} " + |
||||
" and house_id = '' " + |
||||
")) t1 on " + |
||||
" dh.device_num = t1.mt_num " + |
||||
"where " + |
||||
" date_trunc(#{dateType}, dh.cur_time) = date_trunc(#{dateType},#{lastHour}::timestamp) " + |
||||
"order by " + |
||||
" cur_time; " + |
||||
"</script>") |
||||
List<DataMonth> queryEnergyDatas(@Param("tableName") String tableName, |
||||
@Param("buildingId") String buildingId, |
||||
@Param("lastHour") String lastHourTime, |
||||
@Param("dateType") String dateType); |
||||
|
||||
@Select("select count(1) from ${tableName} where building_id = #{buildingId} and cur_date = #{curDate}") |
||||
int haveRecord(String tableName, String buildingId, String curDate); |
||||
|
||||
@Select("SELECT pro_energy_sum(#{lastHourTime}); ") |
||||
Map<String, Object> calcFloorEnergyDataDetail(@Param("lastHourTime") String lastHourTime); |
||||
|
||||
@Select("<script>" + |
||||
"select " + |
||||
" fi.id as building_id, " + |
||||
" SUBSTRING(fi.floor_name from '(-?\\d+楼)') as building_name, " + |
||||
" cpm.other_name as device_name, " + |
||||
" dm.* " + |
||||
"from " + |
||||
" ${tableName} dm " + |
||||
"join " + |
||||
"collection_params_manage cpm " + |
||||
"on " + |
||||
" dm.device_num = cpm.mt_num " + |
||||
" and dm.device_code = cpm.mt_code " + |
||||
"join cpm_space_relation csr on " + |
||||
" cpm.id = csr.cpm_id " + |
||||
"join floor_info fi on " + |
||||
" fi.id = csr.floor_id " + |
||||
"where " + |
||||
" date(dm.cur_time) >= date(#{startDate}) " + |
||||
" and date(dm.cur_time) <= date(#{endDate}) " + |
||||
" and cpm.param_type = #{deviceType} " + |
||||
" and cpm.grade = 40 " + |
||||
" and csr.house_id = '' " + |
||||
"<if test='buildingId != null and buildingId != \"所有\" and buildingId != \"\" '>" + |
||||
" and csr.floor_id = #{buildingId} " + |
||||
"</if>" + |
||||
"order by " + |
||||
" dm.cur_time desc " + |
||||
"</script>") |
||||
List<DataResultDTO> queryDeviceDatas(@Param("buildingId") String buildingId, |
||||
@Param("startDate") String startDate, |
||||
@Param("endDate") String endDate, |
||||
@Param("deviceType") String deviceType, |
||||
@Param("tableName") String tableName); |
||||
} |
@ -0,0 +1,102 @@
|
||||
package com.mh.system.mapper.energy; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.mh.common.core.domain.entity.WaterLevel; |
||||
import org.apache.ibatis.annotations.*; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水温度记录 |
||||
* @date 2025-06-19 16:24:31 |
||||
*/ |
||||
@Mapper |
||||
public interface WaterLevelMapper extends BaseMapper<WaterLevel> { |
||||
|
||||
|
||||
@Select("select " + |
||||
" t1.*, " + |
||||
" csr.floor_id " + |
||||
"from " + |
||||
" ( " + |
||||
" select " + |
||||
" cpm.id, " + |
||||
" cpm.cur_value, " + |
||||
" cpm.cur_time, " + |
||||
" cpm.mt_num, " + |
||||
" dl.device_name " + |
||||
" from " + |
||||
" collection_params_manage cpm " + |
||||
" join device_ledger dl on " + |
||||
" cpm.device_ledger_id = dl.id " + |
||||
" where " + |
||||
" dl.system_type = '1' " + |
||||
" and device_type = '16' " + |
||||
" and cpm.param_type = '11' " + |
||||
" ) t1 " + |
||||
"join cpm_space_relation csr on " + |
||||
" t1.id = csr.cpm_id " + |
||||
"where " + |
||||
" csr.house_id = '' " + |
||||
"order by " + |
||||
" t1.device_name ") |
||||
List<Map<String, Object>> getNowWaterLevel(); |
||||
|
||||
@Select("select count(1) from water_level where date(cur_date) = date(#{date}::timestamp) and building_id = #{buildingId} and device_num = #{pumpId}") |
||||
int isExits(@Param("date") String date, |
||||
@Param("buildingId") String buildingId, |
||||
@Param("pumpId") String pumpId); |
||||
|
||||
@Insert("insert into water_level(cur_date,building_id,device_num,device_name, ${tempTime}) values(#{date}::timestamp,#{buildingId},#{pumpId},#{pumpName},#{curValue})") |
||||
void insertWaterLevel(String date, String buildingId, String pumpId, String pumpName, BigDecimal curValue, String tempTime); |
||||
|
||||
@Update("update water_level set ${tempTime} = #{curValue} where date(cur_date) = date(#{date}::timestamp) and building_id = #{buildingId} and device_num = #{pumpId}") |
||||
void updateWaterLevel(String date, String buildingId, String pumpId, String pumpName, BigDecimal curValue, String tempTime); |
||||
|
||||
@Select("select " + |
||||
" wt.building_id, " + |
||||
" SUBSTRING(fi.floor_name FROM '(-?\\d+楼)') as building_name, " + |
||||
" ROUND(avg(temp00::numeric(24, 1)),1) as temp00, " + |
||||
" ROUND(avg(temp01::numeric(24, 1)),1) as temp01, " + |
||||
" ROUND(avg(temp02::numeric(24, 1)),1) as temp02, " + |
||||
" ROUND(avg(temp03::numeric(24, 1)),1) as temp03, " + |
||||
" ROUND(avg(temp04::numeric(24, 1)),1) as temp04, " + |
||||
" ROUND(avg(temp05::numeric(24, 1)),1) as temp05, " + |
||||
" ROUND(avg(temp06::numeric(24, 1)),1) as temp06, " + |
||||
" ROUND(avg(temp07::numeric(24, 1)),1) as temp07, " + |
||||
" ROUND(avg(temp08::numeric(24, 1)),1) as temp08, " + |
||||
" ROUND(avg(temp09::numeric(24, 1)),1) as temp09, " + |
||||
" ROUND(avg(temp10::numeric(24, 1)),1) as temp10, " + |
||||
" ROUND(avg(temp11::numeric(24, 1)),1) as temp11, " + |
||||
" ROUND(avg(temp12::numeric(24, 1)),1) as temp12, " + |
||||
" ROUND(avg(temp13::numeric(24, 1)),1) as temp13, " + |
||||
" ROUND(avg(temp14::numeric(24, 1)),1) as temp14, " + |
||||
" ROUND(avg(temp15::numeric(24, 1)),1) as temp15, " + |
||||
" ROUND(avg(temp16::numeric(24, 1)),1) as temp16, " + |
||||
" ROUND(avg(temp17::numeric(24, 1)),1) as temp17, " + |
||||
" ROUND(avg(temp18::numeric(24, 1)),1) as temp18, " + |
||||
" ROUND(avg(temp19::numeric(24, 1)),1) as temp19, " + |
||||
" ROUND(avg(temp20::numeric(24, 1)),1) as temp20, " + |
||||
" ROUND(avg(temp21::numeric(24, 1)),1) as temp21, " + |
||||
" ROUND(avg(temp22::numeric(24, 1)),1) as temp22, " + |
||||
" ROUND(avg(temp23::numeric(24, 1)),1) as temp23 " + |
||||
"from " + |
||||
" water_level wt " + |
||||
"join floor_info fi on wt.building_id = fi.id " + |
||||
"where " + |
||||
" date(wt.cur_date) = date(#{curDate}) " + |
||||
"group by " + |
||||
" wt.building_id, fi.floor_name " + |
||||
"order by SUBSTRING(fi.floor_name FROM '(-?\\d)') ") |
||||
List<WaterLevel> queryAvgWaterTemp(String curDate); |
||||
|
||||
@Select("select wt.*, SUBSTRING(fi.floor_name FROM '(-?\\d+楼)') as building_name from water_level wt " + |
||||
" join floor_info fi on wt.building_id = fi.id " + |
||||
" where wt.building_id = #{buildingId} and date(wt.cur_date) = date(#{curDate}) order by wt.device_name ") |
||||
List<WaterLevel> queryWaterTemp(String buildingId, String curDate); |
||||
} |
@ -0,0 +1,103 @@
|
||||
package com.mh.system.mapper.energy; |
||||
|
||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper; |
||||
import com.mh.common.core.domain.entity.WaterTemp; |
||||
import org.apache.ibatis.annotations.*; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水温度记录 |
||||
* @date 2025-06-19 16:24:31 |
||||
*/ |
||||
@Mapper |
||||
public interface WaterTempMapper extends BaseMapper<WaterTemp> { |
||||
|
||||
|
||||
@Select("select " + |
||||
" t1.*, " + |
||||
" csr.floor_id, " + |
||||
" csr.house_id " + |
||||
"from " + |
||||
" ( " + |
||||
" select " + |
||||
" cpm.id, " + |
||||
" cpm.cur_value, " + |
||||
" cpm.cur_time, " + |
||||
" cpm.mt_num, " + |
||||
" dl.device_name " + |
||||
" from " + |
||||
" collection_params_manage cpm " + |
||||
" join device_ledger dl on " + |
||||
" cpm.device_ledger_id = dl.id " + |
||||
" where " + |
||||
" dl.system_type = '1' " + |
||||
" and dl.device_type = '11' " + |
||||
" and cpm.param_type = '12' " + |
||||
" ) t1 " + |
||||
"join cpm_space_relation csr on " + |
||||
" t1.id = csr.cpm_id " + |
||||
"where " + |
||||
" csr.house_id = '' " + |
||||
"order by " + |
||||
" t1.device_name ") |
||||
List<Map<String, Object>> getNowWaterTemp(); |
||||
|
||||
@Select("select count(1) from water_temp where date(cur_date) = date(#{date}::timestamp) and building_id = #{buildingId} and device_num = #{pumpId}") |
||||
int isExits(@Param("date") String date, |
||||
@Param("buildingId") String buildingId, |
||||
@Param("pumpId") String pumpId); |
||||
|
||||
@Insert("insert into water_temp(cur_date,building_id, device_num, device_name, ${tempTime}) values(#{date}::timestamp,#{buildingId},#{pumpId},#{pumpName},#{curValue})") |
||||
void insertWaterTemp(String date, String buildingId, String pumpId, String pumpName, BigDecimal curValue, String tempTime); |
||||
|
||||
@Update("update water_temp set ${tempTime} = #{curValue} where date(cur_date) = date(#{date}::timestamp) and building_id = #{buildingId} and device_num = #{pumpId}") |
||||
void updateWaterTemp(String date, String buildingId, String pumpId, String pumpName, BigDecimal curValue, String tempTime); |
||||
|
||||
@Select("select " + |
||||
" wt.building_id, " + |
||||
" SUBSTRING(fi.floor_name FROM '(-?\\d+楼)') as building_name, " + |
||||
" ROUND(avg(temp00::numeric(24, 1)),1) as temp00, " + |
||||
" ROUND(avg(temp01::numeric(24, 1)),1) as temp01, " + |
||||
" ROUND(avg(temp02::numeric(24, 1)),1) as temp02, " + |
||||
" ROUND(avg(temp03::numeric(24, 1)),1) as temp03, " + |
||||
" ROUND(avg(temp04::numeric(24, 1)),1) as temp04, " + |
||||
" ROUND(avg(temp05::numeric(24, 1)),1) as temp05, " + |
||||
" ROUND(avg(temp06::numeric(24, 1)),1) as temp06, " + |
||||
" ROUND(avg(temp07::numeric(24, 1)),1) as temp07, " + |
||||
" ROUND(avg(temp08::numeric(24, 1)),1) as temp08, " + |
||||
" ROUND(avg(temp09::numeric(24, 1)),1) as temp09, " + |
||||
" ROUND(avg(temp10::numeric(24, 1)),1) as temp10, " + |
||||
" ROUND(avg(temp11::numeric(24, 1)),1) as temp11, " + |
||||
" ROUND(avg(temp12::numeric(24, 1)),1) as temp12, " + |
||||
" ROUND(avg(temp13::numeric(24, 1)),1) as temp13, " + |
||||
" ROUND(avg(temp14::numeric(24, 1)),1) as temp14, " + |
||||
" ROUND(avg(temp15::numeric(24, 1)),1) as temp15, " + |
||||
" ROUND(avg(temp16::numeric(24, 1)),1) as temp16, " + |
||||
" ROUND(avg(temp17::numeric(24, 1)),1) as temp17, " + |
||||
" ROUND(avg(temp18::numeric(24, 1)),1) as temp18, " + |
||||
" ROUND(avg(temp19::numeric(24, 1)),1) as temp19, " + |
||||
" ROUND(avg(temp20::numeric(24, 1)),1) as temp20, " + |
||||
" ROUND(avg(temp21::numeric(24, 1)),1) as temp21, " + |
||||
" ROUND(avg(temp22::numeric(24, 1)),1) as temp22, " + |
||||
" ROUND(avg(temp23::numeric(24, 1)),1) as temp23 " + |
||||
"from " + |
||||
" water_temp wt " + |
||||
"join floor_info fi on wt.building_id = fi.id " + |
||||
"where " + |
||||
" date(wt.cur_date) = date(#{curDate}) " + |
||||
"group by " + |
||||
" wt.building_id, fi.floor_name " + |
||||
"order by SUBSTRING(fi.floor_name FROM '(-?\\d)') ") |
||||
List<WaterTemp> queryAvgWaterTemp(String curDate); |
||||
|
||||
@Select("select wt.*, SUBSTRING(fi.floor_name FROM '(-?\\d+楼)') as building_name from water_temp wt " + |
||||
" join floor_info fi on wt.building_id = fi.id " + |
||||
" where wt.building_id = #{buildingId} and date(wt.cur_date) = date(#{curDate}) order by wt.device_name ") |
||||
List<WaterTemp> queryWaterTemp(String buildingId, String curDate); |
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.mh.system.service.energy; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水温度服务类 |
||||
* @date 2025-06-19 16:26:10 |
||||
*/ |
||||
public interface IWaterLevelService { |
||||
|
||||
void calcWaterLevel(); |
||||
|
||||
} |
@ -0,0 +1,14 @@
|
||||
package com.mh.system.service.energy; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水温度服务类 |
||||
* @date 2025-06-19 16:26:10 |
||||
*/ |
||||
public interface IWaterTempService { |
||||
|
||||
void calcWaterTemp(); |
||||
|
||||
} |
@ -0,0 +1,60 @@
|
||||
package com.mh.system.service.energy.impl; |
||||
|
||||
import com.mh.system.mapper.energy.WaterLevelMapper; |
||||
import com.mh.system.mapper.energy.WaterTempMapper; |
||||
import com.mh.system.service.energy.IWaterLevelService; |
||||
import com.mh.system.service.energy.IWaterTempService; |
||||
import jakarta.annotation.Resource; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水温度服务类实现类 |
||||
* @date 2025-06-19 16:26:36 |
||||
*/ |
||||
@Service |
||||
public class WaterLevelServiceImpl implements IWaterLevelService { |
||||
|
||||
@Resource |
||||
private WaterLevelMapper waterLevelMapper; |
||||
|
||||
@Override |
||||
public void calcWaterLevel() { |
||||
// todo 1、获取到多少个水箱,以及水位对应的实时水位
|
||||
// todo 2、根据对应的水箱id查询水箱对应的液位
|
||||
// todo 3、再根据绑定关系表查询到热泵对应的楼层id
|
||||
List<Map<String, Object>> list = waterLevelMapper.getNowWaterLevel(); |
||||
// 开始遍历数据
|
||||
for (Map<String, Object> map : list) { |
||||
// todo 5、拼接sql语句,插入到存储表中(id,楼栋id,水箱id,水箱名称,temp00至temp23)
|
||||
String cpmId = map.get("id").toString(); |
||||
BigDecimal curValue = new BigDecimal(map.get("cur_value").toString()).setScale(1, BigDecimal.ROUND_HALF_UP); |
||||
String buildingId = map.get("floor_id").toString(); |
||||
String pumpId = map.get("mt_num").toString(); |
||||
String pumpName = map.get("device_name").toString(); |
||||
String curDate = map.get("cur_time").toString(); |
||||
|
||||
String tempTime = "temp" + curDate.substring(11, 13); |
||||
|
||||
// 格式化时间
|
||||
String date = curDate.substring(0,10) + " 00:00:00"; |
||||
// 判断是否存在值
|
||||
int count = waterLevelMapper.isExits(date, buildingId, pumpId); |
||||
|
||||
if (count == 0) { |
||||
// todo 6、插入数据
|
||||
waterLevelMapper.insertWaterLevel(date, buildingId, pumpId, pumpName, curValue, tempTime); |
||||
} else { |
||||
// todo 7、更新数据
|
||||
waterLevelMapper.updateWaterLevel(date, buildingId, pumpId, pumpName, curValue, tempTime); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
@ -0,0 +1,60 @@
|
||||
package com.mh.system.service.energy.impl; |
||||
|
||||
import com.mh.common.utils.DateUtils; |
||||
import com.mh.system.mapper.energy.WaterTempMapper; |
||||
import com.mh.system.service.energy.IWaterTempService; |
||||
import jakarta.annotation.Resource; |
||||
import org.springframework.stereotype.Service; |
||||
|
||||
import java.math.BigDecimal; |
||||
import java.util.Date; |
||||
import java.util.List; |
||||
import java.util.Map; |
||||
|
||||
/** |
||||
* @author LJF |
||||
* @version 1.0 |
||||
* @project EEMCS |
||||
* @description 热水温度服务类实现类 |
||||
* @date 2025-06-19 16:26:36 |
||||
*/ |
||||
@Service |
||||
public class WaterTempServiceImpl implements IWaterTempService { |
||||
|
||||
@Resource |
||||
private WaterTempMapper waterTempMapper; |
||||
|
||||
@Override |
||||
public void calcWaterTemp() { |
||||
// todo 1、获取到多少个热泵,以及热泵对应的实时温度
|
||||
// todo 2、根据热泵id查询热泵对应的实时温度
|
||||
// todo 3、再根据绑定关系表查询到热泵对应的楼层id
|
||||
List<Map<String, Object>> list = waterTempMapper.getNowWaterTemp(); |
||||
// 开始遍历数据
|
||||
for (Map<String, Object> map : list) { |
||||
// todo 5、拼接sql语句,插入到存储表中(id,楼栋id,热泵采集id,热泵名称,temp00至temp23)
|
||||
String cpmId = map.get("id").toString(); |
||||
BigDecimal curValue = new BigDecimal(map.get("cur_value").toString()).setScale(1, BigDecimal.ROUND_HALF_UP); |
||||
String buildingId = map.get("floor_id").toString(); |
||||
String pumpId = map.get("mt_num").toString(); |
||||
String pumpName = map.get("device_name").toString(); |
||||
String curDate = map.get("cur_time").toString(); |
||||
|
||||
String tempTime = "temp" + curDate.substring(11, 13); |
||||
|
||||
// 格式化时间
|
||||
String date = curDate.substring(0,10) + " 00:00:00"; |
||||
// 判断是否存在值
|
||||
int count = waterTempMapper.isExits(date, buildingId, pumpId); |
||||
|
||||
if (count == 0) { |
||||
// todo 6、插入数据
|
||||
waterTempMapper.insertWaterTemp(date, buildingId, pumpId, pumpName, curValue, tempTime); |
||||
} else { |
||||
// todo 7、更新数据
|
||||
waterTempMapper.updateWaterTemp(date, buildingId, pumpId, pumpName, curValue, tempTime); |
||||
} |
||||
} |
||||
} |
||||
|
||||
} |
Loading…
Reference in new issue