Compare commits

...

38 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
7964806b94 站点配置-获取站点列表 2025-07-02 19:43:17 +08:00
b4302edd8a redis key常量 2025-07-02 17:34:09 +08:00
88fee64f46 redis key常量 2025-07-02 17:32:17 +08:00
8081e38d5e 本地调试-回退 2025-07-02 16:10:22 +08:00
8415e2749e 从redis取数 2025-07-02 16:08:50 +08:00
170bae19f8 修正部分参数 2025-07-02 12:26:09 +08:00
37fd07b0c8 修正部分参数 2025-07-02 12:10:46 +08:00
f73ba23b52 修正部分参数 2025-07-02 11:40:23 +08:00
a3f77113c9 字段值修改 2025-07-01 22:09:16 +08:00
a7e33afb19 修正部分参数 2025-07-01 22:03:43 +08:00
2c5d4ddd1b 修正部分参数 2025-07-01 21:58:26 +08:00
9efb87ed24 修正部分参数 2025-07-01 21:50:54 +08:00
4d5f2adef4 修正部分参数 2025-07-01 21:39:32 +08:00
0318b2455d Merge remote-tracking branch 'origin/dev' into dev 2025-07-01 21:28:30 +08:00
b2c624f452 修正部分参数 2025-07-01 21:28:25 +08:00
b207208623 Merge remote-tracking branch 'origin/dev' into dev 2025-07-01 21:22:18 +08:00
259784f525 概率统计-电量指标默认7天 2025-07-01 21:21:55 +08:00
5eb8de692c 修正部分参数 2025-07-01 21:21:20 +08:00
ed025d2750 概率统计-电量指标 2025-07-01 16:25:23 +08:00
d24da5363a 单体电池-增加簇号 2025-07-01 13:28:50 +08:00
342439e3a9 单体电池修改 2025-06-30 23:01:41 +08:00
8663ab8325 单体电池添加入参site_id 2025-06-30 22:22:47 +08:00
93bd88b94c 修正部分参数 2025-06-30 22:08:15 +08:00
7e265e21b1 修正部分参数 2025-06-30 21:54:51 +08:00
d0db9e137a 修正部分参数 2025-06-30 21:47:39 +08:00
790e4ca716 修正部分参数 2025-06-30 21:38:17 +08:00
62e4608a7a Merge remote-tracking branch 'origin/dev' into dev 2025-06-30 21:15:23 +08:00
9fbc6dc6b8 修改 mqtt 密码 2025-06-30 21:15:20 +08:00
3d71b9caba 枚举 2025-06-30 20:33:57 +08:00
a6af1397e9 枚举 2025-06-30 20:01:55 +08:00
2a5ac78394 Merge remote-tracking branch 'origin/dev' into dev 2025-06-30 18:59:00 +08:00
f2e5e07857 紧急修改 siteid 2025-06-30 18:58:53 +08:00
70 changed files with 4858 additions and 1792 deletions

View File

@ -0,0 +1,64 @@
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;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;
import java.util.List;
/**
*
* 站点配置
*
*/
@RestController
@RequestMapping("/ems/siteConfig")
public class EmsSiteConfigController extends BaseController{
@Autowired
private IEmsSiteService iEmsSiteService;
@Autowired
private IEmsDeviceSettingService iEmsDeviceSettingService;
/**
* 获取站点列表
*/
@GetMapping("/getSiteInfoList")
public TableDataInfo getSiteInfoList(@RequestParam String siteName, @RequestParam String startTime, @RequestParam String endTime)
{
startPage();
List<EmsSiteSetting> list = iEmsSiteService.getAllSiteInfoList(siteName,startTime,endTime);
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

@ -110,11 +110,11 @@ public class EmsSiteMonitorController extends BaseController{
* 获取电池簇下面的单体电池数据
*/
@GetMapping("/getClusterDataInfoList")
public TableDataInfo getClusterDataInfoList(@RequestParam String clusterDeviceId)
public TableDataInfo getClusterDataInfoList(@RequestParam String clusterDeviceId,@RequestParam String siteId)
{
startPage();
List<BatteryDataStatsListVo> list = iSingleSiteService.getClusterDataInfoList(clusterDeviceId);
return getDataTable(list);
List<BatteryDataStatsListVo> list = iSingleSiteService.getClusterDataInfoList(clusterDeviceId,siteId);
return getDataTable2(list);
}
/**

View File

@ -0,0 +1,48 @@
package com.xzzn.web.controller.ems;
import com.xzzn.common.core.controller.BaseController;
import com.xzzn.common.core.domain.AjaxResult;
import com.xzzn.common.utils.StringUtils;
import com.xzzn.ems.domain.vo.DateSearchRequest;
import com.xzzn.ems.service.IEmsStatsReportService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
/**
* 单站监控-统计报表
*
* @author xzzn
*/
@RestController
@RequestMapping("/ems/statsReport")
public class EmsStatisticalReportController extends BaseController
{
@Autowired
private IEmsStatsReportService ieEmsStatsReportService;
/**
* 概率统计-收益指标查询
*/
@GetMapping("/getRevenueData")
public AjaxResult getRevenueData(DateSearchRequest requestVo)
{
return success(null);
}
/**
* 概率统计-电量指标查询
*/
@GetMapping("/getElectricData")
public AjaxResult getElectricData(DateSearchRequest requestVo)
{
if (!StringUtils.isEmpty(requestVo.getSiteId())) {
return success(ieEmsStatsReportService.getElectricDataResult(requestVo));
} else {
return error("站点id必传");
}
}
}

View File

@ -1,13 +1,8 @@
package com.xzzn.web.controller.ems;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.TypeReference;
import com.xzzn.common.utils.DateUtils;
import com.xzzn.common.utils.StringUtils;
import com.xzzn.ems.domain.*;
import com.xzzn.ems.service.*;
import com.xzzn.ems.domain.EmsMqttMessage;
import com.xzzn.ems.service.IEmsMqttMessageService;
import com.xzzn.ems.service.IFXXDataProcessService;
import com.xzzn.framework.manager.MqttLifecycleManager;
import com.xzzn.framework.web.service.MqttPublisher;
import com.xzzn.framework.web.service.MqttSubscriber;
@ -20,8 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.util.*;
@Service
public class MqttMessageController implements MqttPublisher, MqttSubscriber {
@ -36,21 +29,7 @@ public class MqttMessageController implements MqttPublisher, MqttSubscriber {
private IEmsMqttMessageService emsMqttMessageService;
@Autowired
private IEmsBatteryDataService emsBatteryDataService;
@Autowired
private IEmsPcsDataService emsPcsDataService;
@Autowired
private IEmsPcsBranchDataService emsPcsBranchDataService;
@Autowired
private IEmsBatteryClusterService emsBatteryClusterService;
@Autowired
private IEmsBatteryStackService emsBatteryStackService;
private IFXXDataProcessService fXXDataProcessService;
@Autowired
public MqttMessageController(MqttLifecycleManager mqttLifecycleManager) {
@ -93,7 +72,7 @@ public class MqttMessageController implements MqttPublisher, MqttSubscriber {
System.out.println("[DEVICE] data: " + payload);
try {
// 业务处理逻辑
handleFxData(payload);
fXXDataProcessService.handleFxData(payload);
EmsMqttMessage mqttMessage = new EmsMqttMessage();
@ -138,326 +117,5 @@ public class MqttMessageController implements MqttPublisher, MqttSubscriber {
}
private void handleFxData(String message) {
JSONArray arraylist = JSONArray.parseArray(message);
for (int i = 0; i < arraylist.size(); i++) {
JSONObject obj = JSONObject.parseObject(arraylist.get(i).toString());
String deviceId = obj.get("Device").toString();
String jsonData = obj.get("Data").toString();
log.info("deviceId:" + deviceId);
if (deviceId.contains("BMS")) {
log.info("====================");
log.info("BMS data:"+ jsonData);
//BMS 电池簇
EmsBatteryCluster data = new EmsBatteryCluster();
// 设置所有 BigDecimal 类型字段为 ZERO
data.setChargeableCapacity(BigDecimal.ZERO);
data.setTotalChargedCapacity(BigDecimal.ZERO);
data.setDischargeableCapacity(BigDecimal.ZERO);
data.setTotalDischargedCapacity(BigDecimal.ZERO);
data.setSoh(BigDecimal.ZERO);
data.setAverageTemperature(BigDecimal.ZERO);
data.setInsulationResistance(BigDecimal.ZERO);
data.setCurrentSoc(BigDecimal.ZERO);
data.setMaxAllowedChargePower(BigDecimal.ZERO);
data.setMaxAllowedDischargePower(BigDecimal.ZERO);
data.setMaxAllowedChargeVoltage(BigDecimal.ZERO);
data.setMaxAllowedDischargeVoltage(BigDecimal.ZERO);
data.setMaxAllowedChargeCurrent(BigDecimal.ZERO);
data.setMaxAllowedDischargeCurrent(BigDecimal.ZERO);
data.setBatteryPackVoltage(BigDecimal.ZERO);
data.setBatteryPackCurrent(BigDecimal.ZERO);
data.setBatteryPackTemp(BigDecimal.ZERO);
data.setBatteryPackSoc(BigDecimal.ZERO);
data.setBatteryPackSoh(BigDecimal.ZERO);
data.setBatteryPackInsulationResistance(BigDecimal.ZERO);
data.setAvgCellVoltage(BigDecimal.ZERO);
data.setAvgCellTemp(BigDecimal.ZERO);
data.setMaxCellVoltage(BigDecimal.ZERO);
data.setMinCellVoltage(BigDecimal.ZERO);
data.setMaxCellTemp(BigDecimal.ZERO);
data.setMinCellTemp(BigDecimal.ZERO);
data.setMaxCellSoc(BigDecimal.ZERO);
data.setMinCellSoc(BigDecimal.ZERO);
data.setMaxCellSoh(BigDecimal.ZERO);
data.setMinCellSoh(BigDecimal.ZERO);
data.setTotalChargeEnergy(BigDecimal.ZERO);
data.setTotalDischargeEnergy(BigDecimal.ZERO);
// 其他非 BigDecimal 字段
data.setWorkStatus("1"); // 或其他默认值
data.setPcsCommunicationStatus("1");
data.setEmsCommunicationStatus("1");
data.setCreateBy("system");
data.setCreateTime(DateUtils.getNowDate());
data.setUpdateBy("system");
data.setUpdateTime(DateUtils.getNowDate());
data.setSiteId("021_FXX_01");
data.setDeviceId(deviceId);
data.setMaxCellVoltageId(Long.parseLong("1"));
data.setMinCellVoltageId(Long.parseLong("1"));
data.setMaxCellTempId(Long.parseLong("1"));
data.setMinCellTempId(Long.parseLong("1"));
data.setMaxCellSocId(Long.parseLong("1"));
data.setMinCellSocId(Long.parseLong("1"));
data.setMaxCellSohId(Long.parseLong("1"));
data.setMinCellSohId(Long.parseLong("1"));
data.setStackDeviceId("1");
emsBatteryClusterService.insertEmsBatteryCluster(data);
//电池堆
//BMS 电池簇
EmsBatteryStack dataStack = new EmsBatteryStack();
// 设置所有 BigDecimal 类型字段为 ZERO
dataStack.setChargeableCapacity(BigDecimal.ZERO);
dataStack.setTotalChargedCapacity(BigDecimal.ZERO);
dataStack.setDischargeableCapacity(BigDecimal.ZERO);
dataStack.setTotalDischargedCapacity(BigDecimal.ZERO);
dataStack.setSoh(BigDecimal.ZERO);
dataStack.setAverageTemperature(BigDecimal.ZERO);
dataStack.setInsulationResistance(BigDecimal.ZERO);
dataStack.setCurrentSoc(BigDecimal.ZERO);
dataStack.setMaxAllowedChargePower(BigDecimal.ZERO);
dataStack.setMaxAllowedDischargePower(BigDecimal.ZERO);
dataStack.setMaxAllowedChargeVoltage(BigDecimal.ZERO);
dataStack.setMaxAllowedDischargeVoltage(BigDecimal.ZERO);
dataStack.setMaxAllowedChargeCurrent(BigDecimal.ZERO);
dataStack.setMaxAllowedDischargeCurrent(BigDecimal.ZERO);
dataStack.setBatteryPackVoltage(BigDecimal.ZERO);
dataStack.setBatteryPackCurrent(BigDecimal.ZERO);
dataStack.setBatteryPackTemp(BigDecimal.ZERO);
dataStack.setBatteryPackSoc(BigDecimal.ZERO);
dataStack.setBatteryPackSoh(BigDecimal.ZERO);
dataStack.setBatteryPackInsulationResistance(BigDecimal.ZERO);
dataStack.setAvgCellVoltage(BigDecimal.ZERO);
dataStack.setAvgCellTemp(BigDecimal.ZERO);
dataStack.setMaxCellVoltage(BigDecimal.ZERO);
dataStack.setMinCellVoltage(BigDecimal.ZERO);
dataStack.setMaxCellTemp(BigDecimal.ZERO);
dataStack.setMinCellTemp(BigDecimal.ZERO);
dataStack.setMaxCellSoc(BigDecimal.ZERO);
dataStack.setMinCellSoc(BigDecimal.ZERO);
dataStack.setMaxCellSoh(BigDecimal.ZERO);
dataStack.setMinCellSoh(BigDecimal.ZERO);
dataStack.setTotalChargeEnergy(BigDecimal.ZERO);
dataStack.setTotalDischargeEnergy(BigDecimal.ZERO);
// 其他非 BigDecimal 字段
dataStack.setWorkStatus("1"); // 或其他默认值
dataStack.setPcsCommunicationStatus("1");
dataStack.setEmsCommunicationStatus("1");
dataStack.setCreateBy("system");
dataStack.setCreateTime(DateUtils.getNowDate());
dataStack.setUpdateBy("system");
dataStack.setUpdateTime(DateUtils.getNowDate());
dataStack.setSiteId("021_FXX_01");
dataStack.setDeviceId(deviceId);
dataStack.setMaxCellVoltageId(Long.parseLong("1"));
dataStack.setMinCellVoltageId(Long.parseLong("1"));
dataStack.setMaxCellTempId(Long.parseLong("1"));
dataStack.setMinCellTempId(Long.parseLong("1"));
dataStack.setMaxCellSocId(Long.parseLong("1"));
dataStack.setMinCellSocId(Long.parseLong("1"));
dataStack.setMaxCellSohId(Long.parseLong("1"));
dataStack.setMinCellSohId(Long.parseLong("1"));
emsBatteryStackService.insertEmsBatteryStack(dataStack);
//单体电池
Map<String, Map<String, Object>> records = processData(JSON.parseObject(jsonData, new TypeReference<Map<String, Object>>() {}));
List<EmsBatteryData> list = new ArrayList<>();
//单体电池
for (Map.Entry<String, Map<String, Object>> record : records.entrySet()) {
String recordId = record.getKey();
Map<String, Object> fields = record.getValue();
EmsBatteryData batteryData = new EmsBatteryData();
batteryData.setDeviceId(recordId);
batteryData.setBatteryCellId(recordId);
batteryData.setSoc(StringUtils.getBigDecimal(fields.get("DTSOC")));
batteryData.setSoh(StringUtils.getBigDecimal(fields.get("DTSOH")));
batteryData.setTemperature(StringUtils.getBigDecimal(fields.get("DTWD")));
batteryData.setVoltage(StringUtils.getBigDecimal(fields.get("DTDY")));
batteryData.setBatteryCluster(deviceId);
batteryData.setBatteryPack(deviceId);
// 时间戳
batteryData.setDataTimestamp(new Date());
// ID字段
batteryData.setSiteId(("021"));
batteryData.setClusterDeviceId(("021"));
list.add(batteryData);
}
if (list.size() > 0 ) {
emsBatteryDataService.insertEmsBatteryDataList(list);
}
} else if (deviceId.contains("PCS")) {
log.info("====================");
log.info("PCS data:"+ jsonData);
//pcs
EmsPcsData pcsData = new EmsPcsData();
// 时间与状态类字段
pcsData.setDataUpdateTime(new Date());
pcsData.setWorkStatus("A");
pcsData.setGridStatus("B");
pcsData.setDeviceStatus("C");
pcsData.setControlMode("D");
// 功率与能量类字段
pcsData.setTotalActivePower(BigDecimal.ZERO);
pcsData.setDailyAcChargeEnergy(BigDecimal.ZERO);
pcsData.setTotalReactivePower(BigDecimal.ZERO);
pcsData.setDailyAcDischargeEnergy(BigDecimal.ZERO);
pcsData.setTotalApparentPower(BigDecimal.ZERO);
pcsData.setTotalPowerFactor(BigDecimal.ZERO);
pcsData.setDcPower(BigDecimal.ZERO);
pcsData.setTotalAcChargeEnergy(BigDecimal.ZERO);
pcsData.setTotalAcDischargeEnergy(BigDecimal.ZERO);
pcsData.setAcChargeActivePower(BigDecimal.ZERO);
pcsData.setAcCapacitiveReactivePower(BigDecimal.ZERO);
pcsData.setAcDischargeActivePower(BigDecimal.ZERO);
pcsData.setAcInductiveReactivePower(BigDecimal.ZERO);
pcsData.setMaxCapacitivePowerCapacity(BigDecimal.ZERO);
pcsData.setMaxInductivePowerCapacity(BigDecimal.ZERO);
pcsData.setMaxChargePowerCapacity(BigDecimal.ZERO);
pcsData.setMaxDischargePowerCapacity(BigDecimal.ZERO);
// 温度与环境参数
pcsData.setPcsModuleTemperature(BigDecimal.ZERO);
pcsData.setPcsEnvironmentTemperature(BigDecimal.ZERO);
pcsData.setAcFrequency(BigDecimal.ZERO);
// 状态指示类
pcsData.setBranchStatus("A");
pcsData.setDischargeStatus("A");
pcsData.setAcSwitchStatus("A");
pcsData.setDcSwitchStatus("A");
pcsData.setRemoteControlStatus("A");
// 直流参数
pcsData.setDcVoltage(BigDecimal.ZERO);
pcsData.setDcCurrent(BigDecimal.ZERO);
// 系统管理字段
// data.setCreateBy(BigDecimal.ZERO);
// data.setCreateTime(BigDecimal.ZERO);
// data.setUpdateBy(BigDecimal.ZERO);
// data.setUpdateTime(BigDecimal.ZERO);
// data.setRemark(BigDecimal.ZERO);
pcsData.setSiteId("021_FXX_01");
pcsData.setDeviceId(deviceId);
pcsData.setDateMonth(DateUtils.getNowMonthLong());
pcsData.setDateDay(DateUtils.getNowDayLong());
pcsData.setDeviceId(deviceId);
emsPcsDataService.insertEmsPcsData(pcsData);
Map<String, Map<String, Object>> records = processDataPrefix(JSON.parseObject(jsonData, new TypeReference<Map<String, Object>>() {}));
List<EmsPcsBranchData> list = new ArrayList<>();
//PCS支路
for (Map.Entry<String, Map<String, Object>> record : records.entrySet()) {
String recordId = record.getKey();
Map<String, Object> fields = record.getValue();
EmsPcsBranchData data = new EmsPcsBranchData();
data.setDeviceId(recordId);
data.setDcPower(BigDecimal.ZERO);
data.setDcVoltage(BigDecimal.ZERO);
data.setDcCurrent(BigDecimal.ZERO);
data.setGridUVoltage(BigDecimal.ZERO);
data.setGridVVoltage(BigDecimal.ZERO);
data.setGridWVoltage(BigDecimal.ZERO);
data.setOutputUCurrent(BigDecimal.ZERO);
data.setOutputVCurrent(BigDecimal.ZERO);
data.setOutputWCurrent(BigDecimal.ZERO);
data.setApparentPower(BigDecimal.ZERO);
data.setActivePower(BigDecimal.ZERO);
data.setReactivePower(BigDecimal.ZERO);
data.setPowerFactor(BigDecimal.ZERO);
data.setFrequency(BigDecimal.ZERO);
data.setInternalTemp(BigDecimal.ZERO);
data.setuIgbtTemp(BigDecimal.ZERO);
data.setvIgbtTemp(BigDecimal.ZERO);
data.setwIgbtTemp(BigDecimal.ZERO);
data.setAvailablePower(BigDecimal.ZERO);
data.setTotalLoadRatio(BigDecimal.ZERO);
data.setAcLeakageCurrent(BigDecimal.ZERO);
data.setInsulationResistance(BigDecimal.ZERO);
data.setBranchId(Long.parseLong("1"));
list.add(data);
}
if (list.size() > 0 ) {
emsPcsBranchDataService.insertEmsPcsBranchDataList(list);
}
}
}
}
// 数据分组处理
private static Map<String, Map<String, Object>> processData(Map<String, Object> rawData) {
Map<String, Map<String, Object>> records = new HashMap<>();
for (Map.Entry<String, Object> entry : rawData.entrySet()) {
String key = entry.getKey();
// 提取记录ID最后3位
String recordId = key.substring(key.length() - 3);
try {
Long.parseLong(recordId);
} catch (Exception e) {
continue;
}
// 提取字段类型(前缀)
String fieldType = key.substring(0, key.length() - 3);
// 初始化记录
records.putIfAbsent(recordId, new HashMap<>());
// 存入字段值
records.get(recordId).put(fieldType, entry.getValue());
}
return records;
}
private static Map<String, Map<String, Object>> processDataPrefix(Map<String, Object> rawData) {
Map<String, Map<String, Object>> records = new HashMap<>();
for (Map.Entry<String, Object> entry : rawData.entrySet()) {
String key = entry.getKey();
// 确保键长度足够
if (key.length() < 3) {
continue;
}
// 提取记录ID前3位
String recordId = key.substring(0, 3);
if (!recordId.startsWith("DY")) {
continue;
}
// 提取字段类型(剩余部分)
String fieldType = key.substring(3);
// 初始化记录
records.putIfAbsent(recordId, new HashMap<>());
// 存入字段值
records.get(recordId).put(fieldType, entry.getValue());
}
return records;
}
}

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

@ -132,7 +132,7 @@ mqtt:
broker.url: tcp://122.51.194.184:1883
client.id: ems-cloud
username: dmbroker
password: Setri@64335270
password: qwer1234
connection-timeout: 15
keep-alive-interval: 30
automatic-reconnect: true

View File

@ -0,0 +1,39 @@
package com.xzzn.common.constant;
/**
* 数据存储 Redis key 常量
*
* @author xzzn
*/
public class RedisKeyConstants
{
/**
* pcs数据 redis key
*/
public static final String PCS = "PCS_";
/**
* pcs branch数据 redis key
*/
public static final String BRANCH = "BRANCH_";
/**
* stack电池堆数据 redis key
*/
public static final String STACK = "STACK_";
/**
* cluster电池簇数据 redis key
*/
public static final String CLUSTER = "CLUSTER_";
/**
* battery单体电池数据 redis key
*/
public static final String BATTERY = "BATTERY_";
/**
* 电表数据 redis key
*/
public static final String AMMETER = "AMMETER_";
}

View File

@ -1,6 +1,8 @@
package com.xzzn.common.core.controller;
import java.beans.PropertyEditorSupport;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date;
import java.util.List;
import org.slf4j.Logger;
@ -199,4 +201,35 @@ public class BaseController
{
return getLoginUser().getUsername();
}
/**
* 手动处理分页
*/
@SuppressWarnings({ "rawtypes", "unchecked" })
protected TableDataInfo getDataTable2(List<?> list)
{
List<?> subList = new ArrayList<>();
// 分页梳理
PageDomain pageDomain = TableSupport.buildPageRequest();
int pageNum = pageDomain.getPageNum();
int pageSize = pageDomain.getPageSize();
if (pageNum > 0 && pageSize > 0) {
// 计算分页起始和结束索引
int startIndex = (pageNum - 1) * pageSize;
int endIndex = Math.min(startIndex + pageSize, list.size());
// 防止越界
if (startIndex >= list.size()) {
subList = Collections.emptyList();
}
// 截取当前页数据
subList = list.subList(startIndex, endIndex);
}
TableDataInfo rspData = new TableDataInfo();
rspData.setCode(HttpStatus.SUCCESS);
rspData.setMsg("查询成功");
rspData.setRows(subList);
rspData.setTotal(list.size());
return rspData;
}
}

View File

@ -265,4 +265,15 @@ public class RedisCache
{
return redisTemplate.keys(pattern);
}
/**
* 删除list
*
* @param key Redis键
* @return 对象列表
*/
public boolean deleteList(final String key)
{
return redisTemplate.delete(key);
}
}

View File

@ -0,0 +1,30 @@
package com.xzzn.common.enums;
/**
* alarm-告警等级
*
* @author xzzn
*/
public enum AlarmLevelStatus
{
WARNING("A", "提示"), GENERAL("B", "一般"), SERIOUS("C", "严重"), EMERGENCY("D", "紧急");
private final String code;
private final String info;
AlarmLevelStatus(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -0,0 +1,30 @@
package com.xzzn.common.enums;
/**
* alarm-告警状态
*
* @author xzzn
*/
public enum AlarmStatus
{
WAITING("0", "待处理"), DONE("1", "已处理"),PROCESSING("2", "处理中");
private final String code;
private final String info;
AlarmStatus(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -0,0 +1,34 @@
package com.xzzn.common.enums;
/**
* ammeter-电表数据类别
*
* @author xzzn
*/
public enum AmmeterCategory
{
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;
AmmeterCategory(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -0,0 +1,30 @@
package com.xzzn.common.enums;
/**
* pcs-branch-支路状态
*
* @author xzzn
*/
public enum BranchStatus
{
STANDBY("0", "备用"), NORMAL("1", "正常"), SWITCHING("2", "切换中");
private final String code;
private final String info;
BranchStatus(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -0,0 +1,30 @@
package com.xzzn.common.enums;
/**
* 充电状态&放电状态
*
* @author xzzn
*/
public enum ChargeStatus
{
CHARGING("1", "充电"), STANDBY("2", "待机"), DISCHARGING("3", "放电");
private final String code;
private final String info;
ChargeStatus(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -0,0 +1,30 @@
package com.xzzn.common.enums;
/**
* device-通信状态
*
* @author xzzn
*/
public enum CommunicationStatus
{
OK("0", "正常"), SUSPEND("1", "通信中断") ,EXCEPTION("1", "异常");
private final String code;
private final String info;
CommunicationStatus(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -0,0 +1,30 @@
package com.xzzn.common.enums;
/**
* pcs-控制模式
*
* @author xzzn
*/
public enum ControlModeStatus
{
REMOTE("0", "远程"), LOCAL("1", "本地");
private final String code;
private final String info;
ControlModeStatus(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -0,0 +1,35 @@
package com.xzzn.common.enums;
/**
* device-设备类别
*
* @author xzzn
*/
public enum DeviceCategory
{
PCS("PCS", "PCS设备"),
BRANCH("BRANCH", "PCS分支设备"),
STACK("STACK", "电池堆"),
CLUSTER("CLUSTER", "电池簇"),
BATTERY("BATTERY", "单体电池"),
AMMETER("AMMETER", "电表");
private final String code;
private final String info;
DeviceCategory(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -0,0 +1,30 @@
package com.xzzn.common.enums;
/**
* pcs-设备状态
*
* @author xzzn
*/
public enum DeviceStatus
{
ONLINE("0", "在线"), OFFLINE("1", "离线"), UNDER_REPAIR("2", "维修中");
private final String code;
private final String info;
DeviceStatus(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -0,0 +1,20 @@
package com.xzzn.common.enums;
/**
* device-设备类型
*
* @author xzzn
*/
public enum DeviceType
{
/**
* 网络设备
*/
TCP,
/**
* 串口设备
*/
RTU
}

View File

@ -0,0 +1,30 @@
package com.xzzn.common.enums;
/**
* pcs-并网状态
*
* @author xzzn
*/
public enum GridStatus
{
GRID("0", "并网"), NOTGRID("1", "未并网");
private final String code;
private final String info;
GridStatus(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -0,0 +1,30 @@
package com.xzzn.common.enums;
/**
* strategy-策略状态
*
* @author xzzn
*/
public enum StrategyStatus
{
NOT_ENABLED("0", "未启用"), RUNNING("1", "已运行"),SUSPENDED("2", "已暂停"), DISABLE("1", "禁用"),DELETE("2", "删除");
private final String code;
private final String info;
StrategyStatus(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -0,0 +1,30 @@
package com.xzzn.common.enums;
/**
* pcs-开关状态
*
* @author xzzn
*/
public enum SwitchStatus
{
CLOSED("0", "闭合"), DISCONNECT("1", "断开"), FAULT_DISCONNECT("2", "故障断开");
private final String code;
private final String info;
SwitchStatus(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -0,0 +1,30 @@
package com.xzzn.common.enums;
/**
* pcs-工作状态
*
* @author xzzn
*/
public enum WorkStatus
{
NORMAL("0", "正常"), ABNORMAL("1", "异常"), STOP("2", "停止");
private final String code;
private final String info;
WorkStatus(String code, String info)
{
this.code = code;
this.info = info;
}
public String getCode()
{
return code;
}
public String getInfo()
{
return info;
}
}

View File

@ -723,12 +723,32 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
public static BigDecimal getBigDecimal(Object s){
BigDecimal result;
try {
return new BigDecimal(s.toString());
} catch (NumberFormatException e) {
result = new BigDecimal(s.toString());
} catch (Exception e) {
return BigDecimal.ZERO;
}
return result;
}
public static Long getLong(Object s){
Long result;
try {
result = Long.parseLong(s.toString());
} catch (Exception e) {
return Long.parseLong("0");
}
return result;
}
public static String getString(Object s){
String result;
try {
result = String.valueOf(s);
} catch (Exception e) {
return "0";
}
return result;
}
}

View File

@ -11,7 +11,7 @@ import com.xzzn.common.annotation.Excel;
* Modbus设备配置对象 ems_devices_setting
*
* @author xzzn
* @date 2025-06-29
* @date 2025-07-02
*/
public class EmsDevicesSetting extends BaseEntity
{
@ -86,14 +86,22 @@ public class EmsDevicesSetting extends BaseEntity
@Excel(name = "站点id")
private String siteId;
/** 通信状态 */
@Excel(name = "通信状态")
/** 通信状态:0-正常 1-通信中断 2-异常 */
@Excel(name = "通信状态:0-正常 1-通信中断 2-异常")
private String communicationStatus;
/** 设备唯一标识符 */
@Excel(name = "设备唯一标识符")
private String deviceId;
/** 上级设备id */
@Excel(name = "上级设备id")
private String parentId;
/** 设备类别例如“STACK/CLUSTER/PCS等” */
@Excel(name = "设备类别例如“STACK/CLUSTER/PCS等”")
private String deviceCategory;
public void setId(Long id)
{
this.id = id;
@ -284,6 +292,26 @@ public class EmsDevicesSetting extends BaseEntity
return deviceId;
}
public void setParentId(String parentId)
{
this.parentId = parentId;
}
public String getParentId()
{
return parentId;
}
public void setDeviceCategory(String deviceCategory)
{
this.deviceCategory = deviceCategory;
}
public String getDeviceCategory()
{
return deviceCategory;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -306,6 +334,8 @@ public class EmsDevicesSetting extends BaseEntity
.append("siteId", getSiteId())
.append("communicationStatus", getCommunicationStatus())
.append("deviceId", getDeviceId())
.append("parentId", getParentId())
.append("deviceCategory", getDeviceCategory())
.toString();
}
}

View File

@ -46,7 +46,7 @@ public class EmsPcsBranchData extends BaseEntity
/** 支路id */
@Excel(name = "支路id")
private Long branchId;
private String branchId;
/** 电网U相电压 */
@Excel(name = "电网U相电压")
@ -198,12 +198,12 @@ public class EmsPcsBranchData extends BaseEntity
return deviceId;
}
public void setBranchId(Long branchId)
public void setBranchId(String branchId)
{
this.branchId = branchId;
}
public Long getBranchId()
public String getBranchId()
{
return branchId;
}

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

@ -30,8 +30,8 @@ public class EmsSiteSetting extends BaseEntity
private String siteAddress;
/** 运营时间 */
@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 runningTime;
/** 纬度 */

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

@ -57,51 +57,6 @@ public class BMSBatteryClusterVo {
/** 设备唯一标识符 */
private String deviceId;
/** 单体温度平均值 */
private BigDecimal avgTemp;
/** 单体温度最小值 */
private BigDecimal minTemp;
/** 单体温度最小值ID */
private String minTempID;
/** 单体温度最大值 */
private BigDecimal maxTemp;
/** 单体温度最大值ID */
private String maxTempID;
/** 单体电压平均值 */
private BigDecimal avgVoltage;
/** 单体电压最小值 */
private BigDecimal minVoltage;
/** 单体电压最小值ID */
private String minVoltageID;
/** 单体电压最大值 */
private BigDecimal maxVoltage;
/** 单体电压最大值ID */
private String maxVoltageID;
/** 单体Soc平均值 */
private BigDecimal avgSoc;
/** 单体Soc最小值 */
private BigDecimal minSoc;
/** 单体Soc最小值ID */
private String minSocID;
/** 单体Soc最大值 */
private BigDecimal maxSoc;
/** 单体Soc最大值ID */
private String maxSocID;
private List<BMSBatteryClusterDataList> batteryDataList;
public String getDeviceName() {
@ -239,124 +194,4 @@ public class BMSBatteryClusterVo {
public void setBatteryDataList(List<BMSBatteryClusterDataList> batteryDataList) {
this.batteryDataList = batteryDataList;
}
public String getMaxSocID() {
return maxSocID;
}
public void setMaxSocID(String maxSocID) {
this.maxSocID = maxSocID;
}
public BigDecimal getMaxSoc() {
return maxSoc;
}
public void setMaxSoc(BigDecimal maxSoc) {
this.maxSoc = maxSoc;
}
public String getMinSocID() {
return minSocID;
}
public void setMinSocID(String minSocID) {
this.minSocID = minSocID;
}
public BigDecimal getMinSoc() {
return minSoc;
}
public void setMinSoc(BigDecimal minSoc) {
this.minSoc = minSoc;
}
public BigDecimal getAvgSoc() {
return avgSoc;
}
public void setAvgSoc(BigDecimal avgSoc) {
this.avgSoc = avgSoc;
}
public String getMaxVoltageID() {
return maxVoltageID;
}
public void setMaxVoltageID(String maxVoltageID) {
this.maxVoltageID = maxVoltageID;
}
public BigDecimal getMaxVoltage() {
return maxVoltage;
}
public void setMaxVoltage(BigDecimal maxVoltage) {
this.maxVoltage = maxVoltage;
}
public String getMinVoltageID() {
return minVoltageID;
}
public void setMinVoltageID(String minVoltageID) {
this.minVoltageID = minVoltageID;
}
public BigDecimal getMinVoltage() {
return minVoltage;
}
public void setMinVoltage(BigDecimal minVoltage) {
this.minVoltage = minVoltage;
}
public BigDecimal getAvgVoltage() {
return avgVoltage;
}
public void setAvgVoltage(BigDecimal avgVoltage) {
this.avgVoltage = avgVoltage;
}
public String getMaxTempID() {
return maxTempID;
}
public void setMaxTempID(String maxTempID) {
this.maxTempID = maxTempID;
}
public BigDecimal getMaxTemp() {
return maxTemp;
}
public void setMaxTemp(BigDecimal maxTemp) {
this.maxTemp = maxTemp;
}
public String getMinTempID() {
return minTempID;
}
public void setMinTempID(String minTempID) {
this.minTempID = minTempID;
}
public BigDecimal getMinTemp() {
return minTemp;
}
public void setMinTemp(BigDecimal minTemp) {
this.minTemp = minTemp;
}
public BigDecimal getAvgTemp() {
return avgTemp;
}
public void setAvgTemp(BigDecimal avgTemp) {
this.avgTemp = avgTemp;
}
}

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

@ -22,34 +22,34 @@ public class BMSOverViewVo {
private String emsCommunicationStatus;
/** 电池堆总电压 (V) */
private BigDecimal totalVoltage;
private BigDecimal stackVoltage;
/** 可充电量 (kWh) */
private BigDecimal chargeableCapacity;
private BigDecimal availableChargeCapacity;
/** 累计充电量 (kWh) */
private BigDecimal totalChargedCapacity;
private BigDecimal totalChargeCapacity;
/** 电池堆总电流 (A) */
private BigDecimal totalCurrent;
private BigDecimal stackCurrent;
/** 可放电量 (kWh) */
private BigDecimal dischargeableCapacity;
private BigDecimal availableDischargeCapacity;
/** 累计放电量 (kWh) */
private BigDecimal totalDischargedCapacity;
private BigDecimal totalDischargeCapacity;
/** SOH (%) */
private BigDecimal soh;
private BigDecimal stackSoh;
/** 平均温度 (℃) */
private BigDecimal averageTemperature;
private BigDecimal operatingTemp;
/** 绝缘电阻 (Ω) */
private BigDecimal insulationResistance;
private BigDecimal stackInsulationResistance;
/** 当前SOC (%) */
private BigDecimal currentSoc;
private BigDecimal stackSoc;
/** 站点id */
private String siteId;
@ -91,92 +91,84 @@ public class BMSOverViewVo {
this.emsCommunicationStatus = emsCommunicationStatus;
}
public BigDecimal getTotalVoltage() {
return totalVoltage;
public BigDecimal getStackVoltage() {
return stackVoltage;
}
public void setTotalVoltage(BigDecimal totalVoltage) {
this.totalVoltage = totalVoltage;
public void setStackVoltage(BigDecimal stackVoltage) {
this.stackVoltage = stackVoltage;
}
public BigDecimal getChargeableCapacity() {
return chargeableCapacity;
public BigDecimal getAvailableChargeCapacity() {
return availableChargeCapacity;
}
public void setChargeableCapacity(BigDecimal chargeableCapacity) {
this.chargeableCapacity = chargeableCapacity;
public void setAvailableChargeCapacity(BigDecimal availableChargeCapacity) {
this.availableChargeCapacity = availableChargeCapacity;
}
public BigDecimal getTotalChargedCapacity() {
return totalChargedCapacity;
public BigDecimal getTotalChargeCapacity() {
return totalChargeCapacity;
}
public void setTotalChargedCapacity(BigDecimal totalChargedCapacity) {
this.totalChargedCapacity = totalChargedCapacity;
public void setTotalChargeCapacity(BigDecimal totalChargeCapacity) {
this.totalChargeCapacity = totalChargeCapacity;
}
public BigDecimal getTotalCurrent() {
return totalCurrent;
public BigDecimal getStackCurrent() {
return stackCurrent;
}
public void setTotalCurrent(BigDecimal totalCurrent) {
this.totalCurrent = totalCurrent;
public void setStackCurrent(BigDecimal stackCurrent) {
this.stackCurrent = stackCurrent;
}
public BigDecimal getDischargeableCapacity() {
return dischargeableCapacity;
public BigDecimal getAvailableDischargeCapacity() {
return availableDischargeCapacity;
}
public void setDischargeableCapacity(BigDecimal dischargeableCapacity) {
this.dischargeableCapacity = dischargeableCapacity;
public void setAvailableDischargeCapacity(BigDecimal availableDischargeCapacity) {
this.availableDischargeCapacity = availableDischargeCapacity;
}
public BigDecimal getTotalDischargedCapacity() {
return totalDischargedCapacity;
public BigDecimal getTotalDischargeCapacity() {
return totalDischargeCapacity;
}
public void setTotalDischargedCapacity(BigDecimal totalDischargedCapacity) {
this.totalDischargedCapacity = totalDischargedCapacity;
public void setTotalDischargeCapacity(BigDecimal totalDischargeCapacity) {
this.totalDischargeCapacity = totalDischargeCapacity;
}
public BigDecimal getSoh() {
return soh;
public BigDecimal getStackSoh() {
return stackSoh;
}
public void setSoh(BigDecimal soh) {
this.soh = soh;
public void setStackSoh(BigDecimal stackSoh) {
this.stackSoh = stackSoh;
}
public BigDecimal getAverageTemperature() {
return averageTemperature;
public BigDecimal getOperatingTemp() {
return operatingTemp;
}
public void setAverageTemperature(BigDecimal averageTemperature) {
this.averageTemperature = averageTemperature;
public void setOperatingTemp(BigDecimal operatingTemp) {
this.operatingTemp = operatingTemp;
}
public BigDecimal getInsulationResistance() {
return insulationResistance;
public BigDecimal getStackInsulationResistance() {
return stackInsulationResistance;
}
public void setInsulationResistance(BigDecimal insulationResistance) {
this.insulationResistance = insulationResistance;
public void setStackInsulationResistance(BigDecimal stackInsulationResistance) {
this.stackInsulationResistance = stackInsulationResistance;
}
public BigDecimal getCurrentSoc() {
return currentSoc;
public BigDecimal getStackSoc() {
return stackSoc;
}
public void setCurrentSoc(BigDecimal currentSoc) {
this.currentSoc = currentSoc;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
public void setStackSoc(BigDecimal stackSoc) {
this.stackSoc = stackSoc;
}
public String getSiteId() {
@ -187,6 +179,14 @@ public class BMSOverViewVo {
this.siteId = siteId;
}
public String getDeviceId() {
return deviceId;
}
public void setDeviceId(String deviceId) {
this.deviceId = deviceId;
}
public List<BMSBatteryDataList> getBatteryDataList() {
return batteryDataList;
}

View File

@ -1,5 +1,6 @@
package com.xzzn.ems.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.math.BigDecimal;
import java.util.Date;
@ -24,7 +25,11 @@ public class BatteryDataStatsListVo {
/** SOH (%) */
private BigDecimal soh;
private Date updateTime;
@JsonFormat(pattern = "yyyy-MM-dd")
private Date dataTimestamp;
/** 簇号 */
private String clusterDeviceId;
public String getDeviceId() {
return deviceId;
@ -66,11 +71,19 @@ public class BatteryDataStatsListVo {
this.soh = soh;
}
public Date getUpdateTime() {
return updateTime;
public Date getDataTimestamp() {
return dataTimestamp;
}
public void setUpdateTime(Date updateTime) {
this.updateTime = updateTime;
public void setDataTimestamp(Date dataTimestamp) {
this.dataTimestamp = dataTimestamp;
}
public String getClusterDeviceId() {
return clusterDeviceId;
}
public void setClusterDeviceId(String clusterDeviceId) {
this.clusterDeviceId = clusterDeviceId;
}
}

View File

@ -0,0 +1,47 @@
package com.xzzn.ems.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.util.Date;
/**
* 入参-时间
*
*/
public class DateSearchRequest {
/** 开始时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date startDate;
/** 结束时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
private Date endDate;
private String siteId;
public Date getStartDate() {
return startDate;
}
public void setStartDate(Date startDate) {
this.startDate = startDate;
}
public Date getEndDate() {
return endDate;
}
public void setEndDate(Date endDate) {
this.endDate = endDate;
}
public String getSiteId() {
return siteId;
}
public void setSiteId(String siteId) {
this.siteId = siteId;
}
}

View File

@ -0,0 +1,63 @@
package com.xzzn.ems.domain.vo;
import java.math.BigDecimal;
import java.util.List;
/**
* 概率统计-电量指标返回
*
*/
public class ElectricDataInfoVo {
/**
* 总充电量
*/
private BigDecimal totalChargedCap;
/**
* 总放电量
*/
private BigDecimal totalDisChargedCap;
/**
* 综合效率 = 放电量/充电量
*/
private BigDecimal efficiency;
/**
* 按天放电统计
*/
private List<SiteMonitorDataVo> sevenDayDisChargeStats;
public BigDecimal getTotalChargedCap() {
return totalChargedCap;
}
public void setTotalChargedCap(BigDecimal totalChargedCap) {
this.totalChargedCap = totalChargedCap;
}
public BigDecimal getTotalDisChargedCap() {
return totalDisChargedCap;
}
public void setTotalDisChargedCap(BigDecimal totalDisChargedCap) {
this.totalDisChargedCap = totalDisChargedCap;
}
public BigDecimal getEfficiency() {
return efficiency;
}
public void setEfficiency(BigDecimal efficiency) {
this.efficiency = efficiency;
}
public List<SiteMonitorDataVo> getSevenDayDisChargeStats() {
return sevenDayDisChargeStats;
}
public void setSevenDayDisChargeStats(List<SiteMonitorDataVo> sevenDayDisChargeStats) {
this.sevenDayDisChargeStats = sevenDayDisChargeStats;
}
}

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

@ -31,7 +31,7 @@ public class PcsBranchInfo
private String deviceId;
/** 支路id */
private Long branchId;
private String branchId;
public String getDischargeStatus() {
return dischargeStatus;
@ -81,11 +81,11 @@ public class PcsBranchInfo
this.deviceId = deviceId;
}
public Long getBranchId() {
public String getBranchId() {
return branchId;
}
public void setBranchId(Long branchId) {
public void setBranchId(String branchId) {
this.branchId = branchId;
}
}

View File

@ -51,12 +51,12 @@ public class SingleSiteBaseInfo {
/**
* 装机功率MW
*/
private BigDecimal installedPower;
private BigDecimal installPower;
/**
* 装机容量MW
*/
private BigDecimal installedCap;
private BigDecimal installCapacity;
/**
* 七天放电统计
@ -79,20 +79,20 @@ public class SingleSiteBaseInfo {
this.dayChargedCap = dayChargedCap;
}
public BigDecimal getInstalledCap() {
return installedCap;
public BigDecimal getInstallPower() {
return installPower;
}
public void setInstalledCap(BigDecimal installedCap) {
this.installedCap = installedCap;
public void setInstallPower(BigDecimal installPower) {
this.installPower = installPower;
}
public BigDecimal getInstalledPower() {
return installedPower;
public BigDecimal getInstallCapacity() {
return installCapacity;
}
public void setInstalledPower(BigDecimal installedPower) {
this.installedPower = installedPower;
public void setInstallCapacity(BigDecimal installCapacity) {
this.installCapacity = installCapacity;
}
public String getRunningTime() {

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

@ -22,6 +22,8 @@ public class SiteMonitorDataVo {
*/
private BigDecimal chargedCap;
private BigDecimal dailyEfficiency;
public String getAmmeterDate() {
return ammeterDate;
}
@ -45,4 +47,12 @@ public class SiteMonitorDataVo {
public void setChargedCap(BigDecimal chargedCap) {
this.chargedCap = chargedCap;
}
public BigDecimal getDailyEfficiency() {
return dailyEfficiency;
}
public void setDailyEfficiency(BigDecimal dailyEfficiency) {
this.dailyEfficiency = dailyEfficiency;
}
}

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

@ -2,7 +2,6 @@ package com.xzzn.ems.mapper;
import java.util.List;
import com.xzzn.ems.domain.EmsBatteryCluster;
import com.xzzn.ems.domain.vo.BMSBatteryClusterVo;
import com.xzzn.ems.domain.vo.BMSBatteryDataList;
import org.apache.ibatis.annotations.Param;
@ -62,13 +61,6 @@ public interface EmsBatteryClusterMapper
*/
public int deleteEmsBatteryClusterByIds(Long[] ids);
/**
* 根据site_id获取电池簇数据
* @param siteId
* @return
*/
public List<BMSBatteryClusterVo> getBMSBatteryCluster(String siteId);
/**
* 根据site_di和堆id获取簇数据和单体数据
* @param siteId

View File

@ -91,7 +91,7 @@ public interface EmsBatteryDataMapper
* @param clusterDeviceId
* @return
*/
public List<BatteryDataStatsListVo> getAllBatteryDataByClusterId(String clusterDeviceId);
public List<BatteryDataStatsListVo> getAllBatteryDataByClusterId(@Param("clusterDeviceId") String clusterDeviceId,@Param("siteId") String siteId);
int insertEmsBatteryDataList(List<EmsBatteryData> emsBatteryDataList);

View File

@ -4,6 +4,7 @@ import java.util.List;
import java.util.Map;
import com.xzzn.ems.domain.EmsDevicesSetting;
import org.apache.ibatis.annotations.Param;
/**
* Modbus设备配置Mapper接口
@ -60,24 +61,31 @@ public interface EmsDevicesSettingMapper
* @return 结果
*/
public int deleteEmsDevicesSettingByIds(Long[] ids);
/**
* 根据site_id获取所有电池堆
* @param siteId
* 根据父类设备id获取子设备id
* @param parentId
* @return
*/
public List<Map<String, Object>> getAllStackInfoBySiteId(String siteId);
/**
* 根据电池堆id获取所有电池簇
* @param stackDeviceId
* @return
*/
public List<Map<String, Object>> getAllClusterInfoByStackId(String stackDeviceId);
public List<Map<String, Object>> getDeviceInfoByParentId(String parentId);
/**
* 获取该设备下的所有电表
* @param siteId
* @return
*/
public List<EmsDevicesSetting> getAllBatteryDeviceBySiteId(String siteId);
/**
* 根据site_id和device_category获取指定设备信息
* @param siteId
* @param deviceCategory
* @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

@ -1,14 +1,12 @@
package com.xzzn.ems.mapper;
import java.math.BigDecimal;
import java.util.Date;
import java.util.List;
import java.util.Map;
import com.xzzn.ems.domain.EmsPcsData;
import com.xzzn.ems.domain.vo.ElectricIndexList;
import com.xzzn.ems.domain.vo.PcsDetailInfoVo;
import com.xzzn.ems.domain.vo.SiteMonitorDataVo;
import com.xzzn.ems.domain.vo.SiteMonitorRunningHeadInfoVo;
import com.xzzn.ems.domain.vo.*;
import org.apache.ibatis.annotations.Param;
/**
@ -99,4 +97,11 @@ public interface EmsPcsDataMapper
* @return
*/
public Map<String, BigDecimal> getPcsTotalChargeData(String siteId);
/**
* 根据时间按天获取充放电量
* @param requestVo
* @return
*/
public List<SiteMonitorDataVo> getPcsDataByDate(DateSearchRequest requestVo);
}

View File

@ -2,7 +2,9 @@ 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;
/**
* 站点Mapper接口
@ -72,4 +74,20 @@ public interface EmsSiteSettingMapper
* @return
*/
public EmsSiteSetting selectEmsSiteSettingBySiteId(String siteId);
/**
* 根据站点名称和投运时间获取站点列表
* @param siteName
* @param startTime
* @param endTime
* @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,5 +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

@ -0,0 +1,16 @@
package com.xzzn.ems.service;
import com.xzzn.ems.domain.vo.DateSearchRequest;
import com.xzzn.ems.domain.vo.ElectricDataInfoVo;;import java.util.Date;
/**
* 统计报表数据Service接口
*
* @author xzzn
* @date 2025-06-29
*/
public interface IEmsStatsReportService
{
public ElectricDataInfoVo getElectricDataResult(DateSearchRequest requestVo);
}

View File

@ -0,0 +1,7 @@
package com.xzzn.ems.service;
public interface IFXXDataProcessService {
public void handleFxData(String message);
}

View File

@ -27,7 +27,7 @@ public interface ISingleSiteService
public List<EmsCoolingData> getCoolingDataList(String siteId);
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId);
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

@ -1,6 +1,8 @@
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;
@ -41,17 +43,39 @@ public class EmsSiteServiceImpl implements IEmsSiteService
*/
@Override
public List<Map<String, Object>> getAllStackInfo(String siteId) {
return emsDevicesMapper.getAllStackInfoBySiteId(siteId);
return emsDevicesMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.STACK.getCode());
}
/**
* 根据电池堆Id获取电池簇
* @param stackDeviceId
* 根据父类设备id获取子设备id
* @param parentId
* @return
*/
@Override
public List<Map<String, Object>> getAllClusterInfo(String stackDeviceId) {
return emsDevicesMapper.getAllClusterInfoByStackId(stackDeviceId);
public List<Map<String, Object>> getAllClusterInfo(String parentId) {
return emsDevicesMapper.getDeviceInfoByParentId(parentId);
}
/**
* 获取站点列表
* @param siteName
* @param startTime
* @param endTime
* @return
*/
@Override
public List<EmsSiteSetting> getAllSiteInfoList(String siteName, String startTime, String endTime) {
return emsSiteMapper.getSiteInfoList(siteName,startTime,endTime);
}
/**
* 获取设备列表
*
* @param siteId
* @return
*/
@Override
public List<SiteDeviceListVo> getAllDeviceList(String siteId) {
return emsSiteMapper.getAllSiteDeviceList(siteId);
}
}

View File

@ -0,0 +1,77 @@
package com.xzzn.ems.service.impl;
import com.xzzn.common.utils.DateUtils;
import com.xzzn.ems.domain.vo.DateSearchRequest;
import com.xzzn.ems.domain.vo.ElectricDataInfoVo;
import com.xzzn.ems.domain.vo.SiteMonitorDataVo;
import com.xzzn.ems.mapper.EmsPcsDataMapper;
import com.xzzn.ems.service.IEmsStatsReportService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.math.RoundingMode;
import java.time.LocalDate;
import java.util.Date;
import java.util.List;
/**
* 统计报表数据Service业务层处理
*
* @author xzzn
* @date 2025-06-29
*/
@Service
public class EmsStatsReportServiceImpl implements IEmsStatsReportService
{
private static final Logger log = LoggerFactory.getLogger(EmsStatsReportServiceImpl.class);
@Autowired
private EmsPcsDataMapper emsPcsDataMapper;
@Override
public ElectricDataInfoVo getElectricDataResult(DateSearchRequest requestVo) {
ElectricDataInfoVo electricDataInfoVo = new ElectricDataInfoVo();
Date startDate = requestVo.getStartDate();
Date endDate = requestVo.getEndDate();
if (startDate == null && endDate == null) {
// 如果没有传时间默认从今天往前7天
LocalDate sevenDaysAgo = LocalDate.now().minusDays(6);
startDate = DateUtils.toDate(sevenDaysAgo);
requestVo.setStartDate(startDate);
}
// 根据时间获取每天的充放电量
List<SiteMonitorDataVo> dataList = emsPcsDataMapper.getPcsDataByDate(requestVo);
if (!CollectionUtils.isEmpty(dataList)){
// 总充、总放、效率
BigDecimal totalDischarge = new BigDecimal(0);
BigDecimal totalCharge = new BigDecimal(0);
BigDecimal efficiency = new BigDecimal(0);
for (SiteMonitorDataVo siteMonitorDataVo : dataList) {
totalDischarge = totalDischarge.add(siteMonitorDataVo.getDisChargedCap() == null ? BigDecimal.ZERO : siteMonitorDataVo.getDisChargedCap());
totalCharge = totalCharge.add(siteMonitorDataVo.getChargedCap() == null ? BigDecimal.ZERO : siteMonitorDataVo.getChargedCap());
// 计算单天的效率
BigDecimal dailyEfficiency = new BigDecimal(0);
if ( siteMonitorDataVo.getDisChargedCap().compareTo(BigDecimal.ZERO)>0){
dailyEfficiency = siteMonitorDataVo.getDisChargedCap().divide(siteMonitorDataVo.getChargedCap(), 2, RoundingMode.HALF_UP);
}
siteMonitorDataVo.setDailyEfficiency(dailyEfficiency);
}
if ( totalCharge.compareTo(BigDecimal.ZERO)>0){
efficiency = totalDischarge.divide(totalCharge, 2, RoundingMode.HALF_UP);
}
electricDataInfoVo.setSevenDayDisChargeStats(dataList);
electricDataInfoVo.setTotalDisChargedCap(totalDischarge);
electricDataInfoVo.setTotalChargedCap(totalCharge);
electricDataInfoVo.setEfficiency(efficiency);
}
return electricDataInfoVo;
}
}

View File

@ -0,0 +1,641 @@
package com.xzzn.ems.service.impl;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.TypeReference;
import com.xzzn.common.constant.RedisKeyConstants;
import com.xzzn.common.core.redis.RedisCache;
import com.xzzn.common.enums.*;
import com.xzzn.common.utils.DateUtils;
import com.xzzn.common.utils.StringUtils;
import com.xzzn.ems.domain.*;
import com.xzzn.ems.mapper.*;
import com.xzzn.ems.service.IFXXDataProcessService;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.*;
@Service
public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
private static final Log log = LogFactory.getLog(FXXDataProcessServiceImpl.class);
private static final String SITE_ID = "021_FXX_01";
@Autowired
private EmsBatteryClusterMapper emsBatteryClusterMapper;
@Autowired
private EmsBatteryStackMapper emsBatteryStackMapper;
@Autowired
private EmsBatteryDataMapper emsBatteryDataMapper;
@Autowired
private EmsPcsDataMapper emsPcsDataMapper;
@Autowired
private EmsPcsBranchDataMapper emsPcsBranchDataMapper;
@Autowired
private RedisCache redisCache;
@Autowired
private EmsDevicesSettingMapper emsDevicesSettingMapper;
@Autowired
private EmsAmmeterDataMapper emsAmmeterDataMapper;;
@Override
public void handleFxData(String message) {
JSONArray arraylist = JSONArray.parseArray(message);
for (int i = 0; i < arraylist.size(); i++) {
JSONObject obj = JSONObject.parseObject(arraylist.get(i).toString());
String deviceId = obj.get("Device").toString();
String jsonData = obj.get("Data").toString();
log.info("deviceId:" + deviceId);
if (deviceId.contains("BMSD")) {
batteryStackDataProcess(deviceId, jsonData);
} else if (deviceId.contains("BMSC")) {
log.info("BMSC data:"+ 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) {
//电池堆
Map<String, Object> obj = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
});
//BMS 电池簇
EmsBatteryStack dataStack = new EmsBatteryStack();
// 其他非 BigDecimal 字段
dataStack.setWorkStatus(WorkStatus.NORMAL.getCode()); // 或其他默认值
dataStack.setPcsCommunicationStatus(CommunicationStatus.OK.getCode());
dataStack.setEmsCommunicationStatus(CommunicationStatus.OK.getCode());
// 电池堆状态数据设置
dataStack.setOperationStatus(StringUtils.getString(obj.get("DCZT")));
dataStack.setStackVoltage(StringUtils.getBigDecimal(obj.get("DCDDY")));
dataStack.setStackCurrent(StringUtils.getBigDecimal(obj.get("DCDDL")));
dataStack.setStackSoc(StringUtils.getBigDecimal(obj.get("DCDSOC")));
dataStack.setStackSoh(StringUtils.getBigDecimal(obj.get("DCDSOH")));
// 电压极值信息
dataStack.setMaxCellVoltage(StringUtils.getBigDecimal(obj.get("ZGDCDY")));
dataStack.setMaxVoltageGroupId(StringUtils.getLong(obj.get("ZGDCDYZH")));
dataStack.setMaxVoltageCellId(StringUtils.getLong(obj.get("ZGDCDYZHDH")));
dataStack.setMinCellVoltage(StringUtils.getBigDecimal(obj.get("ZDDCDY")));
dataStack.setMinVoltageGroupId(StringUtils.getLong(obj.get("ZDDCDYZH")));
dataStack.setMinVoltageCellId(StringUtils.getLong(obj.get("ZDDCDYZHDH")));
// 温度极值信息
dataStack.setMaxCellTemp(StringUtils.getBigDecimal(obj.get("ZGDCWD")));
dataStack.setMaxTempGroupId(StringUtils.getLong(obj.get("ZGDCWDZH")));
dataStack.setMaxTempCellId(StringUtils.getLong(obj.get("ZGDCWDZHDH")));
dataStack.setMinCellTemp(StringUtils.getBigDecimal(obj.get("ZDDCWD")));
dataStack.setMinTempGroupId(StringUtils.getLong(obj.get("ZDDCWDZH")));
dataStack.setMinTempCellId(StringUtils.getLong(obj.get("ZDDCWDZHDH")));
// 电量统计信息
dataStack.setTotalChargeCapacity(StringUtils.getBigDecimal(obj.get("DLJCDDL")));
dataStack.setTotalDischargeCapacity(StringUtils.getBigDecimal(obj.get("DLCFDDL")));
dataStack.setSessionChargeCapacity(StringUtils.getBigDecimal(obj.get("DDCLJCDDL")));
dataStack.setSessionDischargeCapacity(StringUtils.getBigDecimal(obj.get("DDCLJFDDL")));
dataStack.setAvailableChargeCapacity(StringUtils.getBigDecimal(obj.get("DKCDL")));
dataStack.setAvailableDischargeCapacity(StringUtils.getBigDecimal(obj.get("DKFDL")));
// 时间信息
dataStack.setRemainingDischargeTime(StringUtils.getLong(obj.get("KYFDSJ")));
dataStack.setRemainingChargeTime(StringUtils.getLong(obj.get("KYCDSJ")));
// 功率/电流限制
dataStack.setMaxDischargePower(StringUtils.getBigDecimal(obj.get("YXZDFDGL")));
dataStack.setMaxChargePower(StringUtils.getBigDecimal(obj.get("YXZDCDGL")));
dataStack.setMaxDischargeCurrent(StringUtils.getBigDecimal(obj.get("YXZDFDDL")));
dataStack.setMaxChargeCurrent(StringUtils.getBigDecimal(obj.get("YXZDCDDL")));
// 当日统计
dataStack.setDailyDischargeCycles(StringUtils.getLong(obj.get("DTFDCS")));
dataStack.setDailyChargeCycles(StringUtils.getLong(obj.get("DTCDCS")));
dataStack.setDailyDischargeCapacity(StringUtils.getBigDecimal(obj.get("DTFDDL")));
dataStack.setDailyChargeCapacity(StringUtils.getBigDecimal(obj.get("DTCDDL")));
// 系统状态
dataStack.setOperatingTemp(StringUtils.getBigDecimal(obj.get("YXWD")));
dataStack.setBmsStatus(StringUtils.getString(obj.get("BMSDDQZT")));
dataStack.setBmsChargeStatus(StringUtils.getString(obj.get("BMSCFDZT")));
dataStack.setStackInsulationResistance(StringUtils.getBigDecimal(obj.get("DCDJYDZ")));
dataStack.setCreateBy("system");
dataStack.setCreateTime(DateUtils.getNowDate());
dataStack.setUpdateBy("system");
dataStack.setUpdateTime(DateUtils.getNowDate());
dataStack.setSiteId(SITE_ID);
dataStack.setDeviceId(deviceId);
emsBatteryStackMapper.insertEmsBatteryStack(dataStack);
redisCache.setCacheObject(RedisKeyConstants.STACK + SITE_ID + "_" +deviceId, dataStack);
}
private void batteryClusterDataProcess(String deviceId, String dataJson) {
Map<String, Object> obj = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
});
EmsDevicesSetting joken = new EmsDevicesSetting();
joken.setDeviceId(deviceId);
List<EmsDevicesSetting> up = emsDevicesSettingMapper.selectEmsDevicesSettingList(joken);
String stackDeviceId = "";
if (up != null && up.size() >0) {
stackDeviceId = up.get(0).getParentId();
if (stackDeviceId == null || stackDeviceId.isEmpty()) {
stackDeviceId = "1";
}
}
//BMS 电池簇
EmsBatteryCluster data = new EmsBatteryCluster();
// 设置所有 BigDecimal 类型字段为 ZERO
data.setChargeableCapacity(StringUtils.getBigDecimal(obj.get("KCDL")));
data.setClusterVoltage(StringUtils.getBigDecimal(obj.get("ZDY")));
data.setClusterCurrent(StringUtils.getBigDecimal(obj.get("ZDL")));
data.setTotalChargedCapacity(StringUtils.getBigDecimal(obj.get("LJCDDL")));
data.setDischargeableCapacity(StringUtils.getBigDecimal(obj.get("KFDL")));
data.setTotalDischargedCapacity(StringUtils.getBigDecimal(obj.get("LJFDDL")));
data.setSoh(StringUtils.getBigDecimal(obj.get("ZSOH")));
data.setAverageTemperature(StringUtils.getBigDecimal(obj.get("MKWD")));
data.setInsulationResistance(StringUtils.getBigDecimal(obj.get("ZJYDZ")));
data.setCurrentSoc(StringUtils.getBigDecimal(obj.get("ZSOC")));
data.setMaxAllowedChargePower(StringUtils.getBigDecimal(obj.get("YXCDZDGL")));
data.setMaxAllowedDischargePower(StringUtils.getBigDecimal(obj.get("YXFDZDGL")));
data.setMaxAllowedChargeVoltage(StringUtils.getBigDecimal(obj.get("YXCDZDDY")));
data.setMaxAllowedDischargeVoltage(StringUtils.getBigDecimal(obj.get("YXFDZDDY")));
data.setMaxAllowedChargeCurrent(StringUtils.getBigDecimal(obj.get("YXCDZDDL")));
data.setMaxAllowedDischargeCurrent(StringUtils.getBigDecimal(obj.get("YXFDZDDL")));
data.setBatteryPackVoltage(StringUtils.getBigDecimal(obj.get("ZDY")));
data.setBatteryPackCurrent(StringUtils.getBigDecimal(obj.get("ZDL")));
data.setBatteryPackTemp(StringUtils.getBigDecimal(obj.get("MKWD")));
data.setBatteryPackSoc(StringUtils.getBigDecimal(obj.get("ZSOC")));
data.setBatteryPackSoh(StringUtils.getBigDecimal(obj.get("ZSOH")));
data.setBatteryPackInsulationResistance(StringUtils.getBigDecimal(obj.get("ZJYDZ")));
data.setAvgCellVoltage(StringUtils.getBigDecimal(obj.get("PJDTDY")));
data.setAvgCellTemp(StringUtils.getBigDecimal(obj.get("PJDTWD")));
data.setMaxCellVoltage(StringUtils.getBigDecimal(obj.get("ZGDTDY")));
data.setMinCellVoltage(StringUtils.getBigDecimal(obj.get("ZDDTDY")));
data.setMaxCellTemp(StringUtils.getBigDecimal(obj.get("ZGDTWD")));
data.setMinCellTemp(StringUtils.getBigDecimal(obj.get("ZDDTWD")));
data.setMaxCellSoc(StringUtils.getBigDecimal(obj.get("ZGDTSOC")));
data.setMinCellSoc(StringUtils.getBigDecimal(obj.get("ZDDTSOC")));
data.setMaxCellSoh(StringUtils.getBigDecimal(obj.get("ZGDTSOH")));
data.setMinCellSoh(StringUtils.getBigDecimal(obj.get("ZDDTSOH")));
data.setTotalChargeEnergy(StringUtils.getBigDecimal(obj.get("DCLJCDDL")));
data.setTotalDischargeEnergy(StringUtils.getBigDecimal(obj.get("DCLJFDDL")));
// 其他非 BigDecimal 字段
data.setWorkStatus(WorkStatus.NORMAL.getCode()); // 或其他默认值
data.setPcsCommunicationStatus(CommunicationStatus.OK.getCode());
data.setEmsCommunicationStatus(CommunicationStatus.OK.getCode());
data.setCreateBy("system");
data.setCreateTime(DateUtils.getNowDate());
data.setUpdateBy("system");
data.setUpdateTime(DateUtils.getNowDate());
data.setSiteId(SITE_ID);
data.setDeviceId(deviceId);
data.setMaxCellVoltageId(StringUtils.getLong(obj.get("ZGDTDYDYD")));
data.setMinCellVoltageId(StringUtils.getLong(obj.get("ZDDTDYDYD")));
data.setMaxCellTempId(StringUtils.getLong(obj.get("ZGDTWDDYD")));
data.setMinCellTempId(StringUtils.getLong(obj.get("ZDDTWDDYD")));
data.setMaxCellSocId(StringUtils.getLong(obj.get("ZGDTSOCDYD")));
data.setMinCellSocId(StringUtils.getLong(obj.get("ZDDTSOCDYD")));
data.setMaxCellSohId(StringUtils.getLong(obj.get("ZGDTSOHDYD")));
data.setMinCellSohId(StringUtils.getLong(obj.get("ZDDTSOHDYD")));
if (StringUtils.isNotBlank(stackDeviceId)) {
data.setStackDeviceId(stackDeviceId);
} else {
data.setStackDeviceId("1");
}
emsBatteryClusterMapper.insertEmsBatteryCluster(data);
redisCache.setCacheObject(RedisKeyConstants.CLUSTER + SITE_ID + "_" +deviceId, data);
}
private void batteryDataProcess(String deviceId, String dataJson) {
EmsDevicesSetting joken = new EmsDevicesSetting();
joken.setDeviceId(deviceId);
List<EmsDevicesSetting> up = emsDevicesSettingMapper.selectEmsDevicesSettingList(joken);
String stackDeviceId = "";
if (up != null && up.size() >0) {
stackDeviceId = up.get(0).getParentId();
if (stackDeviceId == null || stackDeviceId.isEmpty()) {
stackDeviceId = "1";
}
}
//单体电池
Map<String, Map<String, Object>> records = processData(JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {}));
List<EmsBatteryData> list = new ArrayList<>();
//单体电池
for (Map.Entry<String, Map<String, Object>> record : records.entrySet()) {
String recordId = record.getKey();
Map<String, Object> fields = record.getValue();
EmsBatteryData batteryData = new EmsBatteryData();
batteryData.setDeviceId(recordId);
batteryData.setBatteryCellId(recordId);
batteryData.setSoc(StringUtils.getBigDecimal(fields.get("DTSOC")));
batteryData.setSoh(StringUtils.getBigDecimal(fields.get("DTSOH")));
batteryData.setTemperature(StringUtils.getBigDecimal(fields.get("DTWD")));
batteryData.setVoltage(StringUtils.getBigDecimal(fields.get("DTDY")));
batteryData.setBatteryCluster(deviceId);
batteryData.setBatteryPack(stackDeviceId);
// 时间戳
batteryData.setDataTimestamp(new Date());
// ID字段
batteryData.setSiteId(SITE_ID);
batteryData.setClusterDeviceId(deviceId);
list.add(batteryData);
}
if (list.size() > 0 ) {
emsBatteryDataMapper.insertEmsBatteryDataList(list);
redisCache.deleteList(RedisKeyConstants.BATTERY + SITE_ID + "_" +deviceId);
redisCache.setCacheList(RedisKeyConstants.BATTERY + SITE_ID + "_" +deviceId, list);
}
}
private void pcsDataProcess(String deviceId, String dataJson) {
Map<String, Object> obj = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
});
//pcs
EmsPcsData pcsData = new EmsPcsData();
// 时间与状态类字段
pcsData.setDataUpdateTime(new Date());
pcsData.setWorkStatus(WorkStatus.NORMAL.getCode());
pcsData.setGridStatus(GridStatus.GRID.getCode());
pcsData.setDeviceStatus(DeviceStatus.ONLINE.getCode());
pcsData.setControlMode(ControlModeStatus.REMOTE.getCode());
// 功率与能量类字段
pcsData.setTotalActivePower(StringUtils.getBigDecimal(obj.get("JLCCDYGGL")));
pcsData.setDailyAcChargeEnergy(StringUtils.getBigDecimal(obj.get("RCDL")));
pcsData.setTotalReactivePower(StringUtils.getBigDecimal(obj.get("JLCRXWGGL")));
pcsData.setDailyAcDischargeEnergy(StringUtils.getBigDecimal(obj.get("RFDL")));
pcsData.setTotalApparentPower(StringUtils.getBigDecimal(obj.get("XTSZGL")));
pcsData.setTotalPowerFactor(StringUtils.getBigDecimal(obj.get("GLYS")));
pcsData.setDcPower(StringUtils.getBigDecimal(obj.get("XTSZGL")));
pcsData.setTotalAcChargeEnergy(StringUtils.getBigDecimal(obj.get("ZCDL")));
pcsData.setTotalAcDischargeEnergy(StringUtils.getBigDecimal(obj.get("ZFDL")));
pcsData.setAcChargeActivePower(StringUtils.getBigDecimal(obj.get("JLCCDYGGL")));
pcsData.setAcCapacitiveReactivePower(StringUtils.getBigDecimal(obj.get("JLCRXWGGL")));
pcsData.setAcDischargeActivePower(StringUtils.getBigDecimal(obj.get("JLCFDYGGL")));
pcsData.setAcInductiveReactivePower(StringUtils.getBigDecimal(obj.get("JLCGXWGGL")));
pcsData.setMaxCapacitivePowerCapacity(StringUtils.getBigDecimal(obj.get("ZDRXWGNL")));
pcsData.setMaxInductivePowerCapacity(StringUtils.getBigDecimal(obj.get("ZDGXWGNL")));
pcsData.setMaxChargePowerCapacity(StringUtils.getBigDecimal(obj.get("ZDKCGL")));
pcsData.setMaxDischargePowerCapacity(StringUtils.getBigDecimal(obj.get("ZDKFGL")));
// 温度与环境参数
// pcsData.setPcsModuleTemperature(StringUtils.getBigDecimal(obj.get("ChargeableCapacity")));
// pcsData.setPcsEnvironmentTemperature(StringUtils.getBigDecimal(obj.get("ChargeableCapacity")));
// pcsData.setAcFrequency(StringUtils.getBigDecimal(obj.get("ChargeableCapacity")));
// 状态指示类
pcsData.setBranchStatus(BranchStatus.NORMAL.getCode());
pcsData.setDischargeStatus(ChargeStatus.CHARGING.getCode());
String acSwitchStatus = StringUtils.getString(obj.get("JLKGZT"));
pcsData.setAcSwitchStatus(SwitchStatus.CLOSED.getCode());
String dcSwitchStatus = StringUtils.getString(obj.get("ZLKGZT"));
pcsData.setDcSwitchStatus(SwitchStatus.CLOSED.getCode());
String controlMode = StringUtils.getString(obj.get("YCTT"));
pcsData.setRemoteControlStatus(ControlModeStatus.REMOTE.getCode());
// 直流参数
// pcsData.setDcVoltage(StringUtils.getBigDecimal(obj.get("ChargeableCapacity")));
// pcsData.setDcCurrent(StringUtils.getBigDecimal(obj.get("ChargeableCapacity")));
// 系统管理字段
pcsData.setCreateBy("system");
pcsData.setCreateTime(DateUtils.getNowDate());
pcsData.setUpdateBy("system");
pcsData.setUpdateTime(DateUtils.getNowDate());
pcsData.setSiteId(SITE_ID);
pcsData.setDeviceId(deviceId);
pcsData.setDateMonth(DateUtils.getNowMonthLong());
pcsData.setDateDay(DateUtils.getNowDayLong());
emsPcsDataMapper.insertEmsPcsData(pcsData);
redisCache.setCacheObject(RedisKeyConstants.PCS + SITE_ID + "_" +deviceId, pcsData);
}
private void pcsBranchDataProcess(String deviceId, String dataJson) {
Map<String, Map<String, Object>> records = processDataPrefix(JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {}));
List<EmsPcsBranchData> list = new ArrayList<>();
//PCS支路
for (Map.Entry<String, Map<String, Object>> record : records.entrySet()) {
String recordId = record.getKey();
Map<String, Object> fields = record.getValue();
EmsPcsBranchData data = new EmsPcsBranchData();
data.setDeviceId(deviceId);
data.setGridStatus(GridStatus.GRID.getCode());
data.setDcPower(StringUtils.getBigDecimal(fields.get("ZLGL")));
data.setDcVoltage(StringUtils.getBigDecimal(fields.get("ZLDY")));
data.setDcCurrent(StringUtils.getBigDecimal(fields.get("ZLDL")));
data.setGridUVoltage(StringUtils.getBigDecimal(fields.get("DWVXDY")));
data.setGridVVoltage(StringUtils.getBigDecimal(fields.get("DWUXDY")));
data.setGridWVoltage(StringUtils.getBigDecimal(fields.get("DWWXDY")));
data.setOutputUCurrent(StringUtils.getBigDecimal(fields.get("SCUXDL")));
data.setOutputVCurrent(StringUtils.getBigDecimal(fields.get("SCVXDL")));
data.setOutputWCurrent(StringUtils.getBigDecimal(fields.get("SCWXDL")));
data.setApparentPower(StringUtils.getBigDecimal(fields.get("SZGL")));
data.setActivePower(StringUtils.getBigDecimal(fields.get("YGGL")));
data.setReactivePower(StringUtils.getBigDecimal(fields.get("WGGL")));
data.setPowerFactor(StringUtils.getBigDecimal(fields.get("GLYS")));
data.setFrequency(StringUtils.getBigDecimal(fields.get("PL")));
data.setInternalTemp(StringUtils.getBigDecimal(fields.get("DY1WD")));
data.setuIgbtTemp(StringUtils.getBigDecimal(fields.get("UXIGBTWD")));
data.setvIgbtTemp(StringUtils.getBigDecimal(fields.get("VXIGBTWD")));
data.setwIgbtTemp(StringUtils.getBigDecimal(fields.get("WXIGBTWD")));
data.setAvailablePower(StringUtils.getBigDecimal(fields.get("KYGL")));
data.setTotalLoadRatio(StringUtils.getBigDecimal(fields.get("ZFZB")));
data.setAcLeakageCurrent(StringUtils.getBigDecimal(fields.get("JLLDL")));
data.setInsulationResistance(StringUtils.getBigDecimal(fields.get("JYZK")));
data.setBranchId(recordId);
list.add(data);
}
if (list.size() > 0 ) {
emsPcsBranchDataMapper.insertPcsBranchDataList(list);
redisCache.setCacheObject(RedisKeyConstants.BRANCH + SITE_ID + "_" +deviceId, list);
}
}
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<>();
for (Map.Entry<String, Object> entry : rawData.entrySet()) {
String key = entry.getKey();
// 提取记录ID最后3位
String recordId = key.substring(key.length() - 3);
try {
Long.parseLong(recordId);
} catch (Exception e) {
continue;
}
// 提取字段类型(前缀)
String fieldType = key.substring(0, key.length() - 3);
// 初始化记录
records.putIfAbsent(recordId, new HashMap<>());
// 存入字段值
records.get(recordId).put(fieldType, entry.getValue());
}
return records;
}
private static Map<String, Map<String, Object>> processDataPrefix(Map<String, Object> rawData) {
Map<String, Map<String, Object>> records = new HashMap<>();
for (Map.Entry<String, Object> entry : rawData.entrySet()) {
String key = entry.getKey();
// 确保键长度足够
if (key.length() < 3) {
continue;
}
// 提取记录ID前3位
String recordId = key.substring(0, 3);
if (!recordId.startsWith("DY")) {
continue;
}
// 提取字段类型(剩余部分)
String fieldType = key.substring(3);
// 初始化记录
records.putIfAbsent(recordId, new HashMap<>());
// 存入字段值
records.get(recordId).put(fieldType, entry.getValue());
}
return records;
}
}

View File

@ -57,8 +57,8 @@ public class HomePageServiceImpl implements IHomePageService
if (emsSite != null) {
// 装机功率+装机容量
singleSiteBaseInfo.setSiteName(emsSite.getSiteName());
singleSiteBaseInfo.setInstalledCap(emsSite.getInstallCapacity());
singleSiteBaseInfo.setInstalledPower(emsSite.getInstallPower());
singleSiteBaseInfo.setInstallCapacity(emsSite.getInstallCapacity());
singleSiteBaseInfo.setInstallPower(emsSite.getInstallPower());
String[] siteLocation = new String[2];
siteLocation[0] = emsSite.getLongitude() == null ? "" : emsSite.getLongitude().toString();
siteLocation[1] = emsSite.getLatitude() == null ? "" : emsSite.getLatitude().toString();

View File

@ -1,19 +1,21 @@
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.EmsBatteryData;
import com.xzzn.ems.domain.EmsCoolingData;
import com.xzzn.ems.domain.EmsDevicesSetting;
import com.xzzn.ems.domain.*;
import com.xzzn.ems.domain.vo.*;
import com.xzzn.ems.mapper.*;
import com.xzzn.ems.service.ISingleSiteService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* 单点监控 服务层实现
@ -27,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
@ -46,6 +52,9 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
@Autowired
private EmsDevicesSettingMapper emsDevicesSettingMapper;
@Autowired
private RedisCache redisCache;
@Override
public SiteMonitorHomeVo getSiteMonitorDataVo(String siteId) {
SiteMonitorHomeVo siteMonitorHomeVo = new SiteMonitorHomeVo();
@ -137,94 +146,147 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
List<PcsDetailInfoVo> pcsDetailInfoVoList = new ArrayList<>();
if (!StringUtils.isEmpty(siteId)) {
// 获取pcs最新数据
pcsDetailInfoVoList = emsPcsDataMapper.getPcsDetailInfoBySiteId(siteId);
if (!CollectionUtils.isEmpty(pcsDetailInfoVoList)) {
for (PcsDetailInfoVo pcsDetailInfoVo : pcsDetailInfoVoList) {
String deviceId = pcsDetailInfoVo.getDeviceId();
// 获取支路最新数据
if (!StringUtils.isEmpty(deviceId)) {
List<PcsBranchInfo> pcsBranchInfoList = emsPcsBranchDataMapper.getPcsBranchInfoList(siteId, deviceId);
pcsDetailInfoVo.setPcsBranchInfoList(pcsBranchInfoList);
}
// 获取该设备下所有pcs的id
List<Map<String, Object>> pcsIds = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.PCS.getCode());
for (Map<String, Object> pcsDevice : pcsIds) {
PcsDetailInfoVo pcsDetailInfoVo = new PcsDetailInfoVo();
pcsDetailInfoVo.setDeviceName(pcsDevice.get("deviceName").toString());
pcsDetailInfoVo.setCommunicationStatus(pcsDevice.get("communicationStatus").toString());
// 从redis取pcs单个详细数据
String pcsId = pcsDevice.get("id").toString();
EmsPcsData pcsData = redisCache.getCacheObject(RedisKeyConstants.PCS +siteId+"_"+pcsId);
if (pcsData != null) {
BeanUtils.copyProperties(pcsData, pcsDetailInfoVo);
}
// 支路信息数据
List<PcsBranchInfo> pcsBranchInfoList = new ArrayList<>();
processBranchDataInfo(siteId,pcsId,pcsBranchInfoList);
pcsDetailInfoVo.setPcsBranchInfoList(pcsBranchInfoList);
pcsDetailInfoVoList.add(pcsDetailInfoVo);
}
}
return pcsDetailInfoVoList;
}
private void processBranchDataInfo(String siteId, String pcsId, List<PcsBranchInfo> pcsBranchInfoList) {
if (!StringUtils.isEmpty(pcsId)) {
List<EmsPcsBranchData> pcsBranchData = redisCache.getCacheObject(RedisKeyConstants.BRANCH +siteId+"_"+pcsId);
if (pcsBranchData != null) {
for(EmsPcsBranchData emsPcsBranchData : pcsBranchData) {
PcsBranchInfo pcsBranchInfo = new PcsBranchInfo();
BeanUtils.copyProperties(emsPcsBranchData, pcsBranchInfo);
pcsBranchInfoList.add(pcsBranchInfo);
}
}
}
}
// 获取BMS总览数据
@Override
public List<BMSOverViewVo> getBMSOverView(String siteId) {
List<BMSOverViewVo> bmsOverViewVoList = new ArrayList<>();
// 获取所有电池堆
if (!StringUtils.isEmpty(siteId)) {
// 获取电池堆list
bmsOverViewVoList = emsBatteryStackMapper.selectEmsBatteryStackBySiteId(siteId);
if (!CollectionUtils.isEmpty(bmsOverViewVoList)) {
for (BMSOverViewVo bmsOverViewVo : bmsOverViewVoList) {
// 获取单体电池数据
String stackDeviceId = bmsOverViewVo.getDeviceId();
if (!StringUtils.isEmpty(stackDeviceId)) {
List<BMSBatteryDataList> batteryDataList = emsBatteryClusterMapper.getBmsBatteryData(siteId,stackDeviceId);
bmsOverViewVo.setBatteryDataList(batteryDataList);
}
List<Map<String, Object>> stackIds = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.STACK.getCode());
for (Map<String, Object> stackDevice : stackIds) {
BMSOverViewVo bmsOverViewVo = new BMSOverViewVo();
bmsOverViewVo.setDeviceName(stackDevice.get("deviceName").toString());
// 从redis取堆单个详细数据
String stackId = stackDevice.get("id").toString();
EmsBatteryStack stackData = redisCache.getCacheObject(RedisKeyConstants.STACK +siteId+"_"+stackId);
if (stackData != null) {
BeanUtils.copyProperties(stackData, bmsOverViewVo);
}
// 下面簇列表数据
if (!StringUtils.isEmpty(stackId)) {
getBMSClusterListInfo(siteId,stackId,bmsOverViewVo);
}
bmsOverViewVoList.add(bmsOverViewVo);
}
}
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) {
List<BMSBatteryClusterVo> bmsBatteryClusterVoList = new ArrayList<>();
if (!StringUtils.isEmpty(siteId)) {
bmsBatteryClusterVoList = emsBatteryClusterMapper.getBMSBatteryCluster(siteId);
if (!CollectionUtils.isEmpty(bmsBatteryClusterVoList)) {
for (BMSBatteryClusterVo bmsBatteryClusterVo : bmsBatteryClusterVoList) {
String clusterDeviceId = bmsBatteryClusterVo.getDeviceId();
// 获取所有设备下的电池簇id
List<Map<String, Object>> clusterIds = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.CLUSTER.getCode());
for (Map<String, Object> clusterDevice : clusterIds) {
BMSBatteryClusterVo bmsBatteryClusterVo = new BMSBatteryClusterVo();
bmsBatteryClusterVo.setDeviceName(clusterDevice.get("deviceName").toString());
// 从redis取单个簇详细数据
String clusterId = clusterDevice.get("id").toString();
EmsBatteryCluster clusterData = redisCache.getCacheObject(RedisKeyConstants.CLUSTER +siteId+"_"+clusterId);
if (clusterData != null) {
BeanUtils.copyProperties(clusterData, bmsBatteryClusterVo);
// 处理单体电池数据-平均/最大/最小
List<BMSBatteryClusterDataList> clusterDataList = new ArrayList<>();
if (!StringUtils.isEmpty(clusterDeviceId)) {
// 获取单体电池数据-平均/最大/最小
//BatteryClusterDataDetailVo batteryClusterDataDetailVo = emsBatteryDataMapper.getBatteryDataByClusterId(siteId,clusterDeviceId);
// 处理数据
BMSBatteryClusterDataList voltageData = new BMSBatteryClusterDataList();
BMSBatteryClusterDataList tempData = new BMSBatteryClusterDataList();
BMSBatteryClusterDataList socData = new BMSBatteryClusterDataList();
// 设值
voltageData.setDataName(CLUSTER_DATA_VOLTAGE);
voltageData.setAvgData(bmsBatteryClusterVo.getAvgVoltage());
voltageData.setMaxData(bmsBatteryClusterVo.getMaxVoltage());
voltageData.setMaxDataID(bmsBatteryClusterVo.getMaxVoltageID());
voltageData.setMinData(bmsBatteryClusterVo.getMinVoltage());
voltageData.setMinDataID(bmsBatteryClusterVo.getMinVoltageID());
tempData.setDataName(CLUSTER_DATA_TEP);
tempData.setAvgData(bmsBatteryClusterVo.getAvgTemp());
tempData.setMaxData(bmsBatteryClusterVo.getMaxTemp());
tempData.setMaxDataID(bmsBatteryClusterVo.getMaxTempID());
tempData.setMinData(bmsBatteryClusterVo.getMinTemp());
tempData.setMinDataID(bmsBatteryClusterVo.getMinTempID());
socData.setDataName(CLUSTER_DATA_SOC);
socData.setAvgData(bmsBatteryClusterVo.getAvgSoc());
socData.setMaxData(bmsBatteryClusterVo.getMaxSoc());
socData.setMaxDataID(bmsBatteryClusterVo.getMaxSocID());
socData.setMinData(bmsBatteryClusterVo.getMinSoc());
socData.setMinDataID(bmsBatteryClusterVo.getMinSocID());
clusterDataList.add(voltageData);
clusterDataList.add(tempData);
clusterDataList.add(socData);
bmsBatteryClusterVo.setBatteryDataList(clusterDataList);
}
dealWithBatteryClusterData(clusterData,clusterDataList);
bmsBatteryClusterVo.setBatteryDataList(clusterDataList);
}
bmsBatteryClusterVoList.add(bmsBatteryClusterVo);
}
}
return bmsBatteryClusterVoList;
}
private void dealWithBatteryClusterData(EmsBatteryCluster clusterData, List<BMSBatteryClusterDataList> clusterDataList) {
BMSBatteryClusterDataList voltageData = new BMSBatteryClusterDataList();
BMSBatteryClusterDataList tempData = new BMSBatteryClusterDataList();
BMSBatteryClusterDataList socData = new BMSBatteryClusterDataList();
// 设值
voltageData.setDataName(CLUSTER_DATA_VOLTAGE);
voltageData.setAvgData(clusterData.getAvgCellVoltage());
voltageData.setMaxData(clusterData.getMaxCellVoltage());
voltageData.setMaxDataID(clusterData.getMaxCellVoltageId().toString());
voltageData.setMinData(clusterData.getMinCellVoltage());
voltageData.setMinDataID(clusterData.getMinCellVoltageId().toString());
tempData.setDataName(CLUSTER_DATA_TEP);
tempData.setAvgData(clusterData.getAvgCellTemp());
tempData.setMaxData(clusterData.getMaxCellTemp());
tempData.setMaxDataID(clusterData.getMaxCellTempId().toString());
tempData.setMinData(clusterData.getMinCellTemp());
tempData.setMinDataID(clusterData.getMinCellTempId().toString());
socData.setDataName(CLUSTER_DATA_SOC);
socData.setAvgData(clusterData.getCurrentSoc());
socData.setMaxData(clusterData.getMaxCellSoc());
socData.setMaxDataID(clusterData.getMaxCellSocId().toString());
socData.setMinData(clusterData.getMinCellSoc());
socData.setMinDataID(clusterData.getMinCellSocId().toString());
clusterDataList.add(voltageData);
clusterDataList.add(tempData);
clusterDataList.add(socData);
}
// 获取液冷设备参数
@Override
public List<EmsCoolingData> getCoolingDataList(String siteId) {
@ -237,14 +299,33 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
/**
* 根据电池堆获取单体柱状数据
* 根据电池堆获取单体电池数据
* @param clusterDeviceId
* @return
*/
@Override
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId) {
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId,String siteId) {
List<BatteryDataStatsListVo> batteryDataStatsListVo = new ArrayList<>();
batteryDataStatsListVo = emsBatteryDataMapper.getAllBatteryDataByClusterId(clusterDeviceId);
List<Map<String, Object>> clusterIds = new ArrayList<>();
if (StringUtils.isEmpty(clusterDeviceId)) {
clusterIds = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.CLUSTER.getCode());
} else {
Map<String, Object> map = new HashMap<>();
map.put("id", clusterDeviceId);
clusterIds.add(map);
}
for (Map<String, Object> clusterDevice : clusterIds) {
// 从redis取单个簇详细数据
String clusterId = clusterDevice.get("id").toString();
List<EmsBatteryData> batteryDataList = redisCache.getCacheList(RedisKeyConstants.BATTERY + siteId + "_" + clusterId);
if (batteryDataList != null) {
for (EmsBatteryData batteryData : batteryDataList) {
BatteryDataStatsListVo batteryDataStatsVo = new BatteryDataStatsListVo();
BeanUtils.copyProperties(batteryData, batteryDataStatsVo);
batteryDataStatsListVo.add(batteryDataStatsVo);
}
}
}
return batteryDataStatsListVo;
}
@ -254,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

@ -139,17 +139,15 @@
t.alarm_start_time as alarmStartTime,t.alarm_end_time as alarmEndTime
from ems_alarm_records t
where t.site_id = #{siteId}
<if test="deviceType != null and deviceType != 0">
<if test="deviceType != null and deviceType != ''">
AND t.device_type = #{deviceType}
</if>
<if test="alarmLevel != null and alarmLevel != ''">
AND t.alarm_level = #{alarmLevel}
</if>
<if test="alarmStartTime != null and alarmStartTime != ''">
AND date_format(t.alarm_start_time,'%Y%m%d') &gt;= date_format(#{alarmStartTime},'%Y%m%d')
</if>
<if test="alarmEndTime != null and alarmEndTime != ''"><!-- 结束时间检索 -->
AND date_format(t.alarm_end_time,'%Y%m%d') &lt;= date_format(#{alarmEndTime},'%Y%m%d')
<if test="alarmStartTime != null and alarmStartTime != null and alarmEndTime != null and alarmEndTime != ''">
AND (date_format(t.alarm_start_time,'%Y%m%d') BETWEEN date_format(#{alarmStartTime},'%Y%m%d') and date_format(#{alarmEndTime},'%Y%m%d')
or date_format(t.alarm_end_time,'%Y%m%d') BETWEEN date_format(#{alarmStartTime},'%Y%m%d') and date_format(#{alarmEndTime},'%Y%m%d') )
</if>
</select>
</mapper>

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

@ -309,33 +309,6 @@
</foreach>
</delete>
<select id="getBMSBatteryCluster" parameterType="String" resultType="com.xzzn.ems.domain.vo.BMSBatteryClusterVo">
select td.device_name as deviceName, tmp.work_status as workStatus,
tmp.pcs_communication_status as pcsCommunicationStatus, tmp.ems_communication_status as emsCommunicationStatus,
tmp.cluster_voltage as clusterVoltage,tmp.chargeable_capacity as chargeableCapacity,
tmp.total_charged_capacity as totalChargedCapacity,
tmp.cluster_current as clusterCurrent,tmp.dischargeable_capacity as dischargeableCapacity,
tmp.total_discharged_capacity as totalDischargedCapacity,
tmp.soh as soh,tmp.average_temperature as averageTemperature,tmp.insulation_resistance as insulationResistance,
tmp.current_soc as currentSoc,tmp.site_id as siteId,tmp.device_id as deviceId,
tmp.avg_cell_voltage as avgVoltage,tmp.avg_cell_temp as avgTemp,tmp.avg_cell_temp as avgSoc,
tmp.max_cell_voltage as maxVoltage,tmp.max_cell_voltage_id as maxVoltageId,
tmp.min_cell_voltage as minVolatage,tmp.min_cell_voltage_id as minVoltageId,
tmp.max_cell_temp as maxTem,tmp.max_cell_temp_id as maxTempId,
tmp.min_cell_temp as minTemp,tmp.min_cell_temp_id as minTempId,
tmp.max_cell_soc as maxSoc,tmp.max_cell_soc_id as maxSocId,
tmp.min_cell_soc as minSoc,tmp.min_cell_soc_id as minSocId
from ems_battery_cluster tmp left join ems_devices_setting td on tmp.device_id = td.device_id and tmp.site_id = td.site_id
INNER JOIN (
SELECT p.site_id, p.device_id, MAX(p.update_time) AS max_update_time
FROM ems_battery_cluster p
WHERE p.site_id = #{siteId}
GROUP BY p.site_id,p.device_id
) latest on tmp.device_id = latest.device_id and tmp.update_time = latest.max_update_time
where tmp.site_id = #{siteId}
order by tmp.device_id
</select>
<select id="getBmsBatteryData" resultType="com.xzzn.ems.domain.vo.BMSBatteryDataList">
SELECT t.cluster_voltage as clusterVoltage,t.cluster_current as clusterCurrent,
t.current_soc as currentSoc,t.site_id as siteId,t.device_id as clusterId,

View File

@ -177,21 +177,24 @@
SELECT NULL AS type, NULL AS device_id FROM DUAL WHERE 1=0
</select>
<select id="getAllBatteryDataByClusterId" parameterType="String" resultType="com.xzzn.ems.domain.vo.BatteryDataStatsListVo">
SELECT
update_time as updateTime,
voltage, temperature, soc, soh,
device_id as deviceId
FROM (
SELECT
t.update_time, t.voltage, t.temperature, t.soc, t.soh, t.device_id,
ROW_NUMBER() OVER (
PARTITION BY t.device_id ORDER BY t.update_time DESC
) AS rn
FROM ems_battery_data t
WHERE t.cluster_device_id = #{clusterDeviceId}
) ranked
WHERE rn = 1
<select id="getAllBatteryDataByClusterId" resultType="com.xzzn.ems.domain.vo.BatteryDataStatsListVo">
SELECT t.data_timestamp as updateTime, t.voltage, t.temperature,
t.soc, t.soh, t.device_id as deviceId,t.cluster_device_id as clusterDeviceId
FROM ems_battery_data t
INNER JOIN ( SELECT device_id, cluster_device_id, MAX(data_timestamp) AS max_update_time
FROM ems_battery_data
WHERE site_id = #{siteId}
and data_timestamp >= CURDATE()
<if test="clusterDeviceId != null and clusterDeviceId != ''">
and cluster_device_id = #{clusterDeviceId}
</if>
GROUP BY device_id, cluster_device_id
) latest ON t.device_id = latest.device_id AND t.data_timestamp = latest.max_update_time
AND t.cluster_device_id = latest.cluster_device_id
WHERE t.site_id = #{siteId}
<if test="clusterDeviceId != null and clusterDeviceId != ''">
and t.cluster_device_id = #{clusterDeviceId}
</if>
</select>

View File

@ -9,59 +9,53 @@
<result property="workStatus" column="work_status" />
<result property="pcsCommunicationStatus" column="pcs_communication_status" />
<result property="emsCommunicationStatus" column="ems_communication_status" />
<result property="totalVoltage" column="total_voltage" />
<result property="chargeableCapacity" column="chargeable_capacity" />
<result property="totalChargedCapacity" column="total_charged_capacity" />
<result property="totalCurrent" column="total_current" />
<result property="dischargeableCapacity" column="dischargeable_capacity" />
<result property="totalDischargedCapacity" column="total_discharged_capacity" />
<result property="soh" column="soh" />
<result property="averageTemperature" column="average_temperature" />
<result property="insulationResistance" column="insulation_resistance" />
<result property="currentSoc" column="current_soc" />
<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="operationStatus" column="operation_status" />
<result property="stackVoltage" column="stack_voltage" />
<result property="stackCurrent" column="stack_current" />
<result property="stackSoc" column="stack_soc" />
<result property="stackSoh" column="stack_soh" />
<result property="maxCellVoltage" column="max_cell_voltage" />
<result property="maxVoltageGroupId" column="max_voltage_group_id" />
<result property="maxVoltageCellId" column="max_voltage_cell_id" />
<result property="minCellVoltage" column="min_cell_voltage" />
<result property="minVoltageGroupId" column="min_voltage_group_id" />
<result property="minVoltageCellId" column="min_voltage_cell_id" />
<result property="maxCellTemp" column="max_cell_temp" />
<result property="maxTempGroupId" column="max_temp_group_id" />
<result property="maxTempCellId" column="max_temp_cell_id" />
<result property="minCellTemp" column="min_cell_temp" />
<result property="minTempGroupId" column="min_temp_group_id" />
<result property="minTempCellId" column="min_temp_cell_id" />
<result property="totalChargeCapacity" column="total_charge_capacity" />
<result property="totalDischargeCapacity" column="total_discharge_capacity" />
<result property="sessionChargeCapacity" column="session_charge_capacity" />
<result property="sessionDischargeCapacity" column="session_discharge_capacity" />
<result property="availableChargeCapacity" column="available_charge_capacity" />
<result property="availableDischargeCapacity" column="available_discharge_capacity" />
<result property="remainingDischargeTime" column="remaining_discharge_time" />
<result property="remainingChargeTime" column="remaining_charge_time" />
<result property="maxDischargePower" column="max_discharge_power" />
<result property="maxChargePower" column="max_charge_power" />
<result property="maxDischargeCurrent" column="max_discharge_current" />
<result property="maxChargeCurrent" column="max_charge_current" />
<result property="dailyDischargeCycles" column="daily_discharge_cycles" />
<result property="dailyChargeCycles" column="daily_charge_cycles" />
<result property="dailyDischargeCapacity" column="daily_discharge_capacity" />
<result property="dailyChargeCapacity" column="daily_charge_capacity" />
<result property="operatingTemp" column="operating_temp" />
<result property="bmsStatus" column="bms_status" />
<result property="bmsChargeStatus" column="bms_charge_status" />
<result property="stackInsulationResistance" column="stack_insulation_resistance" />
<result property="siteId" column="site_id" />
<result property="deviceId" column="device_id" />
<result property="maxAllowedChargePower" column="max_allowed_charge_power" />
<result property="maxAllowedDischargePower" column="max_allowed_discharge_power" />
<result property="maxAllowedChargeVoltage" column="max_allowed_charge_voltage" />
<result property="maxAllowedDischargeVoltage" column="max_allowed_discharge_voltage" />
<result property="maxAllowedChargeCurrent" column="max_allowed_charge_current" />
<result property="maxAllowedDischargeCurrent" column="max_allowed_discharge_current" />
<result property="batteryPackVoltage" column="battery_pack_voltage" />
<result property="batteryPackCurrent" column="battery_pack_current" />
<result property="batteryPackTemp" column="battery_pack_temp" />
<result property="batteryPackSoc" column="battery_pack_soc" />
<result property="batteryPackSoh" column="battery_pack_soh" />
<result property="batteryPackInsulationResistance" column="battery_pack_insulation_resistance" />
<result property="avgCellVoltage" column="avg_cell_voltage" />
<result property="avgCellTemp" column="avg_cell_temp" />
<result property="maxCellVoltage" column="max_cell_voltage" />
<result property="maxCellVoltageId" column="max_cell_voltage_id" />
<result property="minCellVoltage" column="min_cell_voltage" />
<result property="minCellVoltageId" column="min_cell_voltage_id" />
<result property="maxCellTemp" column="max_cell_temp" />
<result property="maxCellTempId" column="max_cell_temp_id" />
<result property="minCellTemp" column="min_cell_temp" />
<result property="minCellTempId" column="min_cell_temp_id" />
<result property="maxCellSoc" column="max_cell_soc" />
<result property="maxCellSocId" column="max_cell_soc_id" />
<result property="minCellSoc" column="min_cell_soc" />
<result property="minCellSocId" column="min_cell_soc_id" />
<result property="maxCellSoh" column="max_cell_soh" />
<result property="maxCellSohId" column="max_cell_soh_id" />
<result property="minCellSoh" column="min_cell_soh" />
<result property="minCellSohId" column="min_cell_soh_id" />
<result property="totalChargeEnergy" column="total_charge_energy" />
<result property="totalDischargeEnergy" column="total_discharge_energy" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
</resultMap>
<sql id="selectEmsBatteryStackVo">
select id, work_status, pcs_communication_status, ems_communication_status, total_voltage, chargeable_capacity, total_charged_capacity, total_current, dischargeable_capacity, total_discharged_capacity, soh, average_temperature, insulation_resistance, current_soc, create_by, create_time, update_by, update_time, remark, site_id, device_id, max_allowed_charge_power, max_allowed_discharge_power, max_allowed_charge_voltage, max_allowed_discharge_voltage, max_allowed_charge_current, max_allowed_discharge_current, battery_pack_voltage, battery_pack_current, battery_pack_temp, battery_pack_soc, battery_pack_soh, battery_pack_insulation_resistance, avg_cell_voltage, avg_cell_temp, max_cell_voltage, max_cell_voltage_id, min_cell_voltage, min_cell_voltage_id, max_cell_temp, max_cell_temp_id, min_cell_temp, min_cell_temp_id, max_cell_soc, max_cell_soc_id, min_cell_soc, min_cell_soc_id, max_cell_soh, max_cell_soh_id, min_cell_soh, min_cell_soh_id, total_charge_energy, total_discharge_energy from ems_battery_stack
select id, work_status, pcs_communication_status, ems_communication_status, operation_status, stack_voltage, stack_current, stack_soc, stack_soh, max_cell_voltage, max_voltage_group_id, max_voltage_cell_id, min_cell_voltage, min_voltage_group_id, min_voltage_cell_id, max_cell_temp, max_temp_group_id, max_temp_cell_id, min_cell_temp, min_temp_group_id, min_temp_cell_id, total_charge_capacity, total_discharge_capacity, session_charge_capacity, session_discharge_capacity, available_charge_capacity, available_discharge_capacity, remaining_discharge_time, remaining_charge_time, max_discharge_power, max_charge_power, max_discharge_current, max_charge_current, daily_discharge_cycles, daily_charge_cycles, daily_discharge_capacity, daily_charge_capacity, operating_temp, bms_status, bms_charge_status, stack_insulation_resistance, site_id, device_id, create_time, create_by, update_time, update_by from ems_battery_stack
</sql>
<select id="selectEmsBatteryStackList" parameterType="EmsBatteryStack" resultMap="EmsBatteryStackResult">
@ -70,50 +64,45 @@
<if test="workStatus != null and workStatus != ''"> and work_status = #{workStatus}</if>
<if test="pcsCommunicationStatus != null and pcsCommunicationStatus != ''"> and pcs_communication_status = #{pcsCommunicationStatus}</if>
<if test="emsCommunicationStatus != null and emsCommunicationStatus != ''"> and ems_communication_status = #{emsCommunicationStatus}</if>
<if test="totalVoltage != null "> and total_voltage = #{totalVoltage}</if>
<if test="chargeableCapacity != null "> and chargeable_capacity = #{chargeableCapacity}</if>
<if test="totalChargedCapacity != null "> and total_charged_capacity = #{totalChargedCapacity}</if>
<if test="totalCurrent != null "> and total_current = #{totalCurrent}</if>
<if test="dischargeableCapacity != null "> and dischargeable_capacity = #{dischargeableCapacity}</if>
<if test="totalDischargedCapacity != null "> and total_discharged_capacity = #{totalDischargedCapacity}</if>
<if test="soh != null "> and soh = #{soh}</if>
<if test="averageTemperature != null "> and average_temperature = #{averageTemperature}</if>
<if test="insulationResistance != null "> and insulation_resistance = #{insulationResistance}</if>
<if test="currentSoc != null "> and current_soc = #{currentSoc}</if>
<if test="operationStatus != null and operationStatus != ''"> and operation_status = #{operationStatus}</if>
<if test="stackVoltage != null "> and stack_voltage = #{stackVoltage}</if>
<if test="stackCurrent != null "> and stack_current = #{stackCurrent}</if>
<if test="stackSoc != null "> and stack_soc = #{stackSoc}</if>
<if test="stackSoh != null "> and stack_soh = #{stackSoh}</if>
<if test="maxCellVoltage != null "> and max_cell_voltage = #{maxCellVoltage}</if>
<if test="maxVoltageGroupId != null "> and max_voltage_group_id = #{maxVoltageGroupId}</if>
<if test="maxVoltageCellId != null "> and max_voltage_cell_id = #{maxVoltageCellId}</if>
<if test="minCellVoltage != null "> and min_cell_voltage = #{minCellVoltage}</if>
<if test="minVoltageGroupId != null "> and min_voltage_group_id = #{minVoltageGroupId}</if>
<if test="minVoltageCellId != null "> and min_voltage_cell_id = #{minVoltageCellId}</if>
<if test="maxCellTemp != null "> and max_cell_temp = #{maxCellTemp}</if>
<if test="maxTempGroupId != null "> and max_temp_group_id = #{maxTempGroupId}</if>
<if test="maxTempCellId != null "> and max_temp_cell_id = #{maxTempCellId}</if>
<if test="minCellTemp != null "> and min_cell_temp = #{minCellTemp}</if>
<if test="minTempGroupId != null "> and min_temp_group_id = #{minTempGroupId}</if>
<if test="minTempCellId != null "> and min_temp_cell_id = #{minTempCellId}</if>
<if test="totalChargeCapacity != null "> and total_charge_capacity = #{totalChargeCapacity}</if>
<if test="totalDischargeCapacity != null "> and total_discharge_capacity = #{totalDischargeCapacity}</if>
<if test="sessionChargeCapacity != null "> and session_charge_capacity = #{sessionChargeCapacity}</if>
<if test="sessionDischargeCapacity != null "> and session_discharge_capacity = #{sessionDischargeCapacity}</if>
<if test="availableChargeCapacity != null "> and available_charge_capacity = #{availableChargeCapacity}</if>
<if test="availableDischargeCapacity != null "> and available_discharge_capacity = #{availableDischargeCapacity}</if>
<if test="remainingDischargeTime != null "> and remaining_discharge_time = #{remainingDischargeTime}</if>
<if test="remainingChargeTime != null "> and remaining_charge_time = #{remainingChargeTime}</if>
<if test="maxDischargePower != null "> and max_discharge_power = #{maxDischargePower}</if>
<if test="maxChargePower != null "> and max_charge_power = #{maxChargePower}</if>
<if test="maxDischargeCurrent != null "> and max_discharge_current = #{maxDischargeCurrent}</if>
<if test="maxChargeCurrent != null "> and max_charge_current = #{maxChargeCurrent}</if>
<if test="dailyDischargeCycles != null "> and daily_discharge_cycles = #{dailyDischargeCycles}</if>
<if test="dailyChargeCycles != null "> and daily_charge_cycles = #{dailyChargeCycles}</if>
<if test="dailyDischargeCapacity != null "> and daily_discharge_capacity = #{dailyDischargeCapacity}</if>
<if test="dailyChargeCapacity != null "> and daily_charge_capacity = #{dailyChargeCapacity}</if>
<if test="operatingTemp != null "> and operating_temp = #{operatingTemp}</if>
<if test="bmsStatus != null and bmsStatus != ''"> and bms_status = #{bmsStatus}</if>
<if test="bmsChargeStatus != null and bmsChargeStatus != ''"> and bms_charge_status = #{bmsChargeStatus}</if>
<if test="stackInsulationResistance != null "> and stack_insulation_resistance = #{stackInsulationResistance}</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="maxAllowedChargePower != null "> and max_allowed_charge_power = #{maxAllowedChargePower}</if>
<if test="maxAllowedDischargePower != null "> and max_allowed_discharge_power = #{maxAllowedDischargePower}</if>
<if test="maxAllowedChargeVoltage != null "> and max_allowed_charge_voltage = #{maxAllowedChargeVoltage}</if>
<if test="maxAllowedDischargeVoltage != null "> and max_allowed_discharge_voltage = #{maxAllowedDischargeVoltage}</if>
<if test="maxAllowedChargeCurrent != null "> and max_allowed_charge_current = #{maxAllowedChargeCurrent}</if>
<if test="maxAllowedDischargeCurrent != null "> and max_allowed_discharge_current = #{maxAllowedDischargeCurrent}</if>
<if test="batteryPackVoltage != null "> and battery_pack_voltage = #{batteryPackVoltage}</if>
<if test="batteryPackCurrent != null "> and battery_pack_current = #{batteryPackCurrent}</if>
<if test="batteryPackTemp != null "> and battery_pack_temp = #{batteryPackTemp}</if>
<if test="batteryPackSoc != null "> and battery_pack_soc = #{batteryPackSoc}</if>
<if test="batteryPackSoh != null "> and battery_pack_soh = #{batteryPackSoh}</if>
<if test="batteryPackInsulationResistance != null "> and battery_pack_insulation_resistance = #{batteryPackInsulationResistance}</if>
<if test="avgCellVoltage != null "> and avg_cell_voltage = #{avgCellVoltage}</if>
<if test="avgCellTemp != null "> and avg_cell_temp = #{avgCellTemp}</if>
<if test="maxCellVoltage != null "> and max_cell_voltage = #{maxCellVoltage}</if>
<if test="maxCellVoltageId != null "> and max_cell_voltage_id = #{maxCellVoltageId}</if>
<if test="minCellVoltage != null "> and min_cell_voltage = #{minCellVoltage}</if>
<if test="minCellVoltageId != null "> and min_cell_voltage_id = #{minCellVoltageId}</if>
<if test="maxCellTemp != null "> and max_cell_temp = #{maxCellTemp}</if>
<if test="maxCellTempId != null "> and max_cell_temp_id = #{maxCellTempId}</if>
<if test="minCellTemp != null "> and min_cell_temp = #{minCellTemp}</if>
<if test="minCellTempId != null "> and min_cell_temp_id = #{minCellTempId}</if>
<if test="maxCellSoc != null "> and max_cell_soc = #{maxCellSoc}</if>
<if test="maxCellSocId != null "> and max_cell_soc_id = #{maxCellSocId}</if>
<if test="minCellSoc != null "> and min_cell_soc = #{minCellSoc}</if>
<if test="minCellSocId != null "> and min_cell_soc_id = #{minCellSocId}</if>
<if test="maxCellSoh != null "> and max_cell_soh = #{maxCellSoh}</if>
<if test="maxCellSohId != null "> and max_cell_soh_id = #{maxCellSohId}</if>
<if test="minCellSoh != null "> and min_cell_soh = #{minCellSoh}</if>
<if test="minCellSohId != null "> and min_cell_soh_id = #{minCellSohId}</if>
<if test="totalChargeEnergy != null "> and total_charge_energy = #{totalChargeEnergy}</if>
<if test="totalDischargeEnergy != null "> and total_discharge_energy = #{totalDischargeEnergy}</if>
</where>
</select>
@ -128,109 +117,97 @@
<if test="workStatus != null">work_status,</if>
<if test="pcsCommunicationStatus != null">pcs_communication_status,</if>
<if test="emsCommunicationStatus != null">ems_communication_status,</if>
<if test="totalVoltage != null">total_voltage,</if>
<if test="chargeableCapacity != null">chargeable_capacity,</if>
<if test="totalChargedCapacity != null">total_charged_capacity,</if>
<if test="totalCurrent != null">total_current,</if>
<if test="dischargeableCapacity != null">dischargeable_capacity,</if>
<if test="totalDischargedCapacity != null">total_discharged_capacity,</if>
<if test="soh != null">soh,</if>
<if test="averageTemperature != null">average_temperature,</if>
<if test="insulationResistance != null">insulation_resistance,</if>
<if test="currentSoc != null">current_soc,</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="maxAllowedChargePower != null">max_allowed_charge_power,</if>
<if test="maxAllowedDischargePower != null">max_allowed_discharge_power,</if>
<if test="maxAllowedChargeVoltage != null">max_allowed_charge_voltage,</if>
<if test="maxAllowedDischargeVoltage != null">max_allowed_discharge_voltage,</if>
<if test="maxAllowedChargeCurrent != null">max_allowed_charge_current,</if>
<if test="maxAllowedDischargeCurrent != null">max_allowed_discharge_current,</if>
<if test="batteryPackVoltage != null">battery_pack_voltage,</if>
<if test="batteryPackCurrent != null">battery_pack_current,</if>
<if test="batteryPackTemp != null">battery_pack_temp,</if>
<if test="batteryPackSoc != null">battery_pack_soc,</if>
<if test="batteryPackSoh != null">battery_pack_soh,</if>
<if test="batteryPackInsulationResistance != null">battery_pack_insulation_resistance,</if>
<if test="avgCellVoltage != null">avg_cell_voltage,</if>
<if test="avgCellTemp != null">avg_cell_temp,</if>
<if test="operationStatus != null">operation_status,</if>
<if test="stackVoltage != null">stack_voltage,</if>
<if test="stackCurrent != null">stack_current,</if>
<if test="stackSoc != null">stack_soc,</if>
<if test="stackSoh != null">stack_soh,</if>
<if test="maxCellVoltage != null">max_cell_voltage,</if>
<if test="maxCellVoltageId != null">max_cell_voltage_id,</if>
<if test="maxVoltageGroupId != null">max_voltage_group_id,</if>
<if test="maxVoltageCellId != null">max_voltage_cell_id,</if>
<if test="minCellVoltage != null">min_cell_voltage,</if>
<if test="minCellVoltageId != null">min_cell_voltage_id,</if>
<if test="minVoltageGroupId != null">min_voltage_group_id,</if>
<if test="minVoltageCellId != null">min_voltage_cell_id,</if>
<if test="maxCellTemp != null">max_cell_temp,</if>
<if test="maxCellTempId != null">max_cell_temp_id,</if>
<if test="maxTempGroupId != null">max_temp_group_id,</if>
<if test="maxTempCellId != null">max_temp_cell_id,</if>
<if test="minCellTemp != null">min_cell_temp,</if>
<if test="minCellTempId != null">min_cell_temp_id,</if>
<if test="maxCellSoc != null">max_cell_soc,</if>
<if test="maxCellSocId != null">max_cell_soc_id,</if>
<if test="minCellSoc != null">min_cell_soc,</if>
<if test="minCellSocId != null">min_cell_soc_id,</if>
<if test="maxCellSoh != null">max_cell_soh,</if>
<if test="maxCellSohId != null">max_cell_soh_id,</if>
<if test="minCellSoh != null">min_cell_soh,</if>
<if test="minCellSohId != null">min_cell_soh_id,</if>
<if test="totalChargeEnergy != null">total_charge_energy,</if>
<if test="totalDischargeEnergy != null">total_discharge_energy,</if>
<if test="minTempGroupId != null">min_temp_group_id,</if>
<if test="minTempCellId != null">min_temp_cell_id,</if>
<if test="totalChargeCapacity != null">total_charge_capacity,</if>
<if test="totalDischargeCapacity != null">total_discharge_capacity,</if>
<if test="sessionChargeCapacity != null">session_charge_capacity,</if>
<if test="sessionDischargeCapacity != null">session_discharge_capacity,</if>
<if test="availableChargeCapacity != null">available_charge_capacity,</if>
<if test="availableDischargeCapacity != null">available_discharge_capacity,</if>
<if test="remainingDischargeTime != null">remaining_discharge_time,</if>
<if test="remainingChargeTime != null">remaining_charge_time,</if>
<if test="maxDischargePower != null">max_discharge_power,</if>
<if test="maxChargePower != null">max_charge_power,</if>
<if test="maxDischargeCurrent != null">max_discharge_current,</if>
<if test="maxChargeCurrent != null">max_charge_current,</if>
<if test="dailyDischargeCycles != null">daily_discharge_cycles,</if>
<if test="dailyChargeCycles != null">daily_charge_cycles,</if>
<if test="dailyDischargeCapacity != null">daily_discharge_capacity,</if>
<if test="dailyChargeCapacity != null">daily_charge_capacity,</if>
<if test="operatingTemp != null">operating_temp,</if>
<if test="bmsStatus != null">bms_status,</if>
<if test="bmsChargeStatus != null">bms_charge_status,</if>
<if test="stackInsulationResistance != null">stack_insulation_resistance,</if>
<if test="siteId != null and siteId != ''">site_id,</if>
<if test="deviceId != null and deviceId != ''">device_id,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workStatus != null">#{workStatus},</if>
<if test="pcsCommunicationStatus != null">#{pcsCommunicationStatus},</if>
<if test="emsCommunicationStatus != null">#{emsCommunicationStatus},</if>
<if test="totalVoltage != null">#{totalVoltage},</if>
<if test="chargeableCapacity != null">#{chargeableCapacity},</if>
<if test="totalChargedCapacity != null">#{totalChargedCapacity},</if>
<if test="totalCurrent != null">#{totalCurrent},</if>
<if test="dischargeableCapacity != null">#{dischargeableCapacity},</if>
<if test="totalDischargedCapacity != null">#{totalDischargedCapacity},</if>
<if test="soh != null">#{soh},</if>
<if test="averageTemperature != null">#{averageTemperature},</if>
<if test="insulationResistance != null">#{insulationResistance},</if>
<if test="currentSoc != null">#{currentSoc},</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="maxAllowedChargePower != null">#{maxAllowedChargePower},</if>
<if test="maxAllowedDischargePower != null">#{maxAllowedDischargePower},</if>
<if test="maxAllowedChargeVoltage != null">#{maxAllowedChargeVoltage},</if>
<if test="maxAllowedDischargeVoltage != null">#{maxAllowedDischargeVoltage},</if>
<if test="maxAllowedChargeCurrent != null">#{maxAllowedChargeCurrent},</if>
<if test="maxAllowedDischargeCurrent != null">#{maxAllowedDischargeCurrent},</if>
<if test="batteryPackVoltage != null">#{batteryPackVoltage},</if>
<if test="batteryPackCurrent != null">#{batteryPackCurrent},</if>
<if test="batteryPackTemp != null">#{batteryPackTemp},</if>
<if test="batteryPackSoc != null">#{batteryPackSoc},</if>
<if test="batteryPackSoh != null">#{batteryPackSoh},</if>
<if test="batteryPackInsulationResistance != null">#{batteryPackInsulationResistance},</if>
<if test="avgCellVoltage != null">#{avgCellVoltage},</if>
<if test="avgCellTemp != null">#{avgCellTemp},</if>
<if test="operationStatus != null">#{operationStatus},</if>
<if test="stackVoltage != null">#{stackVoltage},</if>
<if test="stackCurrent != null">#{stackCurrent},</if>
<if test="stackSoc != null">#{stackSoc},</if>
<if test="stackSoh != null">#{stackSoh},</if>
<if test="maxCellVoltage != null">#{maxCellVoltage},</if>
<if test="maxCellVoltageId != null">#{maxCellVoltageId},</if>
<if test="maxVoltageGroupId != null">#{maxVoltageGroupId},</if>
<if test="maxVoltageCellId != null">#{maxVoltageCellId},</if>
<if test="minCellVoltage != null">#{minCellVoltage},</if>
<if test="minCellVoltageId != null">#{minCellVoltageId},</if>
<if test="minVoltageGroupId != null">#{minVoltageGroupId},</if>
<if test="minVoltageCellId != null">#{minVoltageCellId},</if>
<if test="maxCellTemp != null">#{maxCellTemp},</if>
<if test="maxCellTempId != null">#{maxCellTempId},</if>
<if test="maxTempGroupId != null">#{maxTempGroupId},</if>
<if test="maxTempCellId != null">#{maxTempCellId},</if>
<if test="minCellTemp != null">#{minCellTemp},</if>
<if test="minCellTempId != null">#{minCellTempId},</if>
<if test="maxCellSoc != null">#{maxCellSoc},</if>
<if test="maxCellSocId != null">#{maxCellSocId},</if>
<if test="minCellSoc != null">#{minCellSoc},</if>
<if test="minCellSocId != null">#{minCellSocId},</if>
<if test="maxCellSoh != null">#{maxCellSoh},</if>
<if test="maxCellSohId != null">#{maxCellSohId},</if>
<if test="minCellSoh != null">#{minCellSoh},</if>
<if test="minCellSohId != null">#{minCellSohId},</if>
<if test="totalChargeEnergy != null">#{totalChargeEnergy},</if>
<if test="totalDischargeEnergy != null">#{totalDischargeEnergy},</if>
<if test="minTempGroupId != null">#{minTempGroupId},</if>
<if test="minTempCellId != null">#{minTempCellId},</if>
<if test="totalChargeCapacity != null">#{totalChargeCapacity},</if>
<if test="totalDischargeCapacity != null">#{totalDischargeCapacity},</if>
<if test="sessionChargeCapacity != null">#{sessionChargeCapacity},</if>
<if test="sessionDischargeCapacity != null">#{sessionDischargeCapacity},</if>
<if test="availableChargeCapacity != null">#{availableChargeCapacity},</if>
<if test="availableDischargeCapacity != null">#{availableDischargeCapacity},</if>
<if test="remainingDischargeTime != null">#{remainingDischargeTime},</if>
<if test="remainingChargeTime != null">#{remainingChargeTime},</if>
<if test="maxDischargePower != null">#{maxDischargePower},</if>
<if test="maxChargePower != null">#{maxChargePower},</if>
<if test="maxDischargeCurrent != null">#{maxDischargeCurrent},</if>
<if test="maxChargeCurrent != null">#{maxChargeCurrent},</if>
<if test="dailyDischargeCycles != null">#{dailyDischargeCycles},</if>
<if test="dailyChargeCycles != null">#{dailyChargeCycles},</if>
<if test="dailyDischargeCapacity != null">#{dailyDischargeCapacity},</if>
<if test="dailyChargeCapacity != null">#{dailyChargeCapacity},</if>
<if test="operatingTemp != null">#{operatingTemp},</if>
<if test="bmsStatus != null">#{bmsStatus},</if>
<if test="bmsChargeStatus != null">#{bmsChargeStatus},</if>
<if test="stackInsulationResistance != null">#{stackInsulationResistance},</if>
<if test="siteId != null and siteId != ''">#{siteId},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
</trim>
</insert>
@ -240,55 +217,49 @@
<if test="workStatus != null">work_status = #{workStatus},</if>
<if test="pcsCommunicationStatus != null">pcs_communication_status = #{pcsCommunicationStatus},</if>
<if test="emsCommunicationStatus != null">ems_communication_status = #{emsCommunicationStatus},</if>
<if test="totalVoltage != null">total_voltage = #{totalVoltage},</if>
<if test="chargeableCapacity != null">chargeable_capacity = #{chargeableCapacity},</if>
<if test="totalChargedCapacity != null">total_charged_capacity = #{totalChargedCapacity},</if>
<if test="totalCurrent != null">total_current = #{totalCurrent},</if>
<if test="dischargeableCapacity != null">dischargeable_capacity = #{dischargeableCapacity},</if>
<if test="totalDischargedCapacity != null">total_discharged_capacity = #{totalDischargedCapacity},</if>
<if test="soh != null">soh = #{soh},</if>
<if test="averageTemperature != null">average_temperature = #{averageTemperature},</if>
<if test="insulationResistance != null">insulation_resistance = #{insulationResistance},</if>
<if test="currentSoc != null">current_soc = #{currentSoc},</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="maxAllowedChargePower != null">max_allowed_charge_power = #{maxAllowedChargePower},</if>
<if test="maxAllowedDischargePower != null">max_allowed_discharge_power = #{maxAllowedDischargePower},</if>
<if test="maxAllowedChargeVoltage != null">max_allowed_charge_voltage = #{maxAllowedChargeVoltage},</if>
<if test="maxAllowedDischargeVoltage != null">max_allowed_discharge_voltage = #{maxAllowedDischargeVoltage},</if>
<if test="maxAllowedChargeCurrent != null">max_allowed_charge_current = #{maxAllowedChargeCurrent},</if>
<if test="maxAllowedDischargeCurrent != null">max_allowed_discharge_current = #{maxAllowedDischargeCurrent},</if>
<if test="batteryPackVoltage != null">battery_pack_voltage = #{batteryPackVoltage},</if>
<if test="batteryPackCurrent != null">battery_pack_current = #{batteryPackCurrent},</if>
<if test="batteryPackTemp != null">battery_pack_temp = #{batteryPackTemp},</if>
<if test="batteryPackSoc != null">battery_pack_soc = #{batteryPackSoc},</if>
<if test="batteryPackSoh != null">battery_pack_soh = #{batteryPackSoh},</if>
<if test="batteryPackInsulationResistance != null">battery_pack_insulation_resistance = #{batteryPackInsulationResistance},</if>
<if test="avgCellVoltage != null">avg_cell_voltage = #{avgCellVoltage},</if>
<if test="avgCellTemp != null">avg_cell_temp = #{avgCellTemp},</if>
<if test="operationStatus != null">operation_status = #{operationStatus},</if>
<if test="stackVoltage != null">stack_voltage = #{stackVoltage},</if>
<if test="stackCurrent != null">stack_current = #{stackCurrent},</if>
<if test="stackSoc != null">stack_soc = #{stackSoc},</if>
<if test="stackSoh != null">stack_soh = #{stackSoh},</if>
<if test="maxCellVoltage != null">max_cell_voltage = #{maxCellVoltage},</if>
<if test="maxCellVoltageId != null">max_cell_voltage_id = #{maxCellVoltageId},</if>
<if test="maxVoltageGroupId != null">max_voltage_group_id = #{maxVoltageGroupId},</if>
<if test="maxVoltageCellId != null">max_voltage_cell_id = #{maxVoltageCellId},</if>
<if test="minCellVoltage != null">min_cell_voltage = #{minCellVoltage},</if>
<if test="minCellVoltageId != null">min_cell_voltage_id = #{minCellVoltageId},</if>
<if test="minVoltageGroupId != null">min_voltage_group_id = #{minVoltageGroupId},</if>
<if test="minVoltageCellId != null">min_voltage_cell_id = #{minVoltageCellId},</if>
<if test="maxCellTemp != null">max_cell_temp = #{maxCellTemp},</if>
<if test="maxCellTempId != null">max_cell_temp_id = #{maxCellTempId},</if>
<if test="maxTempGroupId != null">max_temp_group_id = #{maxTempGroupId},</if>
<if test="maxTempCellId != null">max_temp_cell_id = #{maxTempCellId},</if>
<if test="minCellTemp != null">min_cell_temp = #{minCellTemp},</if>
<if test="minCellTempId != null">min_cell_temp_id = #{minCellTempId},</if>
<if test="maxCellSoc != null">max_cell_soc = #{maxCellSoc},</if>
<if test="maxCellSocId != null">max_cell_soc_id = #{maxCellSocId},</if>
<if test="minCellSoc != null">min_cell_soc = #{minCellSoc},</if>
<if test="minCellSocId != null">min_cell_soc_id = #{minCellSocId},</if>
<if test="maxCellSoh != null">max_cell_soh = #{maxCellSoh},</if>
<if test="maxCellSohId != null">max_cell_soh_id = #{maxCellSohId},</if>
<if test="minCellSoh != null">min_cell_soh = #{minCellSoh},</if>
<if test="minCellSohId != null">min_cell_soh_id = #{minCellSohId},</if>
<if test="totalChargeEnergy != null">total_charge_energy = #{totalChargeEnergy},</if>
<if test="totalDischargeEnergy != null">total_discharge_energy = #{totalDischargeEnergy},</if>
<if test="minTempGroupId != null">min_temp_group_id = #{minTempGroupId},</if>
<if test="minTempCellId != null">min_temp_cell_id = #{minTempCellId},</if>
<if test="totalChargeCapacity != null">total_charge_capacity = #{totalChargeCapacity},</if>
<if test="totalDischargeCapacity != null">total_discharge_capacity = #{totalDischargeCapacity},</if>
<if test="sessionChargeCapacity != null">session_charge_capacity = #{sessionChargeCapacity},</if>
<if test="sessionDischargeCapacity != null">session_discharge_capacity = #{sessionDischargeCapacity},</if>
<if test="availableChargeCapacity != null">available_charge_capacity = #{availableChargeCapacity},</if>
<if test="availableDischargeCapacity != null">available_discharge_capacity = #{availableDischargeCapacity},</if>
<if test="remainingDischargeTime != null">remaining_discharge_time = #{remainingDischargeTime},</if>
<if test="remainingChargeTime != null">remaining_charge_time = #{remainingChargeTime},</if>
<if test="maxDischargePower != null">max_discharge_power = #{maxDischargePower},</if>
<if test="maxChargePower != null">max_charge_power = #{maxChargePower},</if>
<if test="maxDischargeCurrent != null">max_discharge_current = #{maxDischargeCurrent},</if>
<if test="maxChargeCurrent != null">max_charge_current = #{maxChargeCurrent},</if>
<if test="dailyDischargeCycles != null">daily_discharge_cycles = #{dailyDischargeCycles},</if>
<if test="dailyChargeCycles != null">daily_charge_cycles = #{dailyChargeCycles},</if>
<if test="dailyDischargeCapacity != null">daily_discharge_capacity = #{dailyDischargeCapacity},</if>
<if test="dailyChargeCapacity != null">daily_charge_capacity = #{dailyChargeCapacity},</if>
<if test="operatingTemp != null">operating_temp = #{operatingTemp},</if>
<if test="bmsStatus != null">bms_status = #{bmsStatus},</if>
<if test="bmsChargeStatus != null">bms_charge_status = #{bmsChargeStatus},</if>
<if test="stackInsulationResistance != null">stack_insulation_resistance = #{stackInsulationResistance},</if>
<if test="siteId != null and siteId != ''">site_id = #{siteId},</if>
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
</trim>
where id = #{id}
</update>
@ -303,25 +274,4 @@
#{id}
</foreach>
</delete>
<select id="selectEmsBatteryStackBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.BMSOverViewVo">
SELECT td.device_name as deviceName,tmp.work_status as workStatus,
tmp.pcs_communication_status as pcsCommunicationStatus,tmp.ems_communication_status as emsCommunicationStatus,
tmp.total_voltage as totalVoltage,tmp.chargeable_capacity as chargeableCapacity,
tmp.total_charged_capacity as totalChargedCapacity,
tmp.total_current as totalCurrent,tmp.dischargeable_capacity as dischargeableCapacity,
tmp.total_discharged_capacity as totalDischargedCapacity,
tmp.soh as soh,tmp.average_temperature as averageTemperature,tmp.insulation_resistance as insulationResistance,
tmp.current_soc as currentSoc,tmp.site_id as siteId,tmp.device_id as deviceId
FROM ems_battery_stack tmp
left join ems_devices_setting td on tmp.device_id = td.device_id and tmp.site_id = td.site_id
INNER JOIN (
SELECT p.site_id, p.device_id, MAX(p.update_time) AS max_update_time
FROM ems_battery_stack p
WHERE p.site_id = #{siteId}
GROUP BY p.site_id,p.device_id
) latest on tmp.device_id = latest.device_id and tmp.update_time = latest.max_update_time
WHERE tmp.site_id = #{siteId}
order by tmp.device_id
</select>
</mapper>

View File

@ -24,10 +24,12 @@
<result property="siteId" column="site_id" />
<result property="communicationStatus" column="communication_status" />
<result property="deviceId" column="device_id" />
<result property="parentId" column="parent_id" />
<result property="deviceCategory" column="device_category" />
</resultMap>
<sql id="selectEmsDevicesSettingVo">
select id, device_name, device_type, slave_id, timeout_ms, retries, ip_address, ip_port, serial_port, baud_rate, data_bits, stop_bits, parity, description, created_at, updated_at, site_id, communication_status, device_id from ems_devices_setting
select id, device_name, device_type, slave_id, timeout_ms, retries, ip_address, ip_port, serial_port, baud_rate, data_bits, stop_bits, parity, description, created_at, updated_at, site_id, communication_status, device_id, parent_id, device_category from ems_devices_setting
</sql>
<select id="selectEmsDevicesSettingList" parameterType="EmsDevicesSetting" resultMap="EmsDevicesSettingResult">
@ -51,6 +53,8 @@
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="communicationStatus != null and communicationStatus != ''"> and communication_status = #{communicationStatus}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
<if test="parentId != null and parentId != ''"> and parent_id = #{parentId}</if>
<if test="deviceCategory != null and deviceCategory != ''"> and device_category = #{deviceCategory}</if>
</where>
</select>
@ -80,6 +84,8 @@
<if test="siteId != null">site_id,</if>
<if test="communicationStatus != null">communication_status,</if>
<if test="deviceId != null and deviceId != ''">device_id,</if>
<if test="parentId != null">parent_id,</if>
<if test="deviceCategory != null">device_category,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceName != null and deviceName != ''">#{deviceName},</if>
@ -100,6 +106,8 @@
<if test="siteId != null">#{siteId},</if>
<if test="communicationStatus != null">#{communicationStatus},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="parentId != null">#{parentId},</if>
<if test="deviceCategory != null">#{deviceCategory},</if>
</trim>
</insert>
@ -124,6 +132,8 @@
<if test="siteId != null">site_id = #{siteId},</if>
<if test="communicationStatus != null">communication_status = #{communicationStatus},</if>
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
<if test="parentId != null">parent_id = #{parentId},</if>
<if test="deviceCategory != null">device_category = #{deviceCategory},</if>
</trim>
where id = #{id}
</update>
@ -145,10 +155,8 @@
select distinct eb.device_id from ems_battery_stack eb where eb.site_id = #{siteId})
</select>
<select id="getAllClusterInfoByStackId" parameterType="String" resultType="java.util.Map">
select device_id as id,device_name as deviceName
from ems_devices_setting
where device_id in (select distinct eb.device_id from ems_battery_cluster eb where eb.stack_device_id = #{stackDeviceId})
<select id="getDeviceInfoByParentId" parameterType="String" resultType="java.util.Map">
select distinct t.device_id as id,t.device_name as deviceName from ems_devices_setting t where t.parent_id = #{parentId}
</select>
<select id="getAllBatteryDeviceBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.EmsDevicesSetting">
@ -158,4 +166,23 @@
from ems_devices_setting t INNER JOIN ems_ammeter_data e on t.site_id = e.site_id and t.device_id = e.device_id
where t.site_id = #{siteId}
</select>
<select id="getAllClusterInfoBySiteId" parameterType="String" resultType="java.util.Map">
select device_id as id,device_name as deviceName from ems_devices_setting
where device_id in (
select distinct eb.device_id from ems_battery_cluster eb where eb.site_id = #{siteId})
</select>
<select id="getDeviceInfosBySiteIdAndCategory" resultType="java.util.Map">
select DISTINCT device_id as id,
device_name as deviceName,
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

@ -371,4 +371,27 @@
WHERE tmp.site_id = #{siteId}
order by tmp.device_id
</select>
<select id="getPcsDataByDate" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
select CONCAT(t.date_month,'/',t.date_day) as ammeterDate,
sum(t.daily_ac_charge_energy) as chargedCap,
sum(t.daily_ac_discharge_energy) as disChargedCap
from ( SELECT p.site_id, p.device_id,p.date_month,p.date_day, MAX(p.data_update_time) AS max_update_time
FROM ems_pcs_data p
where p.site_id = #{siteId}
<if test="startDate != null">
and p.data_update_time &gt;= #{startDate}
</if>
<if test="endDate != null">
and p.data_update_time &lt; DATE_ADD(#{endDate}, INTERVAL 1 DAY)
</if>
GROUP BY p.site_id,p.device_id,p.date_month,p.date_day
) latest inner join ems_pcs_data t ON latest.site_id = t.site_id
AND latest.device_id = t.device_id
AND latest.max_update_time = t.data_update_time
and latest.date_month = t.date_month
and latest.date_day = t.date_day
group by ammeterDate
order by ammeterDate desc;
</select>
</mapper>

View File

@ -120,4 +120,27 @@
<include refid="selectEmsSiteSettingVo"/>
where site_id = #{siteId}
</select>
<select id="getSiteInfoList" resultMap="EmsSiteSettingResult">
<include refid="selectEmsSiteSettingVo"/>
WHERE 1=1
<if test="siteName != null and siteName != ''">
AND site_name LIKE CONCAT('%', #{siteName}, '%')
</if>
<if test="startTime != null and startTime != null and endTime != null and endTime != ''">
AND running_time &gt;= STR_TO_DATE( #{startTime}, '%Y-%m-%d')
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>