Compare commits

...

49 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
fbab6ea631 电表逻辑修改 2025-06-30 18:14:24 +08:00
337599d1c6 增加工单配置文件 2025-06-30 13:39:51 +08:00
cebd845af1 sql优化 2025-06-30 13:11:05 +08:00
49a3ce2c11 增加mqtt账号密码 2025-06-30 09:46:31 +08:00
551ae90155 删除 lombok 2025-06-29 21:21:37 +08:00
d0b98a0a8a 奉贤数据单独控制 2025-06-29 16:20:13 +08:00
aaacafc0c3 Merge remote-tracking branch 'origin/dev' into dev 2025-06-29 15:41:29 +08:00
c6fc7c00cc 奉贤数据单独控制 2025-06-29 15:41:24 +08:00
ae59143771 单站监控-故障告警 2025-06-29 15:38:31 +08:00
1225559c36 pcs 支路 2025-06-29 15:19:01 +08:00
324beeaa69 优化 2025-06-29 14:45:20 +08:00
88 changed files with 6104 additions and 1520 deletions

View File

@ -0,0 +1,37 @@
package com.xzzn.web.controller.ems;
import com.xzzn.common.core.controller.BaseController;
import com.xzzn.common.core.page.TableDataInfo;
import com.xzzn.ems.domain.vo.AlarmRecordListRequestVo;
import com.xzzn.ems.domain.vo.AlarmRecordListResponseVo;
import com.xzzn.ems.service.IEmsAlarmRecordsService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import java.util.List;
/**
* 单站监控-故障告警
*
* @author xzzn
*/
@RestController
@RequestMapping("/ems/siteAlarm")
public class EmsAlarmRecordsController extends BaseController
{
@Autowired
private IEmsAlarmRecordsService iEmsAlarmRecordsService;
/**
* 获取告警详情列表
*/
@GetMapping("/getAlarmDetailList")
public TableDataInfo getAlarmDetailList(AlarmRecordListRequestVo requestVo)
{
startPage();
List<AlarmRecordListResponseVo> list = iEmsAlarmRecordsService.getAlarmRecordDetailList(requestVo);
return getDataTable(list);
}
}

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") @GetMapping("/getClusterDataInfoList")
public TableDataInfo getClusterDataInfoList(@RequestParam String clusterDeviceId) public TableDataInfo getClusterDataInfoList(@RequestParam String clusterDeviceId,@RequestParam String siteId)
{ {
startPage(); startPage();
List<BatteryDataStatsListVo> list = iSingleSiteService.getClusterDataInfoList(clusterDeviceId); List<BatteryDataStatsListVo> list = iSingleSiteService.getClusterDataInfoList(clusterDeviceId,siteId);
return getDataTable(list); 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,23 +1,11 @@
package com.xzzn.web.controller.ems; package com.xzzn.web.controller.ems;
import com.alibaba.druid.support.json.JSONParser;
import com.alibaba.fastjson2.JSON;
import com.alibaba.fastjson2.JSONArray;
import com.alibaba.fastjson2.JSONObject;
import com.alibaba.fastjson2.TypeReference;
import com.fasterxml.jackson.databind.json.JsonMapper;
import com.xzzn.common.utils.DateUtils;
import com.xzzn.common.utils.StringUtils;
import com.xzzn.ems.domain.EmsBatteryData;
import com.xzzn.ems.domain.EmsMqttMessage; import com.xzzn.ems.domain.EmsMqttMessage;
import com.xzzn.ems.domain.EmsPcsData;
import com.xzzn.ems.service.IEmsBatteryDataService;
import com.xzzn.ems.service.IEmsMqttMessageService; import com.xzzn.ems.service.IEmsMqttMessageService;
import com.xzzn.ems.service.IEmsPcsDataService; import com.xzzn.ems.service.IFXXDataProcessService;
import com.xzzn.framework.manager.MqttLifecycleManager; import com.xzzn.framework.manager.MqttLifecycleManager;
import com.xzzn.framework.web.service.MqttPublisher; import com.xzzn.framework.web.service.MqttPublisher;
import com.xzzn.framework.web.service.MqttSubscriber; import com.xzzn.framework.web.service.MqttSubscriber;
import org.apache.coyote.http11.Http11NioProtocol;
import org.apache.juli.logging.Log; import org.apache.juli.logging.Log;
import org.apache.juli.logging.LogFactory; import org.apache.juli.logging.LogFactory;
import org.eclipse.paho.client.mqttv3.IMqttMessageListener; import org.eclipse.paho.client.mqttv3.IMqttMessageListener;
@ -27,8 +15,6 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import javax.annotation.PostConstruct; import javax.annotation.PostConstruct;
import java.math.BigDecimal;
import java.util.*;
@Service @Service
public class MqttMessageController implements MqttPublisher, MqttSubscriber { public class MqttMessageController implements MqttPublisher, MqttSubscriber {
@ -43,10 +29,7 @@ public class MqttMessageController implements MqttPublisher, MqttSubscriber {
private IEmsMqttMessageService emsMqttMessageService; private IEmsMqttMessageService emsMqttMessageService;
@Autowired @Autowired
private IEmsBatteryDataService emsBatteryDataService; private IFXXDataProcessService fXXDataProcessService;
@Autowired
private IEmsPcsDataService emsPcsDataService;
@Autowired @Autowired
public MqttMessageController(MqttLifecycleManager mqttLifecycleManager) { public MqttMessageController(MqttLifecycleManager mqttLifecycleManager) {
@ -89,7 +72,8 @@ public class MqttMessageController implements MqttPublisher, MqttSubscriber {
System.out.println("[DEVICE] data: " + payload); System.out.println("[DEVICE] data: " + payload);
try { try {
// 业务处理逻辑 // 业务处理逻辑
handleFxData(payload); fXXDataProcessService.handleFxData(payload);
EmsMqttMessage mqttMessage = new EmsMqttMessage(); EmsMqttMessage mqttMessage = new EmsMqttMessage();
mqttMessage.setMqttTopic(topic); mqttMessage.setMqttTopic(topic);
@ -133,146 +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);
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 data = new EmsBatteryData();
data.setDeviceId(recordId);
data.setBatteryCellId(recordId);
data.setSoc(StringUtils.getBigDecimal(fields.get("DTSOC")));
data.setSoh(StringUtils.getBigDecimal(fields.get("DTSOH")));
data.setTemperature(StringUtils.getBigDecimal(fields.get("DTWD")));
data.setVoltage(StringUtils.getBigDecimal(fields.get("DTDY")));
data.setBatteryCluster(deviceId);
data.setBatteryPack(deviceId);
// 时间戳
data.setDataTimestamp(new Date());
// ID字段
data.setSiteId(("021"));
data.setClusterDeviceId(("021"));
list.add(data);
}
if (list.size() > 0 ) {
emsBatteryDataService.insertEmsBatteryDataList(list);
}
} else if (deviceId.contains("PCS")) {
log.info("====================");
log.info("PCS data:"+ jsonData);
//pcs
EmsPcsData data = new EmsPcsData();
// 时间与状态类字段
data.setDataUpdateTime(new Date());
data.setWorkStatus("A");
data.setGridStatus("B");
data.setDeviceStatus("C");
data.setControlMode("D");
// 功率与能量类字段
data.setTotalActivePower(BigDecimal.ZERO);
data.setDailyAcChargeEnergy(BigDecimal.ZERO);
data.setTotalReactivePower(BigDecimal.ZERO);
data.setDailyAcDischargeEnergy(BigDecimal.ZERO);
data.setTotalApparentPower(BigDecimal.ZERO);
data.setTotalPowerFactor(BigDecimal.ZERO);
data.setDcPower(BigDecimal.ZERO);
data.setTotalAcChargeEnergy(BigDecimal.ZERO);
data.setTotalAcDischargeEnergy(BigDecimal.ZERO);
data.setAcChargeActivePower(BigDecimal.ZERO);
data.setAcCapacitiveReactivePower(BigDecimal.ZERO);
data.setAcDischargeActivePower(BigDecimal.ZERO);
data.setAcInductiveReactivePower(BigDecimal.ZERO);
data.setMaxCapacitivePowerCapacity(BigDecimal.ZERO);
data.setMaxInductivePowerCapacity(BigDecimal.ZERO);
data.setMaxChargePowerCapacity(BigDecimal.ZERO);
data.setMaxDischargePowerCapacity(BigDecimal.ZERO);
// 温度与环境参数
data.setPcsModuleTemperature(BigDecimal.ZERO);
data.setPcsEnvironmentTemperature(BigDecimal.ZERO);
data.setAcFrequency(BigDecimal.ZERO);
// 状态指示类
data.setBranchStatus("A");
data.setDischargeStatus("A");
data.setAcSwitchStatus("A");
data.setDcSwitchStatus("A");
data.setRemoteControlStatus("A");
// 直流参数
data.setDcVoltage(BigDecimal.ZERO);
data.setDcCurrent(BigDecimal.ZERO);
// 系统管理字段
// data.setCreateBy(BigDecimal.ZERO);
// data.setCreateTime(BigDecimal.ZERO);
// data.setUpdateBy(BigDecimal.ZERO);
// data.setUpdateTime(BigDecimal.ZERO);
// data.setRemark(BigDecimal.ZERO);
data.setSiteId(("021"));
data.setDeviceId(deviceId);
data.setDateMonth(Long.parseLong("6"));
data.setDateDay(Long.parseLong("28"));
data.setDeviceId(deviceId);
emsPcsDataService.insertEmsPcsData(data);
}
}
}
// 数据分组处理
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;
}
} }

View File

@ -131,8 +131,8 @@ xss:
mqtt: mqtt:
broker.url: tcp://122.51.194.184:1883 broker.url: tcp://122.51.194.184:1883
client.id: ems-cloud client.id: ems-cloud
username: admin username: dmbroker
password: pass123 password: qwer1234
connection-timeout: 15 connection-timeout: 15
keep-alive-interval: 30 keep-alive-interval: 30
automatic-reconnect: true 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; package com.xzzn.common.core.controller;
import java.beans.PropertyEditorSupport; import java.beans.PropertyEditorSupport;
import java.util.ArrayList;
import java.util.Collections;
import java.util.Date; import java.util.Date;
import java.util.List; import java.util.List;
import org.slf4j.Logger; import org.slf4j.Logger;
@ -199,4 +201,35 @@ public class BaseController
{ {
return getLoginUser().getUsername(); 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); 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

@ -8,6 +8,7 @@ import java.time.LocalDateTime;
import java.time.LocalTime; import java.time.LocalTime;
import java.time.ZoneId; import java.time.ZoneId;
import java.time.ZonedDateTime; import java.time.ZonedDateTime;
import java.util.Calendar;
import java.util.Date; import java.util.Date;
import org.apache.commons.lang3.time.DateFormatUtils; import org.apache.commons.lang3.time.DateFormatUtils;
@ -188,4 +189,15 @@ public class DateUtils extends org.apache.commons.lang3.time.DateUtils
ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault()); ZonedDateTime zdt = localDateTime.atZone(ZoneId.systemDefault());
return Date.from(zdt.toInstant()); return Date.from(zdt.toInstant());
} }
public static Long getNowMonthLong() {
Calendar calendar = Calendar.getInstance();
long month = (long) calendar.get(Calendar.MONTH) + 1; // 月份从0开始所以要加1
return month;
}
public static Long getNowDayLong() {
Calendar calendar = Calendar.getInstance();
long date = calendar.get(Calendar.DAY_OF_MONTH); // 月份从0开始所以要加1
return date;
}
} }

View File

@ -723,12 +723,32 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
public static BigDecimal getBigDecimal(Object s){ public static BigDecimal getBigDecimal(Object s){
BigDecimal result;
try { try {
return new BigDecimal(s.toString()); result = new BigDecimal(s.toString());
} catch (NumberFormatException e) { } catch (Exception e) {
return BigDecimal.ZERO; 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

@ -61,11 +61,6 @@
<groupId>com.xzzn</groupId> <groupId>com.xzzn</groupId>
<artifactId>ems-system</artifactId> <artifactId>ems-system</artifactId>
</dependency> </dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
</dependencies> </dependencies>

View File

@ -1,10 +1,8 @@
package com.xzzn.framework.config.properties; package com.xzzn.framework.config.properties;
import lombok.Data;
import org.springframework.beans.factory.annotation.Value; import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration; import org.springframework.context.annotation.Configuration;
@Data
@Configuration @Configuration
public class MqttProperties { public class MqttProperties {
@Value("${mqtt.broker.url}") @Value("${mqtt.broker.url}")
@ -28,4 +26,59 @@ public class MqttProperties {
@Value("${mqtt.automatic-reconnect:true}") @Value("${mqtt.automatic-reconnect:true}")
private boolean automaticReconnect; private boolean automaticReconnect;
public String getBrokerUrl() {
return brokerUrl;
}
public void setBrokerUrl(String brokerUrl) {
this.brokerUrl = brokerUrl;
}
public String getClientId() {
return clientId;
}
public void setClientId(String clientId) {
this.clientId = clientId;
}
public String getUsername() {
return username;
}
public void setUsername(String username) {
this.username = username;
}
public String getPassword() {
return password;
}
public void setPassword(String password) {
this.password = password;
}
public int getConnectionTimeout() {
return connectionTimeout;
}
public void setConnectionTimeout(int connectionTimeout) {
this.connectionTimeout = connectionTimeout;
}
public int getKeepAliveInterval() {
return keepAliveInterval;
}
public void setKeepAliveInterval(int keepAliveInterval) {
this.keepAliveInterval = keepAliveInterval;
}
public boolean isAutomaticReconnect() {
return automaticReconnect;
}
public void setAutomaticReconnect(boolean automaticReconnect) {
this.automaticReconnect = automaticReconnect;
}
} }

View File

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

View File

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

View File

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

View File

@ -30,8 +30,8 @@ public class EmsSiteSetting extends BaseEntity
private String siteAddress; private String siteAddress;
/** 运营时间 */ /** 运营时间 */
@JsonFormat(pattern = "yyyy-MM-dd") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "运营时间", width = 30, dateFormat = "yyyy-MM-dd") @Excel(name = "运营时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date runningTime; private Date runningTime;
/** 纬度 */ /** 纬度 */

View File

@ -0,0 +1,65 @@
package com.xzzn.ems.domain.vo;
import java.util.Date;
/**
* 单站监控-故障告警请求
*
*/
public class AlarmRecordListRequestVo {
/** 站点id */
private String siteId;
/** 设备类型 */
private String deviceType;
/** 告警等级 */
private String alarmLevel;
/** 告警发生时间 */
private String alarmStartTime;
/** 告警结束时间 */
private String alarmEndTime;
public String getSiteId() {
return siteId;
}
public void setSiteId(String siteId) {
this.siteId = siteId;
}
public String getDeviceType() {
return deviceType;
}
public void setDeviceType(String deviceType) {
this.deviceType = deviceType;
}
public String getAlarmLevel() {
return alarmLevel;
}
public void setAlarmLevel(String alarmLevel) {
this.alarmLevel = alarmLevel;
}
public String getAlarmStartTime() {
return alarmStartTime;
}
public void setAlarmStartTime(String alarmStartTime) {
this.alarmStartTime = alarmStartTime;
}
public String getAlarmEndTime() {
return alarmEndTime;
}
public void setAlarmEndTime(String alarmEndTime) {
this.alarmEndTime = alarmEndTime;
}
}

View File

@ -0,0 +1,78 @@
package com.xzzn.ems.domain.vo;
import com.xzzn.common.annotation.Excel;
import java.util.Date;
/**
* 单站监控-故障告警返回
*
*/
public class AlarmRecordListResponseVo {
/** 设备名称 */
private String deviceName;
/** 告警等级 */
private String alarmLevel;
/** 告警内容 */
private String alarmContent;
/** 告警发生时间 */
private Date alarmStartTime;
/** 告警结束时间 */
private Date alarmEndTime;
/** 状态 */
private String status;
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getAlarmLevel() {
return alarmLevel;
}
public void setAlarmLevel(String alarmLevel) {
this.alarmLevel = alarmLevel;
}
public String getAlarmContent() {
return alarmContent;
}
public void setAlarmContent(String alarmContent) {
this.alarmContent = alarmContent;
}
public Date getAlarmStartTime() {
return alarmStartTime;
}
public void setAlarmStartTime(Date alarmStartTime) {
this.alarmStartTime = alarmStartTime;
}
public Date getAlarmEndTime() {
return alarmEndTime;
}
public void setAlarmEndTime(Date alarmEndTime) {
this.alarmEndTime = alarmEndTime;
}
public String getStatus() {
return status;
}
public void setStatus(String status) {
this.status = status;
}
}

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,12 @@ import java.util.Date;
import java.util.List; import java.util.List;
/** /**
* 电表数据 * 电表-总表数据
*/ */
public class AmmeterDataVo { public class AmmeterLoadDataVo {
/** 电表名称 */
private String deviceName;
/** 通信状态 */ /** 通信状态 */
private String emsCommunicationStatus; private String emsCommunicationStatus;
@ -17,7 +20,16 @@ public class AmmeterDataVo {
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss") @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
private Date dataUpdateTime; private Date dataUpdateTime;
private List<AmmeterDataDetailInfo> ammeterDataDetailInfos; /** 总表数据信息 */
private List<LoadDataDetailInfo> loadDataDetailInfo;
public String getDeviceName() {
return deviceName;
}
public void setDeviceName(String deviceName) {
this.deviceName = deviceName;
}
public String getEmsCommunicationStatus() { public String getEmsCommunicationStatus() {
return emsCommunicationStatus; return emsCommunicationStatus;
@ -35,11 +47,11 @@ public class AmmeterDataVo {
this.dataUpdateTime = dataUpdateTime; this.dataUpdateTime = dataUpdateTime;
} }
public List<AmmeterDataDetailInfo> getAmmeterDataDetailInfos() { public List<LoadDataDetailInfo> getLoadDataDetailInfo() {
return ammeterDataDetailInfos; return loadDataDetailInfo;
} }
public void setAmmeterDataDetailInfos(List<AmmeterDataDetailInfo> ammeterDataDetailInfos) { public void setLoadDataDetailInfo(List<LoadDataDetailInfo> loadDataDetailInfo) {
this.ammeterDataDetailInfos = ammeterDataDetailInfos; 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

@ -9,7 +9,7 @@ public class BMSBatteryDataList {
/** /**
* 簇号 * 簇号
*/ */
private Long clusterId; private String clusterId;
/** 簇电压 (V) */ /** 簇电压 (V) */
private BigDecimal clusterVoltage; private BigDecimal clusterVoltage;
@ -21,16 +21,16 @@ public class BMSBatteryDataList {
private BigDecimal currentSoc; private BigDecimal currentSoc;
/** 单体最高电压 (V) */ /** 单体最高电压 (V) */
private BigDecimal maxVoltage; private BigDecimal maxCellVoltage;
/** 单体最低电压 (V) */ /** 单体最低电压 (V) */
private BigDecimal minVoltage; private BigDecimal minCellVoltage;
/** 单体最高温度 (℃) */ /** 单体最高温度 (℃) */
private BigDecimal maxTemperature; private BigDecimal maxCellTemp;
/** 单体最低温度 (℃) */ /** 单体最低温度 (℃) */
private BigDecimal minTemperature; private BigDecimal minCellTemp;
/** 换电站id */ /** 换电站id */
private String siteId; private String siteId;
@ -38,44 +38,60 @@ public class BMSBatteryDataList {
/** 堆id */ /** 堆id */
private String stackDeviceId; private String stackDeviceId;
public Long getClusterId() { public String getClusterId() {
return clusterId; return clusterId;
} }
public void setClusterId(Long clusterId) { public void setClusterId(String clusterId) {
this.clusterId = clusterId; this.clusterId = clusterId;
} }
public BigDecimal getMinTemperature() { public String getStackDeviceId() {
return minTemperature; return stackDeviceId;
} }
public void setMinTemperature(BigDecimal minTemperature) { public void setStackDeviceId(String stackDeviceId) {
this.minTemperature = minTemperature; this.stackDeviceId = stackDeviceId;
} }
public BigDecimal getMaxTemperature() { public String getSiteId() {
return maxTemperature; return siteId;
} }
public void setMaxTemperature(BigDecimal maxTemperature) { public void setSiteId(String siteId) {
this.maxTemperature = maxTemperature; this.siteId = siteId;
} }
public BigDecimal getMinVoltage() { public BigDecimal getMinCellTemp() {
return minVoltage; return minCellTemp;
} }
public void setMinVoltage(BigDecimal minVoltage) { public void setMinCellTemp(BigDecimal minCellTemp) {
this.minVoltage = minVoltage; this.minCellTemp = minCellTemp;
} }
public BigDecimal getMaxVoltage() { public BigDecimal getMaxCellTemp() {
return maxVoltage; return maxCellTemp;
} }
public void setMaxVoltage(BigDecimal maxVoltage) { public void setMaxCellTemp(BigDecimal maxCellTemp) {
this.maxVoltage = maxVoltage; 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() { public BigDecimal getCurrentSoc() {

View File

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

View File

@ -1,5 +1,6 @@
package com.xzzn.ems.domain.vo; package com.xzzn.ems.domain.vo;
import com.fasterxml.jackson.annotation.JsonFormat;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date; import java.util.Date;
@ -24,7 +25,11 @@ public class BatteryDataStatsListVo {
/** SOH (%) */ /** SOH (%) */
private BigDecimal soh; private BigDecimal soh;
private Date updateTime; @JsonFormat(pattern = "yyyy-MM-dd")
private Date dataTimestamp;
/** 簇号 */
private String clusterDeviceId;
public String getDeviceId() { public String getDeviceId() {
return deviceId; return deviceId;
@ -66,11 +71,19 @@ public class BatteryDataStatsListVo {
this.soh = soh; this.soh = soh;
} }
public Date getUpdateTime() { public Date getDataTimestamp() {
return updateTime; return dataTimestamp;
} }
public void setUpdateTime(Date updateTime) { public void setDataTimestamp(Date dataTimestamp) {
this.updateTime = updateTime; 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; package com.xzzn.ems.domain.vo;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
/** /**
* 总表详细数据 * 电表-总表数据展示
*/ */
public class AmmeterDataDetailInfo public class LoadDataDetailInfo
{ {
/** 类别 */ /** 类别 */
private String category; private String category;
/** 总 (kWh) */ /** 总 (kWh) */
private BigDecimal totalKwh; private BigDecimal totalKwh = BigDecimal.ZERO;
/** 尖 (kWh) */ /** 尖 (kWh) */
private BigDecimal sharpKwh; private BigDecimal peakKwh = BigDecimal.ZERO;
/** 峰 (kWh) */ /** 峰 (kWh) */
private BigDecimal peakKwh; private BigDecimal highKwh = BigDecimal.ZERO;
/** 平 (kWh) */ /** 平 (kWh) */
private BigDecimal flatKwh; private BigDecimal flatKwh = BigDecimal.ZERO;
/** 谷 (kWh) */ /** 谷 (kWh) */
private BigDecimal valleyKwh; private BigDecimal valleyKwh = BigDecimal.ZERO;
/** 总表设备Id */
private String deviceId;
/** 数据更新时间 */
private Date updateTime;
public BigDecimal getValleyKwh() { public BigDecimal getValleyKwh() {
return valleyKwh; return valleyKwh;
@ -56,12 +50,12 @@ public class AmmeterDataDetailInfo
this.peakKwh = peakKwh; this.peakKwh = peakKwh;
} }
public BigDecimal getSharpKwh() { public BigDecimal getHighKwh() {
return sharpKwh; return highKwh;
} }
public void setSharpKwh(BigDecimal sharpKwh) { public void setHighKwh(BigDecimal highKwh) {
this.sharpKwh = sharpKwh; this.highKwh = highKwh;
} }
public BigDecimal getTotalKwh() { public BigDecimal getTotalKwh() {
@ -79,20 +73,4 @@ public class AmmeterDataDetailInfo
public void setCategory(String category) { public void setCategory(String category) {
this.category = 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; private String deviceId;
/** 支路id */ /** 支路id */
private Long branchId; private String branchId;
public String getDischargeStatus() { public String getDischargeStatus() {
return dischargeStatus; return dischargeStatus;
@ -81,11 +81,11 @@ public class PcsBranchInfo
this.deviceId = deviceId; this.deviceId = deviceId;
} }
public Long getBranchId() { public String getBranchId() {
return branchId; return branchId;
} }
public void setBranchId(Long branchId) { public void setBranchId(String branchId) {
this.branchId = branchId; this.branchId = branchId;
} }
} }

View File

@ -51,12 +51,12 @@ public class SingleSiteBaseInfo {
/** /**
* 装机功率MW * 装机功率MW
*/ */
private BigDecimal installedPower; private BigDecimal installPower;
/** /**
* 装机容量MW * 装机容量MW
*/ */
private BigDecimal installedCap; private BigDecimal installCapacity;
/** /**
* 七天放电统计 * 七天放电统计
@ -79,20 +79,20 @@ public class SingleSiteBaseInfo {
this.dayChargedCap = dayChargedCap; this.dayChargedCap = dayChargedCap;
} }
public BigDecimal getInstalledCap() { public BigDecimal getInstallPower() {
return installedCap; return installPower;
} }
public void setInstalledCap(BigDecimal installedCap) { public void setInstallPower(BigDecimal installPower) {
this.installedCap = installedCap; this.installPower = installPower;
} }
public BigDecimal getInstalledPower() { public BigDecimal getInstallCapacity() {
return installedPower; return installCapacity;
} }
public void setInstalledPower(BigDecimal installedPower) { public void setInstallCapacity(BigDecimal installCapacity) {
this.installedPower = installedPower; this.installCapacity = installCapacity;
} }
public String getRunningTime() { 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 chargedCap;
private BigDecimal dailyEfficiency;
public String getAmmeterDate() { public String getAmmeterDate() {
return ammeterDate; return ammeterDate;
} }
@ -45,4 +47,12 @@ public class SiteMonitorDataVo {
public void setChargedCap(BigDecimal chargedCap) { public void setChargedCap(BigDecimal chargedCap) {
this.chargedCap = chargedCap; this.chargedCap = chargedCap;
} }
public BigDecimal getDailyEfficiency() {
return dailyEfficiency;
}
public void setDailyEfficiency(BigDecimal dailyEfficiency) {
this.dailyEfficiency = dailyEfficiency;
}
} }

View File

@ -37,6 +37,11 @@ public class SiteMonitorRunningHeadInfoVo {
*/ */
private BigDecimal dayDisChargedCap; private BigDecimal dayDisChargedCap;
/**
* 站点id
*/
private String siteId;
public BigDecimal getTotalActivePower() { public BigDecimal getTotalActivePower() {
return totalActivePower; return totalActivePower;
} }
@ -84,4 +89,12 @@ public class SiteMonitorRunningHeadInfoVo {
public void setDayDisChargedCap(BigDecimal dayDisChargedCap) { public void setDayDisChargedCap(BigDecimal dayDisChargedCap) {
this.dayDisChargedCap = dayDisChargedCap; this.dayDisChargedCap = dayDisChargedCap;
} }
public String getSiteId() {
return siteId;
}
public void setSiteId(String siteId) {
this.siteId = siteId;
}
} }

View File

@ -2,9 +2,7 @@ package com.xzzn.ems.mapper;
import java.util.List; import java.util.List;
import com.xzzn.ems.domain.EmsAlarmRecords; import com.xzzn.ems.domain.EmsAlarmRecords;
import com.xzzn.ems.domain.vo.AlarmTrendList; import com.xzzn.ems.domain.vo.*;
import com.xzzn.ems.domain.vo.DeviceAlarmProportionList;
import com.xzzn.ems.domain.vo.SiteMonitorHomeAlarmVo;
/** /**
* 告警记录Mapper接口 * 告警记录Mapper接口
@ -79,4 +77,6 @@ public interface EmsAlarmRecordsMapper
* *
*/ */
public List<DeviceAlarmProportionList> getDeviceAlarmPropList(); public List<DeviceAlarmProportionList> getDeviceAlarmPropList();
public List<AlarmRecordListResponseVo> getAlarmRecordDetailList(AlarmRecordListRequestVo requestVo);
} }

View File

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

View File

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

View File

@ -4,9 +4,8 @@ import java.util.List;
import java.util.Map; import java.util.Map;
import com.xzzn.ems.domain.EmsBatteryData; import com.xzzn.ems.domain.EmsBatteryData;
import com.xzzn.ems.domain.vo.BMSBatteryClusterDataList;
import com.xzzn.ems.domain.vo.BatteryClusterDataDetailVo; import com.xzzn.ems.domain.vo.BatteryClusterDataDetailVo;
import org.apache.ibatis.annotations.Mapper; import com.xzzn.ems.domain.vo.BatteryDataStatsListVo;
import org.apache.ibatis.annotations.Param; import org.apache.ibatis.annotations.Param;
/** /**
@ -92,7 +91,7 @@ public interface EmsBatteryDataMapper
* @param clusterDeviceId * @param clusterDeviceId
* @return * @return
*/ */
public List<BatteryDataStatsListVo> getAllBatteryDataByClusterId(String clusterDeviceId); public List<BatteryDataStatsListVo> getAllBatteryDataByClusterId(@Param("clusterDeviceId") String clusterDeviceId,@Param("siteId") String siteId);
int insertEmsBatteryDataList(List<EmsBatteryData> emsBatteryDataList); int insertEmsBatteryDataList(List<EmsBatteryData> emsBatteryDataList);

View File

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

View File

@ -3,7 +3,7 @@ package com.xzzn.ems.mapper;
import java.util.List; import java.util.List;
import com.xzzn.ems.domain.EmsPcsBranchData; import com.xzzn.ems.domain.EmsPcsBranchData;
import com.xzzn.ems.domain.vo.PcsBranchInfo; import com.xzzn.ems.domain.vo.PcsBranchInfo;
import io.lettuce.core.dynamic.annotation.Param; import org.apache.ibatis.annotations.Param;
/** /**
* pcs支路数据Mapper接口 * pcs支路数据Mapper接口
@ -68,4 +68,6 @@ public interface EmsPcsBranchDataMapper
* @return * @return
*/ */
public List<PcsBranchInfo> getPcsBranchInfoList(@Param("siteId")String siteId, @Param("deviceId")String deviceId); public List<PcsBranchInfo> getPcsBranchInfoList(@Param("siteId")String siteId, @Param("deviceId")String deviceId);
int insertPcsBranchDataList(List<EmsPcsBranchData> list);
} }

View File

@ -1,14 +1,13 @@
package com.xzzn.ems.mapper; package com.xzzn.ems.mapper;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.Date;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import com.xzzn.ems.domain.EmsPcsData; import com.xzzn.ems.domain.EmsPcsData;
import com.xzzn.ems.domain.vo.ElectricIndexList; import com.xzzn.ems.domain.vo.*;
import com.xzzn.ems.domain.vo.PcsDetailInfoVo; import org.apache.ibatis.annotations.Param;
import com.xzzn.ems.domain.vo.SiteMonitorDataVo;
import com.xzzn.ems.domain.vo.SiteMonitorRunningHeadInfoVo;
/** /**
* PCS数据Mapper接口 * PCS数据Mapper接口
@ -71,14 +70,7 @@ public interface EmsPcsDataMapper
* @param siteId * @param siteId
* @return * @return
*/ */
public List<SiteMonitorDataVo> getPcsDataBySiteId(String siteId); public List<SiteMonitorDataVo> getPcsDataBySiteId(@Param("siteId")String siteId, @Param("limitTime")int limitTime);
/**
* 根据站点获取电网实时功率=sum总交流有功电率
* @param siteId
* @return
*/
public BigDecimal getGridNrtPower(String siteId);
/** /**
* 根据站点获取设备监控的实时运行头信息 * 根据站点获取设备监控的实时运行头信息
@ -104,5 +96,12 @@ public interface EmsPcsDataMapper
* 获取总充+总放 * 获取总充+总放
* @return * @return
*/ */
public Map<String, BigDecimal> getPcsTotalChargeData(); 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 java.util.List;
import com.xzzn.ems.domain.EmsSiteSetting; import com.xzzn.ems.domain.EmsSiteSetting;
import com.xzzn.ems.domain.vo.SiteDeviceListVo;
import com.xzzn.ems.domain.vo.SiteTotalInfoVo; import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
import org.apache.ibatis.annotations.Param;
/** /**
* 站点Mapper接口 * 站点Mapper接口
@ -72,4 +74,20 @@ public interface EmsSiteSettingMapper
* @return * @return
*/ */
public EmsSiteSetting selectEmsSiteSettingBySiteId(String siteId); 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,70 @@
package com.xzzn.ems.service;
import java.util.List;
import com.xzzn.ems.domain.EmsAlarmRecords;
import com.xzzn.ems.domain.vo.AlarmRecordListRequestVo;
import com.xzzn.ems.domain.vo.AlarmRecordListResponseVo;
/**
* 告警记录Service接口
*
* @author xzzn
* @date 2025-06-29
*/
public interface IEmsAlarmRecordsService
{
/**
* 查询告警记录
*
* @param id 告警记录主键
* @return 告警记录
*/
public EmsAlarmRecords selectEmsAlarmRecordsById(Long id);
/**
* 查询告警记录列表
*
* @param emsAlarmRecords 告警记录
* @return 告警记录集合
*/
public List<EmsAlarmRecords> selectEmsAlarmRecordsList(EmsAlarmRecords emsAlarmRecords);
/**
* 新增告警记录
*
* @param emsAlarmRecords 告警记录
* @return 结果
*/
public int insertEmsAlarmRecords(EmsAlarmRecords emsAlarmRecords);
/**
* 修改告警记录
*
* @param emsAlarmRecords 告警记录
* @return 结果
*/
public int updateEmsAlarmRecords(EmsAlarmRecords emsAlarmRecords);
/**
* 批量删除告警记录
*
* @param ids 需要删除的告警记录主键集合
* @return 结果
*/
public int deleteEmsAlarmRecordsByIds(Long[] ids);
/**
* 删除告警记录信息
*
* @param id 告警记录主键
* @return 结果
*/
public int deleteEmsAlarmRecordsById(Long id);
/**
* 获取故障告警列表
* @param requestVo
* @return
*/
public List<AlarmRecordListResponseVo> getAlarmRecordDetailList(AlarmRecordListRequestVo requestVo);
}

View File

@ -0,0 +1,61 @@
package com.xzzn.ems.service;
import java.util.List;
import com.xzzn.ems.domain.EmsBatteryCluster;
/**
* 电池簇数据Service接口
*
* @author xzzn
* @date 2025-06-29
*/
public interface IEmsBatteryClusterService
{
/**
* 查询电池簇数据
*
* @param id 电池簇数据主键
* @return 电池簇数据
*/
public EmsBatteryCluster selectEmsBatteryClusterById(Long id);
/**
* 查询电池簇数据列表
*
* @param emsBatteryCluster 电池簇数据
* @return 电池簇数据集合
*/
public List<EmsBatteryCluster> selectEmsBatteryClusterList(EmsBatteryCluster emsBatteryCluster);
/**
* 新增电池簇数据
*
* @param emsBatteryCluster 电池簇数据
* @return 结果
*/
public int insertEmsBatteryCluster(EmsBatteryCluster emsBatteryCluster);
/**
* 修改电池簇数据
*
* @param emsBatteryCluster 电池簇数据
* @return 结果
*/
public int updateEmsBatteryCluster(EmsBatteryCluster emsBatteryCluster);
/**
* 批量删除电池簇数据
*
* @param ids 需要删除的电池簇数据主键集合
* @return 结果
*/
public int deleteEmsBatteryClusterByIds(Long[] ids);
/**
* 删除电池簇数据信息
*
* @param id 电池簇数据主键
* @return 结果
*/
public int deleteEmsBatteryClusterById(Long id);
}

View File

@ -0,0 +1,61 @@
package com.xzzn.ems.service;
import java.util.List;
import com.xzzn.ems.domain.EmsBatteryStack;
/**
* 电池堆数据Service接口
*
* @author xzzn
* @date 2025-06-29
*/
public interface IEmsBatteryStackService
{
/**
* 查询电池堆数据
*
* @param id 电池堆数据主键
* @return 电池堆数据
*/
public EmsBatteryStack selectEmsBatteryStackById(Long id);
/**
* 查询电池堆数据列表
*
* @param emsBatteryStack 电池堆数据
* @return 电池堆数据集合
*/
public List<EmsBatteryStack> selectEmsBatteryStackList(EmsBatteryStack emsBatteryStack);
/**
* 新增电池堆数据
*
* @param emsBatteryStack 电池堆数据
* @return 结果
*/
public int insertEmsBatteryStack(EmsBatteryStack emsBatteryStack);
/**
* 修改电池堆数据
*
* @param emsBatteryStack 电池堆数据
* @return 结果
*/
public int updateEmsBatteryStack(EmsBatteryStack emsBatteryStack);
/**
* 批量删除电池堆数据
*
* @param ids 需要删除的电池堆数据主键集合
* @return 结果
*/
public int deleteEmsBatteryStackByIds(Long[] ids);
/**
* 删除电池堆数据信息
*
* @param id 电池堆数据主键
* @return 结果
*/
public int deleteEmsBatteryStackById(Long id);
}

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

@ -0,0 +1,63 @@
package com.xzzn.ems.service;
import java.util.List;
import com.xzzn.ems.domain.EmsPcsBranchData;
/**
* pcs支路数据Service接口
*
* @author xzzn
* @date 2025-06-29
*/
public interface IEmsPcsBranchDataService
{
/**
* 查询pcs支路数据
*
* @param id pcs支路数据主键
* @return pcs支路数据
*/
public EmsPcsBranchData selectEmsPcsBranchDataById(Long id);
/**
* 查询pcs支路数据列表
*
* @param emsPcsBranchData pcs支路数据
* @return pcs支路数据集合
*/
public List<EmsPcsBranchData> selectEmsPcsBranchDataList(EmsPcsBranchData emsPcsBranchData);
/**
* 新增pcs支路数据
*
* @param emsPcsBranchData pcs支路数据
* @return 结果
*/
public int insertEmsPcsBranchData(EmsPcsBranchData emsPcsBranchData);
/**
* 修改pcs支路数据
*
* @param emsPcsBranchData pcs支路数据
* @return 结果
*/
public int updateEmsPcsBranchData(EmsPcsBranchData emsPcsBranchData);
/**
* 批量删除pcs支路数据
*
* @param ids 需要删除的pcs支路数据主键集合
* @return 结果
*/
public int deleteEmsPcsBranchDataByIds(Long[] ids);
/**
* 删除pcs支路数据信息
*
* @param id pcs支路数据主键
* @return 结果
*/
public int deleteEmsPcsBranchDataById(Long id);
int insertEmsPcsBranchDataList(List<EmsPcsBranchData> list);
}

View File

@ -1,6 +1,7 @@
package com.xzzn.ems.service; package com.xzzn.ems.service;
import com.xzzn.ems.domain.EmsSiteSetting; import com.xzzn.ems.domain.EmsSiteSetting;
import com.xzzn.ems.domain.vo.SiteDeviceListVo;
import com.xzzn.ems.domain.vo.SiteTotalInfoVo; import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
import java.util.List; import java.util.List;
@ -22,5 +23,7 @@ public interface IEmsSiteService
public List<Map<String,Object>> getAllClusterInfo(String stackDeviceId); 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<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,103 @@
package com.xzzn.ems.service.impl;
import java.util.List;
import com.xzzn.common.utils.DateUtils;
import com.xzzn.ems.domain.vo.AlarmRecordListRequestVo;
import com.xzzn.ems.domain.vo.AlarmRecordListResponseVo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xzzn.ems.mapper.EmsAlarmRecordsMapper;
import com.xzzn.ems.domain.EmsAlarmRecords;
import com.xzzn.ems.service.IEmsAlarmRecordsService;
/**
* 告警记录Service业务层处理
*
* @author xzzn
* @date 2025-06-29
*/
@Service
public class EmsAlarmRecordsServiceImpl implements IEmsAlarmRecordsService
{
@Autowired
private EmsAlarmRecordsMapper emsAlarmRecordsMapper;
/**
* 查询告警记录
*
* @param id 告警记录主键
* @return 告警记录
*/
@Override
public EmsAlarmRecords selectEmsAlarmRecordsById(Long id)
{
return emsAlarmRecordsMapper.selectEmsAlarmRecordsById(id);
}
/**
* 查询告警记录列表
*
* @param emsAlarmRecords 告警记录
* @return 告警记录
*/
@Override
public List<EmsAlarmRecords> selectEmsAlarmRecordsList(EmsAlarmRecords emsAlarmRecords)
{
return emsAlarmRecordsMapper.selectEmsAlarmRecordsList(emsAlarmRecords);
}
/**
* 新增告警记录
*
* @param emsAlarmRecords 告警记录
* @return 结果
*/
@Override
public int insertEmsAlarmRecords(EmsAlarmRecords emsAlarmRecords)
{
emsAlarmRecords.setCreateTime(DateUtils.getNowDate());
return emsAlarmRecordsMapper.insertEmsAlarmRecords(emsAlarmRecords);
}
/**
* 修改告警记录
*
* @param emsAlarmRecords 告警记录
* @return 结果
*/
@Override
public int updateEmsAlarmRecords(EmsAlarmRecords emsAlarmRecords)
{
emsAlarmRecords.setUpdateTime(DateUtils.getNowDate());
return emsAlarmRecordsMapper.updateEmsAlarmRecords(emsAlarmRecords);
}
/**
* 批量删除告警记录
*
* @param ids 需要删除的告警记录主键
* @return 结果
*/
@Override
public int deleteEmsAlarmRecordsByIds(Long[] ids)
{
return emsAlarmRecordsMapper.deleteEmsAlarmRecordsByIds(ids);
}
/**
* 删除告警记录信息
*
* @param id 告警记录主键
* @return 结果
*/
@Override
public int deleteEmsAlarmRecordsById(Long id)
{
return emsAlarmRecordsMapper.deleteEmsAlarmRecordsById(id);
}
@Override
public List<AlarmRecordListResponseVo> getAlarmRecordDetailList(AlarmRecordListRequestVo requestVo) {
return emsAlarmRecordsMapper.getAlarmRecordDetailList(requestVo);
}
}

View File

@ -0,0 +1,96 @@
package com.xzzn.ems.service.impl;
import java.util.List;
import com.xzzn.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xzzn.ems.mapper.EmsBatteryClusterMapper;
import com.xzzn.ems.domain.EmsBatteryCluster;
import com.xzzn.ems.service.IEmsBatteryClusterService;
/**
* 电池簇数据Service业务层处理
*
* @author xzzn
* @date 2025-06-29
*/
@Service
public class EmsBatteryClusterServiceImpl implements IEmsBatteryClusterService
{
@Autowired
private EmsBatteryClusterMapper emsBatteryClusterMapper;
/**
* 查询电池簇数据
*
* @param id 电池簇数据主键
* @return 电池簇数据
*/
@Override
public EmsBatteryCluster selectEmsBatteryClusterById(Long id)
{
return emsBatteryClusterMapper.selectEmsBatteryClusterById(id);
}
/**
* 查询电池簇数据列表
*
* @param emsBatteryCluster 电池簇数据
* @return 电池簇数据
*/
@Override
public List<EmsBatteryCluster> selectEmsBatteryClusterList(EmsBatteryCluster emsBatteryCluster)
{
return emsBatteryClusterMapper.selectEmsBatteryClusterList(emsBatteryCluster);
}
/**
* 新增电池簇数据
*
* @param emsBatteryCluster 电池簇数据
* @return 结果
*/
@Override
public int insertEmsBatteryCluster(EmsBatteryCluster emsBatteryCluster)
{
emsBatteryCluster.setCreateTime(DateUtils.getNowDate());
return emsBatteryClusterMapper.insertEmsBatteryCluster(emsBatteryCluster);
}
/**
* 修改电池簇数据
*
* @param emsBatteryCluster 电池簇数据
* @return 结果
*/
@Override
public int updateEmsBatteryCluster(EmsBatteryCluster emsBatteryCluster)
{
emsBatteryCluster.setUpdateTime(DateUtils.getNowDate());
return emsBatteryClusterMapper.updateEmsBatteryCluster(emsBatteryCluster);
}
/**
* 批量删除电池簇数据
*
* @param ids 需要删除的电池簇数据主键
* @return 结果
*/
@Override
public int deleteEmsBatteryClusterByIds(Long[] ids)
{
return emsBatteryClusterMapper.deleteEmsBatteryClusterByIds(ids);
}
/**
* 删除电池簇数据信息
*
* @param id 电池簇数据主键
* @return 结果
*/
@Override
public int deleteEmsBatteryClusterById(Long id)
{
return emsBatteryClusterMapper.deleteEmsBatteryClusterById(id);
}
}

View File

@ -0,0 +1,96 @@
package com.xzzn.ems.service.impl;
import java.util.List;
import com.xzzn.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xzzn.ems.mapper.EmsBatteryStackMapper;
import com.xzzn.ems.domain.EmsBatteryStack;
import com.xzzn.ems.service.IEmsBatteryStackService;
/**
* 电池堆数据Service业务层处理
*
* @author xzzn
* @date 2025-06-29
*/
@Service
public class EmsBatteryStackServiceImpl implements IEmsBatteryStackService
{
@Autowired
private EmsBatteryStackMapper emsBatteryStackMapper;
/**
* 查询电池堆数据
*
* @param id 电池堆数据主键
* @return 电池堆数据
*/
@Override
public EmsBatteryStack selectEmsBatteryStackById(Long id)
{
return emsBatteryStackMapper.selectEmsBatteryStackById(id);
}
/**
* 查询电池堆数据列表
*
* @param emsBatteryStack 电池堆数据
* @return 电池堆数据
*/
@Override
public List<EmsBatteryStack> selectEmsBatteryStackList(EmsBatteryStack emsBatteryStack)
{
return emsBatteryStackMapper.selectEmsBatteryStackList(emsBatteryStack);
}
/**
* 新增电池堆数据
*
* @param emsBatteryStack 电池堆数据
* @return 结果
*/
@Override
public int insertEmsBatteryStack(EmsBatteryStack emsBatteryStack)
{
emsBatteryStack.setCreateTime(DateUtils.getNowDate());
return emsBatteryStackMapper.insertEmsBatteryStack(emsBatteryStack);
}
/**
* 修改电池堆数据
*
* @param emsBatteryStack 电池堆数据
* @return 结果
*/
@Override
public int updateEmsBatteryStack(EmsBatteryStack emsBatteryStack)
{
emsBatteryStack.setUpdateTime(DateUtils.getNowDate());
return emsBatteryStackMapper.updateEmsBatteryStack(emsBatteryStack);
}
/**
* 批量删除电池堆数据
*
* @param ids 需要删除的电池堆数据主键
* @return 结果
*/
@Override
public int deleteEmsBatteryStackByIds(Long[] ids)
{
return emsBatteryStackMapper.deleteEmsBatteryStackByIds(ids);
}
/**
* 删除电池堆数据信息
*
* @param id 电池堆数据主键
* @return 结果
*/
@Override
public int deleteEmsBatteryStackById(Long id)
{
return emsBatteryStackMapper.deleteEmsBatteryStackById(id);
}
}

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

@ -0,0 +1,105 @@
package com.xzzn.ems.service.impl;
import java.util.List;
import com.xzzn.common.utils.DateUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xzzn.ems.mapper.EmsPcsBranchDataMapper;
import com.xzzn.ems.domain.EmsPcsBranchData;
import com.xzzn.ems.service.IEmsPcsBranchDataService;
/**
* pcs支路数据Service业务层处理
*
* @author xzzn
* @date 2025-06-29
*/
@Service
public class EmsPcsBranchDataServiceImpl implements IEmsPcsBranchDataService
{
@Autowired
private EmsPcsBranchDataMapper emsPcsBranchDataMapper;
/**
* 查询pcs支路数据
*
* @param id pcs支路数据主键
* @return pcs支路数据
*/
@Override
public EmsPcsBranchData selectEmsPcsBranchDataById(Long id)
{
return emsPcsBranchDataMapper.selectEmsPcsBranchDataById(id);
}
/**
* 查询pcs支路数据列表
*
* @param emsPcsBranchData pcs支路数据
* @return pcs支路数据
*/
@Override
public List<EmsPcsBranchData> selectEmsPcsBranchDataList(EmsPcsBranchData emsPcsBranchData)
{
return emsPcsBranchDataMapper.selectEmsPcsBranchDataList(emsPcsBranchData);
}
/**
* 新增pcs支路数据
*
* @param emsPcsBranchData pcs支路数据
* @return 结果
*/
@Override
public int insertEmsPcsBranchData(EmsPcsBranchData emsPcsBranchData)
{
emsPcsBranchData.setCreateTime(DateUtils.getNowDate());
return emsPcsBranchDataMapper.insertEmsPcsBranchData(emsPcsBranchData);
}
/**
* 修改pcs支路数据
*
* @param emsPcsBranchData pcs支路数据
* @return 结果
*/
@Override
public int updateEmsPcsBranchData(EmsPcsBranchData emsPcsBranchData)
{
emsPcsBranchData.setUpdateTime(DateUtils.getNowDate());
return emsPcsBranchDataMapper.updateEmsPcsBranchData(emsPcsBranchData);
}
/**
* 批量删除pcs支路数据
*
* @param ids 需要删除的pcs支路数据主键
* @return 结果
*/
@Override
public int deleteEmsPcsBranchDataByIds(Long[] ids)
{
return emsPcsBranchDataMapper.deleteEmsPcsBranchDataByIds(ids);
}
/**
* 删除pcs支路数据信息
*
* @param id pcs支路数据主键
* @return 结果
*/
@Override
public int deleteEmsPcsBranchDataById(Long id)
{
return emsPcsBranchDataMapper.deleteEmsPcsBranchDataById(id);
}
@Override
public int insertEmsPcsBranchDataList(List<EmsPcsBranchData> list) {
for (EmsPcsBranchData item : list) {
item.setCreateTime(DateUtils.getNowDate());
}
return emsPcsBranchDataMapper.insertPcsBranchDataList(list);
}
}

View File

@ -1,6 +1,8 @@
package com.xzzn.ems.service.impl; package com.xzzn.ems.service.impl;
import com.xzzn.common.enums.DeviceCategory;
import com.xzzn.ems.domain.EmsSiteSetting; import com.xzzn.ems.domain.EmsSiteSetting;
import com.xzzn.ems.domain.vo.SiteDeviceListVo;
import com.xzzn.ems.domain.vo.SiteTotalInfoVo; import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
import com.xzzn.ems.mapper.EmsDevicesSettingMapper; import com.xzzn.ems.mapper.EmsDevicesSettingMapper;
import com.xzzn.ems.mapper.EmsSiteSettingMapper; import com.xzzn.ems.mapper.EmsSiteSettingMapper;
@ -41,17 +43,39 @@ public class EmsSiteServiceImpl implements IEmsSiteService
*/ */
@Override @Override
public List<Map<String, Object>> getAllStackInfo(String siteId) { public List<Map<String, Object>> getAllStackInfo(String siteId) {
return emsDevicesMapper.getAllStackInfoBySiteId(siteId); return emsDevicesMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.STACK.getCode());
} }
/** /**
* 根据电池堆Id获取电池簇 * 根据父类设备id获取子设备id
* @param stackDeviceId * @param parentId
* @return * @return
*/ */
@Override @Override
public List<Map<String, Object>> getAllClusterInfo(String stackDeviceId) { public List<Map<String, Object>> getAllClusterInfo(String parentId) {
return emsDevicesMapper.getAllClusterInfoByStackId(stackDeviceId); 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

@ -22,6 +22,7 @@ import java.util.*;
@Service @Service
public class HomePageServiceImpl implements IHomePageService public class HomePageServiceImpl implements IHomePageService
{ {
private static final int LIMIT_TIME = 6;
@Autowired @Autowired
private IEmsSiteService emsSiteService; private IEmsSiteService emsSiteService;
@ -37,10 +38,11 @@ public class HomePageServiceImpl implements IHomePageService
SiteTotalInfoVo siteTotalInfoVo = new SiteTotalInfoVo(); SiteTotalInfoVo siteTotalInfoVo = new SiteTotalInfoVo();
siteTotalInfoVo = emsSiteService.getSiteTotalInfo(); siteTotalInfoVo = emsSiteService.getSiteTotalInfo();
// 获取总充+总放 // 获取总充+总放
Map<String,BigDecimal> pcsMap = new HashMap<>(); Map<String,BigDecimal> pcsMap = emsPcsDataMapper.getPcsTotalChargeData(null);
pcsMap = emsPcsDataMapper.getPcsTotalChargeData(); if(pcsMap != null){
siteTotalInfoVo.setTotalChargedCap(pcsMap.get("totalChargedCap")); siteTotalInfoVo.setTotalChargedCap(pcsMap.get("totalChargedCap"));
siteTotalInfoVo.setTotalDischargedCap(pcsMap.get("totalDischargedCap")); siteTotalInfoVo.setTotalDischargedCap(pcsMap.get("totalDischargedCap"));
}
return siteTotalInfoVo; return siteTotalInfoVo;
} }
@ -55,8 +57,8 @@ public class HomePageServiceImpl implements IHomePageService
if (emsSite != null) { if (emsSite != null) {
// 装机功率+装机容量 // 装机功率+装机容量
singleSiteBaseInfo.setSiteName(emsSite.getSiteName()); singleSiteBaseInfo.setSiteName(emsSite.getSiteName());
singleSiteBaseInfo.setInstalledCap(emsSite.getInstallCapacity()); singleSiteBaseInfo.setInstallCapacity(emsSite.getInstallCapacity());
singleSiteBaseInfo.setInstalledPower(emsSite.getInstallPower()); singleSiteBaseInfo.setInstallPower(emsSite.getInstallPower());
String[] siteLocation = new String[2]; String[] siteLocation = new String[2];
siteLocation[0] = emsSite.getLongitude() == null ? "" : emsSite.getLongitude().toString(); siteLocation[0] = emsSite.getLongitude() == null ? "" : emsSite.getLongitude().toString();
siteLocation[1] = emsSite.getLatitude() == null ? "" : emsSite.getLatitude().toString(); siteLocation[1] = emsSite.getLatitude() == null ? "" : emsSite.getLatitude().toString();
@ -64,8 +66,14 @@ public class HomePageServiceImpl implements IHomePageService
singleSiteBaseInfo.setSiteAddress(emsSite.getSiteAddress()); singleSiteBaseInfo.setSiteAddress(emsSite.getSiteAddress());
singleSiteBaseInfo.setRunningTime(emsSite.getRunningTime() == null ? null : singleSiteBaseInfo.setRunningTime(emsSite.getRunningTime() == null ? null :
DateUtils.parseDateToStr("yyyy-MM-dd",emsSite.getRunningTime()));//投运时间 DateUtils.parseDateToStr("yyyy-MM-dd",emsSite.getRunningTime()));//投运时间
// 获取单站点的总充+总放
Map<String,BigDecimal> pcsMap = emsPcsDataMapper.getPcsTotalChargeData(siteId);
if (pcsMap != null) {
singleSiteBaseInfo.setTotalChargedCap(pcsMap.get("totalChargedCap"));
singleSiteBaseInfo.setTotalDisChargedCap(pcsMap.get("totalDischargedCap"));
}
// 七天放电数据统计 // 七天放电数据统计
List<SiteMonitorDataVo> siteMonitorDataVoList = emsPcsDataMapper.getPcsDataBySiteId(siteId); List<SiteMonitorDataVo> siteMonitorDataVoList = emsPcsDataMapper.getPcsDataBySiteId(siteId,LIMIT_TIME);
singleSiteBaseInfo.setSevenDayDisChargeStats(siteMonitorDataVoList); singleSiteBaseInfo.setSevenDayDisChargeStats(siteMonitorDataVoList);
// 充放电基本数据处理 // 充放电基本数据处理
dealSitePCSDate(singleSiteBaseInfo,siteMonitorDataVoList); dealSitePCSDate(singleSiteBaseInfo,siteMonitorDataVoList);
@ -77,27 +85,15 @@ public class HomePageServiceImpl implements IHomePageService
private void dealSitePCSDate(SingleSiteBaseInfo singleSiteBaseInfo, List<SiteMonitorDataVo> siteMonitorDataVoList) { private void dealSitePCSDate(SingleSiteBaseInfo singleSiteBaseInfo, List<SiteMonitorDataVo> siteMonitorDataVoList) {
if (siteMonitorDataVoList != null && !siteMonitorDataVoList.isEmpty()) { if (siteMonitorDataVoList != null && !siteMonitorDataVoList.isEmpty()) {
BigDecimal dayChargeCap = new BigDecimal(0);
BigDecimal dayDisChargeCap = new BigDecimal(0);
BigDecimal totalChargeCap = new BigDecimal(0);
BigDecimal totalDisChargeCap = new BigDecimal(0);
for (SiteMonitorDataVo sitePcsData : siteMonitorDataVoList) { for (SiteMonitorDataVo sitePcsData : siteMonitorDataVoList) {
// 总充电量
totalChargeCap = totalChargeCap.add(sitePcsData.getChargedCap());
// 总放电量
totalDisChargeCap = totalDisChargeCap.add(sitePcsData.getDisChargedCap());
// 获取当天的充电量+放电量 // 获取当天的充电量+放电量
String pcsDate = sitePcsData.getAmmeterDate(); String pcsDate = sitePcsData.getAmmeterDate();
boolean isToday= checkIsToday(pcsDate); boolean isToday= checkIsToday(pcsDate);
if(isToday){ if(isToday){
dayChargeCap = dayChargeCap.add(sitePcsData.getChargedCap()); singleSiteBaseInfo.setDayChargedCap(sitePcsData.getChargedCap());
dayDisChargeCap = dayDisChargeCap.add(sitePcsData.getDisChargedCap()); singleSiteBaseInfo.setDayDisChargedCap(sitePcsData.getDisChargedCap());
} }
} }
singleSiteBaseInfo.setDayChargedCap(dayChargeCap);
singleSiteBaseInfo.setDayDisChargedCap(dayDisChargeCap);
singleSiteBaseInfo.setTotalChargedCap(totalChargeCap);
singleSiteBaseInfo.setTotalDisChargedCap(totalDisChargeCap);
} }
} }

View File

@ -1,18 +1,21 @@
package com.xzzn.ems.service.impl; 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.common.utils.StringUtils;
import com.xzzn.ems.domain.EmsBatteryData; import com.xzzn.ems.domain.*;
import com.xzzn.ems.domain.EmsCoolingData;
import com.xzzn.ems.domain.vo.*; import com.xzzn.ems.domain.vo.*;
import com.xzzn.ems.mapper.*; import com.xzzn.ems.mapper.*;
import com.xzzn.ems.service.ISingleSiteService; import com.xzzn.ems.service.ISingleSiteService;
import org.springframework.beans.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import org.springframework.util.CollectionUtils; import org.springframework.util.CollectionUtils;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.util.*; import java.util.*;
import java.util.stream.Collectors;
/** /**
* 单点监控 服务层实现 * 单点监控 服务层实现
@ -26,6 +29,10 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
private static final String CLUSTER_DATA_SOC = "SOC"; 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 @Autowired
private EmsPcsDataMapper emsPcsDataMapper; private EmsPcsDataMapper emsPcsDataMapper;
@Autowired @Autowired
@ -45,45 +52,41 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
@Autowired @Autowired
private EmsDevicesSettingMapper emsDevicesSettingMapper; private EmsDevicesSettingMapper emsDevicesSettingMapper;
@Autowired
private RedisCache redisCache;
@Override @Override
public SiteMonitorHomeVo getSiteMonitorDataVo(String siteId) { public SiteMonitorHomeVo getSiteMonitorDataVo(String siteId) {
SiteMonitorHomeVo siteMonitorHomeVo = new SiteMonitorHomeVo(); SiteMonitorHomeVo siteMonitorHomeVo = new SiteMonitorHomeVo();
if (!StringUtils.isEmpty(siteId)) { if (!StringUtils.isEmpty(siteId)) {
// 获取单站点的总充+总放+电网实时功率
Map<String,BigDecimal> pcsMap = emsPcsDataMapper.getPcsTotalChargeData(siteId);
if (pcsMap != null) {
siteMonitorHomeVo.setTotalChargedCap(pcsMap.get("totalChargedCap"));
siteMonitorHomeVo.setTotalDischargedCap(pcsMap.get("totalDischargedCap"));
siteMonitorHomeVo.setGridNrtPower(pcsMap.get("gridNrtPower"));
}
// 实时告警数据 名称+状态+告警内容 // 实时告警数据 名称+状态+告警内容
List<SiteMonitorHomeAlarmVo> siteMonitorHomeAlarmVo = emsAlarmRecordsMapper.getAlarmRecordsBySiteId(siteId); List<SiteMonitorHomeAlarmVo> siteMonitorHomeAlarmVo = emsAlarmRecordsMapper.getAlarmRecordsBySiteId(siteId);
siteMonitorHomeVo.setSiteMonitorHomeAlarmVo(siteMonitorHomeAlarmVo); siteMonitorHomeVo.setSiteMonitorHomeAlarmVo(siteMonitorHomeAlarmVo);
// 能量数据 // 能量数据
List<SiteMonitorDataVo> siteMonitorDataVoList = emsPcsDataMapper.getPcsDataBySiteId(siteId); List<SiteMonitorDataVo> siteMonitorDataVoList = emsPcsDataMapper.getPcsDataBySiteId(siteId,6);
if (!CollectionUtils.isEmpty(siteMonitorDataVoList)) { if (!CollectionUtils.isEmpty(siteMonitorDataVoList)) {
BigDecimal dayChargeCap = new BigDecimal(0);
BigDecimal dayDisChargeCap = new BigDecimal(0);
BigDecimal totalChargeCap = new BigDecimal(0);
BigDecimal totalDisChargeCap = new BigDecimal(0);
for (SiteMonitorDataVo sitePcsData : siteMonitorDataVoList) { for (SiteMonitorDataVo sitePcsData : siteMonitorDataVoList) {
// 总充电量
totalChargeCap = totalChargeCap.add(sitePcsData.getChargedCap());
// 总放电量
totalDisChargeCap = totalDisChargeCap.add(sitePcsData.getDisChargedCap());
// 获取当天的充电量+放电量 // 获取当天的充电量+放电量
String pcsDate = sitePcsData.getAmmeterDate(); String pcsDate = sitePcsData.getAmmeterDate();
boolean isToday= checkIsToday(pcsDate); boolean isToday= checkIsToday(pcsDate);
if(isToday){ if(isToday){
dayChargeCap = dayChargeCap.add(sitePcsData.getChargedCap()); siteMonitorHomeVo.setDayChargedCap(sitePcsData.getChargedCap());
dayDisChargeCap = dayDisChargeCap.add(sitePcsData.getDisChargedCap()); siteMonitorHomeVo.setDayDisChargedCap(sitePcsData.getDisChargedCap());
} }
} }
siteMonitorHomeVo.setDayChargedCap(dayChargeCap);
siteMonitorHomeVo.setDayDisChargedCap(dayDisChargeCap);
siteMonitorHomeVo.setTotalChargedCap(totalChargeCap);
siteMonitorHomeVo.setTotalDischargedCap(totalDisChargeCap);
// 储能可用电量 // 储能可用电量
BigDecimal energyStorageAvailElec = siteMonitorHomeVo.getTotalDischargedCap().subtract(siteMonitorHomeVo.getTotalChargedCap()); BigDecimal energyStorageAvailElec = siteMonitorHomeVo.getTotalDischargedCap().subtract(siteMonitorHomeVo.getTotalChargedCap());
siteMonitorHomeVo.setEnergyStorageAvailElec(energyStorageAvailElec); siteMonitorHomeVo.setEnergyStorageAvailElec(energyStorageAvailElec);
} }
siteMonitorHomeVo.setSiteMonitorDataVo(siteMonitorDataVoList); siteMonitorHomeVo.setSiteMonitorDataVo(siteMonitorDataVoList);
// 电网实时功率
siteMonitorHomeVo.setGridNrtPower(emsPcsDataMapper.getGridNrtPower(siteId));
} }
return siteMonitorHomeVo; return siteMonitorHomeVo;
@ -143,114 +146,147 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
List<PcsDetailInfoVo> pcsDetailInfoVoList = new ArrayList<>(); List<PcsDetailInfoVo> pcsDetailInfoVoList = new ArrayList<>();
if (!StringUtils.isEmpty(siteId)) { if (!StringUtils.isEmpty(siteId)) {
// 获取pcs最新数据 // 获取该设备下所有pcs的id
pcsDetailInfoVoList = emsPcsDataMapper.getPcsDetailInfoBySiteId(siteId); List<Map<String, Object>> pcsIds = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.PCS.getCode());
if (!CollectionUtils.isEmpty(pcsDetailInfoVoList)) {
for (PcsDetailInfoVo pcsDetailInfoVo : pcsDetailInfoVoList) { for (Map<String, Object> pcsDevice : pcsIds) {
String deviceId = pcsDetailInfoVo.getDeviceId(); PcsDetailInfoVo pcsDetailInfoVo = new PcsDetailInfoVo();
// 获取支路最新数据 pcsDetailInfoVo.setDeviceName(pcsDevice.get("deviceName").toString());
if (!StringUtils.isEmpty(deviceId)) { pcsDetailInfoVo.setCommunicationStatus(pcsDevice.get("communicationStatus").toString());
List<PcsBranchInfo> pcsBranchInfoList = emsPcsBranchDataMapper.getPcsBranchInfoList(siteId, deviceId); // 从redis取pcs单个详细数据
pcsDetailInfoVo.setPcsBranchInfoList(pcsBranchInfoList); 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; 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总览数据 // 获取BMS总览数据
@Override @Override
public List<BMSOverViewVo> getBMSOverView(String siteId) { public List<BMSOverViewVo> getBMSOverView(String siteId) {
List<BMSOverViewVo> bmsOverViewVoList = new ArrayList<>(); List<BMSOverViewVo> bmsOverViewVoList = new ArrayList<>();
// 获取所有电池堆
if (!StringUtils.isEmpty(siteId)) { if (!StringUtils.isEmpty(siteId)) {
// 获取电池堆list List<Map<String, Object>> stackIds = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.STACK.getCode());
bmsOverViewVoList = emsBatteryStackMapper.selectEmsBatteryStackBySiteId(siteId); for (Map<String, Object> stackDevice : stackIds) {
if (!CollectionUtils.isEmpty(bmsOverViewVoList)) { BMSOverViewVo bmsOverViewVo = new BMSOverViewVo();
for (BMSOverViewVo bmsOverViewVo : bmsOverViewVoList) { bmsOverViewVo.setDeviceName(stackDevice.get("deviceName").toString());
// 获取单体电池数据-待确认 // 从redis取堆单个详细数据
String stackDeviceId = bmsOverViewVo.getDeviceId(); String stackId = stackDevice.get("id").toString();
if (!StringUtils.isEmpty(stackDeviceId)) { EmsBatteryStack stackData = redisCache.getCacheObject(RedisKeyConstants.STACK +siteId+"_"+stackId);
List<BMSBatteryDataList> batteryDataList = new ArrayList<>(); if (stackData != null) {
batteryDataList = emsBatteryClusterMapper.getBmsBatteryData(siteId,stackDeviceId); BeanUtils.copyProperties(stackData, bmsOverViewVo);
bmsOverViewVo.setBatteryDataList(batteryDataList);
}
} }
// 下面簇列表数据
if (!StringUtils.isEmpty(stackId)) {
getBMSClusterListInfo(siteId,stackId,bmsOverViewVo);
}
bmsOverViewVoList.add(bmsOverViewVo);
} }
} }
return bmsOverViewVoList; 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电池簇数据 // 获取BMS电池簇数据
@Override @Override
public List<BMSBatteryClusterVo> getBMSBatteryCluster(String siteId) { public List<BMSBatteryClusterVo> getBMSBatteryCluster(String siteId) {
List<BMSBatteryClusterVo> bmsBatteryClusterVoList = new ArrayList<>(); List<BMSBatteryClusterVo> bmsBatteryClusterVoList = new ArrayList<>();
if (!StringUtils.isEmpty(siteId)) { if (!StringUtils.isEmpty(siteId)) {
bmsBatteryClusterVoList = emsBatteryClusterMapper.getBMSBatteryCluster(siteId); // 获取所有设备下的电池簇id
if (!CollectionUtils.isEmpty(bmsBatteryClusterVoList)) { List<Map<String, Object>> clusterIds = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.CLUSTER.getCode());
for (BMSBatteryClusterVo bmsBatteryClusterVo : bmsBatteryClusterVoList) { for (Map<String, Object> clusterDevice : clusterIds) {
BMSBatteryClusterVo bmsBatteryClusterVo = new BMSBatteryClusterVo();
String clusterDeviceId = bmsBatteryClusterVo.getDeviceId(); 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<>(); List<BMSBatteryClusterDataList> clusterDataList = new ArrayList<>();
if (!StringUtils.isEmpty(clusterDeviceId)) { dealWithBatteryClusterData(clusterData,clusterDataList);
// 获取单体电池数据-平均/最大/最小 bmsBatteryClusterVo.setBatteryDataList(clusterDataList);
BatteryClusterDataDetailVo batteryClusterDataDetailVo = emsBatteryDataMapper.getBatteryDataByClusterId(siteId,clusterDeviceId);
// 处理数据
if (batteryClusterDataDetailVo != null) {
BMSBatteryClusterDataList voltageData = new BMSBatteryClusterDataList();
BMSBatteryClusterDataList tempData = new BMSBatteryClusterDataList();
BMSBatteryClusterDataList socData = new BMSBatteryClusterDataList();
// 设值
voltageData.setDataName(CLUSTER_DATA_VOLTAGE);
voltageData.setAvgData(batteryClusterDataDetailVo.getAvgVoltage());
voltageData.setMaxData(batteryClusterDataDetailVo.getMaxVoltage());
voltageData.setMinData(batteryClusterDataDetailVo.getMinVoltage());
tempData.setDataName(CLUSTER_DATA_TEP);
tempData.setAvgData(batteryClusterDataDetailVo.getAvgTemp());
tempData.setMaxData(batteryClusterDataDetailVo.getMaxTemp());
tempData.setMinData(batteryClusterDataDetailVo.getMinTemp());
socData.setDataName(CLUSTER_DATA_SOC);
socData.setAvgData(batteryClusterDataDetailVo.getAvgSoc());
socData.setMaxData(batteryClusterDataDetailVo.getMaxSoc());
socData.setMinData(batteryClusterDataDetailVo.getMinSoc());
// 设置对应单体id
List<Map<String,Object>> dataIdMapList = emsBatteryDataMapper.getDataIdsMap(batteryClusterDataDetailVo);
Map<String,String> resultIdMap = new HashMap<>();
if (!CollectionUtils.isEmpty(dataIdMapList)) {
resultIdMap = dataIdMapList.stream()
.filter(map -> map.containsKey("type") && map.containsKey("device_id")) // 过滤无效数据
.filter(map -> map.get("type") instanceof String && map.get("device_id") instanceof Number) // 确保类型正确
.collect(Collectors.toMap(
map -> (String) map.get("type"), // 键type 字段
map -> (String) map.get("device_id"), // 值device_id 转为 int
(existing, replacement) -> existing // 处理键冲突的策略
));
// 电压
voltageData.setMaxDataID(resultIdMap.get("maxVoltageId"));
voltageData.setMaxDataID(resultIdMap.get("maxVoltageId"));
// 温度
tempData.setMaxDataID(resultIdMap.get("maxTempId"));
tempData.setMinDataID(resultIdMap.get("minTempId"));
// soc
socData.setMaxDataID(resultIdMap.get("maxSocId"));
socData.setMinDataID(resultIdMap.get("minSocId"));
}
clusterDataList.add(voltageData);
clusterDataList.add(tempData);
clusterDataList.add(socData);
}
bmsBatteryClusterVo.setBatteryDataList(clusterDataList);
}
} }
bmsBatteryClusterVoList.add(bmsBatteryClusterVo);
} }
} }
return bmsBatteryClusterVoList; 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 @Override
public List<EmsCoolingData> getCoolingDataList(String siteId) { public List<EmsCoolingData> getCoolingDataList(String siteId) {
@ -263,14 +299,33 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
/** /**
* 根据电池堆获取单体柱状数据 * 根据电池堆获取单体电池数据
* @param clusterDeviceId * @param clusterDeviceId
* @return * @return
*/ */
@Override @Override
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId) { public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId,String siteId) {
List<BatteryDataStatsListVo> batteryDataStatsListVo = new ArrayList<>(); 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; return batteryDataStatsListVo;
} }
@ -280,23 +335,96 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
* @return * @return
*/ */
@Override @Override
public List<AmmeterDataVo> getAmmeterDataList(String siteId) { public AmmeterDataResponse getAmmeterDataList(String siteId) {
List<AmmeterDataVo> ammeterDataVos = new ArrayList<>(); AmmeterDataResponse ammeterResponse = new AmmeterDataResponse();
AmmeterDataVo ammeterDataVo = new AmmeterDataVo();
if (!StringUtils.isEmpty(siteId)) { if (!StringUtils.isEmpty(siteId)) {
List<AmmeterDataDetailInfo> ammeterDataDetailInfos = emsAmmeterDataMapper.getAmmeterDetailInfo(siteId); // 先获取电表设备
ammeterDataVo.setAmmeterDataDetailInfos(ammeterDataDetailInfos); List<Map<String, Object>> ammeterIdList = emsDevicesSettingMapper.getDeviceInfosBySiteIdAndCategory(siteId, DeviceCategory.AMMETER.getCode());
if (!CollectionUtils.isEmpty(ammeterDataDetailInfos)) {
// 获取通信状态 for (Map<String, Object> ammeterDevice : ammeterIdList) {
String deviceId = ammeterDataDetailInfos.get(0).getDeviceId(); String ammeterId = ammeterDevice.get("id").toString();
Map<String,Object> map = emsDevicesSettingMapper.getDeviceStatus(deviceId); // 从redis取总表详细数据
ammeterDataVo.setEmsCommunicationStatus(map.get("communication_status").toString()); EmsAmmeterData ammeterData = redisCache.getCacheObject(RedisKeyConstants.AMMETER + siteId + "_" +ammeterId);
// 数据更新时间 // 判断电表类型
ammeterDataVo.setDataUpdateTime(ammeterDataDetailInfos.get(0).getUpdateTime()); 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);
}
} }
} }
ammeterDataVos.add(ammeterDataVo); return ammeterResponse;
return ammeterDataVos; }
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

@ -132,4 +132,22 @@
from ems_alarm_records from ems_alarm_records
group by device_type group by device_type
</select> </select>
<select id="getAlarmRecordDetailList" parameterType="AlarmRecordListRequestVo" resultType="com.xzzn.ems.domain.vo.AlarmRecordListResponseVo">
select t.device_name as deviceName,t.alarm_level as alarmLevel,
t.alarm_content as alarmContent,t.status as status,
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 != ''">
AND t.device_type = #{deviceType}
</if>
<if test="alarmLevel != null and alarmLevel != ''">
AND t.alarm_level = #{alarmLevel}
</if>
<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> </mapper>

View File

@ -7,37 +7,211 @@
<resultMap type="EmsAmmeterData" id="EmsAmmeterDataResult"> <resultMap type="EmsAmmeterData" id="EmsAmmeterDataResult">
<result property="id" column="id" /> <result property="id" column="id" />
<result property="dataUpdateTime" column="data_update_time" /> <result property="dataUpdateTime" column="data_update_time" />
<result property="category" column="category" /> <result property="currentCombActiveTotal" column="current_comb_active_total" />
<result property="totalKwh" column="total_kwh" /> <result property="currentCombActivePeak" column="current_comb_active_peak" />
<result property="sharpKwh" column="sharp_kwh" /> <result property="currentCombActiveHigh" column="current_comb_active_high" />
<result property="peakKwh" column="peak_kwh" /> <result property="currentCombActiveFlat" column="current_comb_active_flat" />
<result property="flatKwh" column="flat_kwh" /> <result property="currentCombActiveValley" column="current_comb_active_valley" />
<result property="valleyKwh" column="valley_kwh" /> <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="createBy" column="create_by" />
<result property="createTime" column="create_time" /> <result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" /> <result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" /> <result property="updateTime" column="update_time" />
<result property="remark" column="remark" /> <result property="remark" column="remark" />
<result property="siteId" column="site_id" /> <result property="secondaryAbLineVoltage" column="secondary_ab_line_voltage" />
<result property="deviceId" column="device_id" /> <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> </resultMap>
<sql id="selectEmsAmmeterDataVo"> <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> </sql>
<select id="selectEmsAmmeterDataList" parameterType="EmsAmmeterData" resultMap="EmsAmmeterDataResult"> <select id="selectEmsAmmeterDataList" parameterType="EmsAmmeterData" resultMap="EmsAmmeterDataResult">
<include refid="selectEmsAmmeterDataVo"/> <include refid="selectEmsAmmeterDataVo"/>
<where> <where>
<if test="dataUpdateTime != null "> and data_update_time = #{dataUpdateTime}</if> <if test="dataUpdateTime != null "> and data_update_time = #{dataUpdateTime}</if>
<if test="category != null and category != ''"> and category = #{category}</if> <if test="currentCombActiveTotal != null "> and current_comb_active_total = #{currentCombActiveTotal}</if>
<if test="totalKwh != null "> and total_kwh = #{totalKwh}</if> <if test="currentCombActivePeak != null "> and current_comb_active_peak = #{currentCombActivePeak}</if>
<if test="sharpKwh != null "> and sharp_kwh = #{sharpKwh}</if> <if test="currentCombActiveHigh != null "> and current_comb_active_high = #{currentCombActiveHigh}</if>
<if test="peakKwh != null "> and peak_kwh = #{peakKwh}</if> <if test="currentCombActiveFlat != null "> and current_comb_active_flat = #{currentCombActiveFlat}</if>
<if test="flatKwh != null "> and flat_kwh = #{flatKwh}</if> <if test="currentCombActiveValley != null "> and current_comb_active_valley = #{currentCombActiveValley}</if>
<if test="valleyKwh != null "> and valley_kwh = #{valleyKwh}</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="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</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> </where>
</select> </select>
@ -50,35 +224,209 @@
insert into ems_ammeter_data insert into ems_ammeter_data
<trim prefix="(" suffix=")" suffixOverrides=","> <trim prefix="(" suffix=")" suffixOverrides=",">
<if test="dataUpdateTime != null">data_update_time,</if> <if test="dataUpdateTime != null">data_update_time,</if>
<if test="category != null">category,</if> <if test="currentCombActiveTotal != null">current_comb_active_total,</if>
<if test="totalKwh != null">total_kwh,</if> <if test="currentCombActivePeak != null">current_comb_active_peak,</if>
<if test="sharpKwh != null">sharp_kwh,</if> <if test="currentCombActiveHigh != null">current_comb_active_high,</if>
<if test="peakKwh != null">peak_kwh,</if> <if test="currentCombActiveFlat != null">current_comb_active_flat,</if>
<if test="flatKwh != null">flat_kwh,</if> <if test="currentCombActiveValley != null">current_comb_active_valley,</if>
<if test="valleyKwh != null">valley_kwh,</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="createBy != null">create_by,</if>
<if test="createTime != null">create_time,</if> <if test="createTime != null">create_time,</if>
<if test="updateBy != null">update_by,</if> <if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if> <if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if> <if test="remark != null">remark,</if>
<if test="siteId != null">site_id,</if> <if test="secondaryAbLineVoltage != null">secondary_ab_line_voltage,</if>
<if test="deviceId != null and deviceId != ''">device_id,</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>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dataUpdateTime != null">#{dataUpdateTime},</if> <if test="dataUpdateTime != null">#{dataUpdateTime},</if>
<if test="category != null">#{category},</if> <if test="currentCombActiveTotal != null">#{currentCombActiveTotal},</if>
<if test="totalKwh != null">#{totalKwh},</if> <if test="currentCombActivePeak != null">#{currentCombActivePeak},</if>
<if test="sharpKwh != null">#{sharpKwh},</if> <if test="currentCombActiveHigh != null">#{currentCombActiveHigh},</if>
<if test="peakKwh != null">#{peakKwh},</if> <if test="currentCombActiveFlat != null">#{currentCombActiveFlat},</if>
<if test="flatKwh != null">#{flatKwh},</if> <if test="currentCombActiveValley != null">#{currentCombActiveValley},</if>
<if test="valleyKwh != null">#{valleyKwh},</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="createBy != null">#{createBy},</if>
<if test="createTime != null">#{createTime},</if> <if test="createTime != null">#{createTime},</if>
<if test="updateBy != null">#{updateBy},</if> <if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if> <if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if> <if test="remark != null">#{remark},</if>
<if test="siteId != null">#{siteId},</if> <if test="secondaryAbLineVoltage != null">#{secondaryAbLineVoltage},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</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> </trim>
</insert> </insert>
@ -86,19 +434,106 @@
update ems_ammeter_data update ems_ammeter_data
<trim prefix="SET" suffixOverrides=","> <trim prefix="SET" suffixOverrides=",">
<if test="dataUpdateTime != null">data_update_time = #{dataUpdateTime},</if> <if test="dataUpdateTime != null">data_update_time = #{dataUpdateTime},</if>
<if test="category != null">category = #{category},</if> <if test="currentCombActiveTotal != null">current_comb_active_total = #{currentCombActiveTotal},</if>
<if test="totalKwh != null">total_kwh = #{totalKwh},</if> <if test="currentCombActivePeak != null">current_comb_active_peak = #{currentCombActivePeak},</if>
<if test="sharpKwh != null">sharp_kwh = #{sharpKwh},</if> <if test="currentCombActiveHigh != null">current_comb_active_high = #{currentCombActiveHigh},</if>
<if test="peakKwh != null">peak_kwh = #{peakKwh},</if> <if test="currentCombActiveFlat != null">current_comb_active_flat = #{currentCombActiveFlat},</if>
<if test="flatKwh != null">flat_kwh = #{flatKwh},</if> <if test="currentCombActiveValley != null">current_comb_active_valley = #{currentCombActiveValley},</if>
<if test="valleyKwh != null">valley_kwh = #{valleyKwh},</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="createBy != null">create_by = #{createBy},</if>
<if test="createTime != null">create_time = #{createTime},</if> <if test="createTime != null">create_time = #{createTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if> <if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if> <if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if> <if test="remark != null">remark = #{remark},</if>
<if test="siteId != null">site_id = #{siteId},</if> <if test="secondaryAbLineVoltage != null">secondary_ab_line_voltage = #{secondaryAbLineVoltage},</if>
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</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> </trim>
where id = #{id} where id = #{id}
</update> </update>
@ -114,19 +549,4 @@
</foreach> </foreach>
</delete> </delete>
<select id="getAmmeterDetailInfo" parameterType="String" 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.valley_kwh as valleyKwh,
t.device_id as deviceId,
Max(t.data_update_time) as updateTime
from ems_ammeter_data t
where t.site_id = #{siteId}
and t.data_update_time = (select MAX(tmp.data_update_time) from ems_ammeter_data tmp where tmp.site_id = t.site_id and tmp.device_id = t.device_id)
group by t.category,t.total_kwh,t.flat_kwh,t.peak_kwh,t.valley_kwh,t.device_id
order by updateTime desc
</select>
</mapper> </mapper>

View File

@ -309,29 +309,20 @@
</foreach> </foreach>
</delete> </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
from ems_battery_cluster tmp left join ems_devices_setting td on tmp.device_id = td.id and tmp.site_id = td.site_id
where tmp.site_id = #{siteId}
and tmp.update_time = (select MAX(t.update_time) FROM ems_battery_cluster t where t.site_id = tmp.site_id
and t.device_id = tmp.device_id)
order by tmp.device_id
</select>
<select id="getBmsBatteryData" resultType="com.xzzn.ems.domain.vo.BMSBatteryDataList"> <select id="getBmsBatteryData" resultType="com.xzzn.ems.domain.vo.BMSBatteryDataList">
select t.cluster_voltage as clusterVoltage,t.cluster_current as clusterCurrent, SELECT t.cluster_voltage as clusterVoltage,t.cluster_current as clusterCurrent,
t.current_soc as currentSoc,MAX(tb.voltage) as maxVoltage,MIN(tb.voltage) as minVoltage, t.current_soc as currentSoc,t.site_id as siteId,t.device_id as clusterId,
MAX(tb.temperature) as maxTemperature,MIN(tb.temperature) as minTemperature, t.max_cell_voltage as maxVoltage,t.min_cell_voltage as minVoltage,
tb.site_id as siteId,tb.cluster_device_id as clusterId,tb.device_id as stackDeviceId t.max_cell_temp as maxTemperature,t.min_cell_temp as minTemperature
from ems_battery_cluster t left join ems_battery_data tb on t.device_id = tb.cluster_device_id FROM ems_battery_cluster t
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} and p.stack_device_id = #{stackDeviceId}
GROUP BY p.site_id,p.device_id
) latest on t.device_id = latest.device_id and t.update_time = latest.max_update_time
where t.site_id = #{siteId} and t.stack_device_id = #{stackDeviceId} where t.site_id = #{siteId} and t.stack_device_id = #{stackDeviceId}
and t.update_time = (select MAX(update_time) FROM ems_battery_cluster where site_id = t.site_id group by t.cluster_voltage,t.cluster_current,t.current_soc,t.site_id,t.device_id,t.max_cell_voltage,t.min_cell_voltage,
and device_id = t.device_id and stack_device_id = t.stack_device_id) t.max_cell_temp,t.min_cell_temp
group by t.cluster_voltage,t.cluster_current,t.current_soc,tb.site_id,tb.cluster_device_id,tb.device_id
</select> </select>
</mapper> </mapper>

View File

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

View File

@ -9,59 +9,53 @@
<result property="workStatus" column="work_status" /> <result property="workStatus" column="work_status" />
<result property="pcsCommunicationStatus" column="pcs_communication_status" /> <result property="pcsCommunicationStatus" column="pcs_communication_status" />
<result property="emsCommunicationStatus" column="ems_communication_status" /> <result property="emsCommunicationStatus" column="ems_communication_status" />
<result property="totalVoltage" column="total_voltage" /> <result property="operationStatus" column="operation_status" />
<result property="chargeableCapacity" column="chargeable_capacity" /> <result property="stackVoltage" column="stack_voltage" />
<result property="totalChargedCapacity" column="total_charged_capacity" /> <result property="stackCurrent" column="stack_current" />
<result property="totalCurrent" column="total_current" /> <result property="stackSoc" column="stack_soc" />
<result property="dischargeableCapacity" column="dischargeable_capacity" /> <result property="stackSoh" column="stack_soh" />
<result property="totalDischargedCapacity" column="total_discharged_capacity" /> <result property="maxCellVoltage" column="max_cell_voltage" />
<result property="soh" column="soh" /> <result property="maxVoltageGroupId" column="max_voltage_group_id" />
<result property="averageTemperature" column="average_temperature" /> <result property="maxVoltageCellId" column="max_voltage_cell_id" />
<result property="insulationResistance" column="insulation_resistance" /> <result property="minCellVoltage" column="min_cell_voltage" />
<result property="currentSoc" column="current_soc" /> <result property="minVoltageGroupId" column="min_voltage_group_id" />
<result property="createBy" column="create_by" /> <result property="minVoltageCellId" column="min_voltage_cell_id" />
<result property="createTime" column="create_time" /> <result property="maxCellTemp" column="max_cell_temp" />
<result property="updateBy" column="update_by" /> <result property="maxTempGroupId" column="max_temp_group_id" />
<result property="updateTime" column="update_time" /> <result property="maxTempCellId" column="max_temp_cell_id" />
<result property="remark" column="remark" /> <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="siteId" column="site_id" />
<result property="deviceId" column="device_id" /> <result property="deviceId" column="device_id" />
<result property="maxAllowedChargePower" column="max_allowed_charge_power" /> <result property="createTime" column="create_time" />
<result property="maxAllowedDischargePower" column="max_allowed_discharge_power" /> <result property="createBy" column="create_by" />
<result property="maxAllowedChargeVoltage" column="max_allowed_charge_voltage" /> <result property="updateTime" column="update_time" />
<result property="maxAllowedDischargeVoltage" column="max_allowed_discharge_voltage" /> <result property="updateBy" column="update_by" />
<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" />
</resultMap> </resultMap>
<sql id="selectEmsBatteryStackVo"> <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> </sql>
<select id="selectEmsBatteryStackList" parameterType="EmsBatteryStack" resultMap="EmsBatteryStackResult"> <select id="selectEmsBatteryStackList" parameterType="EmsBatteryStack" resultMap="EmsBatteryStackResult">
@ -70,50 +64,45 @@
<if test="workStatus != null and workStatus != ''"> and work_status = #{workStatus}</if> <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="pcsCommunicationStatus != null and pcsCommunicationStatus != ''"> and pcs_communication_status = #{pcsCommunicationStatus}</if>
<if test="emsCommunicationStatus != null and emsCommunicationStatus != ''"> and ems_communication_status = #{emsCommunicationStatus}</if> <if test="emsCommunicationStatus != null and emsCommunicationStatus != ''"> and ems_communication_status = #{emsCommunicationStatus}</if>
<if test="totalVoltage != null "> and total_voltage = #{totalVoltage}</if> <if test="operationStatus != null and operationStatus != ''"> and operation_status = #{operationStatus}</if>
<if test="chargeableCapacity != null "> and chargeable_capacity = #{chargeableCapacity}</if> <if test="stackVoltage != null "> and stack_voltage = #{stackVoltage}</if>
<if test="totalChargedCapacity != null "> and total_charged_capacity = #{totalChargedCapacity}</if> <if test="stackCurrent != null "> and stack_current = #{stackCurrent}</if>
<if test="totalCurrent != null "> and total_current = #{totalCurrent}</if> <if test="stackSoc != null "> and stack_soc = #{stackSoc}</if>
<if test="dischargeableCapacity != null "> and dischargeable_capacity = #{dischargeableCapacity}</if> <if test="stackSoh != null "> and stack_soh = #{stackSoh}</if>
<if test="totalDischargedCapacity != null "> and total_discharged_capacity = #{totalDischargedCapacity}</if> <if test="maxCellVoltage != null "> and max_cell_voltage = #{maxCellVoltage}</if>
<if test="soh != null "> and soh = #{soh}</if> <if test="maxVoltageGroupId != null "> and max_voltage_group_id = #{maxVoltageGroupId}</if>
<if test="averageTemperature != null "> and average_temperature = #{averageTemperature}</if> <if test="maxVoltageCellId != null "> and max_voltage_cell_id = #{maxVoltageCellId}</if>
<if test="insulationResistance != null "> and insulation_resistance = #{insulationResistance}</if> <if test="minCellVoltage != null "> and min_cell_voltage = #{minCellVoltage}</if>
<if test="currentSoc != null "> and current_soc = #{currentSoc}</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="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</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> </where>
</select> </select>
@ -128,109 +117,97 @@
<if test="workStatus != null">work_status,</if> <if test="workStatus != null">work_status,</if>
<if test="pcsCommunicationStatus != null">pcs_communication_status,</if> <if test="pcsCommunicationStatus != null">pcs_communication_status,</if>
<if test="emsCommunicationStatus != null">ems_communication_status,</if> <if test="emsCommunicationStatus != null">ems_communication_status,</if>
<if test="totalVoltage != null">total_voltage,</if> <if test="operationStatus != null">operation_status,</if>
<if test="chargeableCapacity != null">chargeable_capacity,</if> <if test="stackVoltage != null">stack_voltage,</if>
<if test="totalChargedCapacity != null">total_charged_capacity,</if> <if test="stackCurrent != null">stack_current,</if>
<if test="totalCurrent != null">total_current,</if> <if test="stackSoc != null">stack_soc,</if>
<if test="dischargeableCapacity != null">dischargeable_capacity,</if> <if test="stackSoh != null">stack_soh,</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="maxCellVoltage != null">max_cell_voltage,</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="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="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="minCellTemp != null">min_cell_temp,</if>
<if test="minCellTempId != null">min_cell_temp_id,</if> <if test="minTempGroupId != null">min_temp_group_id,</if>
<if test="maxCellSoc != null">max_cell_soc,</if> <if test="minTempCellId != null">min_temp_cell_id,</if>
<if test="maxCellSocId != null">max_cell_soc_id,</if> <if test="totalChargeCapacity != null">total_charge_capacity,</if>
<if test="minCellSoc != null">min_cell_soc,</if> <if test="totalDischargeCapacity != null">total_discharge_capacity,</if>
<if test="minCellSocId != null">min_cell_soc_id,</if> <if test="sessionChargeCapacity != null">session_charge_capacity,</if>
<if test="maxCellSoh != null">max_cell_soh,</if> <if test="sessionDischargeCapacity != null">session_discharge_capacity,</if>
<if test="maxCellSohId != null">max_cell_soh_id,</if> <if test="availableChargeCapacity != null">available_charge_capacity,</if>
<if test="minCellSoh != null">min_cell_soh,</if> <if test="availableDischargeCapacity != null">available_discharge_capacity,</if>
<if test="minCellSohId != null">min_cell_soh_id,</if> <if test="remainingDischargeTime != null">remaining_discharge_time,</if>
<if test="totalChargeEnergy != null">total_charge_energy,</if> <if test="remainingChargeTime != null">remaining_charge_time,</if>
<if test="totalDischargeEnergy != null">total_discharge_energy,</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>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workStatus != null">#{workStatus},</if> <if test="workStatus != null">#{workStatus},</if>
<if test="pcsCommunicationStatus != null">#{pcsCommunicationStatus},</if> <if test="pcsCommunicationStatus != null">#{pcsCommunicationStatus},</if>
<if test="emsCommunicationStatus != null">#{emsCommunicationStatus},</if> <if test="emsCommunicationStatus != null">#{emsCommunicationStatus},</if>
<if test="totalVoltage != null">#{totalVoltage},</if> <if test="operationStatus != null">#{operationStatus},</if>
<if test="chargeableCapacity != null">#{chargeableCapacity},</if> <if test="stackVoltage != null">#{stackVoltage},</if>
<if test="totalChargedCapacity != null">#{totalChargedCapacity},</if> <if test="stackCurrent != null">#{stackCurrent},</if>
<if test="totalCurrent != null">#{totalCurrent},</if> <if test="stackSoc != null">#{stackSoc},</if>
<if test="dischargeableCapacity != null">#{dischargeableCapacity},</if> <if test="stackSoh != null">#{stackSoh},</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="maxCellVoltage != null">#{maxCellVoltage},</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="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="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="minCellTemp != null">#{minCellTemp},</if>
<if test="minCellTempId != null">#{minCellTempId},</if> <if test="minTempGroupId != null">#{minTempGroupId},</if>
<if test="maxCellSoc != null">#{maxCellSoc},</if> <if test="minTempCellId != null">#{minTempCellId},</if>
<if test="maxCellSocId != null">#{maxCellSocId},</if> <if test="totalChargeCapacity != null">#{totalChargeCapacity},</if>
<if test="minCellSoc != null">#{minCellSoc},</if> <if test="totalDischargeCapacity != null">#{totalDischargeCapacity},</if>
<if test="minCellSocId != null">#{minCellSocId},</if> <if test="sessionChargeCapacity != null">#{sessionChargeCapacity},</if>
<if test="maxCellSoh != null">#{maxCellSoh},</if> <if test="sessionDischargeCapacity != null">#{sessionDischargeCapacity},</if>
<if test="maxCellSohId != null">#{maxCellSohId},</if> <if test="availableChargeCapacity != null">#{availableChargeCapacity},</if>
<if test="minCellSoh != null">#{minCellSoh},</if> <if test="availableDischargeCapacity != null">#{availableDischargeCapacity},</if>
<if test="minCellSohId != null">#{minCellSohId},</if> <if test="remainingDischargeTime != null">#{remainingDischargeTime},</if>
<if test="totalChargeEnergy != null">#{totalChargeEnergy},</if> <if test="remainingChargeTime != null">#{remainingChargeTime},</if>
<if test="totalDischargeEnergy != null">#{totalDischargeEnergy},</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> </trim>
</insert> </insert>
@ -240,55 +217,49 @@
<if test="workStatus != null">work_status = #{workStatus},</if> <if test="workStatus != null">work_status = #{workStatus},</if>
<if test="pcsCommunicationStatus != null">pcs_communication_status = #{pcsCommunicationStatus},</if> <if test="pcsCommunicationStatus != null">pcs_communication_status = #{pcsCommunicationStatus},</if>
<if test="emsCommunicationStatus != null">ems_communication_status = #{emsCommunicationStatus},</if> <if test="emsCommunicationStatus != null">ems_communication_status = #{emsCommunicationStatus},</if>
<if test="totalVoltage != null">total_voltage = #{totalVoltage},</if> <if test="operationStatus != null">operation_status = #{operationStatus},</if>
<if test="chargeableCapacity != null">chargeable_capacity = #{chargeableCapacity},</if> <if test="stackVoltage != null">stack_voltage = #{stackVoltage},</if>
<if test="totalChargedCapacity != null">total_charged_capacity = #{totalChargedCapacity},</if> <if test="stackCurrent != null">stack_current = #{stackCurrent},</if>
<if test="totalCurrent != null">total_current = #{totalCurrent},</if> <if test="stackSoc != null">stack_soc = #{stackSoc},</if>
<if test="dischargeableCapacity != null">dischargeable_capacity = #{dischargeableCapacity},</if> <if test="stackSoh != null">stack_soh = #{stackSoh},</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="maxCellVoltage != null">max_cell_voltage = #{maxCellVoltage},</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="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="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="minCellTemp != null">min_cell_temp = #{minCellTemp},</if>
<if test="minCellTempId != null">min_cell_temp_id = #{minCellTempId},</if> <if test="minTempGroupId != null">min_temp_group_id = #{minTempGroupId},</if>
<if test="maxCellSoc != null">max_cell_soc = #{maxCellSoc},</if> <if test="minTempCellId != null">min_temp_cell_id = #{minTempCellId},</if>
<if test="maxCellSocId != null">max_cell_soc_id = #{maxCellSocId},</if> <if test="totalChargeCapacity != null">total_charge_capacity = #{totalChargeCapacity},</if>
<if test="minCellSoc != null">min_cell_soc = #{minCellSoc},</if> <if test="totalDischargeCapacity != null">total_discharge_capacity = #{totalDischargeCapacity},</if>
<if test="minCellSocId != null">min_cell_soc_id = #{minCellSocId},</if> <if test="sessionChargeCapacity != null">session_charge_capacity = #{sessionChargeCapacity},</if>
<if test="maxCellSoh != null">max_cell_soh = #{maxCellSoh},</if> <if test="sessionDischargeCapacity != null">session_discharge_capacity = #{sessionDischargeCapacity},</if>
<if test="maxCellSohId != null">max_cell_soh_id = #{maxCellSohId},</if> <if test="availableChargeCapacity != null">available_charge_capacity = #{availableChargeCapacity},</if>
<if test="minCellSoh != null">min_cell_soh = #{minCellSoh},</if> <if test="availableDischargeCapacity != null">available_discharge_capacity = #{availableDischargeCapacity},</if>
<if test="minCellSohId != null">min_cell_soh_id = #{minCellSohId},</if> <if test="remainingDischargeTime != null">remaining_discharge_time = #{remainingDischargeTime},</if>
<if test="totalChargeEnergy != null">total_charge_energy = #{totalChargeEnergy},</if> <if test="remainingChargeTime != null">remaining_charge_time = #{remainingChargeTime},</if>
<if test="totalDischargeEnergy != null">total_discharge_energy = #{totalDischargeEnergy},</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> </trim>
where id = #{id} where id = #{id}
</update> </update>
@ -303,18 +274,4 @@
#{id} #{id}
</foreach> </foreach>
</delete> </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.id and tmp.site_id = td.site_id
where tmp.site_id = #{siteId}
and tmp.update_time = (select MAX(t.update_time) FROM ems_battery_stack t where t.site_id = tmp.site_id
and t.device_id = tmp.device_id)
order by tmp.device_id
</select>
</mapper> </mapper>

View File

@ -125,12 +125,12 @@
</delete> </delete>
<select id="getCoolingDataList" parameterType="String" resultMap="EmsCoolingDataResult"> <select id="getCoolingDataList" parameterType="String" resultMap="EmsCoolingDataResult">
select t.* SELECT t.*
from ems_cooling_data t FROM ( SELECT *, ROW_NUMBER() OVER (PARTITION BY device_id ORDER BY update_time DESC ) AS rn
where t.site_id = #{siteId} FROM ems_cooling_data
and t.update_time = ( WHERE site_id = #{siteId}
select MAX(tcd.update_time) from ems_cooling_data tcd where tcd.site_id = t.site_id and tcd.device_id = t.device_id) ) t
order by t.system_name WHERE rn = 1
ORDER BY system_name
</select> </select>
</mapper> </mapper>

View File

@ -24,10 +24,12 @@
<result property="siteId" column="site_id" /> <result property="siteId" column="site_id" />
<result property="communicationStatus" column="communication_status" /> <result property="communicationStatus" column="communication_status" />
<result property="deviceId" column="device_id" /> <result property="deviceId" column="device_id" />
<result property="parentId" column="parent_id" />
<result property="deviceCategory" column="device_category" />
</resultMap> </resultMap>
<sql id="selectEmsDevicesSettingVo"> <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> </sql>
<select id="selectEmsDevicesSettingList" parameterType="EmsDevicesSetting" resultMap="EmsDevicesSettingResult"> <select id="selectEmsDevicesSettingList" parameterType="EmsDevicesSetting" resultMap="EmsDevicesSettingResult">
@ -51,6 +53,8 @@
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if> <if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="communicationStatus != null and communicationStatus != ''"> and communication_status = #{communicationStatus}</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="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> </where>
</select> </select>
@ -80,6 +84,8 @@
<if test="siteId != null">site_id,</if> <if test="siteId != null">site_id,</if>
<if test="communicationStatus != null">communication_status,</if> <if test="communicationStatus != null">communication_status,</if>
<if test="deviceId != null and deviceId != ''">device_id,</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>
<trim prefix="values (" suffix=")" suffixOverrides=","> <trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="deviceName != null and deviceName != ''">#{deviceName},</if> <if test="deviceName != null and deviceName != ''">#{deviceName},</if>
@ -100,6 +106,8 @@
<if test="siteId != null">#{siteId},</if> <if test="siteId != null">#{siteId},</if>
<if test="communicationStatus != null">#{communicationStatus},</if> <if test="communicationStatus != null">#{communicationStatus},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if> <if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="parentId != null">#{parentId},</if>
<if test="deviceCategory != null">#{deviceCategory},</if>
</trim> </trim>
</insert> </insert>
@ -124,6 +132,8 @@
<if test="siteId != null">site_id = #{siteId},</if> <if test="siteId != null">site_id = #{siteId},</if>
<if test="communicationStatus != null">communication_status = #{communicationStatus},</if> <if test="communicationStatus != null">communication_status = #{communicationStatus},</if>
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</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> </trim>
where id = #{id} where id = #{id}
</update> </update>
@ -145,15 +155,34 @@
select distinct eb.device_id from ems_battery_stack eb where eb.site_id = #{siteId}) select distinct eb.device_id from ems_battery_stack eb where eb.site_id = #{siteId})
</select> </select>
<select id="getAllClusterInfoByStackId" parameterType="String" resultType="java.util.Map"> <select id="getDeviceInfoByParentId" parameterType="String" resultType="java.util.Map">
select device_id as id,device_name as deviceName select distinct t.device_id as id,t.device_name as deviceName from ems_devices_setting t where t.parent_id = #{parentId}
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> </select>
<select id="getDeviceStatus" parameterType="String" resultType="java.util.Map"> <select id="getAllBatteryDeviceBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.EmsDevicesSetting">
select device_id as id,communication_status select distinct e.device_id as deviceId,
from ems_devices_setting t.device_name as deviceName,
t.communication_status as communicationStatus
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} where device_id = #{deviceId}
limit 1
</select> </select>
</mapper> </mapper>

View File

@ -205,14 +205,88 @@
</delete> </delete>
<select id="getPcsBranchInfoList" resultType="com.xzzn.ems.domain.vo.PcsBranchInfo"> <select id="getPcsBranchInfoList" resultType="com.xzzn.ems.domain.vo.PcsBranchInfo">
select tmp.branch_id as branchId, tmp.discharge_status as dischargeStatus, SELECT tmp.branch_id as branchId, tmp.discharge_status as dischargeStatus,
tmp.dc_power as dcPower, tmp.dc_voltage as dcVoltage, tmp.dc_power as dcPower, tmp.dc_voltage as dcVoltage,
tmp.dc_current as dcCurrent, tmp.site_id as siteId, tmp.device_id as deviceId tmp.dc_current as dcCurrent, tmp.site_id as siteId, tmp.device_id as deviceId
from ems_pcs_branch_data tmp FROM (
where tmp.site_id = #{siteId} SELECT t.*, ROW_NUMBER() OVER ( PARTITION BY t.branch_id ORDER BY t.update_time DESC ) AS rn
and tmp.device_id = #{deviceId} FROM ems_pcs_branch_data t
and tmp.update_time = (select MAX(t.update_time) FROM ems_pcs_branch_data t where t.site_id = tmp.site_id WHERE t.site_id = #{siteId} AND t.device_id = #{deviceId}
and t.device_id = tmp.device_id and t.branch_id = tmp.branch_id) ) tmp
order by tmp.branch_id WHERE rn = 1
ORDER BY tmp.branch_id
</select> </select>
<insert id="insertPcsBranchDataList" parameterType="java.util.List">
INSERT INTO ems_pcs_branch_data (
discharge_status,
dc_power,
dc_voltage,
dc_current,
site_id,
device_id,
branch_id,
grid_u_voltage,
grid_v_voltage,
grid_w_voltage,
output_u_current,
output_v_current,
output_w_current,
apparent_power,
active_power,
reactive_power,
power_factor,
frequency,
internal_temp,
u_igbt_temp,
v_igbt_temp,
w_igbt_temp,
grid_status,
available_power,
total_load_ratio,
ac_leakage_current,
insulation_resistance,
create_by,
create_time,
update_by,
update_time,
remark
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.dischargeStatus},
#{item.dcPower},
#{item.dcVoltage},
#{item.dcCurrent},
#{item.siteId},
#{item.deviceId},
#{item.branchId},
#{item.gridUVoltage},
#{item.gridVVoltage},
#{item.gridWVoltage},
#{item.outputUCurrent},
#{item.outputVCurrent},
#{item.outputWCurrent},
#{item.apparentPower},
#{item.activePower},
#{item.reactivePower},
#{item.powerFactor},
#{item.frequency},
#{item.internalTemp},
#{item.uIgbtTemp},
#{item.vIgbtTemp},
#{item.wIgbtTemp},
#{item.gridStatus},
#{item.availablePower},
#{item.totalLoadRatio},
#{item.acLeakageCurrent},
#{item.insulationResistance},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime},
#{item.remark}
)
</foreach>
</insert>
</mapper> </mapper>

View File

@ -279,45 +279,57 @@
</foreach> </foreach>
</delete> </delete>
<select id="getPcsDataBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo"> <select id="getPcsDataBySiteId" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
select CONCAT(date_month,'/',date_day) as ammeterDate, select CONCAT(t.date_month,'/',t.date_day) as ammeterDate,
sum(daily_ac_charge_energy) as chargedCap, sum(t.daily_ac_charge_energy) as chargedCap,
sum(daily_ac_discharge_energy) as disChargedCap sum(t.daily_ac_discharge_energy) as disChargedCap
from ems_pcs_data from (
where site_id = #{siteId} SELECT p.site_id, p.device_id,p.date_month,p.date_day, MAX(p.data_update_time) AS max_update_time
and date_sub(CURDATE(), interval 6 day) &lt;= create_time FROM ems_pcs_data p
group by date_month,date_day where p.site_id = #{siteId} and p.create_time >= CURDATE() - INTERVAL #{limitTime} DAY
</select> 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
<select id="getGridNrtPower" parameterType="String" resultType="java.math.BigDecimal"> AND latest.device_id = t.device_id
select sum(total_active_power) as gridNrtPower AND latest.max_update_time = t.data_update_time
from ems_pcs_data and latest.date_month = t.date_month
where site_id = #{siteId} and latest.date_day = t.date_day
group by ammeterDate
order by ammeterDate desc;
</select> </select>
<select id="getPcsTotalChargeData" resultType="map"> <select id="getPcsTotalChargeData" resultType="map">
select SUM(t.daily_ac_charge_energy) as totalChargedCap, SELECT
SUM(t.daily_ac_discharge_energy) as totalDischargedCap SUM(t.total_ac_charge_energy) AS totalChargedCap,
from ems_pcs_data t SUM(t.total_ac_discharge_energy) AS totalDischargedCap,
where t.data_update_time = (select MAX(data_update_time) FROM ems_pcs_data SUM(t.total_active_power) as gridNrtPower
where site_id = t.site_id and device_id = t.device_id and date_month = t.date_month and date_day = t.date_day) FROM (
SELECT p.site_id, p.device_id, MAX(p.data_update_time) AS max_update_time
FROM ems_pcs_data p inner join ems_site_setting s on p.site_id = s.site_id
<if test="siteId != null and siteId != ''">
where p.site_id = #{siteId}
</if>
GROUP BY p.site_id,p.device_id
) 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
</select> </select>
<select id="getSiteRunningHeadInfo" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteMonitorRunningHeadInfoVo"> <select id="getSiteRunningHeadInfo" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteMonitorRunningHeadInfoVo">
select sum(a.total_active_power) as totalActivePower, SELECT
sum(a.total_reactive_power) as totalReactivePower, SUM(t.total_active_power) as totalActivePower,
sum(a.daily_ac_charge_energy) as dayChargedCap, SUM(t.total_reactive_power) as totalReactivePower,
sum(a.daily_ac_discharge_energy) as dayDisChargedCap sum(t.daily_ac_charge_energy) as dayChargedCap,
from ( sum(t.daily_ac_discharge_energy) as dayDisChargedCap,
select t.total_active_power,t.total_reactive_power, #{siteId} as siteId
t.daily_ac_charge_energy,t.daily_ac_discharge_energy, FROM (
t.device_id,t.site_id,t.create_time SELECT p.device_id, MAX(p.data_update_time) AS max_update_time
from ems_pcs_data t FROM ems_pcs_data p
where t.site_id = #{siteId} where p.site_id = #{siteId}
and t.create_time = (select MAX(create_time) FROM ems_pcs_data where site_id = t.site_id and device_id = t.device_id) and p.data_update_time &gt;= CURDATE()
group by t.device_id,t.total_active_power, total_reactive_power, GROUP BY p.device_id
t.daily_ac_charge_energy,t.daily_ac_discharge_energy,t.site_id,t.create_time ) latest inner join ems_pcs_data t ON latest.device_id = t.device_id
) a AND latest.max_update_time = t.data_update_time
AND t.site_id = #{siteId}
</select> </select>
<select id="getElectDataList" resultType="com.xzzn.ems.domain.vo.ElectricIndexList"> <select id="getElectDataList" resultType="com.xzzn.ems.domain.vo.ElectricIndexList">
@ -335,7 +347,7 @@
</select> </select>
<select id="getPcsDetailInfoBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.PcsDetailInfoVo"> <select id="getPcsDetailInfoBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.PcsDetailInfoVo">
select td.device_name as deviceName, SELECT td.device_name as deviceName,
td.communication_status as communicationStatus, td.communication_status as communicationStatus,
tmp.site_id as siteId, tmp.site_id as siteId,
tmp.device_id as deviceId, tmp.device_id as deviceId,
@ -349,10 +361,37 @@
tmp.c_phase_current as cPhaseVoltage,tmp.c_phase_current as cPhaseCurrent, tmp.c_phase_current as cPhaseVoltage,tmp.c_phase_current as cPhaseCurrent,
tmp.total_power_factor as totalPowerFactor, tmp.total_power_factor as totalPowerFactor,
tmp.pcs_environment_temperature as pcsEnvironmentTemperature,tmp.ac_frequency as acFrequency tmp.pcs_environment_temperature as pcsEnvironmentTemperature,tmp.ac_frequency as acFrequency
from ems_pcs_data tmp left join ems_devices_setting td on tmp.device_id = td.id and tmp.site_id = td.site_id FROM ems_pcs_data tmp
where tmp.site_id = #{siteId} LEFT JOIN ems_devices_setting td on tmp.device_id = td.device_id and tmp.site_id = td.site_id
and tmp.data_update_time = (select MAX(data_update_time) FROM ems_pcs_data where site_id = tmp.site_id INNER JOIN ( SELECT p.site_id, p.device_id, MAX(p.data_update_time) AS max_update_time
and device_id = tmp.device_id) FROM ems_pcs_data p
WHERE p.site_id = #{siteId}
GROUP BY p.site_id,p.device_id
) latest on tmp.device_id = latest.device_id and tmp.data_update_time = latest.max_update_time
WHERE tmp.site_id = #{siteId}
order by tmp.device_id order by tmp.device_id
</select> </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> </mapper>

View File

@ -120,4 +120,27 @@
<include refid="selectEmsSiteSettingVo"/> <include refid="selectEmsSiteSettingVo"/>
where site_id = #{siteId} where site_id = #{siteId}
</select> </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> </mapper>

View File

@ -0,0 +1,107 @@
<?xml version="1.0" encoding="UTF-8" ?>
<!DOCTYPE mapper
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="com.xzzn.ems.mapper.EmsTicketMapper">
<resultMap type="EmsTicket" id="EmsTicketResult">
<result property="id" column="id" />
<result property="ticketNo" column="ticket_no" />
<result property="userId" column="user_id" />
<result property="title" column="title" />
<result property="content" column="content" />
<result property="images" column="images" />
<result property="status" column="status" />
<result property="createTime" column="create_time" />
<result property="completeTime" column="complete_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="workUserId" column="work_user_id" />
</resultMap>
<sql id="selectEmsTicketVo">
select id, ticket_no, user_id, title, content, images, status, create_time, complete_time, create_by, update_by, update_time, work_user_id from ems_ticket
</sql>
<select id="selectEmsTicketList" parameterType="EmsTicket" resultMap="EmsTicketResult">
<include refid="selectEmsTicketVo"/>
<where>
<if test="ticketNo != null and ticketNo != ''"> and ticket_no = #{ticketNo}</if>
<if test="userId != null and userId != ''"> and user_id = #{userId}</if>
<if test="title != null and title != ''"> and title = #{title}</if>
<if test="content != null and content != ''"> and content = #{content}</if>
<if test="images != null and images != ''"> and images = #{images}</if>
<if test="status != null "> and status = #{status}</if>
<if test="completeTime != null "> and complete_time = #{completeTime}</if>
<if test="workUserId != null "> and work_user_id = #{workUserId}</if>
</where>
</select>
<select id="selectEmsTicketById" parameterType="String" resultMap="EmsTicketResult">
<include refid="selectEmsTicketVo"/>
where id = #{id}
</select>
<insert id="insertEmsTicket" parameterType="EmsTicket" useGeneratedKeys="true" keyProperty="id">
insert into ems_ticket
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="ticketNo != null and ticketNo != ''">ticket_no,</if>
<if test="userId != null and userId != ''">user_id,</if>
<if test="title != null and title != ''">title,</if>
<if test="content != null and content != ''">content,</if>
<if test="images != null">images,</if>
<if test="status != null">status,</if>
<if test="createTime != null">create_time,</if>
<if test="completeTime != null">complete_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="workUserId != null">work_user_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="ticketNo != null and ticketNo != ''">#{ticketNo},</if>
<if test="userId != null and userId != ''">#{userId},</if>
<if test="title != null and title != ''">#{title},</if>
<if test="content != null and content != ''">#{content},</if>
<if test="images != null">#{images},</if>
<if test="status != null">#{status},</if>
<if test="createTime != null">#{createTime},</if>
<if test="completeTime != null">#{completeTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="workUserId != null">#{workUserId},</if>
</trim>
</insert>
<update id="updateEmsTicket" parameterType="EmsTicket">
update ems_ticket
<trim prefix="SET" suffixOverrides=",">
<if test="ticketNo != null and ticketNo != ''">ticket_no = #{ticketNo},</if>
<if test="userId != null and userId != ''">user_id = #{userId},</if>
<if test="title != null and title != ''">title = #{title},</if>
<if test="content != null and content != ''">content = #{content},</if>
<if test="images != null">images = #{images},</if>
<if test="status != null">status = #{status},</if>
<if test="createTime != null">create_time = #{createTime},</if>
<if test="completeTime != null">complete_time = #{completeTime},</if>
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="workUserId != null">work_user_id = #{workUserId},</if>
</trim>
where id = #{id}
</update>
<delete id="deleteEmsTicketById" parameterType="String">
delete from ems_ticket where id = #{id}
</delete>
<delete id="deleteEmsTicketByIds" parameterType="String">
delete from ems_ticket where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>