Compare commits

...

6 Commits

Author SHA1 Message Date
f42e8549b1 单站监控-电表取数逻辑修改 2025-07-04 13:51:42 +08:00
4bb23a7c75 奉贤电表数据接入 2025-07-04 12:37:18 +08:00
126b637932 BMS总览-获取堆下面簇数据 2025-07-03 16:12:19 +08:00
7bf4baf85f 设备列表接口 2025-07-03 15:40:27 +08:00
9dae47934f Merge remote-tracking branch 'origin/dev' into dev 2025-07-03 14:47:33 +08:00
0e726a214d 删除无用代码 2025-07-03 14:47:27 +08:00
26 changed files with 2521 additions and 246 deletions

View File

@ -1,8 +1,12 @@
package com.xzzn.web.controller.ems;
import com.xzzn.common.core.controller.BaseController;
import com.xzzn.common.core.domain.AjaxResult;
import com.xzzn.common.core.page.TableDataInfo;
import com.xzzn.ems.domain.EmsDevicesSetting;
import com.xzzn.ems.domain.EmsSiteSetting;
import com.xzzn.ems.domain.vo.SiteDeviceListVo;
import com.xzzn.ems.service.IEmsDeviceSettingService;
import com.xzzn.ems.service.IEmsSiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -24,6 +28,9 @@ public class EmsSiteConfigController extends BaseController{
@Autowired
private IEmsSiteService iEmsSiteService;
@Autowired
private IEmsDeviceSettingService iEmsDeviceSettingService;
/**
* 获取站点列表
*/
@ -35,4 +42,23 @@ public class EmsSiteConfigController extends BaseController{
return getDataTable(list);
}
/**
* 获取设备列表
*/
@GetMapping("/getDeviceInfoList")
public TableDataInfo getDeviceInfoList(@RequestParam String siteId)
{
startPage();
List<SiteDeviceListVo> list = iEmsSiteService.getAllDeviceList(siteId);
return getDataTable(list);
}
/**
* 获取设备详细信息
*/
@GetMapping("/getDeviceDetailInfo")
public AjaxResult getDeviceDetailInfo(@RequestParam String deviceId)
{
return success(iEmsDeviceSettingService.getDeviceDetailInfo(deviceId));
}
}

View File

@ -1,29 +0,0 @@
package com.xzzn.web.controller.ems.data;
public class FXDataProcess {
public void batteryClusterProcess(String data) {
}
public void batteryStackProcess(String data) {
}
public void batteryDataProcess(String data) {
}
public void pcsProcess(String data) {
}
public void pcsBranchProcess(String data) {
}
public void coolingProcess(String data) {
}
public void ameterProcess(String data) {
}
}

View File

@ -31,4 +31,9 @@ public class RedisKeyConstants
* battery单体电池数据 redis key
*/
public static final String BATTERY = "BATTERY_";
/**
* 电表数据 redis key
*/
public static final String AMMETER = "AMMETER_";
}

View File

@ -5,14 +5,18 @@ package com.xzzn.common.enums;
*
* @author xzzn
*/
public enum AmmeterCategoryStatus
public enum AmmeterCategory
{
TOTAL_CHARGE("1", "累计充电量"), TOTAL_DISCHARGE("2", "累计放电量"), DAILY_CHARGE("3", "日充电量"), DAILY_DISCHARGE("4", "日放电量");
CURRENT_COMB_ACTIVE("1", "当前组合有功电能"),
CURRENT_COMB_REACTIVE("2", "当前组合无功"),
A_POWER("3", "A相功率"),
B_POWER("4", "B相功率"),
C_POWER("5", "C相功率");
private final String code;
private final String info;
AmmeterCategoryStatus(String code, String info)
AmmeterCategory(String code, String info)
{
this.code = code;
this.info = info;

View File

@ -22,8 +22,8 @@ public class EmsPcsData extends BaseEntity
private Long id;
/** 数据更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "数据更新时间", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "数据更新时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date dataUpdateTime;
/** 工作状态 */

View File

@ -0,0 +1,31 @@
package com.xzzn.ems.domain.vo;
import java.util.List;
/**
* 电表数据
*/
public class AmmeterDataResponse {
/** 总表信息 */
private AmmeterLoadDataVo ammeterLoadData;
/** 储能表信息 */
private AmmeterMeteDataVo ammeterMeteData;
public AmmeterLoadDataVo getAmmeterLoadData() {
return ammeterLoadData;
}
public void setAmmeterLoadDataVoList(AmmeterLoadDataVo ammeterLoadData) {
this.ammeterLoadData = ammeterLoadData;
}
public AmmeterMeteDataVo getAmmeterMeteData() {
return ammeterMeteData;
}
public void setAmmeterMeteDataVoList(AmmeterMeteDataVo ammeterMeteData) {
this.ammeterMeteData = ammeterMeteData;
}
}

View File

@ -6,9 +6,9 @@ import java.util.Date;
import java.util.List;
/**
* 电表数据
* 电表-总表数据
*/
public class AmmeterDataVo {
public class AmmeterLoadDataVo {
/** 电表名称 */
private String deviceName;
@ -20,7 +20,8 @@ public class AmmeterDataVo {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dataUpdateTime;
private List<AmmeterDataDetailInfo> ammeterDataDetailInfos;
/** 总表数据信息 */
private List<LoadDataDetailInfo> loadDataDetailInfo;
public String getDeviceName() {
return deviceName;
@ -46,11 +47,11 @@ public class AmmeterDataVo {
this.dataUpdateTime = dataUpdateTime;
}
public List<AmmeterDataDetailInfo> getAmmeterDataDetailInfos() {
return ammeterDataDetailInfos;
public List<LoadDataDetailInfo> getLoadDataDetailInfo() {
return loadDataDetailInfo;
}
public void setAmmeterDataDetailInfos(List<AmmeterDataDetailInfo> ammeterDataDetailInfos) {
this.ammeterDataDetailInfos = ammeterDataDetailInfos;
public void setLoadDataDetailInfo(List<LoadDataDetailInfo> loadDataDetailInfo) {
this.loadDataDetailInfo = loadDataDetailInfo;
}
}

View File

@ -0,0 +1,57 @@
package com.xzzn.ems.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
import java.util.List;
/**
* 电表-总表数据
*/
public class AmmeterMeteDataVo {
/** 电表名称 */
private String deviceName;
/** 通信状态 */
private String emsCommunicationStatus;
/** 数据更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dataUpdateTime;
/** 储能表数据信息 */
private List<MeteDataDetailInfo> meteDataDetailInfo;
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getEmsCommunicationStatus() {
return emsCommunicationStatus;
}
public void setEmsCommunicationStatus(String emsCommunicationStatus) {
this.emsCommunicationStatus = emsCommunicationStatus;
}
public Date getDataUpdateTime() {
return dataUpdateTime;
}
public void setDataUpdateTime(Date dataUpdateTime) {
this.dataUpdateTime = dataUpdateTime;
}
public List<MeteDataDetailInfo> getMeteDataDetailInfo() {
return meteDataDetailInfo;
}
public void setMeteDataDetailInfo(List<MeteDataDetailInfo> meteDataDetailInfo) {
this.meteDataDetailInfo = meteDataDetailInfo;
}
}

View File

@ -21,16 +21,16 @@ public class BMSBatteryDataList {
private BigDecimal currentSoc;
/** 单体最高电压 (V) */
private BigDecimal maxVoltage;
private BigDecimal maxCellVoltage;
/** 单体最低电压 (V) */
private BigDecimal minVoltage;
private BigDecimal minCellVoltage;
/** 单体最高温度 (℃) */
private BigDecimal maxTemperature;
private BigDecimal maxCellTemp;
/** 单体最低温度 (℃) */
private BigDecimal minTemperature;
private BigDecimal minCellTemp;
/** 换电站id */
private String siteId;
@ -46,36 +46,52 @@ public class BMSBatteryDataList {
this.clusterId = clusterId;
}
public BigDecimal getMinTemperature() {
return minTemperature;
public String getStackDeviceId() {
return stackDeviceId;
}
public void setMinTemperature(BigDecimal minTemperature) {
this.minTemperature = minTemperature;
public void setStackDeviceId(String stackDeviceId) {
this.stackDeviceId = stackDeviceId;
}
public BigDecimal getMaxTemperature() {
return maxTemperature;
public String getSiteId() {
return siteId;
}
public void setMaxTemperature(BigDecimal maxTemperature) {
this.maxTemperature = maxTemperature;
public void setSiteId(String siteId) {
this.siteId = siteId;
}
public BigDecimal getMinVoltage() {
return minVoltage;
public BigDecimal getMinCellTemp() {
return minCellTemp;
}
public void setMinVoltage(BigDecimal minVoltage) {
this.minVoltage = minVoltage;
public void setMinCellTemp(BigDecimal minCellTemp) {
this.minCellTemp = minCellTemp;
}
public BigDecimal getMaxVoltage() {
return maxVoltage;
public BigDecimal getMaxCellTemp() {
return maxCellTemp;
}
public void setMaxVoltage(BigDecimal maxVoltage) {
this.maxVoltage = maxVoltage;
public void setMaxCellTemp(BigDecimal maxCellTemp) {
this.maxCellTemp = maxCellTemp;
}
public BigDecimal getMinCellVoltage() {
return minCellVoltage;
}
public void setMinCellVoltage(BigDecimal minCellVoltage) {
this.minCellVoltage = minCellVoltage;
}
public BigDecimal getMaxCellVoltage() {
return maxCellVoltage;
}
public void setMaxCellVoltage(BigDecimal maxCellVoltage) {
this.maxCellVoltage = maxCellVoltage;
}
public BigDecimal getCurrentSoc() {

View File

@ -1,36 +1,30 @@
package com.xzzn.ems.domain.vo;
import java.math.BigDecimal;
import java.util.Date;
/**
* 电表详细数据
* 电表-总表数据展示
*/
public class AmmeterDataDetailInfo
public class LoadDataDetailInfo
{
/** 类别 */
private String category;
/** 总 (kWh) */
private BigDecimal totalKwh;
private BigDecimal totalKwh = BigDecimal.ZERO;
/** 尖 (kWh) */
private BigDecimal sharpKwh;
private BigDecimal peakKwh = BigDecimal.ZERO;
/** 峰 (kWh) */
private BigDecimal peakKwh;
private BigDecimal highKwh = BigDecimal.ZERO;
/** 平 (kWh) */
private BigDecimal flatKwh;
private BigDecimal flatKwh = BigDecimal.ZERO;
/** 谷 (kWh) */
private BigDecimal valleyKwh;
private BigDecimal valleyKwh = BigDecimal.ZERO;
/** 总表设备Id */
private String deviceId;
/** 数据更新时间 */
private Date updateTime;
public BigDecimal getValleyKwh() {
return valleyKwh;
@ -56,12 +50,12 @@ public class AmmeterDataDetailInfo
this.peakKwh = peakKwh;
}
public BigDecimal getSharpKwh() {
return sharpKwh;
public BigDecimal getHighKwh() {
return highKwh;
}
public void setSharpKwh(BigDecimal sharpKwh) {
this.sharpKwh = sharpKwh;
public void setHighKwh(BigDecimal highKwh) {
this.highKwh = highKwh;
}
public BigDecimal getTotalKwh() {
@ -79,20 +73,4 @@ public class AmmeterDataDetailInfo
public void setCategory(String category) {
this.category = category;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public Date getUpdateTime() {
return updateTime;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
}
}

View File

@ -0,0 +1,42 @@
package com.xzzn.ems.domain.vo;
import java.math.BigDecimal;
/**
* 电表-储能表数据展示
*/
public class MeteDataDetailInfo
{
/** 类别A相 B相 C相*/
private String category;
/** 有功功率 */
private BigDecimal activePower = BigDecimal.ZERO;
/** 无功功率 */
private BigDecimal reactivePower = BigDecimal.ZERO;
public String getCategory() {
return category;
}
public void setCategory(String category) {
this.category = category;
}
public BigDecimal getActivePower() {
return activePower;
}
public void setActivePower(BigDecimal activePower) {
this.activePower = activePower;
}
public BigDecimal getReactivePower() {
return reactivePower;
}
public void setReactivePower(BigDecimal reactivePower) {
this.reactivePower = reactivePower;
}
}

View File

@ -0,0 +1,68 @@
package com.xzzn.ems.domain.vo;
/**
* 站点管理-站点设备列表
*
*/
public class SiteDeviceListVo {
/** 站点id */
private String siteId;
/** 站点名称 */
private String siteName;
/** 设备id */
private String deviceId;
/** 设备名称 */
private String deviceName;
/** 设备类型 */
private String deviceType;
/** 通信状态 */
private String communicationStatus;
public String getSiteId() {
return siteId;
}
public void setSiteId(String siteId) {
this.siteId = siteId;
}
public String getSiteName() {
return siteName;
}
public void setSiteName(String siteName) {
this.siteName = siteName;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
public String getCommunicationStatus() {
return communicationStatus;
}
public void setCommunicationStatus(String communicationStatus) {
this.communicationStatus = communicationStatus;
}
}

View File

@ -2,14 +2,12 @@ package com.xzzn.ems.mapper;
import java.util.List;
import com.xzzn.ems.domain.EmsAmmeterData;
import com.xzzn.ems.domain.vo.AmmeterDataDetailInfo;
import org.apache.ibatis.annotations.Param;
/**
* 总数据Mapper接口
*
* @author xzzn
* @date 2025-06-27
* @date 2025-07-03
*/
public interface EmsAmmeterDataMapper
{
@ -60,11 +58,4 @@ public interface EmsAmmeterDataMapper
* @return 结果
*/
public int deleteEmsAmmeterDataByIds(Long[] ids);
/**
* 获取总表详细数据
* @param siteId
* @return
*/
public List<AmmeterDataDetailInfo> getAmmeterDetailInfo(@Param("siteId")String siteId,@Param("deviceId") String deviceId);
}

View File

@ -74,7 +74,6 @@ public interface EmsDevicesSettingMapper
*/
public List<EmsDevicesSetting> getAllBatteryDeviceBySiteId(String siteId);
/**
* 根据site_id和device_category获取指定设备信息
* @param siteId
@ -82,4 +81,11 @@ public interface EmsDevicesSettingMapper
* @return
*/
public List<Map<String, Object>> getDeviceInfosBySiteIdAndCategory(@Param("siteId")String siteId, @Param("deviceCategory")String deviceCategory);
/**
* 获取该设备的详细数据
* @param deviceId
* @return
*/
public EmsDevicesSetting getDeviceDetailInfo(String deviceId);
}

View File

@ -2,6 +2,7 @@ package com.xzzn.ems.mapper;
import java.util.List;
import com.xzzn.ems.domain.EmsSiteSetting;
import com.xzzn.ems.domain.vo.SiteDeviceListVo;
import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
import org.apache.ibatis.annotations.Param;
@ -83,4 +84,10 @@ public interface EmsSiteSettingMapper
* @return
*/
public List<EmsSiteSetting> getSiteInfoList(@Param("siteName")String siteName, @Param("startTime")String startTime, @Param("endTime")String endTime);
/**
* 获取站点的设备列表
* @return
*/
public List<SiteDeviceListVo> getAllSiteDeviceList(String siteId);
}

View File

@ -0,0 +1,13 @@
package com.xzzn.ems.service;
import com.xzzn.ems.domain.EmsDevicesSetting;
/**
* 设备信息 服务层
*
*/
public interface IEmsDeviceSettingService
{
public EmsDevicesSetting getDeviceDetailInfo(String deviceId);
}

View File

@ -1,6 +1,7 @@
package com.xzzn.ems.service;
import com.xzzn.ems.domain.EmsSiteSetting;
import com.xzzn.ems.domain.vo.SiteDeviceListVo;
import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
import java.util.List;
@ -22,6 +23,7 @@ public interface IEmsSiteService
public List<Map<String,Object>> getAllClusterInfo(String stackDeviceId);
public List<EmsSiteSetting> getAllSiteInfoList(String siteName, String startTime, String endTime);
public List<SiteDeviceListVo> getAllDeviceList(String siteId);
}

View File

@ -29,5 +29,5 @@ public interface ISingleSiteService
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId,String siteId);
public List<AmmeterDataVo> getAmmeterDataList(String siteId);
public AmmeterDataResponse getAmmeterDataList(String siteId);
}

View File

@ -0,0 +1,28 @@
package com.xzzn.ems.service.impl;
import com.xzzn.ems.domain.EmsDevicesSetting;
import com.xzzn.ems.mapper.EmsDevicesSettingMapper;
import com.xzzn.ems.service.IEmsDeviceSettingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
/**
* 站点信息 服务层实现
*
*/
@Service
public class EmsDeviceSettingServiceImpl implements IEmsDeviceSettingService
{
@Autowired
private EmsDevicesSettingMapper emsDevicesMapper;
/**
* 获取设备详细信息
* @param deviceId
* @return
*/
@Override
public EmsDevicesSetting getDeviceDetailInfo(String deviceId) {
return emsDevicesMapper.getDeviceDetailInfo(deviceId);
}
}

View File

@ -2,6 +2,7 @@ package com.xzzn.ems.service.impl;
import com.xzzn.common.enums.DeviceCategory;
import com.xzzn.ems.domain.EmsSiteSetting;
import com.xzzn.ems.domain.vo.SiteDeviceListVo;
import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
import com.xzzn.ems.mapper.EmsDevicesSettingMapper;
import com.xzzn.ems.mapper.EmsSiteSettingMapper;
@ -67,4 +68,14 @@ public class EmsSiteServiceImpl implements IEmsSiteService
return emsSiteMapper.getSiteInfoList(siteName,startTime,endTime);
}
/**
* 获取设备列表
*
* @param siteId
* @return
*/
@Override
public List<SiteDeviceListVo> getAllDeviceList(String siteId) {
return emsSiteMapper.getAllSiteDeviceList(siteId);
}
}

View File

@ -17,7 +17,6 @@ import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.math.BigDecimal;
import java.util.*;
@Service
@ -43,7 +42,10 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
private RedisCache redisCache;
@Autowired
private EmsDevicesSettingMapper emsDevicesSettingMapper;;
private EmsDevicesSettingMapper emsDevicesSettingMapper;
@Autowired
private EmsAmmeterDataMapper emsAmmeterDataMapper;;
@Override
public void handleFxData(String message) {
@ -61,15 +63,20 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
} else if (deviceId.contains("BMSC")) {
log.info("BMSC data:"+ jsonData);
batteryCluserDataProcess(deviceId, jsonData);
batteryClusterDataProcess(deviceId, jsonData);
batteryDataProcess(deviceId, jsonData);
} else if (deviceId.contains("PCS")) {
pcsDataProcess(deviceId, jsonData);
pcsBranchDataProcess(deviceId, jsonData);
} else if (deviceId.contains("LOAD")) {
loadDataProcess(deviceId, jsonData);
} else if (deviceId.contains("METE")) {
meteDataProcess(deviceId, jsonData);
}
}
}
private void batteryStackDataProcess(String deviceId, String dataJson) {
//电池堆
@ -151,7 +158,7 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
}
private void batteryCluserDataProcess(String deviceId, String dataJson) {
private void batteryClusterDataProcess(String deviceId, String dataJson) {
Map<String, Object> obj = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
});
@ -161,7 +168,7 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
String stackDeviceId = "";
if (up != null && up.size() >0) {
stackDeviceId = up.get(0).getParentId();
if (stackDeviceId != null || stackDeviceId.isEmpty()) {
if (stackDeviceId == null || stackDeviceId.isEmpty()) {
stackDeviceId = "1";
}
}
@ -239,7 +246,7 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
String stackDeviceId = "";
if (up != null && up.size() >0) {
stackDeviceId = up.get(0).getParentId();
if (stackDeviceId != null || stackDeviceId.isEmpty()) {
if (stackDeviceId == null || stackDeviceId.isEmpty()) {
stackDeviceId = "1";
}
}
@ -346,7 +353,6 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
}
private void pcsBranchDataProcess(String deviceId, String dataJson) {
Map<String, Map<String, Object>> records = processDataPrefix(JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {}));
@ -394,7 +400,192 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
}
private void loadDataProcess(String deviceId, String dataJson) {
//总表
Map<String, Object> obj = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
});
EmsAmmeterData dataLoad = new EmsAmmeterData();
// 更新时间
dataLoad.setDataUpdateTime(new Date());
// 电能设置-组合有功
dataLoad.setCurrentCombActiveTotal(StringUtils.getBigDecimal(obj.get("DQZHYGZDN")));
dataLoad.setCurrentCombActivePeak(StringUtils.getBigDecimal(obj.get("DQZHYGJDN")));
dataLoad.setCurrentCombActiveHigh(StringUtils.getBigDecimal(obj.get("DQZHYGFDN")));
dataLoad.setCurrentCombActiveFlat(StringUtils.getBigDecimal(obj.get("DQZHYGPDN")));
dataLoad.setCurrentCombActiveValley(StringUtils.getBigDecimal(obj.get("DQZHYGGDN")));
// 电能设置-正向有功
dataLoad.setCurrentForwardActiveTotal(StringUtils.getBigDecimal(obj.get("DQZXYGZDN")));
dataLoad.setCurrentForwardActivePeak(StringUtils.getBigDecimal(obj.get("DQZXYGJDN")));
dataLoad.setCurrentForwardActiveHigh(StringUtils.getBigDecimal(obj.get("DQZXYGFDN")));
dataLoad.setCurrentForwardActiveFlat(StringUtils.getBigDecimal(obj.get("DQZXYGPDN")));
dataLoad.setCurrentForwardActiveValley(StringUtils.getBigDecimal(obj.get("DQZXYGGDN")));
// 电能设置-反向有功
dataLoad.setCurrentReverseActiveTotal(StringUtils.getBigDecimal(obj.get("DQFXYGZDN")));
dataLoad.setCurrentReverseActivePeak(StringUtils.getBigDecimal(obj.get("DQFXYGJDN")));
dataLoad.setCurrentReverseActiveHigh(StringUtils.getBigDecimal(obj.get("DQFXYGFDN")));
dataLoad.setCurrentReverseActiveFlat(StringUtils.getBigDecimal(obj.get("DQFXYGPDN")));
dataLoad.setCurrentReverseActiveValley(StringUtils.getBigDecimal(obj.get("DQFXYGGDN")));
// 电能设置-组合无功
dataLoad.setCurrentCombReactiveTotal(StringUtils.getBigDecimal(obj.get("DQZHWGZDN")));
dataLoad.setCurrentCombReactivePeak(StringUtils.getBigDecimal(obj.get("DQZHWGJDN")));
dataLoad.setCurrentCombReactiveHigh(StringUtils.getBigDecimal(obj.get("DQZHWGFDN")));
dataLoad.setCurrentCombReactiveFlat(StringUtils.getBigDecimal(obj.get("DQZHWGPDN")));
dataLoad.setCurrentCombReactiveValley(StringUtils.getBigDecimal(obj.get("DQZHWGGDN")));
// 电能设置-正向无功
dataLoad.setCurrentForwardReactiveTotal(StringUtils.getBigDecimal(obj.get("DQZXWGZDN")));
dataLoad.setCurrentForwardReactivePeak(StringUtils.getBigDecimal(obj.get("DQZXWGJDN")));
dataLoad.setCurrentForwardReactiveHigh(StringUtils.getBigDecimal(obj.get("DQZXWGFDN")));
dataLoad.setCurrentForwardReactiveFlat(StringUtils.getBigDecimal(obj.get("DQZXWGPDN")));
dataLoad.setCurrentForwardReactiveValley(StringUtils.getBigDecimal(obj.get("DQZXWGGDN")));
// 电能设置-反向无功
dataLoad.setCurrentReverseReactiveTotal(StringUtils.getBigDecimal(obj.get("DQFXWGZDN")));
dataLoad.setCurrentReverseReactivePeak(StringUtils.getBigDecimal(obj.get("DQFXWGJDN")));
dataLoad.setCurrentReverseReactiveHigh(StringUtils.getBigDecimal(obj.get("DQFXWGFDN")));
dataLoad.setCurrentReverseReactiveFlat(StringUtils.getBigDecimal(obj.get("DQFXWGPDN")));
dataLoad.setCurrentReverseReactiveValley(StringUtils.getBigDecimal(obj.get("DQFXWGGDN")));
// 电压+电流
dataLoad.setPhaseAVoltage(StringUtils.getBigDecimal(obj.get("AXDY")));
dataLoad.setPhaseBVoltage(StringUtils.getBigDecimal(obj.get("BXDY")));
dataLoad.setPhaseCVoltage(StringUtils.getBigDecimal(obj.get("CXDY")));
dataLoad.setPhaseACurrent(StringUtils.getBigDecimal(obj.get("AXDL")));
dataLoad.setPhaseBCurrent(StringUtils.getBigDecimal(obj.get("BXDL")));
dataLoad.setPhaseCCurrent(StringUtils.getBigDecimal(obj.get("CXDL")));
dataLoad.setAbLineVoltage(StringUtils.getBigDecimal(obj.get("ABXDY")));
dataLoad.setCbLineVoltage(StringUtils.getBigDecimal(obj.get("CBXDY")));
dataLoad.setAcLineVoltage(StringUtils.getBigDecimal(obj.get("ACXDY")));
// 频率
dataLoad.setFrequency(StringUtils.getBigDecimal(obj.get("PL")));
// 功率 有功+总+无功+无总+视在
dataLoad.setPhaseAActivePower(StringUtils.getBigDecimal(obj.get("AXYGGL")));
dataLoad.setPhaseBActivePower(StringUtils.getBigDecimal(obj.get("BXYGGL")));
dataLoad.setPhaseCActivePower(StringUtils.getBigDecimal(obj.get("CXYGGL")));
dataLoad.setTotalActivePower(StringUtils.getBigDecimal(obj.get("ZYGGL")));
dataLoad.setPhaseAReactivePower(StringUtils.getBigDecimal(obj.get("AXWGGL")));
dataLoad.setPhaseBReactivePower(StringUtils.getBigDecimal(obj.get("BXWGGL")));
dataLoad.setPhaseCReactivePower(StringUtils.getBigDecimal(obj.get("CXWGGL")));
dataLoad.setTotalReactivePower(StringUtils.getBigDecimal(obj.get("ZWGGL")));
dataLoad.setPhaseAApparentPower(StringUtils.getBigDecimal(obj.get("AXSZGL")));
dataLoad.setPhaseBApparentPower(StringUtils.getBigDecimal(obj.get("BXSZGL")));
dataLoad.setPhaseCApparentPower(StringUtils.getBigDecimal(obj.get("CXSZGL")));
dataLoad.setTotalApparentPower(StringUtils.getBigDecimal(obj.get("ZSZGL")));
// 功率因数
dataLoad.setPhaseAPowerFactor(StringUtils.getBigDecimal(obj.get("AXGLYS")));
dataLoad.setPhaseBPowerFactor(StringUtils.getBigDecimal(obj.get("BXGLYS")));
dataLoad.setPhaseCPowerFactor(StringUtils.getBigDecimal(obj.get("CXGLYS")));
dataLoad.setTotalPowerFactor(StringUtils.getBigDecimal(obj.get("ZGLYS")));
// 需量
dataLoad.setForwardAcMaxDemand(StringUtils.getBigDecimal(obj.get("ZXYGZDXL")));
dataLoad.setReverseAcMaxDemand(StringUtils.getBigDecimal(obj.get("FXYGZDXL")));
dataLoad.setDailyForwardMaxDemand(StringUtils.getBigDecimal(obj.get("DRZXYGZDXL")));
dataLoad.setCreateBy("system");
dataLoad.setCreateTime(DateUtils.getNowDate());
dataLoad.setUpdateBy("system");
dataLoad.setUpdateTime(DateUtils.getNowDate());
dataLoad.setSiteId(SITE_ID);
dataLoad.setDeviceId(deviceId);
emsAmmeterDataMapper.insertEmsAmmeterData(dataLoad);
redisCache.setCacheObject(RedisKeyConstants.AMMETER + SITE_ID + "_" +deviceId, dataLoad);
}
private void meteDataProcess(String deviceId, String dataJson) {
//总表
Map<String, Object> obj = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
});
EmsAmmeterData dataLoad = new EmsAmmeterData();
// 更新时间
dataLoad.setDataUpdateTime(new Date());
// 电压+电流
dataLoad.setPhaseAVoltage(StringUtils.getBigDecimal(obj.get("AXDY")));
dataLoad.setPhaseBVoltage(StringUtils.getBigDecimal(obj.get("BXDY")));
dataLoad.setPhaseCVoltage(StringUtils.getBigDecimal(obj.get("CXDY")));
dataLoad.setPhaseACurrent(StringUtils.getBigDecimal(obj.get("AXDL")));
dataLoad.setPhaseBCurrent(StringUtils.getBigDecimal(obj.get("BXDL")));
dataLoad.setPhaseCCurrent(StringUtils.getBigDecimal(obj.get("CXDL")));
dataLoad.setAbLineVoltage(StringUtils.getBigDecimal(obj.get("ABXDY")));
dataLoad.setCbLineVoltage(StringUtils.getBigDecimal(obj.get("BCXDY")));
dataLoad.setAcLineVoltage(StringUtils.getBigDecimal(obj.get("CAXDY")));
// 频率
dataLoad.setFrequency(StringUtils.getBigDecimal(obj.get("DWPL")));
// 功率
dataLoad.setPhaseAActivePower(StringUtils.getBigDecimal(obj.get("AXYGGL")));
dataLoad.setPhaseBActivePower(StringUtils.getBigDecimal(obj.get("BXYGGL")));
dataLoad.setPhaseCActivePower(StringUtils.getBigDecimal(obj.get("CXYGGL")));
dataLoad.setTotalActivePower(StringUtils.getBigDecimal(obj.get("ZYGGL")));
dataLoad.setPhaseAReactivePower(StringUtils.getBigDecimal(obj.get("AXWGGL")));
dataLoad.setPhaseBReactivePower(StringUtils.getBigDecimal(obj.get("BXWGGL")));
dataLoad.setPhaseCReactivePower(StringUtils.getBigDecimal(obj.get("CXWGGL")));
dataLoad.setTotalReactivePower(StringUtils.getBigDecimal(obj.get("ZWGGL")));
dataLoad.setTotalApparentPower(StringUtils.getBigDecimal(obj.get("ZSZGL")));
dataLoad.setTotalPowerFactor(StringUtils.getBigDecimal(obj.get("ZGLYS")));
// 二次相关数据
dataLoad.setSecondaryAbLineVoltage(StringUtils.getBigDecimal(obj.get("ECABXDY")));
dataLoad.setSecondaryAPhaseCurrent(StringUtils.getBigDecimal(obj.get("ECAXDL")));
dataLoad.setSecondaryAPhaseVoltage(StringUtils.getBigDecimal(obj.get("ECAXDY")));
dataLoad.setSecondaryAPowerFactor(StringUtils.getBigDecimal(obj.get("ECAXGLYS")));
dataLoad.setSecondaryAApparentPower(StringUtils.getBigDecimal(obj.get("ECAXSZGL")));
dataLoad.setSecondaryAReactivePower(StringUtils.getBigDecimal(obj.get("ECAXWGGL")));
dataLoad.setSecondaryAActivePower(StringUtils.getBigDecimal(obj.get("ECAXYGGL")));
dataLoad.setSecondaryBcLineVoltage(StringUtils.getBigDecimal(obj.get("ECBCXDY")));
dataLoad.setSecondaryBPhaseCurrent(StringUtils.getBigDecimal(obj.get("ECBXDL")));
dataLoad.setSecondaryBPhaseVoltage(StringUtils.getBigDecimal(obj.get("ECBXDY")));
dataLoad.setSecondaryBPowerFactor(StringUtils.getBigDecimal(obj.get("ECBXGLYS")));
dataLoad.setSecondaryBApparentPower(StringUtils.getBigDecimal(obj.get("ECBXSZGL")));
dataLoad.setSecondaryBReactivePower(StringUtils.getBigDecimal(obj.get("ECBXWGGL")));
dataLoad.setSecondaryBActivePower(StringUtils.getBigDecimal(obj.get("ECBXYGGL")));
dataLoad.setSecondaryCaLineVoltage(StringUtils.getBigDecimal(obj.get("ECCAXDY")));
dataLoad.setSecondaryCPhaseCurrent(StringUtils.getBigDecimal(obj.get("ECCXDL")));
dataLoad.setSecondaryCPhaseVoltage(StringUtils.getBigDecimal(obj.get("ECCXDY")));
dataLoad.setSecondaryCPowerFactor(StringUtils.getBigDecimal(obj.get("ECCXGLYS")));
dataLoad.setSecondaryCApparentPower(StringUtils.getBigDecimal(obj.get("ECCXSZGL")));
dataLoad.setSecondaryCReactivePower(StringUtils.getBigDecimal(obj.get("ECCXWGGL")));
dataLoad.setSecondaryCActivePower(StringUtils.getBigDecimal(obj.get("ECCXYGGL")));
dataLoad.setSecondaryGridFrequency(StringUtils.getBigDecimal(obj.get("ECDWPL")));
dataLoad.setSecondaryReverseReactiveEnergy(StringUtils.getBigDecimal(obj.get("ECFXWGDN")));
dataLoad.setSecondaryNegativeActiveEnergy(StringUtils.getBigDecimal(obj.get("ECFXYGDN")));
dataLoad.setSecondaryTotalPowerFactor(StringUtils.getBigDecimal(obj.get("ECZGLYS")));
dataLoad.setSecondaryTotalApparentPower(StringUtils.getBigDecimal(obj.get("ECZSZFL")));
dataLoad.setSecondaryTotalReactivePower(StringUtils.getBigDecimal(obj.get("ECZWGGL")));
dataLoad.setSecondaryPositiveReactiveEnergy(StringUtils.getBigDecimal(obj.get("ECZXWGDN")));
dataLoad.setSecondaryPositiveActiveEnergy(StringUtils.getBigDecimal(obj.get("ECZXYGDN")));
dataLoad.setSecondaryTotalActivePower(StringUtils.getBigDecimal(obj.get("ECZYGGL")));
// 需量
dataLoad.setReverseReactiveEnergyEqMinus(StringUtils.getBigDecimal(obj.get("FXWGDN")));
dataLoad.setReverseActiveEnergyEpMinus(StringUtils.getBigDecimal(obj.get("FXYGDN")));
dataLoad.setPositiveReactiveEnergyEqPlus(StringUtils.getBigDecimal(obj.get("ZXWGDN")));
dataLoad.setPositiveActiveEnergyEpPlus(StringUtils.getBigDecimal(obj.get("ZXYGDN")));
dataLoad.setCreateBy("system");
dataLoad.setCreateTime(DateUtils.getNowDate());
dataLoad.setUpdateBy("system");
dataLoad.setUpdateTime(DateUtils.getNowDate());
dataLoad.setSiteId(SITE_ID);
dataLoad.setDeviceId(deviceId);
emsAmmeterDataMapper.insertEmsAmmeterData(dataLoad);
redisCache.setCacheObject(RedisKeyConstants.AMMETER + SITE_ID + "_" +deviceId, dataLoad);
}
// 数据分组处理
private static Map<String, Map<String, Object>> processData(Map<String, Object> rawData) {
Map<String, Map<String, Object>> records = new HashMap<>();

View File

@ -2,6 +2,7 @@ package com.xzzn.ems.service.impl;
import com.xzzn.common.constant.RedisKeyConstants;
import com.xzzn.common.core.redis.RedisCache;
import com.xzzn.common.enums.AmmeterCategory;
import com.xzzn.common.enums.DeviceCategory;
import com.xzzn.common.utils.StringUtils;
import com.xzzn.ems.domain.*;
@ -28,6 +29,10 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
private static final String CLUSTER_DATA_SOC = "SOC";
private static final String AMMETER_DEVICE_LOAD = "LOAD";
private static final String AMMETER_DEVICE_METE = "METE";
@Autowired
private EmsPcsDataMapper emsPcsDataMapper;
@Autowired
@ -195,10 +200,9 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
if (stackData != null) {
BeanUtils.copyProperties(stackData, bmsOverViewVo);
}
// 列表数据
// 下面簇列表数据
if (!StringUtils.isEmpty(stackId)) {
List<BMSBatteryDataList> batteryDataList = emsBatteryClusterMapper.getBmsBatteryData(siteId,stackId);
bmsOverViewVo.setBatteryDataList(batteryDataList);
getBMSClusterListInfo(siteId,stackId,bmsOverViewVo);
}
bmsOverViewVoList.add(bmsOverViewVo);
}
@ -206,6 +210,25 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
return bmsOverViewVoList;
}
private void getBMSClusterListInfo(String siteId, String stackId, BMSOverViewVo bmsOverViewVo) {
List<BMSBatteryDataList> batteryDataList = new ArrayList();
List<Map<String, Object>> clusterIds = emsDevicesSettingMapper.getDeviceInfoByParentId(stackId);
for (Map<String, Object> clusterDevice : clusterIds) {
BMSBatteryDataList bmsBatteryDataList= new BMSBatteryDataList();
// 从redis取单个簇的详细数据
String clusterId = clusterDevice.get("id").toString();
bmsBatteryDataList.setClusterId(clusterId);
EmsBatteryCluster clusterData = redisCache.getCacheObject(RedisKeyConstants.CLUSTER + siteId + "_" + clusterId);
if (clusterData != null) {
BeanUtils.copyProperties(clusterData, bmsBatteryDataList);
}
batteryDataList.add(bmsBatteryDataList);
}
bmsOverViewVo.setBatteryDataList(batteryDataList);
}
// 获取BMS电池簇数据
@Override
public List<BMSBatteryClusterVo> getBMSBatteryCluster(String siteId) {
@ -312,29 +335,96 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
* @return
*/
@Override
public List<AmmeterDataVo> getAmmeterDataList(String siteId) {
List<AmmeterDataVo> ammeterDataVos = new ArrayList<>();
public AmmeterDataResponse getAmmeterDataList(String siteId) {
AmmeterDataResponse ammeterResponse = new AmmeterDataResponse();
if (!StringUtils.isEmpty(siteId)) {
// 先获取所有电表设备
List<EmsDevicesSetting> devicesList = emsDevicesSettingMapper.getAllBatteryDeviceBySiteId(siteId);
if (!CollectionUtils.isEmpty(devicesList)) {
for (EmsDevicesSetting devicesSetting : devicesList) {
AmmeterDataVo ammeterDataVo = new AmmeterDataVo();
ammeterDataVo.setDeviceName(devicesSetting.getDeviceName());
ammeterDataVo.setEmsCommunicationStatus(devicesSetting.getCommunicationStatus());
String deviceId = devicesSetting.getDeviceId();
// 获取类别数据
List<AmmeterDataDetailInfo> ammeterDataDetailInfos = emsAmmeterDataMapper.getAmmeterDetailInfo(siteId,deviceId);
ammeterDataVo.setAmmeterDataDetailInfos(ammeterDataDetailInfos);
// 数据更新时间
ammeterDataVo.setDataUpdateTime(ammeterDataDetailInfos.get(0).getUpdateTime());
// 先获取电表设备
List<Map<String, Object>> ammeterIdList = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.AMMETER.getCode());
ammeterDataVos.add(ammeterDataVo);
for (Map<String, Object> ammeterDevice : ammeterIdList) {
String ammeterId = ammeterDevice.get("id").toString();
// 从redis取总表详细数据
EmsAmmeterData ammeterData = redisCache.getCacheObject(RedisKeyConstants.AMMETER + siteId + "_" +ammeterId);
// 判断电表类型
if (AMMETER_DEVICE_LOAD.equals(ammeterId)) {
AmmeterLoadDataVo ammeterLoadDataVo = new AmmeterLoadDataVo();
ammeterLoadDataVo.setDeviceName(ammeterDevice.get("deviceName").toString());
ammeterLoadDataVo.setEmsCommunicationStatus(ammeterDevice.get("communicationStatus").toString());
// 处理总表数据
dealAmmeterLoadData(ammeterData,ammeterLoadDataVo);
ammeterResponse.setAmmeterLoadDataVoList(ammeterLoadDataVo);
} else if (AMMETER_DEVICE_METE.equals(ammeterId)) {
AmmeterMeteDataVo ammeterMeteDataVo = new AmmeterMeteDataVo();
ammeterMeteDataVo.setDeviceName(ammeterDevice.get("deviceName").toString());
ammeterMeteDataVo.setEmsCommunicationStatus(ammeterDevice.get("communicationStatus").toString());
// 处理储能表数据
dealAmmeterMeteData(ammeterData,ammeterMeteDataVo);
ammeterResponse.setAmmeterMeteDataVoList(ammeterMeteDataVo);
}
}
}
return ammeterDataVos;
return ammeterResponse;
}
private void dealAmmeterMeteData(EmsAmmeterData ammeterData, AmmeterMeteDataVo ammeterMeteDataVo) {
if (ammeterData != null) {
// 数据更新时间
ammeterMeteDataVo.setDataUpdateTime(ammeterData.getDataUpdateTime());
List<MeteDataDetailInfo> meteDataDetailInfos = new ArrayList<>();
// 拼接数据
// a相
MeteDataDetailInfo meteDataDetailInfo1 = new MeteDataDetailInfo();
meteDataDetailInfo1.setCategory(AmmeterCategory.A_POWER.getInfo());
meteDataDetailInfo1.setActivePower(ammeterData.getPhaseAActivePower());
meteDataDetailInfo1.setReactivePower(ammeterData.getPhaseAReactivePower());
meteDataDetailInfos.add(meteDataDetailInfo1);
// b相
MeteDataDetailInfo meteDataDetailInfo2 = new MeteDataDetailInfo();
meteDataDetailInfo2.setCategory(AmmeterCategory.B_POWER.getInfo());
meteDataDetailInfo2.setActivePower(ammeterData.getPhaseBActivePower());
meteDataDetailInfo2.setReactivePower(ammeterData.getPhaseBReactivePower());
meteDataDetailInfos.add(meteDataDetailInfo2);
// c相
MeteDataDetailInfo meteDataDetailInfo3 = new MeteDataDetailInfo();
meteDataDetailInfo3.setCategory(AmmeterCategory.C_POWER.getInfo());
meteDataDetailInfo3.setActivePower(ammeterData.getPhaseCActivePower());
meteDataDetailInfo3.setReactivePower(ammeterData.getPhaseCReactivePower());
meteDataDetailInfos.add(meteDataDetailInfo3);
ammeterMeteDataVo.setMeteDataDetailInfo(meteDataDetailInfos);
}
}
private void dealAmmeterLoadData(EmsAmmeterData ammeterData, AmmeterLoadDataVo ammeterDataVo) {
if (ammeterData != null) {
// 数据更新时间
ammeterDataVo.setDataUpdateTime(ammeterData.getDataUpdateTime());
List<LoadDataDetailInfo> loadDataDetailInfos = new ArrayList<>();
// 拼接数据
// 组合有功
LoadDataDetailInfo ammeterDataDetailInfo1 = new LoadDataDetailInfo();
ammeterDataDetailInfo1.setCategory(AmmeterCategory.CURRENT_COMB_ACTIVE.getInfo());
ammeterDataDetailInfo1.setTotalKwh(ammeterData.getCurrentCombActiveTotal());
ammeterDataDetailInfo1.setPeakKwh(ammeterData.getCurrentCombActivePeak());
ammeterDataDetailInfo1.setHighKwh(ammeterData.getCurrentCombActiveHigh());
ammeterDataDetailInfo1.setFlatKwh(ammeterData.getCurrentCombActiveFlat());
ammeterDataDetailInfo1.setValleyKwh(ammeterData.getCurrentCombActiveValley());
loadDataDetailInfos.add(ammeterDataDetailInfo1);
// 组合无功
LoadDataDetailInfo ammeterDataDetailInfo2 = new LoadDataDetailInfo();
ammeterDataDetailInfo2.setCategory(AmmeterCategory.CURRENT_COMB_REACTIVE.getInfo());
ammeterDataDetailInfo2.setTotalKwh(ammeterData.getCurrentCombReactiveTotal());
ammeterDataDetailInfo2.setPeakKwh(ammeterData.getCurrentCombReactivePeak());
ammeterDataDetailInfo2.setHighKwh(ammeterData.getCurrentCombReactiveHigh());
ammeterDataDetailInfo2.setFlatKwh(ammeterData.getCurrentCombReactiveFlat());
ammeterDataDetailInfo2.setValleyKwh(ammeterData.getCurrentCombReactiveValley());
loadDataDetailInfos.add(ammeterDataDetailInfo2);
ammeterDataVo.setLoadDataDetailInfo(loadDataDetailInfos);
}
}
}

View File

@ -7,37 +7,211 @@
<resultMap type="EmsAmmeterData" id="EmsAmmeterDataResult">
<result property="id" column="id" />
<result property="dataUpdateTime" column="data_update_time" />
<result property="category" column="category" />
<result property="totalKwh" column="total_kwh" />
<result property="sharpKwh" column="sharp_kwh" />
<result property="peakKwh" column="peak_kwh" />
<result property="flatKwh" column="flat_kwh" />
<result property="valleyKwh" column="valley_kwh" />
<result property="currentCombActiveTotal" column="current_comb_active_total" />
<result property="currentCombActivePeak" column="current_comb_active_peak" />
<result property="currentCombActiveHigh" column="current_comb_active_high" />
<result property="currentCombActiveFlat" column="current_comb_active_flat" />
<result property="currentCombActiveValley" column="current_comb_active_valley" />
<result property="currentForwardActiveTotal" column="current_forward_active_total" />
<result property="currentForwardActivePeak" column="current_forward_active_peak" />
<result property="currentForwardActiveHigh" column="current_forward_active_high" />
<result property="currentForwardActiveFlat" column="current_forward_active_flat" />
<result property="currentForwardActiveValley" column="current_forward_active_valley" />
<result property="currentReverseActiveTotal" column="current_reverse_active_total" />
<result property="currentReverseActivePeak" column="current_reverse_active_peak" />
<result property="currentReverseActiveHigh" column="current_reverse_active_high" />
<result property="currentReverseActiveFlat" column="current_reverse_active_flat" />
<result property="currentReverseActiveValley" column="current_reverse_active_valley" />
<result property="currentCombReactiveTotal" column="current_comb_reactive_total" />
<result property="currentCombReactivePeak" column="current_comb_reactive_peak" />
<result property="currentCombReactiveHigh" column="current_comb_reactive_high" />
<result property="currentCombReactiveFlat" column="current_comb_reactive_flat" />
<result property="currentCombReactiveValley" column="current_comb_reactive_valley" />
<result property="currentForwardReactiveTotal" column="current_forward_reactive_total" />
<result property="currentForwardReactivePeak" column="current_forward_reactive_peak" />
<result property="currentForwardReactiveHigh" column="current_forward_reactive_high" />
<result property="currentForwardReactiveFlat" column="current_forward_reactive_flat" />
<result property="currentForwardReactiveValley" column="current_forward_reactive_valley" />
<result property="currentReverseReactiveTotal" column="current_reverse_reactive_total" />
<result property="currentReverseReactivePeak" column="current_reverse_reactive_peak" />
<result property="currentReverseReactiveHigh" column="current_reverse_reactive_high" />
<result property="currentReverseReactiveFlat" column="current_reverse_reactive_flat" />
<result property="currentReverseReactiveValley" column="current_reverse_reactive_valley" />
<result property="phaseAVoltage" column="phase_a_voltage" />
<result property="phaseBVoltage" column="phase_b_voltage" />
<result property="phaseCVoltage" column="phase_c_voltage" />
<result property="phaseACurrent" column="phase_a_current" />
<result property="phaseBCurrent" column="phase_b_current" />
<result property="phaseCCurrent" column="phase_c_current" />
<result property="frequency" column="frequency" />
<result property="abLineVoltage" column="ab_line_voltage" />
<result property="cbLineVoltage" column="cb_line_voltage" />
<result property="acLineVoltage" column="ac_line_voltage" />
<result property="forwardAcMaxDemand" column="forward_ac_max_demand" />
<result property="reverseAcMaxDemand" column="reverse_ac_max_demand" />
<result property="phaseAActivePower" column="phase_a_active_power" />
<result property="phaseBActivePower" column="phase_b_active_power" />
<result property="phaseCActivePower" column="phase_c_active_power" />
<result property="totalActivePower" column="total_active_power" />
<result property="phaseAReactivePower" column="phase_a_reactive_power" />
<result property="phaseBReactivePower" column="phase_b_reactive_power" />
<result property="phaseCReactivePower" column="phase_c_reactive_power" />
<result property="totalReactivePower" column="total_reactive_power" />
<result property="phaseAApparentPower" column="phase_a_apparent_power" />
<result property="phaseBApparentPower" column="phase_b_apparent_power" />
<result property="phaseCApparentPower" column="phase_c_apparent_power" />
<result property="totalApparentPower" column="total_apparent_power" />
<result property="phaseAPowerFactor" column="phase_a_power_factor" />
<result property="phaseBPowerFactor" column="phase_b_power_factor" />
<result property="phaseCPowerFactor" column="phase_c_power_factor" />
<result property="totalPowerFactor" column="total_power_factor" />
<result property="dailyForwardMaxDemand" column="daily_forward_max_demand" />
<result property="siteId" column="site_id" />
<result property="deviceId" column="device_id" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="siteId" column="site_id" />
<result property="deviceId" column="device_id" />
<result property="secondaryAbLineVoltage" column="secondary_ab_line_voltage" />
<result property="secondaryAPhaseCurrent" column="secondary_a_phase_current" />
<result property="secondaryAPhaseVoltage" column="secondary_a_phase_voltage" />
<result property="secondaryAPowerFactor" column="secondary_a_power_factor" />
<result property="secondaryAApparentPower" column="secondary_a_apparent_power" />
<result property="secondaryAReactivePower" column="secondary_a_reactive_power" />
<result property="secondaryAActivePower" column="secondary_a_active_power" />
<result property="secondaryBcLineVoltage" column="secondary_bc_line_voltage" />
<result property="secondaryBPhaseCurrent" column="secondary_b_phase_current" />
<result property="secondaryBPhaseVoltage" column="secondary_b_phase_voltage" />
<result property="secondaryBPowerFactor" column="secondary_b_power_factor" />
<result property="secondaryBApparentPower" column="secondary_b_apparent_power" />
<result property="secondaryBReactivePower" column="secondary_b_reactive_power" />
<result property="secondaryBActivePower" column="secondary_b_active_power" />
<result property="secondaryCaLineVoltage" column="secondary_ca_line_voltage" />
<result property="secondaryCPhaseCurrent" column="secondary_c_phase_current" />
<result property="secondaryCPhaseVoltage" column="secondary_c_phase_voltage" />
<result property="secondaryCPowerFactor" column="secondary_c_power_factor" />
<result property="secondaryCApparentPower" column="secondary_c_apparent_power" />
<result property="secondaryCReactivePower" column="secondary_c_reactive_power" />
<result property="secondaryCActivePower" column="secondary_c_active_power" />
<result property="secondaryGridFrequency" column="secondary_grid_frequency" />
<result property="secondaryReverseReactiveEnergy" column="secondary_reverse_reactive_energy" />
<result property="secondaryNegativeActiveEnergy" column="secondary_negative_active_energy" />
<result property="secondaryTotalPowerFactor" column="secondary_total_power_factor" />
<result property="secondaryTotalApparentPower" column="secondary_total_apparent_power" />
<result property="secondaryTotalReactivePower" column="secondary_total_reactive_power" />
<result property="secondaryPositiveReactiveEnergy" column="secondary_positive_reactive_energy" />
<result property="secondaryPositiveActiveEnergy" column="secondary_positive_active_energy" />
<result property="secondaryTotalActivePower" column="secondary_total_active_power" />
<result property="reverseReactiveEnergyEqMinus" column="reverse_reactive_energy_eq_minus" />
<result property="reverseActiveEnergyEpMinus" column="reverse_active_energy_ep_minus" />
<result property="positiveReactiveEnergyEqPlus" column="positive_reactive_energy_eq_plus" />
<result property="positiveActiveEnergyEpPlus" column="positive_active_energy_ep_plus" />
</resultMap>
<sql id="selectEmsAmmeterDataVo">
select id, data_update_time, category, total_kwh, sharp_kwh, peak_kwh, flat_kwh, valley_kwh, create_by, create_time, update_by, update_time, remark, site_id, device_id from ems_ammeter_data
select id, data_update_time, current_comb_active_total, current_comb_active_peak, current_comb_active_high, current_comb_active_flat, current_comb_active_valley, current_forward_active_total, current_forward_active_peak, current_forward_active_high, current_forward_active_flat, current_forward_active_valley, current_reverse_active_total, current_reverse_active_peak, current_reverse_active_high, current_reverse_active_flat, current_reverse_active_valley, current_comb_reactive_total, current_comb_reactive_peak, current_comb_reactive_high, current_comb_reactive_flat, current_comb_reactive_valley, current_forward_reactive_total, current_forward_reactive_peak, current_forward_reactive_high, current_forward_reactive_flat, current_forward_reactive_valley, current_reverse_reactive_total, current_reverse_reactive_peak, current_reverse_reactive_high, current_reverse_reactive_flat, current_reverse_reactive_valley, phase_a_voltage, phase_b_voltage, phase_c_voltage, phase_a_current, phase_b_current, phase_c_current, frequency, ab_line_voltage, cb_line_voltage, ac_line_voltage, forward_ac_max_demand, reverse_ac_max_demand, phase_a_active_power, phase_b_active_power, phase_c_active_power, total_active_power, phase_a_reactive_power, phase_b_reactive_power, phase_c_reactive_power, total_reactive_power, phase_a_apparent_power, phase_b_apparent_power, phase_c_apparent_power, total_apparent_power, phase_a_power_factor, phase_b_power_factor, phase_c_power_factor, total_power_factor, daily_forward_max_demand, site_id, device_id, create_by, create_time, update_by, update_time, remark, secondary_ab_line_voltage, secondary_a_phase_current, secondary_a_phase_voltage, secondary_a_power_factor, secondary_a_apparent_power, secondary_a_reactive_power, secondary_a_active_power, secondary_bc_line_voltage, secondary_b_phase_current, secondary_b_phase_voltage, secondary_b_power_factor, secondary_b_apparent_power, secondary_b_reactive_power, secondary_b_active_power, secondary_ca_line_voltage, secondary_c_phase_current, secondary_c_phase_voltage, secondary_c_power_factor, secondary_c_apparent_power, secondary_c_reactive_power, secondary_c_active_power, secondary_grid_frequency, secondary_reverse_reactive_energy, secondary_negative_active_energy, secondary_total_power_factor, secondary_total_apparent_power, secondary_total_reactive_power, secondary_positive_reactive_energy, secondary_positive_active_energy, secondary_total_active_power, reverse_reactive_energy_eq_minus, reverse_active_energy_ep_minus, positive_reactive_energy_eq_plus, positive_active_energy_ep_plus from ems_ammeter_data
</sql>
<select id="selectEmsAmmeterDataList" parameterType="EmsAmmeterData" resultMap="EmsAmmeterDataResult">
<include refid="selectEmsAmmeterDataVo"/>
<where>
<if test="dataUpdateTime != null "> and data_update_time = #{dataUpdateTime}</if>
<if test="category != null and category != ''"> and category = #{category}</if>
<if test="totalKwh != null "> and total_kwh = #{totalKwh}</if>
<if test="sharpKwh != null "> and sharp_kwh = #{sharpKwh}</if>
<if test="peakKwh != null "> and peak_kwh = #{peakKwh}</if>
<if test="flatKwh != null "> and flat_kwh = #{flatKwh}</if>
<if test="valleyKwh != null "> and valley_kwh = #{valleyKwh}</if>
<if test="currentCombActiveTotal != null "> and current_comb_active_total = #{currentCombActiveTotal}</if>
<if test="currentCombActivePeak != null "> and current_comb_active_peak = #{currentCombActivePeak}</if>
<if test="currentCombActiveHigh != null "> and current_comb_active_high = #{currentCombActiveHigh}</if>
<if test="currentCombActiveFlat != null "> and current_comb_active_flat = #{currentCombActiveFlat}</if>
<if test="currentCombActiveValley != null "> and current_comb_active_valley = #{currentCombActiveValley}</if>
<if test="currentForwardActiveTotal != null "> and current_forward_active_total = #{currentForwardActiveTotal}</if>
<if test="currentForwardActivePeak != null "> and current_forward_active_peak = #{currentForwardActivePeak}</if>
<if test="currentForwardActiveHigh != null "> and current_forward_active_high = #{currentForwardActiveHigh}</if>
<if test="currentForwardActiveFlat != null "> and current_forward_active_flat = #{currentForwardActiveFlat}</if>
<if test="currentForwardActiveValley != null "> and current_forward_active_valley = #{currentForwardActiveValley}</if>
<if test="currentReverseActiveTotal != null "> and current_reverse_active_total = #{currentReverseActiveTotal}</if>
<if test="currentReverseActivePeak != null "> and current_reverse_active_peak = #{currentReverseActivePeak}</if>
<if test="currentReverseActiveHigh != null "> and current_reverse_active_high = #{currentReverseActiveHigh}</if>
<if test="currentReverseActiveFlat != null "> and current_reverse_active_flat = #{currentReverseActiveFlat}</if>
<if test="currentReverseActiveValley != null "> and current_reverse_active_valley = #{currentReverseActiveValley}</if>
<if test="currentCombReactiveTotal != null "> and current_comb_reactive_total = #{currentCombReactiveTotal}</if>
<if test="currentCombReactivePeak != null "> and current_comb_reactive_peak = #{currentCombReactivePeak}</if>
<if test="currentCombReactiveHigh != null "> and current_comb_reactive_high = #{currentCombReactiveHigh}</if>
<if test="currentCombReactiveFlat != null "> and current_comb_reactive_flat = #{currentCombReactiveFlat}</if>
<if test="currentCombReactiveValley != null "> and current_comb_reactive_valley = #{currentCombReactiveValley}</if>
<if test="currentForwardReactiveTotal != null "> and current_forward_reactive_total = #{currentForwardReactiveTotal}</if>
<if test="currentForwardReactivePeak != null "> and current_forward_reactive_peak = #{currentForwardReactivePeak}</if>
<if test="currentForwardReactiveHigh != null "> and current_forward_reactive_high = #{currentForwardReactiveHigh}</if>
<if test="currentForwardReactiveFlat != null "> and current_forward_reactive_flat = #{currentForwardReactiveFlat}</if>
<if test="currentForwardReactiveValley != null "> and current_forward_reactive_valley = #{currentForwardReactiveValley}</if>
<if test="currentReverseReactiveTotal != null "> and current_reverse_reactive_total = #{currentReverseReactiveTotal}</if>
<if test="currentReverseReactivePeak != null "> and current_reverse_reactive_peak = #{currentReverseReactivePeak}</if>
<if test="currentReverseReactiveHigh != null "> and current_reverse_reactive_high = #{currentReverseReactiveHigh}</if>
<if test="currentReverseReactiveFlat != null "> and current_reverse_reactive_flat = #{currentReverseReactiveFlat}</if>
<if test="currentReverseReactiveValley != null "> and current_reverse_reactive_valley = #{currentReverseReactiveValley}</if>
<if test="phaseAVoltage != null "> and phase_a_voltage = #{phaseAVoltage}</if>
<if test="phaseBVoltage != null "> and phase_b_voltage = #{phaseBVoltage}</if>
<if test="phaseCVoltage != null "> and phase_c_voltage = #{phaseCVoltage}</if>
<if test="phaseACurrent != null "> and phase_a_current = #{phaseACurrent}</if>
<if test="phaseBCurrent != null "> and phase_b_current = #{phaseBCurrent}</if>
<if test="phaseCCurrent != null "> and phase_c_current = #{phaseCCurrent}</if>
<if test="frequency != null "> and frequency = #{frequency}</if>
<if test="abLineVoltage != null "> and ab_line_voltage = #{abLineVoltage}</if>
<if test="cbLineVoltage != null "> and cb_line_voltage = #{cbLineVoltage}</if>
<if test="acLineVoltage != null "> and ac_line_voltage = #{acLineVoltage}</if>
<if test="forwardAcMaxDemand != null "> and forward_ac_max_demand = #{forwardAcMaxDemand}</if>
<if test="reverseAcMaxDemand != null "> and reverse_ac_max_demand = #{reverseAcMaxDemand}</if>
<if test="phaseAActivePower != null "> and phase_a_active_power = #{phaseAActivePower}</if>
<if test="phaseBActivePower != null "> and phase_b_active_power = #{phaseBActivePower}</if>
<if test="phaseCActivePower != null "> and phase_c_active_power = #{phaseCActivePower}</if>
<if test="totalActivePower != null "> and total_active_power = #{totalActivePower}</if>
<if test="phaseAReactivePower != null "> and phase_a_reactive_power = #{phaseAReactivePower}</if>
<if test="phaseBReactivePower != null "> and phase_b_reactive_power = #{phaseBReactivePower}</if>
<if test="phaseCReactivePower != null "> and phase_c_reactive_power = #{phaseCReactivePower}</if>
<if test="totalReactivePower != null "> and total_reactive_power = #{totalReactivePower}</if>
<if test="phaseAApparentPower != null "> and phase_a_apparent_power = #{phaseAApparentPower}</if>
<if test="phaseBApparentPower != null "> and phase_b_apparent_power = #{phaseBApparentPower}</if>
<if test="phaseCApparentPower != null "> and phase_c_apparent_power = #{phaseCApparentPower}</if>
<if test="totalApparentPower != null "> and total_apparent_power = #{totalApparentPower}</if>
<if test="phaseAPowerFactor != null "> and phase_a_power_factor = #{phaseAPowerFactor}</if>
<if test="phaseBPowerFactor != null "> and phase_b_power_factor = #{phaseBPowerFactor}</if>
<if test="phaseCPowerFactor != null "> and phase_c_power_factor = #{phaseCPowerFactor}</if>
<if test="totalPowerFactor != null "> and total_power_factor = #{totalPowerFactor}</if>
<if test="dailyForwardMaxDemand != null "> and daily_forward_max_demand = #{dailyForwardMaxDemand}</if>
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
<if test="secondaryAbLineVoltage != null "> and secondary_ab_line_voltage = #{secondaryAbLineVoltage}</if>
<if test="secondaryAPhaseCurrent != null "> and secondary_a_phase_current = #{secondaryAPhaseCurrent}</if>
<if test="secondaryAPhaseVoltage != null "> and secondary_a_phase_voltage = #{secondaryAPhaseVoltage}</if>
<if test="secondaryAPowerFactor != null "> and secondary_a_power_factor = #{secondaryAPowerFactor}</if>
<if test="secondaryAApparentPower != null "> and secondary_a_apparent_power = #{secondaryAApparentPower}</if>
<if test="secondaryAReactivePower != null "> and secondary_a_reactive_power = #{secondaryAReactivePower}</if>
<if test="secondaryAActivePower != null "> and secondary_a_active_power = #{secondaryAActivePower}</if>
<if test="secondaryBcLineVoltage != null "> and secondary_bc_line_voltage = #{secondaryBcLineVoltage}</if>
<if test="secondaryBPhaseCurrent != null "> and secondary_b_phase_current = #{secondaryBPhaseCurrent}</if>
<if test="secondaryBPhaseVoltage != null "> and secondary_b_phase_voltage = #{secondaryBPhaseVoltage}</if>
<if test="secondaryBPowerFactor != null "> and secondary_b_power_factor = #{secondaryBPowerFactor}</if>
<if test="secondaryBApparentPower != null "> and secondary_b_apparent_power = #{secondaryBApparentPower}</if>
<if test="secondaryBReactivePower != null "> and secondary_b_reactive_power = #{secondaryBReactivePower}</if>
<if test="secondaryBActivePower != null "> and secondary_b_active_power = #{secondaryBActivePower}</if>
<if test="secondaryCaLineVoltage != null "> and secondary_ca_line_voltage = #{secondaryCaLineVoltage}</if>
<if test="secondaryCPhaseCurrent != null "> and secondary_c_phase_current = #{secondaryCPhaseCurrent}</if>
<if test="secondaryCPhaseVoltage != null "> and secondary_c_phase_voltage = #{secondaryCPhaseVoltage}</if>
<if test="secondaryCPowerFactor != null "> and secondary_c_power_factor = #{secondaryCPowerFactor}</if>
<if test="secondaryCApparentPower != null "> and secondary_c_apparent_power = #{secondaryCApparentPower}</if>
<if test="secondaryCReactivePower != null "> and secondary_c_reactive_power = #{secondaryCReactivePower}</if>
<if test="secondaryCActivePower != null "> and secondary_c_active_power = #{secondaryCActivePower}</if>
<if test="secondaryGridFrequency != null "> and secondary_grid_frequency = #{secondaryGridFrequency}</if>
<if test="secondaryReverseReactiveEnergy != null "> and secondary_reverse_reactive_energy = #{secondaryReverseReactiveEnergy}</if>
<if test="secondaryNegativeActiveEnergy != null "> and secondary_negative_active_energy = #{secondaryNegativeActiveEnergy}</if>
<if test="secondaryTotalPowerFactor != null "> and secondary_total_power_factor = #{secondaryTotalPowerFactor}</if>
<if test="secondaryTotalApparentPower != null "> and secondary_total_apparent_power = #{secondaryTotalApparentPower}</if>
<if test="secondaryTotalReactivePower != null "> and secondary_total_reactive_power = #{secondaryTotalReactivePower}</if>
<if test="secondaryPositiveReactiveEnergy != null "> and secondary_positive_reactive_energy = #{secondaryPositiveReactiveEnergy}</if>
<if test="secondaryPositiveActiveEnergy != null "> and secondary_positive_active_energy = #{secondaryPositiveActiveEnergy}</if>
<if test="secondaryTotalActivePower != null "> and secondary_total_active_power = #{secondaryTotalActivePower}</if>
<if test="reverseReactiveEnergyEqMinus != null "> and reverse_reactive_energy_eq_minus = #{reverseReactiveEnergyEqMinus}</if>
<if test="reverseActiveEnergyEpMinus != null "> and reverse_active_energy_ep_minus = #{reverseActiveEnergyEpMinus}</if>
<if test="positiveReactiveEnergyEqPlus != null "> and positive_reactive_energy_eq_plus = #{positiveReactiveEnergyEqPlus}</if>
<if test="positiveActiveEnergyEpPlus != null "> and positive_active_energy_ep_plus = #{positiveActiveEnergyEpPlus}</if>
</where>
</select>
@ -50,35 +224,209 @@
insert into ems_ammeter_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dataUpdateTime != null">data_update_time,</if>
<if test="category != null">category,</if>
<if test="totalKwh != null">total_kwh,</if>
<if test="sharpKwh != null">sharp_kwh,</if>
<if test="peakKwh != null">peak_kwh,</if>
<if test="flatKwh != null">flat_kwh,</if>
<if test="valleyKwh != null">valley_kwh,</if>
<if test="currentCombActiveTotal != null">current_comb_active_total,</if>
<if test="currentCombActivePeak != null">current_comb_active_peak,</if>
<if test="currentCombActiveHigh != null">current_comb_active_high,</if>
<if test="currentCombActiveFlat != null">current_comb_active_flat,</if>
<if test="currentCombActiveValley != null">current_comb_active_valley,</if>
<if test="currentForwardActiveTotal != null">current_forward_active_total,</if>
<if test="currentForwardActivePeak != null">current_forward_active_peak,</if>
<if test="currentForwardActiveHigh != null">current_forward_active_high,</if>
<if test="currentForwardActiveFlat != null">current_forward_active_flat,</if>
<if test="currentForwardActiveValley != null">current_forward_active_valley,</if>
<if test="currentReverseActiveTotal != null">current_reverse_active_total,</if>
<if test="currentReverseActivePeak != null">current_reverse_active_peak,</if>
<if test="currentReverseActiveHigh != null">current_reverse_active_high,</if>
<if test="currentReverseActiveFlat != null">current_reverse_active_flat,</if>
<if test="currentReverseActiveValley != null">current_reverse_active_valley,</if>
<if test="currentCombReactiveTotal != null">current_comb_reactive_total,</if>
<if test="currentCombReactivePeak != null">current_comb_reactive_peak,</if>
<if test="currentCombReactiveHigh != null">current_comb_reactive_high,</if>
<if test="currentCombReactiveFlat != null">current_comb_reactive_flat,</if>
<if test="currentCombReactiveValley != null">current_comb_reactive_valley,</if>
<if test="currentForwardReactiveTotal != null">current_forward_reactive_total,</if>
<if test="currentForwardReactivePeak != null">current_forward_reactive_peak,</if>
<if test="currentForwardReactiveHigh != null">current_forward_reactive_high,</if>
<if test="currentForwardReactiveFlat != null">current_forward_reactive_flat,</if>
<if test="currentForwardReactiveValley != null">current_forward_reactive_valley,</if>
<if test="currentReverseReactiveTotal != null">current_reverse_reactive_total,</if>
<if test="currentReverseReactivePeak != null">current_reverse_reactive_peak,</if>
<if test="currentReverseReactiveHigh != null">current_reverse_reactive_high,</if>
<if test="currentReverseReactiveFlat != null">current_reverse_reactive_flat,</if>
<if test="currentReverseReactiveValley != null">current_reverse_reactive_valley,</if>
<if test="phaseAVoltage != null">phase_a_voltage,</if>
<if test="phaseBVoltage != null">phase_b_voltage,</if>
<if test="phaseCVoltage != null">phase_c_voltage,</if>
<if test="phaseACurrent != null">phase_a_current,</if>
<if test="phaseBCurrent != null">phase_b_current,</if>
<if test="phaseCCurrent != null">phase_c_current,</if>
<if test="frequency != null">frequency,</if>
<if test="abLineVoltage != null">ab_line_voltage,</if>
<if test="cbLineVoltage != null">cb_line_voltage,</if>
<if test="acLineVoltage != null">ac_line_voltage,</if>
<if test="forwardAcMaxDemand != null">forward_ac_max_demand,</if>
<if test="reverseAcMaxDemand != null">reverse_ac_max_demand,</if>
<if test="phaseAActivePower != null">phase_a_active_power,</if>
<if test="phaseBActivePower != null">phase_b_active_power,</if>
<if test="phaseCActivePower != null">phase_c_active_power,</if>
<if test="totalActivePower != null">total_active_power,</if>
<if test="phaseAReactivePower != null">phase_a_reactive_power,</if>
<if test="phaseBReactivePower != null">phase_b_reactive_power,</if>
<if test="phaseCReactivePower != null">phase_c_reactive_power,</if>
<if test="totalReactivePower != null">total_reactive_power,</if>
<if test="phaseAApparentPower != null">phase_a_apparent_power,</if>
<if test="phaseBApparentPower != null">phase_b_apparent_power,</if>
<if test="phaseCApparentPower != null">phase_c_apparent_power,</if>
<if test="totalApparentPower != null">total_apparent_power,</if>
<if test="phaseAPowerFactor != null">phase_a_power_factor,</if>
<if test="phaseBPowerFactor != null">phase_b_power_factor,</if>
<if test="phaseCPowerFactor != null">phase_c_power_factor,</if>
<if test="totalPowerFactor != null">total_power_factor,</if>
<if test="dailyForwardMaxDemand != null">daily_forward_max_demand,</if>
<if test="siteId != null">site_id,</if>
<if test="deviceId != null and deviceId != ''">device_id,</if>
<if test="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="siteId != null">site_id,</if>
<if test="deviceId != null and deviceId != ''">device_id,</if>
<if test="secondaryAbLineVoltage != null">secondary_ab_line_voltage,</if>
<if test="secondaryAPhaseCurrent != null">secondary_a_phase_current,</if>
<if test="secondaryAPhaseVoltage != null">secondary_a_phase_voltage,</if>
<if test="secondaryAPowerFactor != null">secondary_a_power_factor,</if>
<if test="secondaryAApparentPower != null">secondary_a_apparent_power,</if>
<if test="secondaryAReactivePower != null">secondary_a_reactive_power,</if>
<if test="secondaryAActivePower != null">secondary_a_active_power,</if>
<if test="secondaryBcLineVoltage != null">secondary_bc_line_voltage,</if>
<if test="secondaryBPhaseCurrent != null">secondary_b_phase_current,</if>
<if test="secondaryBPhaseVoltage != null">secondary_b_phase_voltage,</if>
<if test="secondaryBPowerFactor != null">secondary_b_power_factor,</if>
<if test="secondaryBApparentPower != null">secondary_b_apparent_power,</if>
<if test="secondaryBReactivePower != null">secondary_b_reactive_power,</if>
<if test="secondaryBActivePower != null">secondary_b_active_power,</if>
<if test="secondaryCaLineVoltage != null">secondary_ca_line_voltage,</if>
<if test="secondaryCPhaseCurrent != null">secondary_c_phase_current,</if>
<if test="secondaryCPhaseVoltage != null">secondary_c_phase_voltage,</if>
<if test="secondaryCPowerFactor != null">secondary_c_power_factor,</if>
<if test="secondaryCApparentPower != null">secondary_c_apparent_power,</if>
<if test="secondaryCReactivePower != null">secondary_c_reactive_power,</if>
<if test="secondaryCActivePower != null">secondary_c_active_power,</if>
<if test="secondaryGridFrequency != null">secondary_grid_frequency,</if>
<if test="secondaryReverseReactiveEnergy != null">secondary_reverse_reactive_energy,</if>
<if test="secondaryNegativeActiveEnergy != null">secondary_negative_active_energy,</if>
<if test="secondaryTotalPowerFactor != null">secondary_total_power_factor,</if>
<if test="secondaryTotalApparentPower != null">secondary_total_apparent_power,</if>
<if test="secondaryTotalReactivePower != null">secondary_total_reactive_power,</if>
<if test="secondaryPositiveReactiveEnergy != null">secondary_positive_reactive_energy,</if>
<if test="secondaryPositiveActiveEnergy != null">secondary_positive_active_energy,</if>
<if test="secondaryTotalActivePower != null">secondary_total_active_power,</if>
<if test="reverseReactiveEnergyEqMinus != null">reverse_reactive_energy_eq_minus,</if>
<if test="reverseActiveEnergyEpMinus != null">reverse_active_energy_ep_minus,</if>
<if test="positiveReactiveEnergyEqPlus != null">positive_reactive_energy_eq_plus,</if>
<if test="positiveActiveEnergyEpPlus != null">positive_active_energy_ep_plus,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dataUpdateTime != null">#{dataUpdateTime},</if>
<if test="category != null">#{category},</if>
<if test="totalKwh != null">#{totalKwh},</if>
<if test="sharpKwh != null">#{sharpKwh},</if>
<if test="peakKwh != null">#{peakKwh},</if>
<if test="flatKwh != null">#{flatKwh},</if>
<if test="valleyKwh != null">#{valleyKwh},</if>
<if test="currentCombActiveTotal != null">#{currentCombActiveTotal},</if>
<if test="currentCombActivePeak != null">#{currentCombActivePeak},</if>
<if test="currentCombActiveHigh != null">#{currentCombActiveHigh},</if>
<if test="currentCombActiveFlat != null">#{currentCombActiveFlat},</if>
<if test="currentCombActiveValley != null">#{currentCombActiveValley},</if>
<if test="currentForwardActiveTotal != null">#{currentForwardActiveTotal},</if>
<if test="currentForwardActivePeak != null">#{currentForwardActivePeak},</if>
<if test="currentForwardActiveHigh != null">#{currentForwardActiveHigh},</if>
<if test="currentForwardActiveFlat != null">#{currentForwardActiveFlat},</if>
<if test="currentForwardActiveValley != null">#{currentForwardActiveValley},</if>
<if test="currentReverseActiveTotal != null">#{currentReverseActiveTotal},</if>
<if test="currentReverseActivePeak != null">#{currentReverseActivePeak},</if>
<if test="currentReverseActiveHigh != null">#{currentReverseActiveHigh},</if>
<if test="currentReverseActiveFlat != null">#{currentReverseActiveFlat},</if>
<if test="currentReverseActiveValley != null">#{currentReverseActiveValley},</if>
<if test="currentCombReactiveTotal != null">#{currentCombReactiveTotal},</if>
<if test="currentCombReactivePeak != null">#{currentCombReactivePeak},</if>
<if test="currentCombReactiveHigh != null">#{currentCombReactiveHigh},</if>
<if test="currentCombReactiveFlat != null">#{currentCombReactiveFlat},</if>
<if test="currentCombReactiveValley != null">#{currentCombReactiveValley},</if>
<if test="currentForwardReactiveTotal != null">#{currentForwardReactiveTotal},</if>
<if test="currentForwardReactivePeak != null">#{currentForwardReactivePeak},</if>
<if test="currentForwardReactiveHigh != null">#{currentForwardReactiveHigh},</if>
<if test="currentForwardReactiveFlat != null">#{currentForwardReactiveFlat},</if>
<if test="currentForwardReactiveValley != null">#{currentForwardReactiveValley},</if>
<if test="currentReverseReactiveTotal != null">#{currentReverseReactiveTotal},</if>
<if test="currentReverseReactivePeak != null">#{currentReverseReactivePeak},</if>
<if test="currentReverseReactiveHigh != null">#{currentReverseReactiveHigh},</if>
<if test="currentReverseReactiveFlat != null">#{currentReverseReactiveFlat},</if>
<if test="currentReverseReactiveValley != null">#{currentReverseReactiveValley},</if>
<if test="phaseAVoltage != null">#{phaseAVoltage},</if>
<if test="phaseBVoltage != null">#{phaseBVoltage},</if>
<if test="phaseCVoltage != null">#{phaseCVoltage},</if>
<if test="phaseACurrent != null">#{phaseACurrent},</if>
<if test="phaseBCurrent != null">#{phaseBCurrent},</if>
<if test="phaseCCurrent != null">#{phaseCCurrent},</if>
<if test="frequency != null">#{frequency},</if>
<if test="abLineVoltage != null">#{abLineVoltage},</if>
<if test="cbLineVoltage != null">#{cbLineVoltage},</if>
<if test="acLineVoltage != null">#{acLineVoltage},</if>
<if test="forwardAcMaxDemand != null">#{forwardAcMaxDemand},</if>
<if test="reverseAcMaxDemand != null">#{reverseAcMaxDemand},</if>
<if test="phaseAActivePower != null">#{phaseAActivePower},</if>
<if test="phaseBActivePower != null">#{phaseBActivePower},</if>
<if test="phaseCActivePower != null">#{phaseCActivePower},</if>
<if test="totalActivePower != null">#{totalActivePower},</if>
<if test="phaseAReactivePower != null">#{phaseAReactivePower},</if>
<if test="phaseBReactivePower != null">#{phaseBReactivePower},</if>
<if test="phaseCReactivePower != null">#{phaseCReactivePower},</if>
<if test="totalReactivePower != null">#{totalReactivePower},</if>
<if test="phaseAApparentPower != null">#{phaseAApparentPower},</if>
<if test="phaseBApparentPower != null">#{phaseBApparentPower},</if>
<if test="phaseCApparentPower != null">#{phaseCApparentPower},</if>
<if test="totalApparentPower != null">#{totalApparentPower},</if>
<if test="phaseAPowerFactor != null">#{phaseAPowerFactor},</if>
<if test="phaseBPowerFactor != null">#{phaseBPowerFactor},</if>
<if test="phaseCPowerFactor != null">#{phaseCPowerFactor},</if>
<if test="totalPowerFactor != null">#{totalPowerFactor},</if>
<if test="dailyForwardMaxDemand != null">#{dailyForwardMaxDemand},</if>
<if test="siteId != null">#{siteId},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="siteId != null">#{siteId},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="secondaryAbLineVoltage != null">#{secondaryAbLineVoltage},</if>
<if test="secondaryAPhaseCurrent != null">#{secondaryAPhaseCurrent},</if>
<if test="secondaryAPhaseVoltage != null">#{secondaryAPhaseVoltage},</if>
<if test="secondaryAPowerFactor != null">#{secondaryAPowerFactor},</if>
<if test="secondaryAApparentPower != null">#{secondaryAApparentPower},</if>
<if test="secondaryAReactivePower != null">#{secondaryAReactivePower},</if>
<if test="secondaryAActivePower != null">#{secondaryAActivePower},</if>
<if test="secondaryBcLineVoltage != null">#{secondaryBcLineVoltage},</if>
<if test="secondaryBPhaseCurrent != null">#{secondaryBPhaseCurrent},</if>
<if test="secondaryBPhaseVoltage != null">#{secondaryBPhaseVoltage},</if>
<if test="secondaryBPowerFactor != null">#{secondaryBPowerFactor},</if>
<if test="secondaryBApparentPower != null">#{secondaryBApparentPower},</if>
<if test="secondaryBReactivePower != null">#{secondaryBReactivePower},</if>
<if test="secondaryBActivePower != null">#{secondaryBActivePower},</if>
<if test="secondaryCaLineVoltage != null">#{secondaryCaLineVoltage},</if>
<if test="secondaryCPhaseCurrent != null">#{secondaryCPhaseCurrent},</if>
<if test="secondaryCPhaseVoltage != null">#{secondaryCPhaseVoltage},</if>
<if test="secondaryCPowerFactor != null">#{secondaryCPowerFactor},</if>
<if test="secondaryCApparentPower != null">#{secondaryCApparentPower},</if>
<if test="secondaryCReactivePower != null">#{secondaryCReactivePower},</if>
<if test="secondaryCActivePower != null">#{secondaryCActivePower},</if>
<if test="secondaryGridFrequency != null">#{secondaryGridFrequency},</if>
<if test="secondaryReverseReactiveEnergy != null">#{secondaryReverseReactiveEnergy},</if>
<if test="secondaryNegativeActiveEnergy != null">#{secondaryNegativeActiveEnergy},</if>
<if test="secondaryTotalPowerFactor != null">#{secondaryTotalPowerFactor},</if>
<if test="secondaryTotalApparentPower != null">#{secondaryTotalApparentPower},</if>
<if test="secondaryTotalReactivePower != null">#{secondaryTotalReactivePower},</if>
<if test="secondaryPositiveReactiveEnergy != null">#{secondaryPositiveReactiveEnergy},</if>
<if test="secondaryPositiveActiveEnergy != null">#{secondaryPositiveActiveEnergy},</if>
<if test="secondaryTotalActivePower != null">#{secondaryTotalActivePower},</if>
<if test="reverseReactiveEnergyEqMinus != null">#{reverseReactiveEnergyEqMinus},</if>
<if test="reverseActiveEnergyEpMinus != null">#{reverseActiveEnergyEpMinus},</if>
<if test="positiveReactiveEnergyEqPlus != null">#{positiveReactiveEnergyEqPlus},</if>
<if test="positiveActiveEnergyEpPlus != null">#{positiveActiveEnergyEpPlus},</if>
</trim>
</insert>
@ -86,19 +434,106 @@
update ems_ammeter_data
<trim prefix="SET" suffixOverrides=",">
<if test="dataUpdateTime != null">data_update_time = #{dataUpdateTime},</if>
<if test="category != null">category = #{category},</if>
<if test="totalKwh != null">total_kwh = #{totalKwh},</if>
<if test="sharpKwh != null">sharp_kwh = #{sharpKwh},</if>
<if test="peakKwh != null">peak_kwh = #{peakKwh},</if>
<if test="flatKwh != null">flat_kwh = #{flatKwh},</if>
<if test="valleyKwh != null">valley_kwh = #{valleyKwh},</if>
<if test="currentCombActiveTotal != null">current_comb_active_total = #{currentCombActiveTotal},</if>
<if test="currentCombActivePeak != null">current_comb_active_peak = #{currentCombActivePeak},</if>
<if test="currentCombActiveHigh != null">current_comb_active_high = #{currentCombActiveHigh},</if>
<if test="currentCombActiveFlat != null">current_comb_active_flat = #{currentCombActiveFlat},</if>
<if test="currentCombActiveValley != null">current_comb_active_valley = #{currentCombActiveValley},</if>
<if test="currentForwardActiveTotal != null">current_forward_active_total = #{currentForwardActiveTotal},</if>
<if test="currentForwardActivePeak != null">current_forward_active_peak = #{currentForwardActivePeak},</if>
<if test="currentForwardActiveHigh != null">current_forward_active_high = #{currentForwardActiveHigh},</if>
<if test="currentForwardActiveFlat != null">current_forward_active_flat = #{currentForwardActiveFlat},</if>
<if test="currentForwardActiveValley != null">current_forward_active_valley = #{currentForwardActiveValley},</if>
<if test="currentReverseActiveTotal != null">current_reverse_active_total = #{currentReverseActiveTotal},</if>
<if test="currentReverseActivePeak != null">current_reverse_active_peak = #{currentReverseActivePeak},</if>
<if test="currentReverseActiveHigh != null">current_reverse_active_high = #{currentReverseActiveHigh},</if>
<if test="currentReverseActiveFlat != null">current_reverse_active_flat = #{currentReverseActiveFlat},</if>
<if test="currentReverseActiveValley != null">current_reverse_active_valley = #{currentReverseActiveValley},</if>
<if test="currentCombReactiveTotal != null">current_comb_reactive_total = #{currentCombReactiveTotal},</if>
<if test="currentCombReactivePeak != null">current_comb_reactive_peak = #{currentCombReactivePeak},</if>
<if test="currentCombReactiveHigh != null">current_comb_reactive_high = #{currentCombReactiveHigh},</if>
<if test="currentCombReactiveFlat != null">current_comb_reactive_flat = #{currentCombReactiveFlat},</if>
<if test="currentCombReactiveValley != null">current_comb_reactive_valley = #{currentCombReactiveValley},</if>
<if test="currentForwardReactiveTotal != null">current_forward_reactive_total = #{currentForwardReactiveTotal},</if>
<if test="currentForwardReactivePeak != null">current_forward_reactive_peak = #{currentForwardReactivePeak},</if>
<if test="currentForwardReactiveHigh != null">current_forward_reactive_high = #{currentForwardReactiveHigh},</if>
<if test="currentForwardReactiveFlat != null">current_forward_reactive_flat = #{currentForwardReactiveFlat},</if>
<if test="currentForwardReactiveValley != null">current_forward_reactive_valley = #{currentForwardReactiveValley},</if>
<if test="currentReverseReactiveTotal != null">current_reverse_reactive_total = #{currentReverseReactiveTotal},</if>
<if test="currentReverseReactivePeak != null">current_reverse_reactive_peak = #{currentReverseReactivePeak},</if>
<if test="currentReverseReactiveHigh != null">current_reverse_reactive_high = #{currentReverseReactiveHigh},</if>
<if test="currentReverseReactiveFlat != null">current_reverse_reactive_flat = #{currentReverseReactiveFlat},</if>
<if test="currentReverseReactiveValley != null">current_reverse_reactive_valley = #{currentReverseReactiveValley},</if>
<if test="phaseAVoltage != null">phase_a_voltage = #{phaseAVoltage},</if>
<if test="phaseBVoltage != null">phase_b_voltage = #{phaseBVoltage},</if>
<if test="phaseCVoltage != null">phase_c_voltage = #{phaseCVoltage},</if>
<if test="phaseACurrent != null">phase_a_current = #{phaseACurrent},</if>
<if test="phaseBCurrent != null">phase_b_current = #{phaseBCurrent},</if>
<if test="phaseCCurrent != null">phase_c_current = #{phaseCCurrent},</if>
<if test="frequency != null">frequency = #{frequency},</if>
<if test="abLineVoltage != null">ab_line_voltage = #{abLineVoltage},</if>
<if test="cbLineVoltage != null">cb_line_voltage = #{cbLineVoltage},</if>
<if test="acLineVoltage != null">ac_line_voltage = #{acLineVoltage},</if>
<if test="forwardAcMaxDemand != null">forward_ac_max_demand = #{forwardAcMaxDemand},</if>
<if test="reverseAcMaxDemand != null">reverse_ac_max_demand = #{reverseAcMaxDemand},</if>
<if test="phaseAActivePower != null">phase_a_active_power = #{phaseAActivePower},</if>
<if test="phaseBActivePower != null">phase_b_active_power = #{phaseBActivePower},</if>
<if test="phaseCActivePower != null">phase_c_active_power = #{phaseCActivePower},</if>
<if test="totalActivePower != null">total_active_power = #{totalActivePower},</if>
<if test="phaseAReactivePower != null">phase_a_reactive_power = #{phaseAReactivePower},</if>
<if test="phaseBReactivePower != null">phase_b_reactive_power = #{phaseBReactivePower},</if>
<if test="phaseCReactivePower != null">phase_c_reactive_power = #{phaseCReactivePower},</if>
<if test="totalReactivePower != null">total_reactive_power = #{totalReactivePower},</if>
<if test="phaseAApparentPower != null">phase_a_apparent_power = #{phaseAApparentPower},</if>
<if test="phaseBApparentPower != null">phase_b_apparent_power = #{phaseBApparentPower},</if>
<if test="phaseCApparentPower != null">phase_c_apparent_power = #{phaseCApparentPower},</if>
<if test="totalApparentPower != null">total_apparent_power = #{totalApparentPower},</if>
<if test="phaseAPowerFactor != null">phase_a_power_factor = #{phaseAPowerFactor},</if>
<if test="phaseBPowerFactor != null">phase_b_power_factor = #{phaseBPowerFactor},</if>
<if test="phaseCPowerFactor != null">phase_c_power_factor = #{phaseCPowerFactor},</if>
<if test="totalPowerFactor != null">total_power_factor = #{totalPowerFactor},</if>
<if test="dailyForwardMaxDemand != null">daily_forward_max_demand = #{dailyForwardMaxDemand},</if>
<if test="siteId != null">site_id = #{siteId},</if>
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="siteId != null">site_id = #{siteId},</if>
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
<if test="secondaryAbLineVoltage != null">secondary_ab_line_voltage = #{secondaryAbLineVoltage},</if>
<if test="secondaryAPhaseCurrent != null">secondary_a_phase_current = #{secondaryAPhaseCurrent},</if>
<if test="secondaryAPhaseVoltage != null">secondary_a_phase_voltage = #{secondaryAPhaseVoltage},</if>
<if test="secondaryAPowerFactor != null">secondary_a_power_factor = #{secondaryAPowerFactor},</if>
<if test="secondaryAApparentPower != null">secondary_a_apparent_power = #{secondaryAApparentPower},</if>
<if test="secondaryAReactivePower != null">secondary_a_reactive_power = #{secondaryAReactivePower},</if>
<if test="secondaryAActivePower != null">secondary_a_active_power = #{secondaryAActivePower},</if>
<if test="secondaryBcLineVoltage != null">secondary_bc_line_voltage = #{secondaryBcLineVoltage},</if>
<if test="secondaryBPhaseCurrent != null">secondary_b_phase_current = #{secondaryBPhaseCurrent},</if>
<if test="secondaryBPhaseVoltage != null">secondary_b_phase_voltage = #{secondaryBPhaseVoltage},</if>
<if test="secondaryBPowerFactor != null">secondary_b_power_factor = #{secondaryBPowerFactor},</if>
<if test="secondaryBApparentPower != null">secondary_b_apparent_power = #{secondaryBApparentPower},</if>
<if test="secondaryBReactivePower != null">secondary_b_reactive_power = #{secondaryBReactivePower},</if>
<if test="secondaryBActivePower != null">secondary_b_active_power = #{secondaryBActivePower},</if>
<if test="secondaryCaLineVoltage != null">secondary_ca_line_voltage = #{secondaryCaLineVoltage},</if>
<if test="secondaryCPhaseCurrent != null">secondary_c_phase_current = #{secondaryCPhaseCurrent},</if>
<if test="secondaryCPhaseVoltage != null">secondary_c_phase_voltage = #{secondaryCPhaseVoltage},</if>
<if test="secondaryCPowerFactor != null">secondary_c_power_factor = #{secondaryCPowerFactor},</if>
<if test="secondaryCApparentPower != null">secondary_c_apparent_power = #{secondaryCApparentPower},</if>
<if test="secondaryCReactivePower != null">secondary_c_reactive_power = #{secondaryCReactivePower},</if>
<if test="secondaryCActivePower != null">secondary_c_active_power = #{secondaryCActivePower},</if>
<if test="secondaryGridFrequency != null">secondary_grid_frequency = #{secondaryGridFrequency},</if>
<if test="secondaryReverseReactiveEnergy != null">secondary_reverse_reactive_energy = #{secondaryReverseReactiveEnergy},</if>
<if test="secondaryNegativeActiveEnergy != null">secondary_negative_active_energy = #{secondaryNegativeActiveEnergy},</if>
<if test="secondaryTotalPowerFactor != null">secondary_total_power_factor = #{secondaryTotalPowerFactor},</if>
<if test="secondaryTotalApparentPower != null">secondary_total_apparent_power = #{secondaryTotalApparentPower},</if>
<if test="secondaryTotalReactivePower != null">secondary_total_reactive_power = #{secondaryTotalReactivePower},</if>
<if test="secondaryPositiveReactiveEnergy != null">secondary_positive_reactive_energy = #{secondaryPositiveReactiveEnergy},</if>
<if test="secondaryPositiveActiveEnergy != null">secondary_positive_active_energy = #{secondaryPositiveActiveEnergy},</if>
<if test="secondaryTotalActivePower != null">secondary_total_active_power = #{secondaryTotalActivePower},</if>
<if test="reverseReactiveEnergyEqMinus != null">reverse_reactive_energy_eq_minus = #{reverseReactiveEnergyEqMinus},</if>
<if test="reverseActiveEnergyEpMinus != null">reverse_active_energy_ep_minus = #{reverseActiveEnergyEpMinus},</if>
<if test="positiveReactiveEnergyEqPlus != null">positive_reactive_energy_eq_plus = #{positiveReactiveEnergyEqPlus},</if>
<if test="positiveActiveEnergyEpPlus != null">positive_active_energy_ep_plus = #{positiveActiveEnergyEpPlus},</if>
</trim>
where id = #{id}
</update>
@ -114,24 +549,4 @@
</foreach>
</delete>
<select id="getAmmeterDetailInfo" resultType="com.xzzn.ems.domain.vo.AmmeterDataDetailInfo">
SELECT t.category as category,
t.total_kwh as totalKwh,
t.sharp_kwh as sharpKwh,
t.flat_kwh as flatKwh,
t.peak_kwh as peakKwh,
t.device_id as deviceId,
t.valley_kwh as valleyKwh,
Max(t.data_update_time) as updateTime
FROM ems_ammeter_data t
INNER JOIN (
SELECT p.site_id, p.device_id,p.category,MAX(p.data_update_time) AS max_update_time
FROM ems_ammeter_data p
WHERE p.site_id = #{siteId} and p.device_id = #{deviceId}
GROUP BY p.site_id,p.device_id,p.category
) latest on t.device_id = latest.device_id and t.data_update_time = latest.max_update_time
WHERE t.site_id = #{siteId} and t.device_id = #{deviceId}
group by t.category,t.total_kwh,t.sharp_kwh,t.flat_kwh,t.peak_kwh,t.valley_kwh,t.device_id
order by updateTime desc
</select>
</mapper>

View File

@ -179,4 +179,10 @@
communication_status as communicationStatus
from ems_devices_setting where site_id = #{siteId} and device_category = #{deviceCategory}
</select>
<select id="getDeviceDetailInfo" parameterType="String" resultMap="EmsDevicesSettingResult">
<include refid="selectEmsDevicesSettingVo"/>
where device_id = #{deviceId}
limit 1
</select>
</mapper>

View File

@ -132,4 +132,15 @@
AND running_time &lt; DATE_ADD(STR_TO_DATE( #{endTime}, '%Y-%m-%d'), INTERVAL 1 DAY)
</if>
</select>
<select id="getAllSiteDeviceList" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteDeviceListVo">
select es.site_id as siteId,es.site_name as siteName,
ed.device_id as deviceId,ed.device_name as deviceName,
ed.device_type as deviceType,ed.communication_status as communicationStatus
from ems_site_setting es INNER JOIN ems_devices_setting ed on es.site_id = ed.site_id
where 1=1
<if test="siteId != null and siteId != ''">
and es.site_id = #{siteId}
</if>
</select>
</mapper>