Compare commits

...

27 Commits

Author SHA1 Message Date
44baca6c45 revert 2025-08-06 22:26:04 +08:00
f59eeab0d0 本地ems不订阅mqtt 2025-08-06 22:23:48 +08:00
f52f253344 误提交-回退 2025-08-04 16:33:45 +08:00
90315d8e2c DDS页面数据设置 2025-08-04 16:23:04 +08:00
97c667bd77 获取堆下面的簇列表入参+站点id 2025-07-29 18:38:21 +08:00
a12f7820cf DDS监控逻辑修改 2025-07-29 18:28:17 +08:00
8fd2f45e18 DDS数据同步 2025-07-29 15:58:26 +08:00
9da5047148 DDS数据同步 2025-07-27 17:34:38 +08:00
281e0f57c4 modbus轮询修改 2025-07-27 13:49:36 +08:00
7ea52a8972 策略曲线图修改 2025-07-22 22:49:54 +08:00
e3e3dc1d96 策略曲线图修改 2025-07-22 22:27:12 +08:00
b4cbf0b34e 电量指标-修改 2025-07-22 13:54:07 +08:00
cbcaaaffb6 DDS数据同步修改-load 2025-07-21 11:01:22 +08:00
c51c4be498 优化sql 2025-07-18 20:14:38 +08:00
51e6936d77 设备列表-返回新增parentId 2025-07-18 10:35:32 +08:00
b25f5310e1 DDS监听数据结构修改 2025-07-18 01:45:09 +08:00
34c2647495 单体电池每日最新数据处理 2025-07-18 01:38:30 +08:00
41af74b33a jar包替換 2025-07-17 17:12:44 +08:00
9125ce735c 策略数据下发大概逻辑 2025-07-17 15:58:08 +08:00
a4338b3995 单个单体电池数据曲线图 2025-07-17 13:31:25 +08:00
1da9867372 modbus协议轮询设备信息 2025-07-17 10:13:19 +08:00
e2663b18d5 工单管理-工单列表入参 2025-07-16 16:18:35 +08:00
587e9f86b1 工单管理-工单详情新增返回字段 2025-07-15 19:31:07 +08:00
161c54b6ef 工单管理-新增字段 2025-07-15 17:59:57 +08:00
af32d62c80 Mqtt数据插入 2025-07-15 15:34:13 +08:00
1e970c9d19 单体电池-按deviceId排序 2025-07-15 13:37:58 +08:00
e6d6f806e4 策略配置-曲线图模型修改 2025-07-15 12:57:00 +08:00
71 changed files with 4966 additions and 549 deletions

View File

@ -4,7 +4,9 @@ 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.vo.BatteryDataStatsListVo;
import com.xzzn.ems.domain.vo.DateSearchRequest;
import com.xzzn.ems.service.IEmsSiteService;
import com.xzzn.ems.service.IEmsStatsReportService;
import com.xzzn.ems.service.ISingleSiteService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@ -24,6 +26,8 @@ public class EmsSiteMonitorController extends BaseController{
private ISingleSiteService iSingleSiteService;
@Autowired
private IEmsSiteService iEmsSiteService;
@Autowired
private IEmsStatsReportService iemsStatsReportService;
/**
* 获取单站首页数据
@ -119,9 +123,9 @@ public class EmsSiteMonitorController extends BaseController{
* 获取所有电池簇
*/
@GetMapping("/getClusterNameList")
public AjaxResult getClusterNameList(@RequestParam String stackDeviceId)
public AjaxResult getClusterNameList(@RequestParam String siteId, @RequestParam String stackDeviceId)
{
return success(iEmsSiteService.getAllClusterInfo(stackDeviceId));
return success(iEmsSiteService.getAllClusterInfo(siteId, stackDeviceId));
}
/**
@ -144,6 +148,15 @@ public class EmsSiteMonitorController extends BaseController{
return getDataTable2(list);
}
/**
* 单个单体电池曲线图
*/
@GetMapping("/getSingleBatteryData")
public AjaxResult getSingleBatteryData(DateSearchRequest requestVo)
{
return success(iemsStatsReportService.getSingleBatteryData(requestVo));
}
/**
* 电表数据
*/

View File

@ -2,6 +2,9 @@ package com.xzzn.web.controller.ems;
import java.util.List;
import javax.servlet.http.HttpServletResponse;
import com.xzzn.ems.domain.EmsStrategyTemp;
import com.xzzn.ems.domain.EmsStrategyTimeConfig;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
@ -19,7 +22,6 @@ import com.xzzn.common.enums.BusinessType;
import com.xzzn.ems.domain.EmsStrategyCurve;
import com.xzzn.ems.service.IEmsStrategyCurveService;
import com.xzzn.common.utils.poi.ExcelUtil;
import com.xzzn.common.core.page.TableDataInfo;
/**
* 策曲线Controller
@ -99,4 +101,13 @@ public class EmsStrategyCurveController extends BaseController
{
return toAjax(emsStrategyCurveService.deleteEmsStrategyCurveByIds(ids));
}
/**
* 获取策略曲线图数据
*/
@GetMapping("/curveList")
public AjaxResult getCurveList(EmsStrategyTemp tempConfig)
{
return success(emsStrategyCurveService.getStrategyCurveList(tempConfig));
}
}

View File

@ -41,10 +41,10 @@ public class EmsTicketController extends BaseController
*/
@PreAuthorize("@ss.hasPermi('system:ticket:list')")
@GetMapping("/list")
public TableDataInfo list(EmsTicket emsTicket)
public TableDataInfo list(Long[] status)
{
startPage();
List<TicketListVo> list = emsTicketService.getAllTicketList(emsTicket);
List<TicketListVo> list = emsTicketService.getAllTicketList(status);
return getDataTable(list);
}

View File

@ -136,3 +136,12 @@ mqtt:
connection-timeout: 15
keep-alive-interval: 30
automatic-reconnect: true
modbus:
pool:
max-total: 20
max-idle: 10
min-idle: 3
poll:
interval: "0 */5 * * * *" # 5分钟间隔
timeout: 30000 # 30秒超时

View File

@ -36,4 +36,19 @@ public class RedisKeyConstants
* 电表数据 redis key
*/
public static final String AMMETER = "AMMETER_";
/**
* 动环数据 redis key
*/
public static final String DH = "DH_";
/**
* 电池组 redis key
*/
public static final String GROUP = "GROUP_";
/**
* BMSD原始数据 redis key
*/
public static final String ORIGINAL_BMSD = "BMSD_";
}

View File

@ -50,6 +50,20 @@
<groupId>org.eclipse.paho</groupId>
<artifactId>org.eclipse.paho.client.mqttv3</artifactId>
</dependency>
<!-- 轮询 -->
<dependency>
<groupId>net.wimpi</groupId>
<artifactId>j2mod</artifactId>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
</dependency>
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-annotations</artifactId>
</dependency>
<!-- 获取系统信息 -->
<dependency>
<groupId>com.github.oshi</groupId>
@ -63,5 +77,4 @@
</dependency>
</dependencies>
</project>

View File

@ -25,7 +25,7 @@ import com.xzzn.common.utils.ip.IpUtils;
* @author xzzn
*/
@Aspect
@Component
@Component("customRateLimiterAspect")
public class RateLimiterAspect
{
private static final Logger log = LoggerFactory.getLogger(RateLimiterAspect.class);

View File

@ -0,0 +1,49 @@
/*
package com.xzzn.framework.config;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.scheduling.annotation.EnableAsync;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import java.util.concurrent.Executor;
import java.util.concurrent.ThreadPoolExecutor;
@Configuration
@EnableAsync
public class AsyncConfig {
@Bean("modbusTaskExecutor")
public Executor taskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(5);
executor.setMaxPoolSize(10);
executor.setQueueCapacity(100);
executor.setKeepAliveSeconds(300);
executor.setThreadNamePrefix("ModbusPoller-");
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executor.initialize();
return executor;
}
*/
/**
* 策略下方定时任务
*//*
*/
/*@Bean("strategyTaskExecutor")
public Executor strategyTaskExecutor() {
ThreadPoolTaskExecutor executor = new ThreadPoolTaskExecutor();
executor.setCorePoolSize(5);
executor.setMaxPoolSize(10);
executor.setQueueCapacity(100);
executor.setKeepAliveSeconds(300);
executor.setThreadNamePrefix("StrategyPoller-");
executor.setRejectedExecutionHandler(new ThreadPoolExecutor.CallerRunsPolicy());
executor.initialize();
return executor;
}*//*
}
*/

View File

@ -0,0 +1,38 @@
package com.xzzn.framework.config;
import com.xzzn.framework.manager.ModbusConnectionManager;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.context.annotation.Configuration;
@Configuration
public class ModbusConfig {
@Value("${modbus.pool.max-total:20}")
private int maxTotal;
@Value("${modbus.pool.max-idle:10}")
private int maxIdle;
@Value("${modbus.pool.min-idle:3}")
private int minIdle;
@Value("${modbus.pool.max-wait:3000}")
private long maxWaitMillis;
@Value("${modbus.pool.time-between-eviction-runs:30000}")
private long timeBetweenEvictionRunsMillis;
@Value("${modbus.pool.min-evictable-idle-time:60000}")
private long minEvictableIdleTimeMillis;
public ModbusConnectionManager modbusConnectionManager() {
ModbusConnectionManager manager = new ModbusConnectionManager();
manager.setMaxTotal(maxTotal);
manager.setMaxIdle(maxIdle);
manager.setMinIdle(minIdle);
manager.setMaxWaitMillis(maxWaitMillis);
manager.setTimeBetweenEvictionRunsMillis(timeBetweenEvictionRunsMillis);
manager.setMinEvictableIdleTimeMillis(minEvictableIdleTimeMillis);
return manager;
}
}

View File

@ -0,0 +1,254 @@
package com.xzzn.framework.manager;
import com.ghgande.j2mod.modbus.net.TCPMasterConnection;
import com.xzzn.ems.domain.EmsDevicesSetting;
import com.xzzn.ems.mapper.EmsDevicesSettingMapper;
import org.apache.commons.pool2.impl.GenericObjectPool;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.ApplicationArguments;
import org.springframework.boot.ApplicationRunner;
import org.springframework.stereotype.Component;
import javax.annotation.PreDestroy;
import java.net.InetAddress;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.*;
import java.util.stream.Collectors;
@Component
public class ModbusConnectionManager implements ApplicationRunner {
private static final Logger logger = LoggerFactory.getLogger(ModbusConnectionManager.class);
private final Map<Integer, ModbusConnectionWrapper> connectionPool = new ConcurrentHashMap<>();
// 连接池配置参数
private int maxTotal = 20;
private int maxIdle = 10;
private int minIdle = 3;
private long maxWaitMillis = 3000;
private long timeBetweenEvictionRunsMillis = 30000;
private long minEvictableIdleTimeMillis = 60000;
private ScheduledExecutorService scheduler;
@Autowired
private EmsDevicesSettingMapper deviceRepo;
@Override
public void run(ApplicationArguments args) throws Exception {
init();
}
public void init() {
// 启动心跳检测线程
scheduler = Executors.newSingleThreadScheduledExecutor();
scheduler.scheduleAtFixedRate(this::heartbeatCheck, 1, 5, TimeUnit.MINUTES);
logger.info("Modbus连接管理器已初始化");
}
/**
* 获取连接(带自动创建和缓存)
*/
public ModbusConnectionWrapper getConnection(EmsDevicesSetting device) throws Exception {
return connectionPool.compute(Math.toIntExact(device.getId()), (id, wrapper) -> {
try {
if (wrapper == null || !wrapper.isActive()) {
if (connectionPool.size() >= maxTotal) {
evictIdleConnection();
}
logger.info("创建新连接: {}", device);
return new ModbusConnectionWrapper(createRawConnection(device));
}
wrapper.updateLastAccess();
return wrapper;
} catch (Exception e) {
throw new RuntimeException("连接创建失败: " + device.getId(), e);
}
});
}
/**
* 创建原始Modbus连接
*/
private TCPMasterConnection createRawConnection(EmsDevicesSetting device) throws Exception {
try {
InetAddress addr = InetAddress.getByName("192.168.80.100");
TCPMasterConnection connection = new TCPMasterConnection(addr);
connection.setPort(502);
connection.setTimeout(5000);
connection.connect();
return connection;
} catch (Exception e) {
logger.error("创建Modbus连接失败: {}", device, e);
throw e;
}
}
/**
* 心跳检测
*/
private void heartbeatCheck() {
logger.info("开始监控Modbus连接池状态当前连接数: {}", connectionPool.size());
// 步骤1获取所有活跃设备列表与轮询逻辑共用同一批设备
List<EmsDevicesSetting> activeDevices = null;
if (activeDevices == null || activeDevices.isEmpty()) {
logger.warn("无活跃设备,心跳检测仅清理无效连接");
}
// 步骤2清理无效连接遍历连接池移除已失效的连接
List<Integer> invalidDeviceIds = new ArrayList<>();
connectionPool.forEach((deviceId, wrapper) -> {
try {
if (!wrapper.isActive()) {
logger.info("连接{}已失效,移除连接", deviceId);
invalidDeviceIds.add(deviceId);
wrapper.close();
}
} catch (Exception e) {
logger.error("心跳检测异常: {}", deviceId, e);
}
});
// 批量移除无效连接(避免边遍历边修改)
invalidDeviceIds.forEach(connectionPool::remove);
logger.debug("移除无效连接后,连接池大小: {}", connectionPool.size());
// 步骤3补充关键设备的连接优先保障活跃设备的连接存在
if (!activeDevices.isEmpty()) {
// 3.1 先为所有活跃设备预加载连接(确保需要轮询的设备有连接)
preloadCriticalConnection(activeDevices);
// 3.2 若连接数仍不足minIdle补充额外连接可选避免连接池过小
int currentSize = connectionPool.size();
if (currentSize < minIdle) {
logger.info("连接数{}不足最小空闲数{},补充额外连接", currentSize, minIdle);
// 从活跃设备中选未创建连接的设备补充(避免重复创建)
List<EmsDevicesSetting> needMoreDevices = activeDevices.stream()
.filter(device -> !connectionPool.containsKey(Math.toIntExact(device.getId())))
.limit(minIdle - currentSize) // 只补充差额
.collect(Collectors.toList());
preloadCriticalConnection(needMoreDevices); // 复用预加载方法
}
}
}
/**
* 预加载关键连接
*/
private void preloadCriticalConnection(List<EmsDevicesSetting> devices) {
// 简化示例,不实现具体逻辑
logger.info("预加载连接: 连接池当前大小={}, 最小空闲={}", connectionPool.size(), minIdle);
devices.forEach(device -> {
try {
Integer deviceId = Math.toIntExact(device.getId());
if (!connectionPool.containsKey(deviceId)) {
getConnection(device); // 复用已有创建逻辑
}
} catch (Exception e) {
logger.warn("预加载设备{}连接失败", device.getId(), e);
}
});
}
/**
* 移除最久未使用的空闲连接
*/
private void evictIdleConnection() {
if (connectionPool.isEmpty()) {
return;
}
ModbusConnectionWrapper oldestWrapper = null;
long oldestAccessTime = Long.MAX_VALUE;
for (ModbusConnectionWrapper wrapper : connectionPool.values()) {
if (wrapper.isActive() && wrapper.getLastAccessTime() < oldestAccessTime) {
oldestAccessTime = wrapper.getLastAccessTime();
oldestWrapper = wrapper;
}
}
if (oldestWrapper != null) {
logger.info("移除空闲连接: {}", oldestWrapper.getConnection());
connectionPool.values().remove(oldestWrapper);
oldestWrapper.close();
}
}
// 移除指定设备连接
public void removeConnection(Integer deviceId) {
ModbusConnectionWrapper wrapper = connectionPool.remove(deviceId);
if (wrapper != null) {
wrapper.close(); // 双重保障,确保连接关闭
logger.info("连接池主动移除设备{}的连接", deviceId);
}
}
/**
* 判断是否应该移除空连接池
*/
private boolean shouldRemoveEmptyPool(GenericObjectPool<?> pool) {
// 可根据配置或逻辑决定是否移除空连接池
// 这里简单实现为当连接池数量超过最大值时移除
return connectionPool.size() > maxTotal;
}
/**
* 关闭连接
*/
private void closeConnection(TCPMasterConnection connection) {
try {
if (connection != null && connection.isConnected()) {
connection.close();
}
} catch (Exception e) {
logger.error("关闭Modbus连接失败", e);
}
}
// 容器销毁时关闭线程池
@PreDestroy
public void destroy() {
if (scheduler != null) {
scheduler.shutdown();
try {
if (!scheduler.awaitTermination(5, TimeUnit.SECONDS)) {
scheduler.shutdownNow();
}
} catch (InterruptedException e) {
scheduler.shutdownNow();
}
}
}
// Getters and Setters
public void setMaxTotal(int maxTotal) {
this.maxTotal = maxTotal;
}
public void setMaxIdle(int maxIdle) {
this.maxIdle = maxIdle;
}
public void setMinIdle(int minIdle) {
this.minIdle = minIdle;
}
public void setMaxWaitMillis(long maxWaitMillis) {
this.maxWaitMillis = maxWaitMillis;
}
public void setTimeBetweenEvictionRunsMillis(long timeBetweenEvictionRunsMillis) {
this.timeBetweenEvictionRunsMillis = timeBetweenEvictionRunsMillis;
}
public void setMinEvictableIdleTimeMillis(long minEvictableIdleTimeMillis) {
this.minEvictableIdleTimeMillis = minEvictableIdleTimeMillis;
}
}

View File

@ -0,0 +1,81 @@
package com.xzzn.framework.manager;
import com.ghgande.j2mod.modbus.net.SerialConnection;
import com.ghgande.j2mod.modbus.net.TCPMasterConnection;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.concurrent.atomic.AtomicInteger;
public class ModbusConnectionWrapper {
private static final Logger logger = LoggerFactory.getLogger(ModbusConnectionWrapper.class);
private static final AtomicInteger COUNTER = new AtomicInteger(0);
private final Object connection;
private final int connectionId;
private volatile long lastAccessTime;
private volatile boolean active = true;
public ModbusConnectionWrapper(Object connection) {
this.connection = connection;
this.connectionId = COUNTER.incrementAndGet();
this.lastAccessTime = System.currentTimeMillis();
logger.info("创建连接包装: {}", this);
}
public boolean isActive() {
if (!active) return false;
try {
// 检查连接是否物理上有效
if (connection instanceof TCPMasterConnection) {
return ((TCPMasterConnection) connection).isConnected();
} else if (connection instanceof SerialConnection) {
return ((SerialConnection) connection).isOpen();
}
} catch (Exception e) {
logger.error("连接状态检查失败: {}", connectionId, e);
return false;
}
// 默认检查空闲时间
return System.currentTimeMillis() - lastAccessTime < 300000; // 5分钟
}
public void updateLastAccess() {
this.lastAccessTime = System.currentTimeMillis();
}
public Object getConnection() {
return connection;
}
public void close() {
try {
logger.info("关闭连接: {}", this);
if (connection instanceof TCPMasterConnection) {
((TCPMasterConnection) connection).close();
} else if (connection instanceof SerialConnection) {
((SerialConnection) connection).close();
}
} catch (Exception e) {
logger.error("关闭连接失败: {}", connectionId, e);
} finally {
this.active = false;
}
}
public long getLastAccessTime() {
return lastAccessTime;
}
@Override
public String toString() {
return "ModbusConnectionWrapper{" +
"connectionId=" + connectionId +
", active=" + active +
", lastAccessTime=" + lastAccessTime +
'}';
}
}

View File

@ -17,7 +17,7 @@ public class MqttLifecycleManager implements ApplicationRunner, SmartLifecycle,
private final MqttConnectOptions connectOptions;
private MqttClient mqttClient;
private volatile boolean running = false;
private volatile boolean running = true;
// 存储订阅关系: topic -> (listener, qos)
private final ConcurrentHashMap<String, SubscriptionInfo> subscriptions = new ConcurrentHashMap<>();

View File

@ -0,0 +1,126 @@
package com.xzzn.framework.scheduler;
import com.xzzn.ems.domain.EmsDevicesSetting;
import com.xzzn.ems.mapper.EmsDevicesSettingMapper;
import com.xzzn.ems.mapper.EmsMqttMessageMapper;
import com.xzzn.framework.manager.ModbusConnectionManager;
import com.xzzn.framework.manager.ModbusConnectionWrapper;
import com.xzzn.framework.manager.MqttLifecycleManager;
import com.xzzn.framework.web.service.ModbusService;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.util.List;
@Component
@EnableScheduling
public class ModbusPoller {
private static final Logger logger = LoggerFactory.getLogger(ModbusPoller.class);
private final MqttLifecycleManager mqttLifecycleManager;
@Autowired
private ModbusConnectionManager connectionManager;
@Autowired
private ModbusService modbusService;
@Autowired
private EmsDevicesSettingMapper deviceRepo;
@Autowired
private EmsMqttMessageMapper emsMqttMessageMapper;
@Autowired
public ModbusPoller(MqttLifecycleManager mqttLifecycleManager) {
this.mqttLifecycleManager = mqttLifecycleManager;
}
// 每5分钟触发支持cron表达式动态配置
@Scheduled(cron = "${modbus.poll.interval}")
@Async("modbusTaskExecutor")
public void pollAllDevices() {
logger.info("开始执行Modbus设备轮询...");
List<EmsDevicesSetting> activeDevices = deviceRepo.selectEmsDevicesSettingList(null);
EmsDevicesSetting device = activeDevices.get(0);
try {
processData(device,null);
} catch (Exception e) {
logger.error("调度设备{}任务失败", device.getId(), e);
}
/*
try {
pollSingleDevice(device);
} catch (Exception e) {
logger.error("调度设备{}任务失败", device.getId(), e);
}*/
/*activeDevices.forEach(device -> {
try {
CompletableFuture.runAsync(() -> pollSingleDevice(device))
.exceptionally(e -> {
logger.error("设备{}轮询异常", device.getId(), e);
return null;
});
} catch (Exception e) {
logger.error("调度设备{}任务失败", device.getId(), e);
}
});*/
}
private void pollSingleDevice(EmsDevicesSetting device) {
logger.debug("开始轮询设备: {}", device.getSiteId(), device.getDeviceName(), device.getId());
ModbusConnectionWrapper wrapper = null;
try {
// 获取连接
wrapper = connectionManager.getConnection(device);
// 读取保持寄存器
int[] data = modbusService.readHoldingRegisters(
wrapper.getConnection(),
1, //从站ID
10 // 寄存器数量
);
// 处理读取到的数据
processData(device, data);
} catch (Exception e) {
logger.error("轮询设备{}失败: {}", device.getId(), e.getMessage());
// 标记连接为无效
if (wrapper != null) {
wrapper.close();
connectionManager.removeConnection(Integer.parseInt(device.getDeviceId()));
}
throw new RuntimeException("轮询设备失败", e);
}
}
// 处理获取到的数据发到mqtt服务上
private void processData(EmsDevicesSetting device, int[] data) throws MqttException {
/*if (data == null || data.length == 0) {
logger.warn("设备{}返回空数据", device.getId());
return;
}*/
/*// 数据处理逻辑
StringBuilder sb = new StringBuilder();
sb.append("设备[").append(device.getDeviceName()).append("]数据: ");
for (int i = 0; i < data.length; i++) {
sb.append("R").append(i).append("=").append(data[i]).append(" ");
}
logger.info(sb.toString());*/
// 测试发送mqtt
/* EmsMqttMessage msg = emsMqttMessageMapper.selectEmsMqttMessageById(1L);
String dataJson = msg.getMqttMessage();
String topic = msg.getMqttTopic();
logger.info("topic" + topic);
logger.info("dataJson" + dataJson);
// 将设备数据下发到mqtt服务器上
mqttLifecycleManager.publish(topic, dataJson, 0);*/
}
}

View File

@ -0,0 +1,170 @@
package com.xzzn.framework.scheduler;
import com.alibaba.fastjson2.JSON;
import com.xzzn.common.utils.DateUtils;
import com.xzzn.common.utils.StringUtils;
import com.xzzn.ems.domain.EmsStrategyCurve;
import com.xzzn.ems.domain.EmsStrategyTemp;
import com.xzzn.ems.domain.EmsStrategyTimeConfig;
import com.xzzn.ems.domain.vo.StrategyPowerDataVo;
import com.xzzn.ems.domain.vo.StrategyRunningVo;
import com.xzzn.ems.mapper.*;
import com.xzzn.framework.manager.ModbusConnectionManager;
import com.xzzn.framework.manager.MqttLifecycleManager;
import com.xzzn.framework.web.service.ModbusService;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Async;
import org.springframework.scheduling.annotation.EnableScheduling;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Component;
import java.time.LocalDate;
import java.time.YearMonth;
import java.time.format.DateTimeFormatter;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.concurrent.CompletableFuture;
@Component
@EnableScheduling
public class StrategyPoller {
private static final Logger logger = LoggerFactory.getLogger(StrategyPoller.class);
private final MqttLifecycleManager mqttLifecycleManager;
@Autowired
private ModbusConnectionManager connectionManager;
@Autowired
private ModbusService modbusService;
@Autowired
private EmsDevicesSettingMapper deviceRepo;
@Autowired
private EmsMqttMessageMapper emsMqttMessageMapper;
@Autowired
private EmsStrategyRunningMapper emsStrategyRunningMapper;
@Autowired
private EmsStrategyTempMapper emsStrategyTempMapper;
@Autowired
private EmsStrategyTimeConfigMapper emsStrategyTimeConfigMapper;
@Autowired
private EmsStrategyCurveMapper emsStrategyCurveMapper;
@Autowired
public StrategyPoller(MqttLifecycleManager mqttLifecycleManager) {
this.mqttLifecycleManager = mqttLifecycleManager;
}
// 每1分钟触发支持cron表达式动态配置
@Scheduled(cron = "0 */1 * * * *")
@Async("strategyTaskExecutor")
public void pollAllDevices() {
logger.info("开始执行策略数据轮询...");
List<StrategyRunningVo> strategyRunningVoList = emsStrategyRunningMapper.getRunningList(null);
strategyRunningVoList.forEach(strategyVo -> {
try {
CompletableFuture.runAsync(() -> {
processData(strategyVo);
})
.exceptionally(e -> {
logger.error("策略{}轮询异常", strategyVo.getId(), e);
return null;
});
} catch (Exception e) {
logger.error("策略下方{}任务失败", strategyVo.getId(), e);
}
});
}
// 处理获取到的数据发到mqtt服务上
private void processData(StrategyRunningVo strategyVo) {
logger.info("策略下发数据处理开始");
// 根据运行策略获取主副策略的模板数据
Long mainStrategyId = strategyVo.getMainStrategyId();
Long auxStrategyId = strategyVo.getAuxStrategyId();
String siteId = strategyVo.getSiteId();
// 处理主策略数据
if (mainStrategyId != null && StringUtils.isNotBlank(siteId)) {
dealStrategyCurveData(mainStrategyId, siteId);
}
// 处理副策略数据
if (auxStrategyId != null && StringUtils.isNotBlank(siteId)) {
dealStrategyCurveData(auxStrategyId, siteId);
}
// 策略数据下发-下方格式暂无
logger.info("策略下发结束");
}
private void dealStrategyCurveData(Long mainStrategyId, String siteId) {
// 获取当前策略的所有模板
List<Map<String, String>> temps = emsStrategyTempMapper.getTempNameList(mainStrategyId,siteId);
if (temps != null && temps.size() > 0) {
for (Map<String, String> temp : temps) {
String tempId = temp.get("templateId");
List<EmsStrategyTimeConfig> timeConfigs = emsStrategyTimeConfigMapper.getAllTimeConfigByTempId(tempId);
if (timeConfigs != null && timeConfigs.size() > 0) {
for (EmsStrategyTimeConfig timeConfig : timeConfigs) {
EmsStrategyCurve curve = new EmsStrategyCurve();
curve.setStrategyId(mainStrategyId);
curve.setSiteId(siteId);
curve.setTemplateId(tempId);
curve.setCreateBy("system");
curve.setCreateTime(DateUtils.getNowDate());
curve.setUpdateBy("system");
curve.setUpdateTime(DateUtils.getNowDate());
// 时间设置
int month = Integer.parseInt(timeConfig.getMonth().toString());
String[] dateList= dealWithMonth(month);
curve.setMonth(Long.valueOf(month));
curve.setStartDate(DateUtils.dateTime(DateUtils.YYYY_MM_DD,dateList[0]));
curve.setEndDate(DateUtils.dateTime(DateUtils.YYYY_MM_DD,dateList[1]));
// powerData-存json格式
List<EmsStrategyTemp> powerConfig = emsStrategyTempMapper.selectStrategyTempByTempId(tempId);
List<StrategyPowerDataVo> powerDataVoList = new ArrayList<>();
for (int i = 0; i < powerConfig.size(); i++) {
EmsStrategyTemp powerTemp = powerConfig.get(i);
StrategyPowerDataVo powerDataVo = new StrategyPowerDataVo();
powerDataVo.setPowerData(powerTemp.getChargeDischargePower());
powerDataVo.setEndTime(DateUtils.parseDateToStr("HH:mm:ss",powerTemp.getEndTime()));
powerDataVo.setStartTime(DateUtils.parseDateToStr("HH:mm:ss",powerTemp.getStartTime()));
powerDataVoList.add(powerDataVo);
}
curve.setPowerData(powerDataVoList !=null ? JSON.toJSON(powerDataVoList).toString() : "");
// 记录推送记录
emsStrategyCurveMapper.insertEmsStrategyCurve(curve);
// 设置已下发
timeConfig.setIsPost(0);
emsStrategyTimeConfigMapper.updateEmsStrategyTimeConfig(timeConfig);
}
}
}
}
}
private String[] dealWithMonth(int month) {
// 获取当前年份
int currentYear = LocalDate.now().getYear();
// 创建YearMonth对象表示当年指定的月份
YearMonth yearMonth = YearMonth.of(currentYear, month);
// 获取当月的第一天和最后一天
LocalDate firstDay = yearMonth.atDay(1);
LocalDate lastDay = yearMonth.atEndOfMonth();
// 定义日期格式(年月日)
DateTimeFormatter formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd");
// 格式化日期
return new String[]{
firstDay.format(formatter),
lastDay.format(formatter)
};
}
}

View File

@ -0,0 +1,101 @@
package com.xzzn.framework.web.service;
import com.ghgande.j2mod.modbus.ModbusException;
import com.ghgande.j2mod.modbus.ModbusIOException;
import com.ghgande.j2mod.modbus.io.ModbusTCPTransaction;
import com.ghgande.j2mod.modbus.msg.ReadInputRegistersRequest;
import com.ghgande.j2mod.modbus.msg.ReadInputRegistersResponse;
import com.ghgande.j2mod.modbus.net.SerialConnection;
import com.ghgande.j2mod.modbus.net.TCPMasterConnection;
import io.github.resilience4j.circuitbreaker.annotation.CircuitBreaker;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.retry.annotation.Backoff;
import org.springframework.retry.annotation.Retryable;
import org.springframework.stereotype.Service;
/**
* Modbus操作服务添加重试机制
*/
@Service
public class ModbusService {
private static final Logger logger = LoggerFactory.getLogger(ModbusService.class);
@Retryable(
value = {ModbusException.class}, // 仅对自定义Modbus异常重试
maxAttempts = 3, // 最大重试3次1次原始调用 + 2次重试
backoff = @Backoff(delay = 1000, multiplier = 2) // 退避策略1s → 2s → 4s
)
@CircuitBreaker(name = "modbusOperation", fallbackMethod = "readRegistersFallback")
public int[] readHoldingRegisters(Object connection, int startAddr, int count) throws ModbusException {
try {
if (connection instanceof TCPMasterConnection) {
return readTcpRegisters((TCPMasterConnection) connection, startAddr, count);
} else if (connection instanceof SerialConnection) {
return readRtuRegisters((SerialConnection) connection, startAddr, count);
}
throw new IllegalArgumentException("不支持的连接类型: " + connection.getClass().getName());
} catch (ModbusIOException e) {
throw new ModbusException("通信故障", e);
} catch (Exception e) {
throw new ModbusException("系统错误", e);
}
}
private int[] readRtuRegisters(SerialConnection connection, int startAddr, int count) {
return null;
}
private int[] readTcpRegisters(TCPMasterConnection conn, int start, int count) throws ModbusException {
// 验证连接是否已建立
if (!conn.isConnected()) {
throw new ModbusIOException("TCP连接未建立");
}
// 使用正确的功能码03 - 读取保持寄存器ReadHoldingRegistersRequest
ReadInputRegistersRequest request = new ReadInputRegistersRequest(start, count);
ModbusTCPTransaction transaction = new ModbusTCPTransaction(conn);
transaction.setRequest(request);
// 设置超时避免长时间阻塞
transaction.setRetries(2);
try {
transaction.execute();
ReadInputRegistersResponse response = (ReadInputRegistersResponse) transaction.getResponse();
if (response == null) {
throw new ModbusException("Modbus异常响应: " + response.getMessage());
}
// 正确解析寄存器值
return parseRegisters(response);
} catch (ModbusException e) {
// 记录详细错误信息
logger.error("读取TCP寄存器失败: {}", e.getMessage());
throw e;
}
}
/**
* 解析Modbus响应中的寄存器值
*/
private int[] parseRegisters(ReadInputRegistersResponse response) {
int byteCount = response.getByteCount();
int[] result = new int[byteCount / 2];
for (int i = 0; i < result.length; i++) {
// 转换为无符号整数
result[i] = response.getRegisterValue(i) & 0xFFFF;
}
return result;
}
/**
* 熔断降级方法
*/
public int[] readRegistersFallback(Object connection, int startAddr, int count, Exception e) {
logger.warn("Modbus操作降级原因: {}),返回空数据", e.getMessage());
return new int[0];
}
}

View File

@ -12,7 +12,7 @@ import com.xzzn.common.annotation.Excel;
* 总数据对象 ems_ammeter_data
*
* @author xzzn
* @date 2025-07-03
* @date 2025-07-29
*/
public class EmsAmmeterData extends BaseEntity
{
@ -406,6 +406,254 @@ public class EmsAmmeterData extends BaseEntity
@Excel(name = "正向有功电能 EP+")
private BigDecimal positiveActiveEnergyEpPlus;
/** 电流变比 */
@Excel(name = "电流变比")
private BigDecimal currentPercent;
/** 电压变比 */
@Excel(name = "电压变比")
private BigDecimal voltagePercent;
/** 平均电流 */
@Excel(name = "平均电流")
private BigDecimal avgCurrent;
/** 总正向有功电能2 */
@Excel(name = "总正向有功电能2")
private BigDecimal totalForwardActiveTwo;
/** 总尖正向有功电能 */
@Excel(name = "总尖正向有功电能")
private BigDecimal totalPeakForwardActive;
/** 总峰正向有功电能 */
@Excel(name = "总峰正向有功电能")
private BigDecimal totalHighForwardActive;
/** 总平正向有功电能 */
@Excel(name = "总平正向有功电能")
private BigDecimal totalFlatForwardActive;
/** 总谷正向有功电能 */
@Excel(name = "总谷正向有功电能")
private BigDecimal totalValleyForwardActive;
/** 总反向有功电能2 */
@Excel(name = "总反向有功电能2")
private BigDecimal totalReverseActiveTwo;
/** 总尖反向有功电能 */
@Excel(name = "总尖反向有功电能")
private BigDecimal totalPeakReverseActive;
/** 总峰反向有功电能 */
@Excel(name = "总峰反向有功电能")
private BigDecimal totalHighReverseActive;
/** 总平反向有功电能 */
@Excel(name = "总平反向有功电能")
private BigDecimal totalFlatReverseActive;
/** 总谷反向有功电能 */
@Excel(name = "总谷反向有功电能")
private BigDecimal totalValleyReverseActive;
/** 断线检测指示 */
@Excel(name = "断线检测指示")
private String disconnectDetectionIndication;
/** 额定一次电流值 */
@Excel(name = "额定一次电流值")
private BigDecimal ratedPrimaryCurrentValue;
/** 开关量输入输出状态 */
@Excel(name = "开关量输入输出状态")
private String switchInputOutputStatus;
/** 报警状态 */
@Excel(name = "报警状态")
private String alarmStatus;
/** 当前总电压百分比 */
@Excel(name = "当前总电压百分比")
private BigDecimal currentTotalVoltagePercent;
/** 电压直流含量百分比 */
@Excel(name = "电压直流含量百分比")
private BigDecimal voltageContentPercent;
/** 电压交流含量百分比 */
@Excel(name = "电压交流含量百分比")
private BigDecimal voltageAcPercent;
/** 当前总电流百分比 */
@Excel(name = "当前总电流百分比")
private BigDecimal currentTotalCurrentPercent;
/** 电流直流含量百分比 */
@Excel(name = "电流直流含量百分比")
private BigDecimal currentContentPercent;
/** 电流交流含量百分比 */
@Excel(name = "电流交流含量百分比")
private BigDecimal currentAcPercent;
/** 当前总功率百分比 */
@Excel(name = "当前总功率百分比")
private BigDecimal currentTotalPowerPercent;
/** 功率直流含量百分比 */
@Excel(name = "功率直流含量百分比")
private BigDecimal powerContentPercent;
/** 功率交流含量百分比 */
@Excel(name = "功率交流含量百分比")
private BigDecimal powerAcPercent;
/** 日期时间设置(年月) */
@Excel(name = "日期时间设置", readConverterExp = "年=月")
private String dataSettingYearMonth;
/** 日期时间设置(日时) */
@Excel(name = "日期时间设置", readConverterExp = "日=时")
private String dataSettingDayHour;
/** 日期时间设置(分秒) */
@Excel(name = "日期时间设置", readConverterExp = "分=秒")
private String dataSettingMinutesSeconds;
/** 当前抄表日(高)、当前费率(低) */
@Excel(name = "当前抄表日", readConverterExp = "高=")
private BigDecimal currentRate;
/** 软件版本号 */
@Excel(name = "软件版本号")
private String versionNumber;
/** 电压 */
@Excel(name = "电压")
private BigDecimal voltage;
/** 电流 */
@Excel(name = "电流")
private BigDecimal current;
/** 功率 */
@Excel(name = "功率")
private BigDecimal power;
/** 内部温度 */
@Excel(name = "内部温度")
private BigDecimal internalTemp;
/** 总正向有功电能1 */
@Excel(name = "总正向有功电能1")
private BigDecimal totalForwardActiveOne;
/** 总反向有功电能1 */
@Excel(name = "总反向有功电能1")
private BigDecimal totalReverseActiveOne;
/** 正向无功最大需量 */
@Excel(name = "正向无功最大需量")
private BigDecimal forwardReactiveMaxDemand;
/** 反向无功最大需量 */
@Excel(name = "反向无功最大需量")
private BigDecimal reverseReactiveMaxDemand;
/** A 相正向有功电能 */
@Excel(name = "A 相正向有功电能")
private BigDecimal aForwardActiveEnergy;
/** B 相正向有功电能 */
@Excel(name = "B 相正向有功电能")
private BigDecimal bForwardActiveEnergy;
/** C 相正向有功电能 */
@Excel(name = "C 相正向有功电能")
private BigDecimal cForwardActiveEnergy;
/** DIDO 状态、失压状态 */
@Excel(name = "DIDO 状态、失压状态")
private String didoStatus;
/** 运行状态 1高 8 位)/运行状态 2低 8 位) */
@Excel(name = "运行状态 1", readConverterExp = "高=,8=,位=")
private String runningStatus;
/** 零序电流 */
@Excel(name = "零序电流")
private BigDecimal zeroSeqCurrent;
/** 电压不平衡度 */
@Excel(name = "电压不平衡度")
private BigDecimal voltageUnbalanceDegree;
/** 电流不平衡度 */
@Excel(name = "电流不平衡度")
private BigDecimal currentUnbalanceDegree;
/** 当日反向有功最大需量 */
@Excel(name = "当日反向有功最大需量")
private BigDecimal dailyReverseAcMaxDemand;
/** 当日正向无功最大需量 */
@Excel(name = "当日正向无功最大需量")
private BigDecimal dailyForwardReacMaxDemand;
/** 当日反向无功最大需量 */
@Excel(name = "当日反向无功最大需量")
private BigDecimal dailyReverseReacMaxDemand;
/** 上 1 日正向有功最大需量 */
@Excel(name = "上 1 日正向有功最大需量")
private BigDecimal preDayForwardAcMaxDemand;
/** 上 1 日反向有功最大需量 */
@Excel(name = "上 1 日反向有功最大需量")
private BigDecimal preDayReverseAcMaxDemand;
/** 上 1 日正向无功最大需量 */
@Excel(name = "上 1 日正向无功最大需量")
private BigDecimal preDayForwardReacMaxDemand;
/** 上 1 日反向无功最大需量 */
@Excel(name = "上 1 日反向无功最大需量")
private BigDecimal preDayReverseReacMaxDemand;
/** 上 2 日正向有功最大需量 */
@Excel(name = "上 2 日正向有功最大需量")
private BigDecimal pre2dForwardAcMaxDemand;
/** 上 2 日反向有功最大需量 */
@Excel(name = "上 2 日反向有功最大需量")
private BigDecimal pre2dReverseAcMaxDemand;
/** 上 2 日正向无功最大需量 */
@Excel(name = "上 2 日正向无功最大需量")
private BigDecimal pre2dForwardReacMaxDemand;
/** 上 2 日反向无功最大需量 */
@Excel(name = "上 2 日反向无功最大需量")
private BigDecimal pre2dReverseReacMaxDemand;
/** 当前正向有功需量 */
@Excel(name = "当前正向有功需量")
private BigDecimal currentForwardAcDemand;
/** 当前反向有功需量 */
@Excel(name = "当前反向有功需量")
private BigDecimal currentReverseAcDemand;
/** 当前正向无功需量 */
@Excel(name = "当前正向无功需量")
private BigDecimal currentForwardReacDemand;
/** 当前反向无功需量 */
@Excel(name = "当前反向无功需量")
private BigDecimal currentReverseReacDemand;
public void setId(Long id)
{
this.id = id;
@ -1376,6 +1624,626 @@ public class EmsAmmeterData extends BaseEntity
return positiveActiveEnergyEpPlus;
}
public void setCurrentPercent(BigDecimal currentPercent)
{
this.currentPercent = currentPercent;
}
public BigDecimal getCurrentPercent()
{
return currentPercent;
}
public void setVoltagePercent(BigDecimal voltagePercent)
{
this.voltagePercent = voltagePercent;
}
public BigDecimal getVoltagePercent()
{
return voltagePercent;
}
public void setAvgCurrent(BigDecimal avgCurrent)
{
this.avgCurrent = avgCurrent;
}
public BigDecimal getAvgCurrent()
{
return avgCurrent;
}
public void setTotalForwardActiveTwo(BigDecimal totalForwardActiveTwo)
{
this.totalForwardActiveTwo = totalForwardActiveTwo;
}
public BigDecimal getTotalForwardActiveTwo()
{
return totalForwardActiveTwo;
}
public void setTotalPeakForwardActive(BigDecimal totalPeakForwardActive)
{
this.totalPeakForwardActive = totalPeakForwardActive;
}
public BigDecimal getTotalPeakForwardActive()
{
return totalPeakForwardActive;
}
public void setTotalHighForwardActive(BigDecimal totalHighForwardActive)
{
this.totalHighForwardActive = totalHighForwardActive;
}
public BigDecimal getTotalHighForwardActive()
{
return totalHighForwardActive;
}
public void setTotalFlatForwardActive(BigDecimal totalFlatForwardActive)
{
this.totalFlatForwardActive = totalFlatForwardActive;
}
public BigDecimal getTotalFlatForwardActive()
{
return totalFlatForwardActive;
}
public void setTotalValleyForwardActive(BigDecimal totalValleyForwardActive)
{
this.totalValleyForwardActive = totalValleyForwardActive;
}
public BigDecimal getTotalValleyForwardActive()
{
return totalValleyForwardActive;
}
public void setTotalReverseActiveTwo(BigDecimal totalReverseActiveTwo)
{
this.totalReverseActiveTwo = totalReverseActiveTwo;
}
public BigDecimal getTotalReverseActiveTwo()
{
return totalReverseActiveTwo;
}
public void setTotalPeakReverseActive(BigDecimal totalPeakReverseActive)
{
this.totalPeakReverseActive = totalPeakReverseActive;
}
public BigDecimal getTotalPeakReverseActive()
{
return totalPeakReverseActive;
}
public void setTotalHighReverseActive(BigDecimal totalHighReverseActive)
{
this.totalHighReverseActive = totalHighReverseActive;
}
public BigDecimal getTotalHighReverseActive()
{
return totalHighReverseActive;
}
public void setTotalFlatReverseActive(BigDecimal totalFlatReverseActive)
{
this.totalFlatReverseActive = totalFlatReverseActive;
}
public BigDecimal getTotalFlatReverseActive()
{
return totalFlatReverseActive;
}
public void setTotalValleyReverseActive(BigDecimal totalValleyReverseActive)
{
this.totalValleyReverseActive = totalValleyReverseActive;
}
public BigDecimal getTotalValleyReverseActive()
{
return totalValleyReverseActive;
}
public void setDisconnectDetectionIndication(String disconnectDetectionIndication)
{
this.disconnectDetectionIndication = disconnectDetectionIndication;
}
public String getDisconnectDetectionIndication()
{
return disconnectDetectionIndication;
}
public void setRatedPrimaryCurrentValue(BigDecimal ratedPrimaryCurrentValue)
{
this.ratedPrimaryCurrentValue = ratedPrimaryCurrentValue;
}
public BigDecimal getRatedPrimaryCurrentValue()
{
return ratedPrimaryCurrentValue;
}
public void setSwitchInputOutputStatus(String switchInputOutputStatus)
{
this.switchInputOutputStatus = switchInputOutputStatus;
}
public String getSwitchInputOutputStatus()
{
return switchInputOutputStatus;
}
public void setAlarmStatus(String alarmStatus)
{
this.alarmStatus = alarmStatus;
}
public String getAlarmStatus()
{
return alarmStatus;
}
public void setCurrentTotalVoltagePercent(BigDecimal currentTotalVoltagePercent)
{
this.currentTotalVoltagePercent = currentTotalVoltagePercent;
}
public BigDecimal getCurrentTotalVoltagePercent()
{
return currentTotalVoltagePercent;
}
public void setVoltageContentPercent(BigDecimal voltageContentPercent)
{
this.voltageContentPercent = voltageContentPercent;
}
public BigDecimal getVoltageContentPercent()
{
return voltageContentPercent;
}
public void setVoltageAcPercent(BigDecimal voltageAcPercent)
{
this.voltageAcPercent = voltageAcPercent;
}
public BigDecimal getVoltageAcPercent()
{
return voltageAcPercent;
}
public void setCurrentTotalCurrentPercent(BigDecimal currentTotalCurrentPercent)
{
this.currentTotalCurrentPercent = currentTotalCurrentPercent;
}
public BigDecimal getCurrentTotalCurrentPercent()
{
return currentTotalCurrentPercent;
}
public void setCurrentContentPercent(BigDecimal currentContentPercent)
{
this.currentContentPercent = currentContentPercent;
}
public BigDecimal getCurrentContentPercent()
{
return currentContentPercent;
}
public void setCurrentAcPercent(BigDecimal currentAcPercent)
{
this.currentAcPercent = currentAcPercent;
}
public BigDecimal getCurrentAcPercent()
{
return currentAcPercent;
}
public void setCurrentTotalPowerPercent(BigDecimal currentTotalPowerPercent)
{
this.currentTotalPowerPercent = currentTotalPowerPercent;
}
public BigDecimal getCurrentTotalPowerPercent()
{
return currentTotalPowerPercent;
}
public void setPowerContentPercent(BigDecimal powerContentPercent)
{
this.powerContentPercent = powerContentPercent;
}
public BigDecimal getPowerContentPercent()
{
return powerContentPercent;
}
public void setPowerAcPercent(BigDecimal powerAcPercent)
{
this.powerAcPercent = powerAcPercent;
}
public BigDecimal getPowerAcPercent()
{
return powerAcPercent;
}
public void setDataSettingYearMonth(String dataSettingYearMonth)
{
this.dataSettingYearMonth = dataSettingYearMonth;
}
public String getDataSettingYearMonth()
{
return dataSettingYearMonth;
}
public void setDataSettingDayHour(String dataSettingDayHour)
{
this.dataSettingDayHour = dataSettingDayHour;
}
public String getDataSettingDayHour()
{
return dataSettingDayHour;
}
public void setDataSettingMinutesSeconds(String dataSettingMinutesSeconds)
{
this.dataSettingMinutesSeconds = dataSettingMinutesSeconds;
}
public String getDataSettingMinutesSeconds()
{
return dataSettingMinutesSeconds;
}
public void setCurrentRate(BigDecimal currentRate)
{
this.currentRate = currentRate;
}
public BigDecimal getCurrentRate()
{
return currentRate;
}
public void setVersionNumber(String versionNumber)
{
this.versionNumber = versionNumber;
}
public String getVersionNumber()
{
return versionNumber;
}
public void setVoltage(BigDecimal voltage)
{
this.voltage = voltage;
}
public BigDecimal getVoltage()
{
return voltage;
}
public void setCurrent(BigDecimal current)
{
this.current = current;
}
public BigDecimal getCurrent()
{
return current;
}
public void setPower(BigDecimal power)
{
this.power = power;
}
public BigDecimal getPower()
{
return power;
}
public void setInternalTemp(BigDecimal internalTemp)
{
this.internalTemp = internalTemp;
}
public BigDecimal getInternalTemp()
{
return internalTemp;
}
public void setTotalForwardActiveOne(BigDecimal totalForwardActiveOne)
{
this.totalForwardActiveOne = totalForwardActiveOne;
}
public BigDecimal getTotalForwardActiveOne()
{
return totalForwardActiveOne;
}
public void setTotalReverseActiveOne(BigDecimal totalReverseActiveOne)
{
this.totalReverseActiveOne = totalReverseActiveOne;
}
public BigDecimal getTotalReverseActiveOne()
{
return totalReverseActiveOne;
}
public void setForwardReactiveMaxDemand(BigDecimal forwardReactiveMaxDemand)
{
this.forwardReactiveMaxDemand = forwardReactiveMaxDemand;
}
public BigDecimal getForwardReactiveMaxDemand()
{
return forwardReactiveMaxDemand;
}
public void setReverseReactiveMaxDemand(BigDecimal reverseReactiveMaxDemand)
{
this.reverseReactiveMaxDemand = reverseReactiveMaxDemand;
}
public BigDecimal getReverseReactiveMaxDemand()
{
return reverseReactiveMaxDemand;
}
public void setaForwardActiveEnergy(BigDecimal aForwardActiveEnergy)
{
this.aForwardActiveEnergy = aForwardActiveEnergy;
}
public BigDecimal getaForwardActiveEnergy()
{
return aForwardActiveEnergy;
}
public void setbForwardActiveEnergy(BigDecimal bForwardActiveEnergy)
{
this.bForwardActiveEnergy = bForwardActiveEnergy;
}
public BigDecimal getbForwardActiveEnergy()
{
return bForwardActiveEnergy;
}
public void setcForwardActiveEnergy(BigDecimal cForwardActiveEnergy)
{
this.cForwardActiveEnergy = cForwardActiveEnergy;
}
public BigDecimal getcForwardActiveEnergy()
{
return cForwardActiveEnergy;
}
public void setDidoStatus(String didoStatus)
{
this.didoStatus = didoStatus;
}
public String getDidoStatus()
{
return didoStatus;
}
public void setRunningStatus(String runningStatus)
{
this.runningStatus = runningStatus;
}
public String getRunningStatus()
{
return runningStatus;
}
public void setZeroSeqCurrent(BigDecimal zeroSeqCurrent)
{
this.zeroSeqCurrent = zeroSeqCurrent;
}
public BigDecimal getZeroSeqCurrent()
{
return zeroSeqCurrent;
}
public void setVoltageUnbalanceDegree(BigDecimal voltageUnbalanceDegree)
{
this.voltageUnbalanceDegree = voltageUnbalanceDegree;
}
public BigDecimal getVoltageUnbalanceDegree()
{
return voltageUnbalanceDegree;
}
public void setCurrentUnbalanceDegree(BigDecimal currentUnbalanceDegree)
{
this.currentUnbalanceDegree = currentUnbalanceDegree;
}
public BigDecimal getCurrentUnbalanceDegree()
{
return currentUnbalanceDegree;
}
public void setDailyReverseAcMaxDemand(BigDecimal dailyReverseAcMaxDemand)
{
this.dailyReverseAcMaxDemand = dailyReverseAcMaxDemand;
}
public BigDecimal getDailyReverseAcMaxDemand()
{
return dailyReverseAcMaxDemand;
}
public void setDailyForwardReacMaxDemand(BigDecimal dailyForwardReacMaxDemand)
{
this.dailyForwardReacMaxDemand = dailyForwardReacMaxDemand;
}
public BigDecimal getDailyForwardReacMaxDemand()
{
return dailyForwardReacMaxDemand;
}
public void setDailyReverseReacMaxDemand(BigDecimal dailyReverseReacMaxDemand)
{
this.dailyReverseReacMaxDemand = dailyReverseReacMaxDemand;
}
public BigDecimal getDailyReverseReacMaxDemand()
{
return dailyReverseReacMaxDemand;
}
public void setPreDayForwardAcMaxDemand(BigDecimal preDayForwardAcMaxDemand)
{
this.preDayForwardAcMaxDemand = preDayForwardAcMaxDemand;
}
public BigDecimal getPreDayForwardAcMaxDemand()
{
return preDayForwardAcMaxDemand;
}
public void setPreDayReverseAcMaxDemand(BigDecimal preDayReverseAcMaxDemand)
{
this.preDayReverseAcMaxDemand = preDayReverseAcMaxDemand;
}
public BigDecimal getPreDayReverseAcMaxDemand()
{
return preDayReverseAcMaxDemand;
}
public void setPreDayForwardReacMaxDemand(BigDecimal preDayForwardReacMaxDemand)
{
this.preDayForwardReacMaxDemand = preDayForwardReacMaxDemand;
}
public BigDecimal getPreDayForwardReacMaxDemand()
{
return preDayForwardReacMaxDemand;
}
public void setPreDayReverseReacMaxDemand(BigDecimal preDayReverseReacMaxDemand)
{
this.preDayReverseReacMaxDemand = preDayReverseReacMaxDemand;
}
public BigDecimal getPreDayReverseReacMaxDemand()
{
return preDayReverseReacMaxDemand;
}
public void setPre2dForwardAcMaxDemand(BigDecimal pre2dForwardAcMaxDemand)
{
this.pre2dForwardAcMaxDemand = pre2dForwardAcMaxDemand;
}
public BigDecimal getPre2dForwardAcMaxDemand()
{
return pre2dForwardAcMaxDemand;
}
public void setPre2dReverseAcMaxDemand(BigDecimal pre2dReverseAcMaxDemand)
{
this.pre2dReverseAcMaxDemand = pre2dReverseAcMaxDemand;
}
public BigDecimal getPre2dReverseAcMaxDemand()
{
return pre2dReverseAcMaxDemand;
}
public void setPre2dForwardReacMaxDemand(BigDecimal pre2dForwardReacMaxDemand)
{
this.pre2dForwardReacMaxDemand = pre2dForwardReacMaxDemand;
}
public BigDecimal getPre2dForwardReacMaxDemand()
{
return pre2dForwardReacMaxDemand;
}
public void setPre2dReverseReacMaxDemand(BigDecimal pre2dReverseReacMaxDemand)
{
this.pre2dReverseReacMaxDemand = pre2dReverseReacMaxDemand;
}
public BigDecimal getPre2dReverseReacMaxDemand()
{
return pre2dReverseReacMaxDemand;
}
public void setCurrentForwardAcDemand(BigDecimal currentForwardAcDemand)
{
this.currentForwardAcDemand = currentForwardAcDemand;
}
public BigDecimal getCurrentForwardAcDemand()
{
return currentForwardAcDemand;
}
public void setCurrentReverseAcDemand(BigDecimal currentReverseAcDemand)
{
this.currentReverseAcDemand = currentReverseAcDemand;
}
public BigDecimal getCurrentReverseAcDemand()
{
return currentReverseAcDemand;
}
public void setCurrentForwardReacDemand(BigDecimal currentForwardReacDemand)
{
this.currentForwardReacDemand = currentForwardReacDemand;
}
public BigDecimal getCurrentForwardReacDemand()
{
return currentForwardReacDemand;
}
public void setCurrentReverseReacDemand(BigDecimal currentReverseReacDemand)
{
this.currentReverseReacDemand = currentReverseReacDemand;
}
public BigDecimal getCurrentReverseReacDemand()
{
return currentReverseReacDemand;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -1481,6 +2349,68 @@ public class EmsAmmeterData extends BaseEntity
.append("reverseActiveEnergyEpMinus", getReverseActiveEnergyEpMinus())
.append("positiveReactiveEnergyEqPlus", getPositiveReactiveEnergyEqPlus())
.append("positiveActiveEnergyEpPlus", getPositiveActiveEnergyEpPlus())
.append("currentPercent", getCurrentPercent())
.append("voltagePercent", getVoltagePercent())
.append("avgCurrent", getAvgCurrent())
.append("totalForwardActiveTwo", getTotalForwardActiveTwo())
.append("totalPeakForwardActive", getTotalPeakForwardActive())
.append("totalHighForwardActive", getTotalHighForwardActive())
.append("totalFlatForwardActive", getTotalFlatForwardActive())
.append("totalValleyForwardActive", getTotalValleyForwardActive())
.append("totalReverseActiveTwo", getTotalReverseActiveTwo())
.append("totalPeakReverseActive", getTotalPeakReverseActive())
.append("totalHighReverseActive", getTotalHighReverseActive())
.append("totalFlatReverseActive", getTotalFlatReverseActive())
.append("totalValleyReverseActive", getTotalValleyReverseActive())
.append("disconnectDetectionIndication", getDisconnectDetectionIndication())
.append("ratedPrimaryCurrentValue", getRatedPrimaryCurrentValue())
.append("switchInputOutputStatus", getSwitchInputOutputStatus())
.append("alarmStatus", getAlarmStatus())
.append("currentTotalVoltagePercent", getCurrentTotalVoltagePercent())
.append("voltageContentPercent", getVoltageContentPercent())
.append("voltageAcPercent", getVoltageAcPercent())
.append("currentTotalCurrentPercent", getCurrentTotalCurrentPercent())
.append("currentContentPercent", getCurrentContentPercent())
.append("currentAcPercent", getCurrentAcPercent())
.append("currentTotalPowerPercent", getCurrentTotalPowerPercent())
.append("powerContentPercent", getPowerContentPercent())
.append("powerAcPercent", getPowerAcPercent())
.append("dataSettingYearMonth", getDataSettingYearMonth())
.append("dataSettingDayHour", getDataSettingDayHour())
.append("dataSettingMinutesSeconds", getDataSettingMinutesSeconds())
.append("currentRate", getCurrentRate())
.append("versionNumber", getVersionNumber())
.append("voltage", getVoltage())
.append("current", getCurrent())
.append("power", getPower())
.append("internalTemp", getInternalTemp())
.append("totalForwardActiveOne", getTotalForwardActiveOne())
.append("totalReverseActiveOne", getTotalReverseActiveOne())
.append("forwardReactiveMaxDemand", getForwardReactiveMaxDemand())
.append("reverseReactiveMaxDemand", getReverseReactiveMaxDemand())
.append("aForwardActiveEnergy", getaForwardActiveEnergy())
.append("bForwardActiveEnergy", getbForwardActiveEnergy())
.append("cForwardActiveEnergy", getcForwardActiveEnergy())
.append("didoStatus", getDidoStatus())
.append("runningStatus", getRunningStatus())
.append("zeroSeqCurrent", getZeroSeqCurrent())
.append("voltageUnbalanceDegree", getVoltageUnbalanceDegree())
.append("currentUnbalanceDegree", getCurrentUnbalanceDegree())
.append("dailyReverseAcMaxDemand", getDailyReverseAcMaxDemand())
.append("dailyForwardReacMaxDemand", getDailyForwardReacMaxDemand())
.append("dailyReverseReacMaxDemand", getDailyReverseReacMaxDemand())
.append("preDayForwardAcMaxDemand", getPreDayForwardAcMaxDemand())
.append("preDayReverseAcMaxDemand", getPreDayReverseAcMaxDemand())
.append("preDayForwardReacMaxDemand", getPreDayForwardReacMaxDemand())
.append("preDayReverseReacMaxDemand", getPreDayReverseReacMaxDemand())
.append("pre2dForwardAcMaxDemand", getPre2dForwardAcMaxDemand())
.append("pre2dReverseAcMaxDemand", getPre2dReverseAcMaxDemand())
.append("pre2dForwardReacMaxDemand", getPre2dForwardReacMaxDemand())
.append("pre2dReverseReacMaxDemand", getPre2dReverseReacMaxDemand())
.append("currentForwardAcDemand", getCurrentForwardAcDemand())
.append("currentReverseAcDemand", getCurrentReverseAcDemand())
.append("currentForwardReacDemand", getCurrentForwardReacDemand())
.append("currentReverseReacDemand", getCurrentReverseReacDemand())
.toString();
}
}

View File

@ -11,7 +11,7 @@ import com.xzzn.common.annotation.Excel;
* 电池簇数据对象 ems_battery_cluster
*
* @author xzzn
* @date 2025-06-29
* @date 2025-07-29
*/
public class EmsBatteryCluster extends BaseEntity
{
@ -20,16 +20,16 @@ public class EmsBatteryCluster extends BaseEntity
/** */
private Long id;
/** 工作状态 */
@Excel(name = "工作状态")
/** 工作状态0-正常 1-异常 2-停止 */
@Excel(name = "工作状态0-正常 1-异常 2-停止")
private String workStatus;
/** 与PCS通信状态 */
@Excel(name = "与PCS通信状态")
/** 与PCS通信状态0-正常 1-通信中断 2-异常 */
@Excel(name = "与PCS通信状态0-正常 1-通信中断 2-异常")
private String pcsCommunicationStatus;
/** 与EMS通信状态 */
@Excel(name = "与EMS通信状态")
/** 与EMS通信状态0-正常 1-通信中断 2-异常 */
@Excel(name = "与EMS通信状态0-正常 1-通信中断 2-异常")
private String emsCommunicationStatus;
/** 簇电压 (V) */

View File

@ -12,7 +12,7 @@ import com.xzzn.common.annotation.Excel;
* 单体电池实时数据对象 ems_battery_data
*
* @author xzzn
* @date 2025-06-29
* @date 2025-07-29
*/
public class EmsBatteryData extends BaseEntity
{
@ -66,6 +66,10 @@ public class EmsBatteryData extends BaseEntity
@Excel(name = "簇设备id")
private String clusterDeviceId;
/** 单体电池内阻 */
@Excel(name = "单体电池内阻")
private BigDecimal interResistance;
public void setId(Long id)
{
this.id = id;
@ -186,6 +190,16 @@ public class EmsBatteryData extends BaseEntity
return clusterDeviceId;
}
public void setInterResistance(BigDecimal interResistance)
{
this.interResistance = interResistance;
}
public BigDecimal getInterResistance()
{
return interResistance;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -206,6 +220,7 @@ public class EmsBatteryData extends BaseEntity
.append("siteId", getSiteId())
.append("deviceId", getDeviceId())
.append("clusterDeviceId", getClusterDeviceId())
.append("interResistance", getInterResistance())
.toString();
}
}

View File

@ -0,0 +1,213 @@
package com.xzzn.ems.domain;
import java.math.BigDecimal;
import java.util.Date;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.xzzn.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.xzzn.common.annotation.Excel;
/**
* 单体电池每日最新数据对象 ems_battery_data_daily_latest
*
* @author xzzn
* @date 2025-07-17
*/
public class EmsBatteryDataDailyLatest extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** 电池堆 */
@Excel(name = "电池堆")
private String batteryPack;
/** 电池簇 */
@Excel(name = "电池簇")
private String batteryCluster;
/** 单体编号 */
@Excel(name = "单体编号")
private String batteryCellId;
/** 电压 (V) */
@Excel(name = "电压 (V)")
private BigDecimal voltage;
/** 温度 (℃) */
@Excel(name = "温度 (℃)")
private BigDecimal temperature;
/** SOC (%) */
@Excel(name = "SOC (%)")
private BigDecimal soc;
/** SOH (%) */
@Excel(name = "SOH (%)")
private BigDecimal soh;
/** 日期yyyy-MM-dd */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "日期yyyy-MM-dd", width = 30, dateFormat = "yyyy-MM-dd")
private Date dateDay;
/** 数据采集时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "数据采集时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date dataTimestamp;
/** 站点id */
@Excel(name = "站点id")
private String siteId;
/** 设备唯一标识符 */
@Excel(name = "设备唯一标识符")
private String deviceId;
/** 簇设备id */
@Excel(name = "簇设备id")
private String clusterDeviceId;
public void setBatteryPack(String batteryPack)
{
this.batteryPack = batteryPack;
}
public String getBatteryPack()
{
return batteryPack;
}
public void setBatteryCluster(String batteryCluster)
{
this.batteryCluster = batteryCluster;
}
public String getBatteryCluster()
{
return batteryCluster;
}
public void setBatteryCellId(String batteryCellId)
{
this.batteryCellId = batteryCellId;
}
public String getBatteryCellId()
{
return batteryCellId;
}
public void setVoltage(BigDecimal voltage)
{
this.voltage = voltage;
}
public BigDecimal getVoltage()
{
return voltage;
}
public void setTemperature(BigDecimal temperature)
{
this.temperature = temperature;
}
public BigDecimal getTemperature()
{
return temperature;
}
public void setSoc(BigDecimal soc)
{
this.soc = soc;
}
public BigDecimal getSoc()
{
return soc;
}
public void setSoh(BigDecimal soh)
{
this.soh = soh;
}
public BigDecimal getSoh()
{
return soh;
}
public void setDateDay(Date dateDay)
{
this.dateDay = dateDay;
}
public Date getDateDay()
{
return dateDay;
}
public void setDataTimestamp(Date dataTimestamp)
{
this.dataTimestamp = dataTimestamp;
}
public Date getDataTimestamp()
{
return dataTimestamp;
}
public void setSiteId(String siteId)
{
this.siteId = siteId;
}
public String getSiteId()
{
return siteId;
}
public void setDeviceId(String deviceId)
{
this.deviceId = deviceId;
}
public String getDeviceId()
{
return deviceId;
}
public void setClusterDeviceId(String clusterDeviceId)
{
this.clusterDeviceId = clusterDeviceId;
}
public String getClusterDeviceId()
{
return clusterDeviceId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("batteryPack", getBatteryPack())
.append("batteryCluster", getBatteryCluster())
.append("batteryCellId", getBatteryCellId())
.append("voltage", getVoltage())
.append("temperature", getTemperature())
.append("soc", getSoc())
.append("soh", getSoh())
.append("dateDay", getDateDay())
.append("dataTimestamp", getDataTimestamp())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("siteId", getSiteId())
.append("deviceId", getDeviceId())
.append("clusterDeviceId", getClusterDeviceId())
.toString();
}
}

View File

@ -0,0 +1,164 @@
package com.xzzn.ems.domain;
import java.math.BigDecimal;
import com.xzzn.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.xzzn.common.annotation.Excel;
/**
* 电池组数据对象 ems_battery_group
*
* @author xzzn
* @date 2025-07-29
*/
public class EmsBatteryGroup extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 电池组状态 */
@Excel(name = "电池组状态")
private String status;
/** 电压 (V) */
@Excel(name = "电压 (V)")
private BigDecimal voltage;
/** 电流 (A) */
@Excel(name = "电流 (A)")
private BigDecimal current;
/** SOC (%) */
@Excel(name = "SOC (%)")
private BigDecimal soc;
/** SOH (%) */
@Excel(name = "SOH (%)")
private BigDecimal soh;
/** 备电预估时长 */
@Excel(name = "备电预估时长")
private BigDecimal estimatedBackupDuration;
/** 站点id */
@Excel(name = "站点id")
private String siteId;
/** 设备唯一标识符 */
@Excel(name = "设备唯一标识符")
private String deviceId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setStatus(String status)
{
this.status = status;
}
public String getStatus()
{
return status;
}
public void setVoltage(BigDecimal voltage)
{
this.voltage = voltage;
}
public BigDecimal getVoltage()
{
return voltage;
}
public void setCurrent(BigDecimal current)
{
this.current = current;
}
public BigDecimal getCurrent()
{
return current;
}
public void setSoc(BigDecimal soc)
{
this.soc = soc;
}
public BigDecimal getSoc()
{
return soc;
}
public void setSoh(BigDecimal soh)
{
this.soh = soh;
}
public BigDecimal getSoh()
{
return soh;
}
public void setEstimatedBackupDuration(BigDecimal estimatedBackupDuration)
{
this.estimatedBackupDuration = estimatedBackupDuration;
}
public BigDecimal getEstimatedBackupDuration()
{
return estimatedBackupDuration;
}
public void setSiteId(String siteId)
{
this.siteId = siteId;
}
public String getSiteId()
{
return siteId;
}
public void setDeviceId(String deviceId)
{
this.deviceId = deviceId;
}
public String getDeviceId()
{
return deviceId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("status", getStatus())
.append("voltage", getVoltage())
.append("current", getCurrent())
.append("soc", getSoc())
.append("soh", getSoh())
.append("estimatedBackupDuration", getEstimatedBackupDuration())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("siteId", getSiteId())
.append("deviceId", getDeviceId())
.toString();
}
}

View File

@ -188,6 +188,62 @@ public class EmsBatteryStack extends BaseEntity
@Excel(name = "设备id")
private String deviceId;
/** 单体个数 */
@Excel(name = "单体个数")
private Long batteryNumber;
/** 单体平均电压 */
@Excel(name = "单体平均电压")
private BigDecimal batteryAvgVoltage;
/** 单体电池压差 */
@Excel(name = "单体电池压差")
private BigDecimal batteryDifferentPressure;
/** 平均温度 */
@Excel(name = "平均温度")
private BigDecimal avgTemperature;
/** 单体电池温度差 */
@Excel(name = "单体电池温度差")
private BigDecimal batteryDifferentTemperature;
/** 最大单体内阻 */
@Excel(name = "最大单体内阻")
private BigDecimal maxInternalResistance;
/** 最小单体内阻 */
@Excel(name = "最小单体内阻")
private BigDecimal minInternalResistance;
/** 平均单体内阻 */
@Excel(name = "平均单体内阻")
private BigDecimal avgInternalResistance;
/** 单体内阻差 */
@Excel(name = "单体内阻差")
private BigDecimal batteryDefferentResistance;
/** 最大单体内阻编号 */
@Excel(name = "最大单体内阻编号")
private Long maxResistanceCellId;
/** 最小单体内阻编号 */
@Excel(name = "最小单体内阻编号")
private Long minResistanceCellId;
/** 环境温度 */
@Excel(name = "环境温度")
private BigDecimal environmentTemperature;
/** 环境湿度 */
@Excel(name = "环境湿度")
private BigDecimal environmentHumidity;
/** 断路器状态 */
@Excel(name = "断路器状态")
private String circuitBreakerStatus;
public void setId(Long id)
{
this.id = id;
@ -618,6 +674,146 @@ public class EmsBatteryStack extends BaseEntity
return deviceId;
}
public void setBatteryNumber(Long batteryNumber)
{
this.batteryNumber = batteryNumber;
}
public Long getBatteryNumber()
{
return batteryNumber;
}
public void setBatteryAvgVoltage(BigDecimal batteryAvgVoltage)
{
this.batteryAvgVoltage = batteryAvgVoltage;
}
public BigDecimal getBatteryAvgVoltage()
{
return batteryAvgVoltage;
}
public void setBatteryDifferentPressure(BigDecimal batteryDifferentPressure)
{
this.batteryDifferentPressure = batteryDifferentPressure;
}
public BigDecimal getBatteryDifferentPressure()
{
return batteryDifferentPressure;
}
public void setAvgTemperature(BigDecimal avgTemperature)
{
this.avgTemperature = avgTemperature;
}
public BigDecimal getAvgTemperature()
{
return avgTemperature;
}
public void setBatteryDifferentTemperature(BigDecimal batteryDifferentTemperature)
{
this.batteryDifferentTemperature = batteryDifferentTemperature;
}
public BigDecimal getBatteryDifferentTemperature()
{
return batteryDifferentTemperature;
}
public void setMaxInternalResistance(BigDecimal maxInternalResistance)
{
this.maxInternalResistance = maxInternalResistance;
}
public BigDecimal getMaxInternalResistance()
{
return maxInternalResistance;
}
public void setMinInternalResistance(BigDecimal minInternalResistance)
{
this.minInternalResistance = minInternalResistance;
}
public BigDecimal getMinInternalResistance()
{
return minInternalResistance;
}
public void setAvgInternalResistance(BigDecimal avgInternalResistance)
{
this.avgInternalResistance = avgInternalResistance;
}
public BigDecimal getAvgInternalResistance()
{
return avgInternalResistance;
}
public void setBatteryDefferentResistance(BigDecimal batteryDefferentResistance)
{
this.batteryDefferentResistance = batteryDefferentResistance;
}
public BigDecimal getBatteryDefferentResistance()
{
return batteryDefferentResistance;
}
public void setMaxResistanceCellId(Long maxResistanceCellId)
{
this.maxResistanceCellId = maxResistanceCellId;
}
public Long getMaxResistanceCellId()
{
return maxResistanceCellId;
}
public void setMinResistanceCellId(Long minResistanceCellId)
{
this.minResistanceCellId = minResistanceCellId;
}
public Long getMinResistanceCellId()
{
return minResistanceCellId;
}
public void setEnvironmentTemperature(BigDecimal environmentTemperature)
{
this.environmentTemperature = environmentTemperature;
}
public BigDecimal getEnvironmentTemperature()
{
return environmentTemperature;
}
public void setEnvironmentHumidity(BigDecimal environmentHumidity)
{
this.environmentHumidity = environmentHumidity;
}
public BigDecimal getEnvironmentHumidity()
{
return environmentHumidity;
}
public void setCircuitBreakerStatus(String circuitBreakerStatus)
{
this.circuitBreakerStatus = circuitBreakerStatus;
}
public String getCircuitBreakerStatus()
{
return circuitBreakerStatus;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -668,6 +864,20 @@ public class EmsBatteryStack extends BaseEntity
.append("createBy", getCreateBy())
.append("updateTime", getUpdateTime())
.append("updateBy", getUpdateBy())
.append("batteryNumber", getBatteryNumber())
.append("batteryAvgVoltage", getBatteryAvgVoltage())
.append("batteryDifferentPressure", getBatteryDifferentPressure())
.append("avgTemperature", getAvgTemperature())
.append("batteryDifferentTemperature", getBatteryDifferentTemperature())
.append("maxInternalResistance", getMaxInternalResistance())
.append("minInternalResistance", getMinInternalResistance())
.append("avgInternalResistance", getAvgInternalResistance())
.append("batteryDefferentResistance", getBatteryDefferentResistance())
.append("maxResistanceCellId", getMaxResistanceCellId())
.append("minResistanceCellId", getMinResistanceCellId())
.append("environmentTemperature", getEnvironmentTemperature())
.append("environmentHumidity", getEnvironmentHumidity())
.append("circuitBreakerStatus", getCircuitBreakerStatus())
.toString();
}
}

View File

@ -0,0 +1,104 @@
package com.xzzn.ems.domain;
import java.math.BigDecimal;
import com.xzzn.common.core.domain.BaseEntity;
import org.apache.commons.lang3.builder.ToStringBuilder;
import org.apache.commons.lang3.builder.ToStringStyle;
import com.xzzn.common.annotation.Excel;
/**
* 动环数据对象 ems_dh_data
*
* @author xzzn
* @date 2025-07-28
*/
public class EmsDhData extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
private Long id;
/** 湿度 */
@Excel(name = "湿度")
private BigDecimal humidity;
/** 温度 */
@Excel(name = "温度")
private BigDecimal temperature;
/** 站点id */
@Excel(name = "站点id")
private String siteId;
/** 设备唯一标识符 */
@Excel(name = "设备唯一标识符")
private String deviceId;
public void setId(Long id)
{
this.id = id;
}
public Long getId()
{
return id;
}
public void setHumidity(BigDecimal humidity)
{
this.humidity = humidity;
}
public BigDecimal getHumidity()
{
return humidity;
}
public void setTemperature(BigDecimal temperature)
{
this.temperature = temperature;
}
public BigDecimal getTemperature()
{
return temperature;
}
public void setSiteId(String siteId)
{
this.siteId = siteId;
}
public String getSiteId()
{
return siteId;
}
public void setDeviceId(String deviceId)
{
this.deviceId = deviceId;
}
public String getDeviceId()
{
return deviceId;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("humidity", getHumidity())
.append("temperature", getTemperature())
.append("createBy", getCreateBy())
.append("createTime", getCreateTime())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("siteId", getSiteId())
.append("deviceId", getDeviceId())
.toString();
}
}

View File

@ -202,6 +202,10 @@ public class EmsPcsData extends BaseEntity
@Excel(name = "系统输出W相电流")
private BigDecimal sysWCurrent;
/** 电网频率 */
@Excel(name = "电网频率")
private BigDecimal dwFrequency;
public void setId(Long id)
{
this.id = id;
@ -662,6 +666,16 @@ public class EmsPcsData extends BaseEntity
return sysWCurrent;
}
public void setDwFrequency(BigDecimal dwFrequency)
{
this.dwFrequency = dwFrequency;
}
public BigDecimal getDwFrequency()
{
return dwFrequency;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -716,6 +730,7 @@ public class EmsPcsData extends BaseEntity
.append("sysUCurrent", getSysUCurrent())
.append("sysVCurrent", getSysVCurrent())
.append("sysWCurrent", getSysWCurrent())
.append("dwFrequency", getDwFrequency())
.toString();
}
}

View File

@ -46,6 +46,18 @@ public class EmsStrategyCurve extends BaseEntity
@Excel(name = "站点id")
private String siteId;
/** 模板id */
@Excel(name = "模板id")
private String templateId;
/** 月份1-12 */
@Excel(name = "月份1-12")
private Long month;
/** 是否删除 0-已删除 1-未删除 */
@Excel(name = "是否删除 0-已删除 1-未删除")
private Long isDelete;
public void setId(Long id)
{
this.id = id;
@ -116,6 +128,30 @@ public class EmsStrategyCurve extends BaseEntity
return siteId;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public Long getMonth() {
return month;
}
public void setMonth(Long month) {
this.month = month;
}
public Long getIsDelete() {
return isDelete;
}
public void setIsDelete(Long isDelete) {
this.isDelete = isDelete;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -131,6 +167,9 @@ public class EmsStrategyCurve extends BaseEntity
.append("updateTime", getUpdateTime())
.append("remark", getRemark())
.append("siteId", getSiteId())
.append("templateId", getTemplateId())
.append("month", getMonth())
.append("isDelete", getIsDelete())
.toString();
}
}

View File

@ -38,6 +38,10 @@ public class EmsStrategyTimeConfig extends BaseEntity
@Excel(name = "模版id")
private String templateId;
/** 是否下发 0-已下发 1-未下发 */
@Excel(name = "是否下发 0-已下发 1-未下发")
private int isPost;
public void setId(Long id)
{
this.id = id;
@ -98,6 +102,14 @@ public class EmsStrategyTimeConfig extends BaseEntity
return templateId;
}
public int getIsPost() {
return isPost;
}
public void setIsPost(int isPost) {
this.isPost = isPost;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
@ -112,6 +124,7 @@ public class EmsStrategyTimeConfig extends BaseEntity
.append("remark", getRemark())
.append("siteId", getSiteId())
.append("templateId", getTemplateId())
.append("isPost", getIsPost())
.toString();
}
}

View File

@ -9,15 +9,15 @@ import com.xzzn.common.annotation.Excel;
/**
* 工单主对象 ems_ticket
*
*
* @author xzzn
* @date 2025-06-26
* @date 2025-07-15
*/
public class EmsTicket extends BaseEntity
{
private static final long serialVersionUID = 1L;
/** $column.columnComment */
/** */
private String id;
/** 工单号规则T+日期+6位随机 */
@ -44,9 +44,14 @@ public class EmsTicket extends BaseEntity
@Excel(name = "1待处理 2处理中 3已完成")
private Long status;
/** 期望完成时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "期望完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date expectedCompleteTime;
/** 完成时间 */
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd")
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@Excel(name = "完成时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
private Date completeTime;
/** 处理人ID */
@ -57,22 +62,22 @@ public class EmsTicket extends BaseEntity
@Excel(name = "0-已废弃 1-有效")
private Long isDelete;
public void setId(String id)
public void setId(String id)
{
this.id = id;
}
public String getId()
public String getId()
{
return id;
}
public void setTicketNo(String ticketNo)
public void setTicketNo(String ticketNo)
{
this.ticketNo = ticketNo;
}
public String getTicketNo()
public String getTicketNo()
{
return ticketNo;
}
@ -87,91 +92,104 @@ public class EmsTicket extends BaseEntity
return userId;
}
public void setTitle(String title)
public void setTitle(String title)
{
this.title = title;
}
public String getTitle()
public String getTitle()
{
return title;
}
public void setContent(String content)
public void setContent(String content)
{
this.content = content;
}
public String getContent()
public String getContent()
{
return content;
}
public void setImages(String images)
public void setImages(String images)
{
this.images = images;
}
public String getImages()
public String getImages()
{
return images;
}
public void setStatus(Long status)
public void setStatus(Long status)
{
this.status = status;
}
public Long getStatus()
public Long getStatus()
{
return status;
}
public void setCompleteTime(Date completeTime)
public void setExpectedCompleteTime(Date expectedCompleteTime)
{
this.expectedCompleteTime = expectedCompleteTime;
}
public Date getExpectedCompleteTime()
{
return expectedCompleteTime;
}
public void setCompleteTime(Date completeTime)
{
this.completeTime = completeTime;
}
public Date getCompleteTime()
public Date getCompleteTime()
{
return completeTime;
}
public void setWorkUserId(Long workUserId)
public void setWorkUserId(Long workUserId)
{
this.workUserId = workUserId;
}
public Long getWorkUserId()
public Long getWorkUserId()
{
return workUserId;
}
public Long getIsDelete() {
return isDelete;
public void setIsDelete(Long isDelete)
{
this.isDelete = isDelete;
}
public void setIsDelete(Long isDelete) {
this.isDelete = isDelete;
public Long getIsDelete()
{
return isDelete;
}
@Override
public String toString() {
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
.append("id", getId())
.append("ticketNo", getTicketNo())
.append("userId", getUserId())
.append("title", getTitle())
.append("content", getContent())
.append("images", getImages())
.append("status", getStatus())
.append("createTime", getCreateTime())
.append("completeTime", getCompleteTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("workUserId", getWorkUserId())
.append("isDelete", getIsDelete())
.toString();
.append("id", getId())
.append("ticketNo", getTicketNo())
.append("userId", getUserId())
.append("title", getTitle())
.append("content", getContent())
.append("images", getImages())
.append("status", getStatus())
.append("expectedCompleteTime", getExpectedCompleteTime())
.append("completeTime", getCompleteTime())
.append("createTime", getCreateTime())
.append("createBy", getCreateBy())
.append("updateBy", getUpdateBy())
.append("updateTime", getUpdateTime())
.append("workUserId", getWorkUserId())
.append("isDelete", getIsDelete())
.toString();
}
}

View File

@ -25,6 +25,8 @@ public class DateSearchRequest {
private String dataType;
private String clusterDeviceId;
public Date getStartDate() {
return startDate;
}
@ -64,4 +66,12 @@ public class DateSearchRequest {
public void setDataType(String dataType) {
this.dataType = dataType;
}
public String getClusterDeviceId() {
return clusterDeviceId;
}
public void setClusterDeviceId(String clusterDeviceId) {
this.clusterDeviceId = clusterDeviceId;
}
}

View File

@ -11,6 +11,7 @@ public class EnergyStoragePowVo {
/**
* 显示日期
*/
private Date createDate;
/**

View File

@ -23,6 +23,8 @@ public class SiteDeviceListVo {
private String pictureUrl;
/** 唯一标识 */
private String id;
/** 父类id */
private String parentId;
public String getSiteId() {
return siteId;
@ -95,4 +97,12 @@ public class SiteDeviceListVo {
public void setId(String id) {
this.id = id;
}
public String getParentId() {
return parentId;
}
public void setParentId(String parentId) {
this.parentId = parentId;
}
}

View File

@ -21,6 +21,8 @@ public class StatisClusterDateRequest {
private String clusterId;
private String siteId;
public Date getDateTime() {
return dateTime;
}
@ -44,4 +46,12 @@ public class StatisClusterDateRequest {
public void setClusterId(String clusterId) {
this.clusterId = clusterId;
}
public String getSiteId() {
return siteId;
}
public void setSiteId(String siteId) {
this.siteId = siteId;
}
}

View File

@ -0,0 +1,82 @@
package com.xzzn.ems.domain.vo;
import com.xzzn.common.annotation.Excel;
import com.xzzn.ems.domain.EmsStrategyCurve;
import java.util.List;
/**
*策略模块曲线图
*
* @author xzzn
* @date 2025-07-13
*/
public class StrategyCurveVo
{
/** 站点id */
private String siteId;
/** 关联的策略ID */
private Long strategyId;
/** 模板名称 */
private String templateName;
/** 模板id */
private String templateId;
/** 月份 */
private Long month;
/** 模板时间功率 */
List<StrategyPowerDataVo> powerList;
public String getSiteId() {
return siteId;
}
public void setSiteId(String siteId) {
this.siteId = siteId;
}
public Long getStrategyId() {
return strategyId;
}
public void setStrategyId(Long strategyId) {
this.strategyId = strategyId;
}
public String getTemplateName() {
return templateName;
}
public void setTemplateName(String templateName) {
this.templateName = templateName;
}
public String getTemplateId() {
return templateId;
}
public void setTemplateId(String templateId) {
this.templateId = templateId;
}
public Long getMonth() {
return month;
}
public void setMonth(Long month) {
this.month = month;
}
public List<StrategyPowerDataVo> getPowerList() {
return powerList;
}
public void setPowerList(List<StrategyPowerDataVo> powerList) {
this.powerList = powerList;
}
}

View File

@ -0,0 +1,68 @@
package com.xzzn.ems.mapper;
import java.util.List;
import com.xzzn.ems.domain.EmsBatteryDataDailyLatest;
import com.xzzn.ems.domain.vo.BatteryDataStatsListVo;
import com.xzzn.ems.domain.vo.DateSearchRequest;
import org.apache.ibatis.annotations.Param;
/**
* 单体电池每日最新数据Mapper接口
*
* @author xzzn
* @date 2025-07-18
*/
public interface EmsBatteryDailyLatestMapper
{
/**
* 查询单体电池每日最新数据
*
* @param batteryPack 单体电池每日最新数据主键
* @return 单体电池每日最新数据
*/
public EmsBatteryDataDailyLatest selectEmsBatteryDataDailyLatestByBatteryPack(String batteryPack);
/**
* 查询单体电池每日最新数据列表
*
* @param emsBatteryDataDailyLatest 单体电池每日最新数据
* @return 单体电池每日最新数据集合
*/
public List<EmsBatteryDataDailyLatest> selectEmsBatteryDataDailyLatestList(EmsBatteryDataDailyLatest emsBatteryDataDailyLatest);
/**
* 新增单体电池每日最新数据
*
* @param emsBatteryDataDailyLatest 单体电池每日最新数据
* @return 结果
*/
public int insertEmsBatteryDataDailyLatest(EmsBatteryDataDailyLatest emsBatteryDataDailyLatest);
/**
* 修改单体电池每日最新数据
*
* @param emsBatteryDataDailyLatest 单体电池每日最新数据
* @return 结果
*/
public int updateEmsBatteryDataDailyLatest(EmsBatteryDataDailyLatest emsBatteryDataDailyLatest);
/**
* 删除单体电池每日最新数据
*
* @param batteryPack 单体电池每日最新数据主键
* @return 结果
*/
public int deleteEmsBatteryDataDailyLatestByBatteryPack(String batteryPack);
/**
* 批量删除单体电池每日最新数据
*
* @param batteryPacks 需要删除的数据主键集合
* @return 结果
*/
public int deleteEmsBatteryDataDailyLatestByBatteryPacks(String[] batteryPacks);
public void batchUpsert(@Param("list") List<EmsBatteryDataDailyLatest> dataList);
public List<BatteryDataStatsListVo> getBatteryDailyLatest(DateSearchRequest requestVo);
}

View File

@ -6,6 +6,7 @@ import java.util.Map;
import com.xzzn.ems.domain.EmsBatteryData;
import com.xzzn.ems.domain.vo.BatteryClusterDataDetailVo;
import com.xzzn.ems.domain.vo.BatteryDataStatsListVo;
import com.xzzn.ems.domain.vo.DateSearchRequest;
import org.apache.ibatis.annotations.Param;
/**
@ -95,4 +96,5 @@ public interface EmsBatteryDataMapper
int insertEmsBatteryDataList(List<EmsBatteryData> emsBatteryDataList);
}

View File

@ -0,0 +1,64 @@
package com.xzzn.ems.mapper;
import java.util.List;
import com.xzzn.ems.domain.EmsBatteryGroup;
/**
* 电池组数据Mapper接口
*
* @author xzzn
* @date 2025-07-29
*/
public interface EmsBatteryGroupMapper
{
/**
* 查询电池组数据
*
* @param id 电池组数据主键
* @return 电池组数据
*/
public EmsBatteryGroup selectEmsBatteryGroupById(Long id);
/**
* 查询电池组数据列表
*
* @param emsBatteryGroup 电池组数据
* @return 电池组数据集合
*/
public List<EmsBatteryGroup> selectEmsBatteryGroupList(EmsBatteryGroup emsBatteryGroup);
/**
* 新增电池组数据
*
* @param emsBatteryGroup 电池组数据
* @return 结果
*/
public int insertEmsBatteryGroup(EmsBatteryGroup emsBatteryGroup);
/**
* 修改电池组数据
*
* @param emsBatteryGroup 电池组数据
* @return 结果
*/
public int updateEmsBatteryGroup(EmsBatteryGroup emsBatteryGroup);
/**
* 删除电池组数据
*
* @param id 电池组数据主键
* @return 结果
*/
public int deleteEmsBatteryGroupById(Long id);
/**
* 批量删除电池组数据
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEmsBatteryGroupByIds(Long[] ids);
// 批量插入
void batchInsertGroupData(List<EmsBatteryGroup> emsBatteryGroups);
}

View File

@ -83,4 +83,6 @@ public interface EmsBatteryStackMapper
public List<StackStatisListVo> getStackDataByDay(DateSearchRequest requestVo);
public List<StackStatisListVo> getStackDataByMonth(DateSearchRequest requestVo);
public EmsBatteryStack getSiteSumStackInfo(String siteId);
}

View File

@ -66,7 +66,7 @@ public interface EmsDevicesSettingMapper
* @param parentId
* @return
*/
public List<Map<String, Object>> getDeviceInfoByParentId(String parentId);
public List<Map<String, Object>> getDeviceInfoByParentId(@Param("siteId")String siteId, @Param("parentId")String parentId);
/**
* 根据site_id和device_category获取指定设备信息

View File

@ -0,0 +1,61 @@
package com.xzzn.ems.mapper;
import java.util.List;
import com.xzzn.ems.domain.EmsDhData;
/**
* 动环数据Mapper接口
*
* @author xzzn
* @date 2025-07-28
*/
public interface EmsDhDataMapper
{
/**
* 查询动环数据
*
* @param id 动环数据主键
* @return 动环数据
*/
public EmsDhData selectEmsDhDataById(Long id);
/**
* 查询动环数据列表
*
* @param emsDhData 动环数据
* @return 动环数据集合
*/
public List<EmsDhData> selectEmsDhDataList(EmsDhData emsDhData);
/**
* 新增动环数据
*
* @param emsDhData 动环数据
* @return 结果
*/
public int insertEmsDhData(EmsDhData emsDhData);
/**
* 修改动环数据
*
* @param emsDhData 动环数据
* @return 结果
*/
public int updateEmsDhData(EmsDhData emsDhData);
/**
* 删除动环数据
*
* @param id 动环数据主键
* @return 结果
*/
public int deleteEmsDhDataById(Long id);
/**
* 批量删除动环数据
*
* @param ids 需要删除的数据主键集合
* @return 结果
*/
public int deleteEmsDhDataByIds(Long[] ids);
}

View File

@ -2,6 +2,7 @@ package com.xzzn.ems.mapper;
import java.util.List;
import com.xzzn.ems.domain.EmsStrategyCurve;
import org.apache.ibatis.annotations.Param;
/**
* 策曲线Mapper接口
@ -58,4 +59,15 @@ public interface EmsStrategyCurveMapper
* @return 结果
*/
public int deleteEmsStrategyCurveByIds(Long[] ids);
/**
* 根据模板id获取曲线图数据
* @param templateId
* @return
*/
public List<EmsStrategyCurve> getTemplateCurve(String templateId);
public void physicalDeleteCurve(@Param("strategyId")Long strategyId,@Param("siteId")String siteId);
// 根据模版id 删除推送的曲线图数据
public void physicalDeleteByTemplateId(String templateId);
}

View File

@ -65,4 +65,10 @@ public interface EmsStrategyTimeConfigMapper
// 清空该月的模板信息
public void cleanTemplateId(String templateId);
// 获取该策略下的时间配置
List<EmsStrategyTimeConfig> getAllTimeConfigByTempId(String templateId);
// 设置该模版的时间配置为待下发
public void updateTimeConfigWaitingPost(String templateId);
}

View File

@ -2,6 +2,7 @@ package com.xzzn.ems.mapper;
import com.xzzn.ems.domain.EmsTicket;
import com.xzzn.ems.domain.vo.TicketListVo;
import org.apache.ibatis.annotations.Param;
import java.util.List;
@ -70,8 +71,15 @@ public interface EmsTicketMapper
/**
* 获取工单列表
* @param emsTicket
* @param statusList
* @return
*/
public List<TicketListVo> getAllTicketList(EmsTicket emsTicket);
public List<TicketListVo> getAllTicketList(@Param("statusList")Long[] statusList);
/**
* 工单详情
* @param id
* @return
*/
public TicketListVo getTicketDetailInfo(String id);
}

View File

@ -0,0 +1,67 @@
package com.xzzn.ems.service;
import java.util.List;
import com.xzzn.ems.domain.EmsBatteryDataDailyLatest;
/**
* 单体电池每日最新数据Service接口
*
* @author xzzn
* @date 2025-07-18
*/
public interface IEmsBatteryDailyLatestService
{
/**
* 查询单体电池每日最新数据
*
* @param batteryPack 单体电池每日最新数据主键
* @return 单体电池每日最新数据
*/
public EmsBatteryDataDailyLatest selectEmsBatteryDataDailyLatestByBatteryPack(String batteryPack);
/**
* 查询单体电池每日最新数据列表
*
* @param emsBatteryDataDailyLatest 单体电池每日最新数据
* @return 单体电池每日最新数据集合
*/
public List<EmsBatteryDataDailyLatest> selectEmsBatteryDataDailyLatestList(EmsBatteryDataDailyLatest emsBatteryDataDailyLatest);
/**
* 新增单体电池每日最新数据
*
* @param emsBatteryDataDailyLatest 单体电池每日最新数据
* @return 结果
*/
public int insertEmsBatteryDataDailyLatest(EmsBatteryDataDailyLatest emsBatteryDataDailyLatest);
/**
* 修改单体电池每日最新数据
*
* @param emsBatteryDataDailyLatest 单体电池每日最新数据
* @return 结果
*/
public int updateEmsBatteryDataDailyLatest(EmsBatteryDataDailyLatest emsBatteryDataDailyLatest);
/**
* 批量删除单体电池每日最新数据
*
* @param batteryPacks 需要删除的单体电池每日最新数据主键集合
* @return 结果
*/
public int deleteEmsBatteryDataDailyLatestByBatteryPacks(String[] batteryPacks);
/**
* 删除单体电池每日最新数据信息
*
* @param batteryPack 单体电池每日最新数据主键
* @return 结果
*/
public int deleteEmsBatteryDataDailyLatestByBatteryPack(String batteryPack);
/**
* 批量处理每日数据
* @param dailyList
*/
public void batchProcessBatteryData(List<EmsBatteryDataDailyLatest> dailyList);
}

View File

@ -21,7 +21,7 @@ public interface IEmsSiteService
public List<Map<String,Object>> getAllStackInfo(String siteId);
public List<Map<String,Object>> getAllClusterInfo(String stackDeviceId);
public List<Map<String,Object>> getAllClusterInfo(String siteId, String stackDeviceId);
public List<EmsSiteSetting> getAllSiteInfoList(String siteName, String startTime, String endTime);

View File

@ -27,4 +27,6 @@ public interface IEmsStatsReportService
public List<AmmeterStatisListVo> getAmmeterDataResult(StatisAmmeterDateRequest requestVo);
public List<PowerStatisListVo> getPowerDataList(DateSearchRequest requestVo);
public List<BatteryDataStatsListVo> getSingleBatteryData(DateSearchRequest requestVo);
}

View File

@ -2,6 +2,8 @@ package com.xzzn.ems.service;
import java.util.List;
import com.xzzn.ems.domain.EmsStrategyCurve;
import com.xzzn.ems.domain.EmsStrategyTemp;
import com.xzzn.ems.domain.vo.StrategyCurveVo;
/**
* 策曲线Service接口
@ -58,4 +60,7 @@ public interface IEmsStrategyCurveService
* @return 结果
*/
public int deleteEmsStrategyCurveById(Long id);
// 获取站点策略的运行曲线数据
public List<StrategyCurveVo> getStrategyCurveList(EmsStrategyTemp tempConfig);
}

View File

@ -19,7 +19,7 @@ public interface IEmsTicketService
* @param id 工单主主键
* @return 工单主
*/
public EmsTicket selectEmsTicketById(String id);
public TicketListVo selectEmsTicketById(String id);
/**
* 查询工单主列表
@ -69,10 +69,10 @@ public interface IEmsTicketService
public int dropEmsTicketById(String id);
/**
* 获取工单列表
* 获取工单列表 - 根据工单状态获取
*
* @param emsTicket 工单主
* @param statusList 工单主
* @return 工单主集合
*/
public List<TicketListVo> getAllTicketList(EmsTicket emsTicket);
public List<TicketListVo> getAllTicketList(Long[] statusList);
}

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.EmsBatteryDailyLatestMapper;
import com.xzzn.ems.domain.EmsBatteryDataDailyLatest;
import com.xzzn.ems.service.IEmsBatteryDailyLatestService;
import org.springframework.transaction.annotation.Transactional;
/**
* 单体电池每日最新数据Service业务层处理
*
* @author xzzn
* @date 2025-07-18
*/
@Service
public class EmsBatteryDailyLatestServiceImpl implements IEmsBatteryDailyLatestService
{
@Autowired
private EmsBatteryDailyLatestMapper emsBatteryDataDailyLatestMapper;
/**
* 查询单体电池每日最新数据
*
* @param batteryPack 单体电池每日最新数据主键
* @return 单体电池每日最新数据
*/
@Override
public EmsBatteryDataDailyLatest selectEmsBatteryDataDailyLatestByBatteryPack(String batteryPack)
{
return emsBatteryDataDailyLatestMapper.selectEmsBatteryDataDailyLatestByBatteryPack(batteryPack);
}
/**
* 查询单体电池每日最新数据列表
*
* @param emsBatteryDataDailyLatest 单体电池每日最新数据
* @return 单体电池每日最新数据
*/
@Override
public List<EmsBatteryDataDailyLatest> selectEmsBatteryDataDailyLatestList(EmsBatteryDataDailyLatest emsBatteryDataDailyLatest)
{
return emsBatteryDataDailyLatestMapper.selectEmsBatteryDataDailyLatestList(emsBatteryDataDailyLatest);
}
/**
* 新增单体电池每日最新数据
*
* @param emsBatteryDataDailyLatest 单体电池每日最新数据
* @return 结果
*/
@Override
public int insertEmsBatteryDataDailyLatest(EmsBatteryDataDailyLatest emsBatteryDataDailyLatest)
{
emsBatteryDataDailyLatest.setCreateTime(DateUtils.getNowDate());
return emsBatteryDataDailyLatestMapper.insertEmsBatteryDataDailyLatest(emsBatteryDataDailyLatest);
}
/**
* 修改单体电池每日最新数据
*
* @param emsBatteryDataDailyLatest 单体电池每日最新数据
* @return 结果
*/
@Override
public int updateEmsBatteryDataDailyLatest(EmsBatteryDataDailyLatest emsBatteryDataDailyLatest)
{
emsBatteryDataDailyLatest.setUpdateTime(DateUtils.getNowDate());
return emsBatteryDataDailyLatestMapper.updateEmsBatteryDataDailyLatest(emsBatteryDataDailyLatest);
}
/**
* 批量删除单体电池每日最新数据
*
* @param batteryPacks 需要删除的单体电池每日最新数据主键
* @return 结果
*/
@Override
public int deleteEmsBatteryDataDailyLatestByBatteryPacks(String[] batteryPacks)
{
return emsBatteryDataDailyLatestMapper.deleteEmsBatteryDataDailyLatestByBatteryPacks(batteryPacks);
}
/**
* 删除单体电池每日最新数据信息
*
* @param batteryPack 单体电池每日最新数据主键
* @return 结果
*/
@Override
public int deleteEmsBatteryDataDailyLatestByBatteryPack(String batteryPack)
{
return emsBatteryDataDailyLatestMapper.deleteEmsBatteryDataDailyLatestByBatteryPack(batteryPack);
}
@Override
@Transactional
public void batchProcessBatteryData(List<EmsBatteryDataDailyLatest> dailyList) {
// 批量更新每日最新数据表(使用 ON DUPLICATE KEY UPDATE
emsBatteryDataDailyLatestMapper.batchUpsert(dailyList);
}
}

View File

@ -104,6 +104,6 @@ public class EmsMqttMessageServiceImpl implements IEmsMqttMessageService
mqttMessage.setCreateBy("system");
mqttMessage.setUpdateBy("system");
mqttMessage.setUpdateTime(DateUtils.getNowDate());
return emsMqttMessageMapper.updateEmsMqttMessage(mqttMessage);
return emsMqttMessageMapper.insertEmsMqttMessage(mqttMessage);
}
}

View File

@ -52,8 +52,8 @@ public class EmsSiteServiceImpl implements IEmsSiteService
* @return
*/
@Override
public List<Map<String, Object>> getAllClusterInfo(String parentId) {
return emsDevicesMapper.getDeviceInfoByParentId(parentId);
public List<Map<String, Object>> getAllClusterInfo(String siteId, String parentId) {
return emsDevicesMapper.getDeviceInfoByParentId(siteId,parentId);
}
/**

View File

@ -35,6 +35,10 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
private EmsAmmeterDataMapper emsAmmeterDataMapper;
@Autowired
private EmsDevicesSettingMapper emsDevicesSettingMapper;
@Autowired
private EmsBatteryDataMapper emsBatteryDataMapper;
@Autowired
private EmsBatteryDailyLatestMapper emsBatteryDailyLatestMapper;
// 电量指标
@Override
@ -46,6 +50,20 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
Date startDate = requestVo.getStartDate();
Date endDate = requestVo.getEndDate();
// 总充总放
Map<String, BigDecimal> totalMap = emsPcsDataMapper.getPcsTotalChargeData(requestVo.getSiteId());
BigDecimal totalDischarge = totalMap.get("totalDischargedCap") != null ? totalMap.get("totalDischargedCap") : BigDecimal.ZERO;
BigDecimal totalCharge = totalMap.get("totalChargedCap") != null ? totalMap.get("totalChargedCap") : BigDecimal.ZERO;
BigDecimal efficiency = new BigDecimal(0);
if ( totalCharge.compareTo(BigDecimal.ZERO)>0){
efficiency = totalDischarge.divide(totalCharge, 2, RoundingMode.HALF_UP)
.multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
}
electricDataInfoVo.setTotalDisChargedCap(totalDischarge);
electricDataInfoVo.setTotalChargedCap(totalCharge);
electricDataInfoVo.setEfficiency(efficiency);
// 日期筛选
List<SiteMonitorDataVo> dataList = new ArrayList();
// 开始日期和结束日期同一天,展示 0-24 小时数据
if (DateUtils.isSameDay(startDate, endDate)){
@ -66,15 +84,8 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
}
// 根据时间获取每天的充放电量
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.getChargedCap().compareTo(BigDecimal.ZERO)>0){
@ -83,14 +94,8 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
}
siteMonitorDataVo.setDailyEfficiency(dailyEfficiency);
}
if ( totalCharge.compareTo(BigDecimal.ZERO)>0){
efficiency = totalDischarge.divide(totalCharge, 2, RoundingMode.HALF_UP);
efficiency = efficiency.multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
}
electricDataInfoVo.setSevenDayDisChargeStats(dataList);
electricDataInfoVo.setTotalDisChargedCap(totalDischarge);
electricDataInfoVo.setTotalChargedCap(totalCharge);
electricDataInfoVo.setEfficiency(efficiency);
}
return electricDataInfoVo;
}
@ -192,8 +197,8 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
BigDecimal activePower = ammeterStatisListVo.getActiveTotalKwh();
BigDecimal reactivePower = ammeterStatisListVo.getReActiveTotalKwh();
if ( activePower != null && reactivePower !=null
&& activePower.compareTo(BigDecimal.ZERO) >= 0
&& reactivePower.compareTo(BigDecimal.ZERO) >= 0){
&& activePower.compareTo(BigDecimal.ZERO) > 0
&& reactivePower.compareTo(BigDecimal.ZERO) > 0){
effect = reactivePower.divide(activePower, 2, RoundingMode.HALF_UP)
.multiply(new BigDecimal("100")).setScale(2, RoundingMode.HALF_UP);
}
@ -208,7 +213,7 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
BigDecimal totalActive = totalVo.getActiveTotalKwh();
BigDecimal totalReactive = totalVo.getReActiveTotalKwh();
if ( totalActive != null && totalReactive !=null
&& totalActive.compareTo(BigDecimal.ZERO) >= 0
&& totalActive.compareTo(BigDecimal.ZERO) > 0
&& totalReactive.compareTo(BigDecimal.ZERO) >= 0){
BigDecimal totalEffect = new BigDecimal(0);
totalEffect = totalReactive.divide(totalActive, 2, RoundingMode.HALF_UP)
@ -280,4 +285,16 @@ public class EmsStatsReportServiceImpl implements IEmsStatsReportService
requestVo.setEndDate(endDate);
}
}
/**
* 获取单个单体电池数据-默认7天
* @param requestVo
* @return
*/
@Override
public List<BatteryDataStatsListVo> getSingleBatteryData(DateSearchRequest requestVo) {
// 默认时间-7天
dealRequestTime(requestVo);
return emsBatteryDailyLatestMapper.getBatteryDailyLatest(requestVo);
}
}

View File

@ -1,7 +1,16 @@
package com.xzzn.ems.service.impl;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import com.alibaba.fastjson2.JSON;
import com.xzzn.common.utils.DateUtils;
import com.xzzn.common.utils.StringUtils;
import com.xzzn.ems.domain.EmsStrategyTemp;
import com.xzzn.ems.domain.vo.StrategyCurveVo;
import com.xzzn.ems.domain.vo.StrategyPowerDataVo;
import com.xzzn.ems.mapper.EmsStrategyTempMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xzzn.ems.mapper.EmsStrategyCurveMapper;
@ -19,6 +28,8 @@ public class EmsStrategyCurveServiceImpl implements IEmsStrategyCurveService
{
@Autowired
private EmsStrategyCurveMapper emsStrategyCurveMapper;
@Autowired
private EmsStrategyTempMapper emsStrategyTempMapper;
/**
* 查询策曲线
@ -93,4 +104,40 @@ public class EmsStrategyCurveServiceImpl implements IEmsStrategyCurveService
{
return emsStrategyCurveMapper.deleteEmsStrategyCurveById(id);
}
@Override
public List<StrategyCurveVo> getStrategyCurveList(EmsStrategyTemp tempConfig) {
List<StrategyCurveVo> dataList = new ArrayList();
String siteId = tempConfig.getSiteId();
Long strategyId = tempConfig.getStrategyId();
// 获取该策略的所有模板配置
List<Map<String,String>> tempList = emsStrategyTempMapper.getTempNameList(strategyId, siteId);
if (tempList != null && !tempList.isEmpty()) {
for (Map<String,String> map : tempList) {
String tempName = map.get("templateName");
String tempId = map.get("templateId");
if (StringUtils.isNotEmpty(tempId)) {
List<EmsStrategyCurve> taskList = emsStrategyCurveMapper.getTemplateCurve(tempId);
for (int i = 0; i < taskList.size(); i++) {
StrategyCurveVo vo = new StrategyCurveVo();
vo.setTemplateName(tempName);
vo.setTemplateId(tempId);
vo.setStrategyId(taskList.get(i).getStrategyId());
vo.setSiteId(taskList.get(i).getSiteId());
vo.setMonth(taskList.get(i).getMonth());
// 时间功率
String powerJson = taskList.get(i).getPowerData();
List<StrategyPowerDataVo> powerList = JSON.parseArray(powerJson, StrategyPowerDataVo.class);
vo.setPowerList(powerList);
dataList.add(vo);
}
}
}
}
return dataList;
}
}

View File

@ -8,6 +8,7 @@ import com.xzzn.common.utils.StringUtils;
import com.xzzn.common.utils.bean.BeanUtils;
import com.xzzn.ems.domain.EmsStrategyTempTimeConfig;
import com.xzzn.ems.domain.vo.StrategyTempConfigRequest;
import com.xzzn.ems.mapper.EmsStrategyCurveMapper;
import com.xzzn.ems.mapper.EmsStrategyTimeConfigMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -30,6 +31,8 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
private EmsStrategyTempMapper emsStrategyTempMapper;
@Autowired
private EmsStrategyTimeConfigMapper emsStrategyTimeConfigMapper;
@Autowired
private EmsStrategyCurveMapper emsStrategyCurveMapper;
/**
* 查询模板列表
@ -95,6 +98,10 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
// 全删
emsStrategyTempMapper.deleteTempByTempId(templateId);
// 根据模版id 删除推送的曲线图数据
emsStrategyCurveMapper.physicalDeleteByTemplateId(templateId);
// 设置该模版的时间配置为待下发
emsStrategyTimeConfigMapper.updateTimeConfigWaitingPost(templateId);
// 重新新增
addNewTempAndTimeConfig(requestVo);
@ -111,6 +118,9 @@ public class EmsStrategyTempServiceImpl implements IEmsStrategyTempService
public int deleteStrategyTempById(String templateId) {
// 先更新配置该模板的月份数据
emsStrategyTimeConfigMapper.cleanTemplateId(templateId);
// 根据模版id 删除推送的曲线图数据
emsStrategyCurveMapper.physicalDeleteByTemplateId(templateId);
return emsStrategyTempMapper.deleteTempByTempId(templateId);
}
}

View File

@ -2,7 +2,9 @@ package com.xzzn.ems.service.impl;
import java.util.List;
import com.xzzn.common.utils.DateUtils;
import com.xzzn.common.utils.StringUtils;
import com.xzzn.ems.domain.vo.StrategyTimeConfigVo;
import com.xzzn.ems.mapper.EmsStrategyCurveMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.xzzn.ems.mapper.EmsStrategyTimeConfigMapper;
@ -20,6 +22,8 @@ public class EmsStrategyTimeConfigServiceImpl implements IEmsStrategyTimeConfigS
{
@Autowired
private EmsStrategyTimeConfigMapper emsStrategyTimeConfigMapper;
@Autowired
private EmsStrategyCurveMapper emsStrategyCurveMapper;
/**
* 查询时间配置
@ -57,6 +61,9 @@ public class EmsStrategyTimeConfigServiceImpl implements IEmsStrategyTimeConfigS
if (timeConfigList != null) {
for (EmsStrategyTimeConfig strategyTimeConfig : timeConfigList) {
Long id = strategyTimeConfig.getId();
Long strategyId = strategyTimeConfig.getStrategyId();
String siteId = strategyTimeConfig.getSiteId();
strategyTimeConfig.setIsPost(1);//默认未下发
// 新增
if (id == null) {
strategyTimeConfig.setCreateTime(DateUtils.getNowDate());
@ -65,6 +72,10 @@ public class EmsStrategyTimeConfigServiceImpl implements IEmsStrategyTimeConfigS
strategyTimeConfig.setUpdateTime(DateUtils.getNowDate());
emsStrategyTimeConfigMapper.updateEmsStrategyTimeConfig(strategyTimeConfig);
}
// 处理曲线图:物理删除该策略的曲线图
if (StringUtils.isNotEmpty(siteId) && strategyId != null) {
emsStrategyCurveMapper.physicalDeleteCurve(strategyId,siteId);
}
}
} else {
return false;

View File

@ -25,15 +25,15 @@ public class EmsTicketServiceImpl implements IEmsTicketService
private EmsTicketMapper emsTicketMapper;
/**
* 查询工单主
* 查询工单主-工单详情
*
* @param id 工单主主键
* @return 工单主
*/
@Override
public EmsTicket selectEmsTicketById(String id)
public TicketListVo selectEmsTicketById(String id)
{
return emsTicketMapper.selectEmsTicketById(id);
return emsTicketMapper.getTicketDetailInfo(id);
}
/**
@ -62,6 +62,7 @@ public class EmsTicketServiceImpl implements IEmsTicketService
String nowDate = DateUtils.dateTime();
ticketNo = "T" + nowDate + String.format("%06d", new Random().nextInt(1000000));
emsTicket.setTicketNo(ticketNo);
emsTicket.setStatus(1L);//默认待处理
emsTicket.setCreateTime(DateUtils.getNowDate());
return emsTicketMapper.insertEmsTicket(emsTicket);
}
@ -115,8 +116,13 @@ public class EmsTicketServiceImpl implements IEmsTicketService
return emsTicketMapper.dropEmsTicketById(id);
}
/**
* 根据工单状态数组获取-工单列表
* @param statusList
* @return
*/
@Override
public List<TicketListVo> getAllTicketList(EmsTicket emsTicket) {
return emsTicketMapper.getAllTicketList(emsTicket);
public List<TicketListVo> getAllTicketList(Long[] statusList) {
return emsTicketMapper.getAllTicketList(statusList);
}
}

View File

@ -14,6 +14,7 @@ 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.BeanUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@ -45,7 +46,9 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
private EmsDevicesSettingMapper emsDevicesSettingMapper;
@Autowired
private EmsAmmeterDataMapper emsAmmeterDataMapper;;
private EmsAmmeterDataMapper emsAmmeterDataMapper;
@Autowired
private EmsBatteryDailyLatestServiceImpl emsBatteryDailyLatestServiceImpl;
@Override
public void handleFxData(String message) {
@ -253,6 +256,7 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
//单体电池
Map<String, Map<String, Object>> records = processData(JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {}));
List<EmsBatteryData> list = new ArrayList<>();
List<EmsBatteryDataDailyLatest> dailyList = new ArrayList<>();
//单体电池
for (Map.Entry<String, Map<String, Object>> record : records.entrySet()) {
String recordId = record.getKey();
@ -277,6 +281,12 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
batteryData.setClusterDeviceId(deviceId);
list.add(batteryData);
// 每日最新数据
EmsBatteryDataDailyLatest daily = new EmsBatteryDataDailyLatest();
BeanUtils.copyProperties(batteryData, daily);
daily.setDateDay(DateUtils.getNowDate());
dailyList.add(daily);
}
if (list.size() > 0 ) {
emsBatteryDataMapper.insertEmsBatteryDataList(list);
@ -284,9 +294,13 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
redisCache.deleteList(RedisKeyConstants.BATTERY + SITE_ID + "_" +deviceId);
redisCache.setCacheList(RedisKeyConstants.BATTERY + SITE_ID + "_" +deviceId, list);
}
// 批量处理每日最新数据
if (dailyList != null && dailyList.size() > 0) {
emsBatteryDailyLatestServiceImpl.batchProcessBatteryData(dailyList);
}
}
private void pcsDataProcess(String deviceId, String dataJson) {
Map<String, Object> obj = JSON.parseObject(dataJson, new TypeReference<Map<String, Object>>() {
});
@ -374,8 +388,8 @@ public class FXXDataProcessServiceImpl implements IFXXDataProcessService {
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.setGridUVoltage(StringUtils.getBigDecimal(fields.get("DWUXDY")));
data.setGridVVoltage(StringUtils.getBigDecimal(fields.get("DWVXDY")));
data.setGridWVoltage(StringUtils.getBigDecimal(fields.get("DWWXDY")));
data.setOutputUCurrent(StringUtils.getBigDecimal(fields.get("SCUXDL")));
data.setOutputVCurrent(StringUtils.getBigDecimal(fields.get("SCVXDL")));

View File

@ -17,6 +17,7 @@ import org.springframework.util.CollectionUtils;
import java.math.BigDecimal;
import java.util.*;
import java.util.stream.Collectors;
/**
* 单点监控 服务层实现
@ -116,12 +117,11 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
if (!StringUtils.isEmpty(siteId)) {
// 实时有功功率/实时无功功率/今日充电量/今日放电量
siteMonitorRunningHeadInfoVo = emsPcsDataMapper.getSiteRunningHeadInfo(siteId);
// 电池SOC
// 电池堆SOH
EmsBatteryData emsBatteryData = emsBatteryDataMapper.getBatteryDataBySiteId(siteId);
if (emsBatteryData != null) {
siteMonitorRunningHeadInfoVo.setSoc(emsBatteryData.getSoc());
siteMonitorRunningHeadInfoVo.setSoh(emsBatteryData.getSoh());
// 电池SOC + 电池堆SOH
EmsBatteryStack emsBatteryStack = emsBatteryStackMapper.getSiteSumStackInfo(siteId);
if (emsBatteryStack != null) {
siteMonitorRunningHeadInfoVo.setSoc(emsBatteryStack.getStackSoc());
siteMonitorRunningHeadInfoVo.setSoh(emsBatteryStack.getStackSoh());
}
}
@ -134,8 +134,9 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
SiteMonitorRuningInfoVo siteMonitorRuningInfoVo = new SiteMonitorRuningInfoVo();
if (!StringUtils.isEmpty(siteId)) {
// 时间暂定今日+昨日
Date today = new Date();
Date today = DateUtils.getNowDate();
Date yesterday = DateUtils.addDays(today, -1);
//储能功率list
List<EnergyStoragePowVo> energyStoragePowList = emsPcsDataMapper.getStoragePowerList(siteId, yesterday, today);
siteMonitorRuningInfoVo.setEnergyStoragePowList(energyStoragePowList);
@ -197,7 +198,8 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
for (Map<String, Object> pcsDevice : pcsIds) {
PcsDetailInfoVo pcsDetailInfoVo = new PcsDetailInfoVo();
pcsDetailInfoVo.setDeviceName(pcsDevice.get("deviceName").toString());
pcsDetailInfoVo.setCommunicationStatus(pcsDevice.get("communicationStatus").toString());
pcsDetailInfoVo.setCommunicationStatus(pcsDevice.get("communicationStatus") == null ?
"" :pcsDevice.get("communicationStatus").toString());
// 从redis取pcs单个详细数据
String pcsId = pcsDevice.get("id").toString();
EmsPcsData pcsData = redisCache.getCacheObject(RedisKeyConstants.PCS +siteId+"_"+pcsId);
@ -258,7 +260,7 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
private void getBMSClusterListInfo(String siteId, String stackId, BMSOverViewVo bmsOverViewVo) {
List<BMSBatteryDataList> batteryDataList = new ArrayList();
List<Map<String, Object>> clusterIds = emsDevicesSettingMapper.getDeviceInfoByParentId(stackId);
List<Map<String, Object>> clusterIds = emsDevicesSettingMapper.getDeviceInfoByParentId(siteId, stackId);
for (Map<String, Object> clusterDevice : clusterIds) {
BMSBatteryDataList bmsBatteryDataList= new BMSBatteryDataList();
// 从redis取单个簇的详细数据
@ -311,21 +313,21 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
voltageData.setDataName(CLUSTER_DATA_VOLTAGE);
voltageData.setAvgData(clusterData.getAvgCellVoltage());
voltageData.setMaxData(clusterData.getMaxCellVoltage());
voltageData.setMaxDataID(clusterData.getMaxCellVoltageId().toString());
voltageData.setMaxDataID(clusterData.getMaxCellVoltageId() == null ? null : clusterData.getMaxCellVoltageId().toString());
voltageData.setMinData(clusterData.getMinCellVoltage());
voltageData.setMinDataID(clusterData.getMinCellVoltageId().toString());
voltageData.setMinDataID(clusterData.getMinCellVoltageId() == null ? null : clusterData.getMinCellVoltageId().toString());
tempData.setDataName(CLUSTER_DATA_TEP);
tempData.setAvgData(clusterData.getAvgCellTemp());
tempData.setMaxData(clusterData.getMaxCellTemp());
tempData.setMaxDataID(clusterData.getMaxCellTempId().toString());
tempData.setMaxDataID(clusterData.getMaxCellTempId() == null ? null : clusterData.getMaxCellTempId().toString());
tempData.setMinData(clusterData.getMinCellTemp());
tempData.setMinDataID(clusterData.getMinCellTempId().toString());
tempData.setMinDataID(clusterData.getMinCellTempId() == null ? null : clusterData.getMinCellTempId().toString());
socData.setDataName(CLUSTER_DATA_SOC);
socData.setAvgData(clusterData.getCurrentSoc());
socData.setMaxData(clusterData.getMaxCellSoc());
socData.setMaxDataID(clusterData.getMaxCellSocId().toString());
socData.setMaxDataID(clusterData.getMaxCellSocId() == null ? null : clusterData.getMaxCellSocId().toString());
socData.setMinData(clusterData.getMinCellSoc());
socData.setMinDataID(clusterData.getMinCellSocId().toString());
socData.setMinDataID(clusterData.getMinCellSocId() == null ? null : clusterData.getMinCellSocId().toString());
clusterDataList.add(voltageData);
clusterDataList.add(tempData);
@ -371,7 +373,11 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
}
}
}
return batteryDataStatsListVo;
// 排序
List<BatteryDataStatsListVo> sortedList = batteryDataStatsListVo.stream()
.sorted((u1, u2) -> Integer.parseInt(u1.getDeviceId()) - Integer.parseInt(u2.getDeviceId()))
.collect(Collectors.toList());
return sortedList;
}
/**
@ -395,7 +401,8 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
if (AMMETER_DEVICE_LOAD.equals(ammeterId)) {
AmmeterLoadDataVo ammeterLoadDataVo = new AmmeterLoadDataVo();
ammeterLoadDataVo.setDeviceName(ammeterDevice.get("deviceName").toString());
ammeterLoadDataVo.setEmsCommunicationStatus(ammeterDevice.get("communicationStatus").toString());
ammeterLoadDataVo.setEmsCommunicationStatus(ammeterDevice.get("communicationStatus") == null? "" :
ammeterDevice.get("communicationStatus").toString());
// 处理总表数据
dealAmmeterLoadData(ammeterData,ammeterLoadDataVo);
ammeterResponse.setAmmeterLoadDataVoList(ammeterLoadDataVo);

View File

@ -107,10 +107,72 @@
<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" />
<result property="currentPercent" column="current_percent" />
<result property="voltagePercent" column="voltage_percent" />
<result property="avgCurrent" column="avg_current" />
<result property="totalForwardActiveTwo" column="total_forward_active_two" />
<result property="totalPeakForwardActive" column="total_peak_forward_active" />
<result property="totalHighForwardActive" column="total_high_forward_active" />
<result property="totalFlatForwardActive" column="total_flat_forward_active" />
<result property="totalValleyForwardActive" column="total_valley_forward_active" />
<result property="totalReverseActiveTwo" column="total_reverse_active_two" />
<result property="totalPeakReverseActive" column="total_peak_reverse_active" />
<result property="totalHighReverseActive" column="total_high_reverse_active" />
<result property="totalFlatReverseActive" column="total_flat_reverse_active" />
<result property="totalValleyReverseActive" column="total_valley_reverse_active" />
<result property="disconnectDetectionIndication" column="disconnect_detection_indication" />
<result property="ratedPrimaryCurrentValue" column="rated_primary_current_value" />
<result property="switchInputOutputStatus" column="switch_input_output_status" />
<result property="alarmStatus" column="alarm_status" />
<result property="currentTotalVoltagePercent" column="current_total_voltage_percent" />
<result property="voltageContentPercent" column="voltage_content_percent" />
<result property="voltageAcPercent" column="voltage_ac_percent" />
<result property="currentTotalCurrentPercent" column="current_total_current_percent" />
<result property="currentContentPercent" column="current_content_percent" />
<result property="currentAcPercent" column="current_ac_percent" />
<result property="currentTotalPowerPercent" column="current_total_power_percent" />
<result property="powerContentPercent" column="power_content_percent" />
<result property="powerAcPercent" column="power_ac_percent" />
<result property="dataSettingYearMonth" column="data_setting_year_month" />
<result property="dataSettingDayHour" column="data_setting_day_hour" />
<result property="dataSettingMinutesSeconds" column="data_setting_minutes_seconds" />
<result property="currentRate" column="current_rate" />
<result property="versionNumber" column="version_number" />
<result property="voltage" column="voltage" />
<result property="current" column="current" />
<result property="power" column="power" />
<result property="internalTemp" column="internal_temp" />
<result property="totalForwardActiveOne" column="total_forward_active_one" />
<result property="totalReverseActiveOne" column="total_reverse_active_one" />
<result property="forwardReactiveMaxDemand" column="forward_reactive_max_demand" />
<result property="reverseReactiveMaxDemand" column="reverse_reactive_max_demand" />
<result property="aForwardActiveEnergy" column="a_forward_active_energy" />
<result property="bForwardActiveEnergy" column="b_forward_active_energy" />
<result property="cForwardActiveEnergy" column="c_forward_active_energy" />
<result property="didoStatus" column="dido_status" />
<result property="runningStatus" column="running_status" />
<result property="zeroSeqCurrent" column="zero_seq_current" />
<result property="voltageUnbalanceDegree" column="voltage_unbalance_degree" />
<result property="currentUnbalanceDegree" column="current_unbalance_degree" />
<result property="dailyReverseAcMaxDemand" column="daily_reverse_ac_max_demand" />
<result property="dailyForwardReacMaxDemand" column="daily_forward_reac_max_demand" />
<result property="dailyReverseReacMaxDemand" column="daily_reverse_reac_max_demand" />
<result property="preDayForwardAcMaxDemand" column="pre_day_forward_ac_max_demand" />
<result property="preDayReverseAcMaxDemand" column="pre_day_reverse_ac_max_demand" />
<result property="preDayForwardReacMaxDemand" column="pre_day_forward_reac_max_demand" />
<result property="preDayReverseReacMaxDemand" column="pre_day_reverse_reac_max_demand" />
<result property="pre2dForwardAcMaxDemand" column="pre_2d_forward_ac_max_demand" />
<result property="pre2dReverseAcMaxDemand" column="pre_2d_reverse_ac_max_demand" />
<result property="pre2dForwardReacMaxDemand" column="pre_2d_forward_reac_max_demand" />
<result property="pre2dReverseReacMaxDemand" column="pre_2d_reverse_reac_max_demand" />
<result property="currentForwardAcDemand" column="current_forward_ac_demand" />
<result property="currentReverseAcDemand" column="current_reverse_ac_demand" />
<result property="currentForwardReacDemand" column="current_forward_reac_demand" />
<result property="currentReverseReacDemand" column="current_reverse_reac_demand" />
</resultMap>
<sql id="selectEmsAmmeterDataVo">
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
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, current_percent, voltage_percent, avg_current, total_forward_active_two, total_peak_forward_active, total_high_forward_active, total_flat_forward_active, total_valley_forward_active, total_reverse_active_two, total_peak_reverse_active, total_high_reverse_active, total_flat_reverse_active, total_valley_reverse_active, disconnect_detection_indication, rated_primary_current_value, switch_input_output_status, alarm_status, current_total_voltage_percent, voltage_content_percent, voltage_ac_percent, current_total_current_percent, current_content_percent, current_ac_percent, current_total_power_percent, power_content_percent, power_ac_percent, data_setting_year_month, data_setting_day_hour, data_setting_minutes_seconds, current_rate, version_number, voltage, current, power, internal_temp, total_forward_active_one, total_reverse_active_one, forward_reactive_max_demand, reverse_reactive_max_demand, a_forward_active_energy, b_forward_active_energy, c_forward_active_energy, dido_status, running_status, zero_seq_current, voltage_unbalance_degree, current_unbalance_degree, daily_reverse_ac_max_demand, daily_forward_reac_max_demand, daily_reverse_reac_max_demand, pre_day_forward_ac_max_demand, pre_day_reverse_ac_max_demand, pre_day_forward_reac_max_demand, pre_day_reverse_reac_max_demand, pre_2d_forward_ac_max_demand, pre_2d_reverse_ac_max_demand, pre_2d_forward_reac_max_demand, pre_2d_reverse_reac_max_demand, current_forward_ac_demand, current_reverse_ac_demand, current_forward_reac_demand, current_reverse_reac_demand from ems_ammeter_data
</sql>
<select id="selectEmsAmmeterDataList" parameterType="EmsAmmeterData" resultMap="EmsAmmeterDataResult">
@ -212,6 +274,68 @@
<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>
<if test="currentPercent != null "> and current_percent = #{currentPercent}</if>
<if test="voltagePercent != null "> and voltage_percent = #{voltagePercent}</if>
<if test="avgCurrent != null "> and avg_current = #{avgCurrent}</if>
<if test="totalForwardActiveTwo != null "> and total_forward_active_two = #{totalForwardActiveTwo}</if>
<if test="totalPeakForwardActive != null "> and total_peak_forward_active = #{totalPeakForwardActive}</if>
<if test="totalHighForwardActive != null "> and total_high_forward_active = #{totalHighForwardActive}</if>
<if test="totalFlatForwardActive != null "> and total_flat_forward_active = #{totalFlatForwardActive}</if>
<if test="totalValleyForwardActive != null "> and total_valley_forward_active = #{totalValleyForwardActive}</if>
<if test="totalReverseActiveTwo != null "> and total_reverse_active_two = #{totalReverseActiveTwo}</if>
<if test="totalPeakReverseActive != null "> and total_peak_reverse_active = #{totalPeakReverseActive}</if>
<if test="totalHighReverseActive != null "> and total_high_reverse_active = #{totalHighReverseActive}</if>
<if test="totalFlatReverseActive != null "> and total_flat_reverse_active = #{totalFlatReverseActive}</if>
<if test="totalValleyReverseActive != null "> and total_valley_reverse_active = #{totalValleyReverseActive}</if>
<if test="disconnectDetectionIndication != null and disconnectDetectionIndication != ''"> and disconnect_detection_indication = #{disconnectDetectionIndication}</if>
<if test="ratedPrimaryCurrentValue != null "> and rated_primary_current_value = #{ratedPrimaryCurrentValue}</if>
<if test="switchInputOutputStatus != null and switchInputOutputStatus != ''"> and switch_input_output_status = #{switchInputOutputStatus}</if>
<if test="alarmStatus != null and alarmStatus != ''"> and alarm_status = #{alarmStatus}</if>
<if test="currentTotalVoltagePercent != null "> and current_total_voltage_percent = #{currentTotalVoltagePercent}</if>
<if test="voltageContentPercent != null "> and voltage_content_percent = #{voltageContentPercent}</if>
<if test="voltageAcPercent != null "> and voltage_ac_percent = #{voltageAcPercent}</if>
<if test="currentTotalCurrentPercent != null "> and current_total_current_percent = #{currentTotalCurrentPercent}</if>
<if test="currentContentPercent != null "> and current_content_percent = #{currentContentPercent}</if>
<if test="currentAcPercent != null "> and current_ac_percent = #{currentAcPercent}</if>
<if test="currentTotalPowerPercent != null "> and current_total_power_percent = #{currentTotalPowerPercent}</if>
<if test="powerContentPercent != null "> and power_content_percent = #{powerContentPercent}</if>
<if test="powerAcPercent != null "> and power_ac_percent = #{powerAcPercent}</if>
<if test="dataSettingYearMonth != null and dataSettingYearMonth != ''"> and data_setting_year_month = #{dataSettingYearMonth}</if>
<if test="dataSettingDayHour != null and dataSettingDayHour != ''"> and data_setting_day_hour = #{dataSettingDayHour}</if>
<if test="dataSettingMinutesSeconds != null and dataSettingMinutesSeconds != ''"> and data_setting_minutes_seconds = #{dataSettingMinutesSeconds}</if>
<if test="currentRate != null "> and current_rate = #{currentRate}</if>
<if test="versionNumber != null and versionNumber != ''"> and version_number = #{versionNumber}</if>
<if test="voltage != null "> and voltage = #{voltage}</if>
<if test="current != null "> and current = #{current}</if>
<if test="power != null "> and power = #{power}</if>
<if test="internalTemp != null "> and internal_temp = #{internalTemp}</if>
<if test="totalForwardActiveOne != null "> and total_forward_active_one = #{totalForwardActiveOne}</if>
<if test="totalReverseActiveOne != null "> and total_reverse_active_one = #{totalReverseActiveOne}</if>
<if test="forwardReactiveMaxDemand != null and forwardReactiveMaxDemand != ''"> and forward_reactive_max_demand = #{forwardReactiveMaxDemand}</if>
<if test="reverseReactiveMaxDemand != null "> and reverse_reactive_max_demand = #{reverseReactiveMaxDemand}</if>
<if test="aForwardActiveEnergy != null and aForwardActiveEnergy != ''"> and a_forward_active_energy = #{aForwardActiveEnergy}</if>
<if test="bForwardActiveEnergy != null and bForwardActiveEnergy != ''"> and b_forward_active_energy = #{bForwardActiveEnergy}</if>
<if test="cForwardActiveEnergy != null "> and c_forward_active_energy = #{cForwardActiveEnergy}</if>
<if test="didoStatus != null "> and dido_status = #{didoStatus}</if>
<if test="runningStatus != null "> and running_status = #{runningStatus}</if>
<if test="zeroSeqCurrent != null "> and zero_seq_current = #{zeroSeqCurrent}</if>
<if test="voltageUnbalanceDegree != null "> and voltage_unbalance_degree = #{voltageUnbalanceDegree}</if>
<if test="currentUnbalanceDegree != null "> and current_unbalance_degree = #{currentUnbalanceDegree}</if>
<if test="dailyReverseAcMaxDemand != null "> and daily_reverse_ac_max_demand = #{dailyReverseAcMaxDemand}</if>
<if test="dailyForwardReacMaxDemand != null "> and daily_forward_reac_max_demand = #{dailyForwardReacMaxDemand}</if>
<if test="dailyReverseReacMaxDemand != null "> and daily_reverse_reac_max_demand = #{dailyReverseReacMaxDemand}</if>
<if test="preDayForwardAcMaxDemand != null and preDayForwardAcMaxDemand != ''"> and pre_day_forward_ac_max_demand = #{preDayForwardAcMaxDemand}</if>
<if test="preDayReverseAcMaxDemand != null and preDayReverseAcMaxDemand != ''"> and pre_day_reverse_ac_max_demand = #{preDayReverseAcMaxDemand}</if>
<if test="preDayForwardReacMaxDemand != null and preDayForwardReacMaxDemand != ''"> and pre_day_forward_reac_max_demand = #{preDayForwardReacMaxDemand}</if>
<if test="preDayReverseReacMaxDemand != null and preDayReverseReacMaxDemand != ''"> and pre_day_reverse_reac_max_demand = #{preDayReverseReacMaxDemand}</if>
<if test="pre2dForwardAcMaxDemand != null and pre2dForwardAcMaxDemand != ''"> and pre_2d_forward_ac_max_demand = #{pre2dForwardAcMaxDemand}</if>
<if test="pre2dReverseAcMaxDemand != null and pre2dReverseAcMaxDemand != ''"> and pre_2d_reverse_ac_max_demand = #{pre2dReverseAcMaxDemand}</if>
<if test="pre2dForwardReacMaxDemand != null and pre2dForwardReacMaxDemand != ''"> and pre_2d_forward_reac_max_demand = #{pre2dForwardReacMaxDemand}</if>
<if test="pre2dReverseReacMaxDemand != null and pre2dReverseReacMaxDemand != ''"> and pre_2d_reverse_reac_max_demand = #{pre2dReverseReacMaxDemand}</if>
<if test="currentForwardAcDemand != null and currentForwardAcDemand != ''"> and current_forward_ac_demand = #{currentForwardAcDemand}</if>
<if test="currentReverseAcDemand != null "> and current_reverse_ac_demand = #{currentReverseAcDemand}</if>
<if test="currentForwardReacDemand != null and currentForwardReacDemand != ''"> and current_forward_reac_demand = #{currentForwardReacDemand}</if>
<if test="currentReverseReacDemand != null "> and current_reverse_reac_demand = #{currentReverseReacDemand}</if>
</where>
</select>
@ -324,6 +448,68 @@
<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>
<if test="currentPercent != null">current_percent,</if>
<if test="voltagePercent != null">voltage_percent,</if>
<if test="avgCurrent != null">avg_current,</if>
<if test="totalForwardActiveTwo != null">total_forward_active_two,</if>
<if test="totalPeakForwardActive != null">total_peak_forward_active,</if>
<if test="totalHighForwardActive != null">total_high_forward_active,</if>
<if test="totalFlatForwardActive != null">total_flat_forward_active,</if>
<if test="totalValleyForwardActive != null">total_valley_forward_active,</if>
<if test="totalReverseActiveTwo != null">total_reverse_active_two,</if>
<if test="totalPeakReverseActive != null">total_peak_reverse_active,</if>
<if test="totalHighReverseActive != null">total_high_reverse_active,</if>
<if test="totalFlatReverseActive != null">total_flat_reverse_active,</if>
<if test="totalValleyReverseActive != null">total_valley_reverse_active,</if>
<if test="disconnectDetectionIndication != null">disconnect_detection_indication,</if>
<if test="ratedPrimaryCurrentValue != null">rated_primary_current_value,</if>
<if test="switchInputOutputStatus != null">switch_input_output_status,</if>
<if test="alarmStatus != null">alarm_status,</if>
<if test="currentTotalVoltagePercent != null">current_total_voltage_percent,</if>
<if test="voltageContentPercent != null">voltage_content_percent,</if>
<if test="voltageAcPercent != null">voltage_ac_percent,</if>
<if test="currentTotalCurrentPercent != null">current_total_current_percent,</if>
<if test="currentContentPercent != null">current_content_percent,</if>
<if test="currentAcPercent != null">current_ac_percent,</if>
<if test="currentTotalPowerPercent != null">current_total_power_percent,</if>
<if test="powerContentPercent != null">power_content_percent,</if>
<if test="powerAcPercent != null">power_ac_percent,</if>
<if test="dataSettingYearMonth != null">data_setting_year_month,</if>
<if test="dataSettingDayHour != null">data_setting_day_hour,</if>
<if test="dataSettingMinutesSeconds != null">data_setting_minutes_seconds,</if>
<if test="currentRate != null">current_rate,</if>
<if test="versionNumber != null">version_number,</if>
<if test="voltage != null">voltage,</if>
<if test="current != null">current,</if>
<if test="power != null">power,</if>
<if test="internalTemp != null">internal_temp,</if>
<if test="totalForwardActiveOne != null">total_forward_active_one,</if>
<if test="totalReverseActiveOne != null">total_reverse_active_one,</if>
<if test="forwardReactiveMaxDemand != null">forward_reactive_max_demand,</if>
<if test="reverseReactiveMaxDemand != null">reverse_reactive_max_demand,</if>
<if test="aForwardActiveEnergy != null">a_forward_active_energy,</if>
<if test="bForwardActiveEnergy != null">b_forward_active_energy,</if>
<if test="cForwardActiveEnergy != null">c_forward_active_energy,</if>
<if test="didoStatus != null">dido_status,</if>
<if test="runningStatus != null">running_status,</if>
<if test="zeroSeqCurrent != null">zero_seq_current,</if>
<if test="voltageUnbalanceDegree != null">voltage_unbalance_degree,</if>
<if test="currentUnbalanceDegree != null">current_unbalance_degree,</if>
<if test="dailyReverseAcMaxDemand != null">daily_reverse_ac_max_demand,</if>
<if test="dailyForwardReacMaxDemand != null">daily_forward_reac_max_demand,</if>
<if test="dailyReverseReacMaxDemand != null">daily_reverse_reac_max_demand,</if>
<if test="preDayForwardAcMaxDemand != null">pre_day_forward_ac_max_demand,</if>
<if test="preDayReverseAcMaxDemand != null">pre_day_reverse_ac_max_demand,</if>
<if test="preDayForwardReacMaxDemand != null">pre_day_forward_reac_max_demand,</if>
<if test="preDayReverseReacMaxDemand != null">pre_day_reverse_reac_max_demand,</if>
<if test="pre2dForwardAcMaxDemand != null">pre_2d_forward_ac_max_demand,</if>
<if test="pre2dReverseAcMaxDemand != null">pre_2d_reverse_ac_max_demand,</if>
<if test="pre2dForwardReacMaxDemand != null">pre_2d_forward_reac_max_demand,</if>
<if test="pre2dReverseReacMaxDemand != null">pre_2d_reverse_reac_max_demand,</if>
<if test="currentForwardAcDemand != null">current_forward_ac_demand,</if>
<if test="currentReverseAcDemand != null">current_reverse_ac_demand,</if>
<if test="currentForwardReacDemand != null">current_forward_reac_demand,</if>
<if test="currentReverseReacDemand != null">current_reverse_reac_demand,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dataUpdateTime != null">#{dataUpdateTime},</if>
@ -427,6 +613,68 @@
<if test="reverseActiveEnergyEpMinus != null">#{reverseActiveEnergyEpMinus},</if>
<if test="positiveReactiveEnergyEqPlus != null">#{positiveReactiveEnergyEqPlus},</if>
<if test="positiveActiveEnergyEpPlus != null">#{positiveActiveEnergyEpPlus},</if>
<if test="currentPercent != null">#{currentPercent},</if>
<if test="voltagePercent != null">#{voltagePercent},</if>
<if test="avgCurrent != null">#{avgCurrent},</if>
<if test="totalForwardActiveTwo != null">#{totalForwardActiveTwo},</if>
<if test="totalPeakForwardActive != null">#{totalPeakForwardActive},</if>
<if test="totalHighForwardActive != null">#{totalHighForwardActive},</if>
<if test="totalFlatForwardActive != null">#{totalFlatForwardActive},</if>
<if test="totalValleyForwardActive != null">#{totalValleyForwardActive},</if>
<if test="totalReverseActiveTwo != null">#{totalReverseActiveTwo},</if>
<if test="totalPeakReverseActive != null">#{totalPeakReverseActive},</if>
<if test="totalHighReverseActive != null">#{totalHighReverseActive},</if>
<if test="totalFlatReverseActive != null">#{totalFlatReverseActive},</if>
<if test="totalValleyReverseActive != null">#{totalValleyReverseActive},</if>
<if test="disconnectDetectionIndication != null">#{disconnectDetectionIndication},</if>
<if test="ratedPrimaryCurrentValue != null">#{ratedPrimaryCurrentValue},</if>
<if test="switchInputOutputStatus != null">#{switchInputOutputStatus},</if>
<if test="alarmStatus != null">#{alarmStatus},</if>
<if test="currentTotalVoltagePercent != null">#{currentTotalVoltagePercent},</if>
<if test="voltageContentPercent != null">#{voltageContentPercent},</if>
<if test="voltageAcPercent != null">#{voltageAcPercent},</if>
<if test="currentTotalCurrentPercent != null">#{currentTotalCurrentPercent},</if>
<if test="currentContentPercent != null">#{currentContentPercent},</if>
<if test="currentAcPercent != null">#{currentAcPercent},</if>
<if test="currentTotalPowerPercent != null">#{currentTotalPowerPercent},</if>
<if test="powerContentPercent != null">#{powerContentPercent},</if>
<if test="powerAcPercent != null">#{powerAcPercent},</if>
<if test="dataSettingYearMonth != null">#{dataSettingYearMonth},</if>
<if test="dataSettingDayHour != null">#{dataSettingDayHour},</if>
<if test="dataSettingMinutesSeconds != null">#{dataSettingMinutesSeconds},</if>
<if test="currentRate != null">#{currentRate},</if>
<if test="versionNumber != null">#{versionNumber},</if>
<if test="voltage != null">#{voltage},</if>
<if test="current != null">#{current},</if>
<if test="power != null">#{power},</if>
<if test="internalTemp != null">#{internalTemp},</if>
<if test="totalForwardActiveOne != null">#{totalForwardActiveOne},</if>
<if test="totalReverseActiveOne != null">#{totalReverseActiveOne},</if>
<if test="forwardReactiveMaxDemand != null">#{forwardReactiveMaxDemand},</if>
<if test="reverseReactiveMaxDemand != null">#{reverseReactiveMaxDemand},</if>
<if test="aForwardActiveEnergy != null">#{aForwardActiveEnergy},</if>
<if test="bForwardActiveEnergy != null">#{bForwardActiveEnergy},</if>
<if test="cForwardActiveEnergy != null">#{cForwardActiveEnergy},</if>
<if test="didoStatus != null">#{didoStatus},</if>
<if test="runningStatus != null">#{runningStatus},</if>
<if test="zeroSeqCurrent != null">#{zeroSeqCurrent},</if>
<if test="voltageUnbalanceDegree != null">#{voltageUnbalanceDegree},</if>
<if test="currentUnbalanceDegree != null">#{currentUnbalanceDegree},</if>
<if test="dailyReverseAcMaxDemand != null">#{dailyReverseAcMaxDemand},</if>
<if test="dailyForwardReacMaxDemand != null">#{dailyForwardReacMaxDemand},</if>
<if test="dailyReverseReacMaxDemand != null">#{dailyReverseReacMaxDemand},</if>
<if test="preDayForwardAcMaxDemand != null">#{preDayForwardAcMaxDemand},</if>
<if test="preDayReverseAcMaxDemand != null">#{preDayReverseAcMaxDemand},</if>
<if test="preDayForwardReacMaxDemand != null">#{preDayForwardReacMaxDemand},</if>
<if test="preDayReverseReacMaxDemand != null">#{preDayReverseReacMaxDemand},</if>
<if test="pre2dForwardAcMaxDemand != null">#{pre2dForwardAcMaxDemand},</if>
<if test="pre2dReverseAcMaxDemand != null">#{pre2dReverseAcMaxDemand},</if>
<if test="pre2dForwardReacMaxDemand != null">#{pre2dForwardReacMaxDemand},</if>
<if test="pre2dReverseReacMaxDemand != null">#{pre2dReverseReacMaxDemand},</if>
<if test="currentForwardAcDemand != null">#{currentForwardAcDemand},</if>
<if test="currentReverseAcDemand != null">#{currentReverseAcDemand},</if>
<if test="currentForwardReacDemand != null">#{currentForwardReacDemand},</if>
<if test="currentReverseReacDemand != null">#{currentReverseReacDemand},</if>
</trim>
</insert>
@ -534,6 +782,68 @@
<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>
<if test="currentPercent != null">current_percent = #{currentPercent},</if>
<if test="voltagePercent != null">voltage_percent = #{voltagePercent},</if>
<if test="avgCurrent != null">avg_current = #{avgCurrent},</if>
<if test="totalForwardActiveTwo != null">total_forward_active_two = #{totalForwardActiveTwo},</if>
<if test="totalPeakForwardActive != null">total_peak_forward_active = #{totalPeakForwardActive},</if>
<if test="totalHighForwardActive != null">total_high_forward_active = #{totalHighForwardActive},</if>
<if test="totalFlatForwardActive != null">total_flat_forward_active = #{totalFlatForwardActive},</if>
<if test="totalValleyForwardActive != null">total_valley_forward_active = #{totalValleyForwardActive},</if>
<if test="totalReverseActiveTwo != null">total_reverse_active_two = #{totalReverseActiveTwo},</if>
<if test="totalPeakReverseActive != null">total_peak_reverse_active = #{totalPeakReverseActive},</if>
<if test="totalHighReverseActive != null">total_high_reverse_active = #{totalHighReverseActive},</if>
<if test="totalFlatReverseActive != null">total_flat_reverse_active = #{totalFlatReverseActive},</if>
<if test="totalValleyReverseActive != null">total_valley_reverse_active = #{totalValleyReverseActive},</if>
<if test="disconnectDetectionIndication != null">disconnect_detection_indication = #{disconnectDetectionIndication},</if>
<if test="ratedPrimaryCurrentValue != null">rated_primary_current_value = #{ratedPrimaryCurrentValue},</if>
<if test="switchInputOutputStatus != null">switch_input_output_status = #{switchInputOutputStatus},</if>
<if test="alarmStatus != null">alarm_status = #{alarmStatus},</if>
<if test="currentTotalVoltagePercent != null">current_total_voltage_percent = #{currentTotalVoltagePercent},</if>
<if test="voltageContentPercent != null">voltage_content_percent = #{voltageContentPercent},</if>
<if test="voltageAcPercent != null">voltage_ac_percent = #{voltageAcPercent},</if>
<if test="currentTotalCurrentPercent != null">current_total_current_percent = #{currentTotalCurrentPercent},</if>
<if test="currentContentPercent != null">current_content_percent = #{currentContentPercent},</if>
<if test="currentAcPercent != null">current_ac_percent = #{currentAcPercent},</if>
<if test="currentTotalPowerPercent != null">current_total_power_percent = #{currentTotalPowerPercent},</if>
<if test="powerContentPercent != null">power_content_percent = #{powerContentPercent},</if>
<if test="powerAcPercent != null">power_ac_percent = #{powerAcPercent},</if>
<if test="dataSettingYearMonth != null">data_setting_year_month = #{dataSettingYearMonth},</if>
<if test="dataSettingDayHour != null">data_setting_day_hour = #{dataSettingDayHour},</if>
<if test="dataSettingMinutesSeconds != null">data_setting_minutes_seconds = #{dataSettingMinutesSeconds},</if>
<if test="currentRate != null">current_rate = #{currentRate},</if>
<if test="versionNumber != null">version_number = #{versionNumber},</if>
<if test="voltage != null">voltage = #{voltage},</if>
<if test="current != null">current = #{current},</if>
<if test="power != null">power = #{power},</if>
<if test="internalTemp != null">internal_temp = #{internalTemp},</if>
<if test="totalForwardActiveOne != null">total_forward_active_one = #{totalForwardActiveOne},</if>
<if test="totalReverseActiveOne != null">total_reverse_active_one = #{totalReverseActiveOne},</if>
<if test="forwardReactiveMaxDemand != null">forward_reactive_max_demand = #{forwardReactiveMaxDemand},</if>
<if test="reverseReactiveMaxDemand != null">reverse_reactive_max_demand = #{reverseReactiveMaxDemand},</if>
<if test="aForwardActiveEnergy != null">a_forward_active_energy = #{aForwardActiveEnergy},</if>
<if test="bForwardActiveEnergy != null">b_forward_active_energy = #{bForwardActiveEnergy},</if>
<if test="cForwardActiveEnergy != null">c_forward_active_energy = #{cForwardActiveEnergy},</if>
<if test="didoStatus != null">dido_status = #{didoStatus},</if>
<if test="runningStatus != null">running_status = #{runningStatus},</if>
<if test="zeroSeqCurrent != null">zero_seq_current = #{zeroSeqCurrent},</if>
<if test="voltageUnbalanceDegree != null">voltage_unbalance_degree = #{voltageUnbalanceDegree},</if>
<if test="currentUnbalanceDegree != null">current_unbalance_degree = #{currentUnbalanceDegree},</if>
<if test="dailyReverseAcMaxDemand != null">daily_reverse_ac_max_demand = #{dailyReverseAcMaxDemand},</if>
<if test="dailyForwardReacMaxDemand != null">daily_forward_reac_max_demand = #{dailyForwardReacMaxDemand},</if>
<if test="dailyReverseReacMaxDemand != null">daily_reverse_reac_max_demand = #{dailyReverseReacMaxDemand},</if>
<if test="preDayForwardAcMaxDemand != null">pre_day_forward_ac_max_demand = #{preDayForwardAcMaxDemand},</if>
<if test="preDayReverseAcMaxDemand != null">pre_day_reverse_ac_max_demand = #{preDayReverseAcMaxDemand},</if>
<if test="preDayForwardReacMaxDemand != null">pre_day_forward_reac_max_demand = #{preDayForwardReacMaxDemand},</if>
<if test="preDayReverseReacMaxDemand != null">pre_day_reverse_reac_max_demand = #{preDayReverseReacMaxDemand},</if>
<if test="pre2dForwardAcMaxDemand != null">pre_2d_forward_ac_max_demand = #{pre2dForwardAcMaxDemand},</if>
<if test="pre2dReverseAcMaxDemand != null">pre_2d_reverse_ac_max_demand = #{pre2dReverseAcMaxDemand},</if>
<if test="pre2dForwardReacMaxDemand != null">pre_2d_forward_reac_max_demand = #{pre2dForwardReacMaxDemand},</if>
<if test="pre2dReverseReacMaxDemand != null">pre_2d_reverse_reac_max_demand = #{pre2dReverseReacMaxDemand},</if>
<if test="currentForwardAcDemand != null">current_forward_ac_demand = #{currentForwardAcDemand},</if>
<if test="currentReverseAcDemand != null">current_reverse_ac_demand = #{currentReverseAcDemand},</if>
<if test="currentForwardReacDemand != null">current_forward_reac_demand = #{currentForwardReacDemand},</if>
<if test="currentReverseReacDemand != null">current_reverse_reac_demand = #{currentReverseReacDemand},</if>
</trim>
where id = #{id}
</update>

View File

@ -328,30 +328,26 @@
<select id="getAveSocList" resultType="com.xzzn.ems.domain.vo.BatteryAveSOCVo">
select t.site_id,
t.battery_pack_soc as batterySOC,
t.create_time as createDate
avg(t.battery_pack_soc) as batterySOC,
DATE_FORMAT(t.create_time, '%Y-%m-%d %H:%i:00') AS createDate
from ems_battery_cluster t
inner join (select site_id,create_time,MIN(device_id) as device_id
from ems_battery_cluster
where site_id = #{siteId}
AND create_time &gt;= #{startDate}
AND create_time &lt;= #{endDate}
GROUP BY site_id,create_time
) temp on t.site_id = temp.site_id and t.create_time = temp.create_time and t.device_id = temp.device_id
where t.site_id = #{siteId}
AND t.create_time &gt;= Date(#{startDate})
AND t.create_time &lt;= #{endDate}
GROUP BY t.site_id,DATE_FORMAT(t.create_time, '%Y-%m-%d %H:%i:00')
order by createDate
</select>
<select id="getBatteryAveTempList" resultType="com.xzzn.ems.domain.vo.BatteryAveTempVo">
select t.site_id,
t.avg_cell_temp as batteryTemp,
t.create_time as createDate
avg(t.avg_cell_temp) as batteryTemp,
DATE_FORMAT(t.create_time, '%Y-%m-%d %H:%i:00') AS createDate
from ems_battery_cluster t
inner join (select site_id,create_time,MIN(device_id) as device_id
from ems_battery_cluster
where site_id = #{siteId}
AND create_time &gt;= #{startDate}
AND create_time &lt;= #{endDate}
GROUP BY site_id,create_time
) temp on t.site_id = temp.site_id and t.create_time = temp.create_time and t.device_id = temp.device_id
where t.site_id = '021_FXX_01'
AND t.create_time &gt;= Date(#{startDate})
AND t.create_time &lt;= #{endDate}
GROUP BY t.site_id,DATE_FORMAT(t.create_time, '%Y-%m-%d %H:%i:00')
order by createDate
</select>
<select id="getClusterDataByHour" resultType="com.xzzn.ems.domain.vo.ClusterStatisListVo">
@ -366,9 +362,11 @@
t.min_cell_voltage_id as minVoltageId
FROM ( SELECT p.site_id, p.device_id, DATE_FORMAT( p.update_time, '%H' ) AS statisDate, MAX(p.update_time) AS max_update_time
FROM ems_battery_cluster p
WHERE p.stack_device_id = #{stackId}
WHERE p.site_id = #{siteId}
AND p.stack_device_id = #{stackId}
AND p.device_id = #{clusterId}
AND DATE(p.update_time) = #{dateTime}
AND p.update_time &gt;= #{dateTime}
AND p.update_time &lt; DATE_ADD(#{dateTime}, INTERVAL 1 DAY)
GROUP BY p.site_id, p.device_id, statisDate
) latest
INNER JOIN ems_battery_cluster t ON latest.site_id = t.site_id

View File

@ -0,0 +1,179 @@
<?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.EmsBatteryDailyLatestMapper">
<resultMap type="EmsBatteryDataDailyLatest" id="EmsBatteryDataDailyLatestResult">
<result property="batteryPack" column="battery_pack" />
<result property="batteryCluster" column="battery_cluster" />
<result property="batteryCellId" column="battery_cell_id" />
<result property="voltage" column="voltage" />
<result property="temperature" column="temperature" />
<result property="soc" column="soc" />
<result property="soh" column="soh" />
<result property="dateDay" column="date_day" />
<result property="dataTimestamp" column="data_timestamp" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="siteId" column="site_id" />
<result property="deviceId" column="device_id" />
<result property="clusterDeviceId" column="cluster_device_id" />
</resultMap>
<sql id="selectEmsBatteryDataDailyLatestVo">
select battery_pack, battery_cluster, battery_cell_id, voltage, temperature, soc, soh, date_day, data_timestamp, create_by, create_time, update_by, update_time, remark, site_id, device_id, cluster_device_id from ems_battery_data_daily_latest
</sql>
<select id="selectEmsBatteryDataDailyLatestList" parameterType="EmsBatteryDataDailyLatest" resultMap="EmsBatteryDataDailyLatestResult">
<include refid="selectEmsBatteryDataDailyLatestVo"/>
<where>
<if test="batteryPack != null and batteryPack != ''"> and battery_pack = #{batteryPack}</if>
<if test="batteryCluster != null and batteryCluster != ''"> and battery_cluster = #{batteryCluster}</if>
<if test="batteryCellId != null and batteryCellId != ''"> and battery_cell_id = #{batteryCellId}</if>
<if test="voltage != null "> and voltage = #{voltage}</if>
<if test="temperature != null "> and temperature = #{temperature}</if>
<if test="soc != null "> and soc = #{soc}</if>
<if test="soh != null "> and soh = #{soh}</if>
<if test="dateDay != null "> and date_day = #{dateDay}</if>
<if test="dataTimestamp != null "> and data_timestamp = #{dataTimestamp}</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="clusterDeviceId != null and clusterDeviceId != ''"> and cluster_device_id = #{clusterDeviceId}</if>
</where>
</select>
<select id="selectEmsBatteryDataDailyLatestByBatteryPack" parameterType="String" resultMap="EmsBatteryDataDailyLatestResult">
<include refid="selectEmsBatteryDataDailyLatestVo"/>
where battery_pack = #{batteryPack}
</select>
<insert id="insertEmsBatteryDataDailyLatest" parameterType="EmsBatteryDataDailyLatest">
insert into ems_battery_data_daily_latest
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="batteryPack != null">battery_pack,</if>
<if test="batteryCluster != null">battery_cluster,</if>
<if test="batteryCellId != null">battery_cell_id,</if>
<if test="voltage != null">voltage,</if>
<if test="temperature != null">temperature,</if>
<if test="soc != null">soc,</if>
<if test="soh != null">soh,</if>
<if test="dateDay != null">date_day,</if>
<if test="dataTimestamp != null">data_timestamp,</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">device_id,</if>
<if test="clusterDeviceId != null">cluster_device_id,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="batteryPack != null">#{batteryPack},</if>
<if test="batteryCluster != null">#{batteryCluster},</if>
<if test="batteryCellId != null">#{batteryCellId},</if>
<if test="voltage != null">#{voltage},</if>
<if test="temperature != null">#{temperature},</if>
<if test="soc != null">#{soc},</if>
<if test="soh != null">#{soh},</if>
<if test="dateDay != null">#{dateDay},</if>
<if test="dataTimestamp != null">#{dataTimestamp},</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">#{deviceId},</if>
<if test="clusterDeviceId != null">#{clusterDeviceId},</if>
</trim>
</insert>
<update id="updateEmsBatteryDataDailyLatest" parameterType="EmsBatteryDataDailyLatest">
update ems_battery_data_daily_latest
<trim prefix="SET" suffixOverrides=",">
<if test="batteryCluster != null">battery_cluster = #{batteryCluster},</if>
<if test="batteryCellId != null">battery_cell_id = #{batteryCellId},</if>
<if test="voltage != null">voltage = #{voltage},</if>
<if test="temperature != null">temperature = #{temperature},</if>
<if test="soc != null">soc = #{soc},</if>
<if test="soh != null">soh = #{soh},</if>
<if test="dateDay != null">date_day = #{dateDay},</if>
<if test="dataTimestamp != null">data_timestamp = #{dataTimestamp},</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">device_id = #{deviceId},</if>
<if test="clusterDeviceId != null">cluster_device_id = #{clusterDeviceId},</if>
</trim>
where battery_pack = #{batteryPack}
</update>
<delete id="deleteEmsBatteryDataDailyLatestByBatteryPack" parameterType="String">
delete from ems_battery_data_daily_latest where battery_pack = #{batteryPack}
</delete>
<delete id="deleteEmsBatteryDataDailyLatestByBatteryPacks" parameterType="String">
delete from ems_battery_data_daily_latest where battery_pack in
<foreach item="batteryPack" collection="array" open="(" separator="," close=")">
#{batteryPack}
</foreach>
</delete>
<insert id="batchUpsert">
INSERT INTO ems_battery_data_daily_latest (
battery_pack, battery_cluster, battery_cell_id, voltage, temperature, soc, soh, date_day,
data_timestamp, create_by, create_time, update_by, update_time, remark, site_id, device_id, cluster_device_id
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.batteryPack},
#{item.batteryCluster},
#{item.batteryCellId},
#{item.voltage},
#{item.temperature},
#{item.soc},
#{item.soh},
#{item.dateDay},
#{item.dataTimestamp},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime},
#{item.remark},
#{item.siteId},
#{item.deviceId},
#{item.clusterDeviceId}
)
</foreach>
ON DUPLICATE KEY UPDATE
voltage = VALUES(voltage),
temperature = VALUES(temperature),
soc = VALUES(soc),
soh = VALUES(soh),
data_timestamp = VALUES(data_timestamp),
update_time = NOW(),
remark = VALUES(remark)
</insert>
<select id="getBatteryDailyLatest" parameterType="com.xzzn.ems.domain.vo.DateSearchRequest" resultType="com.xzzn.ems.domain.vo.BatteryDataStatsListVo">
SELECT date_day as dataTimestamp,
voltage, temperature, soc, soh,
device_id as deviceId,
cluster_device_id as clusterDeviceId
FROM ems_battery_data_daily_latest
WHERE site_id = #{siteId}
and cluster_device_id = #{clusterDeviceId}
and device_id = #{deviceId}
and date_day &gt;= #{startDate}
and date_day &lt;= #{endDate}
GROUP BY dataTimestamp
</select>
</mapper>

View File

@ -22,10 +22,11 @@
<result property="siteId" column="site_id" />
<result property="deviceId" column="device_id" />
<result property="clusterDeviceId" column="cluster_device_id" />
<result property="interResistance" column="inter_resistance" />
</resultMap>
<sql id="selectEmsBatteryDataVo">
select id, battery_pack, battery_cluster, battery_cell_id, voltage, temperature, soc, soh, data_timestamp, create_by, create_time, update_by, update_time, remark, site_id, device_id, cluster_device_id from ems_battery_data
select id, battery_pack, battery_cluster, battery_cell_id, voltage, temperature, soc, soh, data_timestamp, create_by, create_time, update_by, update_time, remark, site_id, device_id, cluster_device_id, inter_resistance from ems_battery_data
</sql>
<select id="selectEmsBatteryDataList" parameterType="EmsBatteryData" resultMap="EmsBatteryDataResult">
@ -42,6 +43,7 @@
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
<if test="clusterDeviceId != null and clusterDeviceId != ''"> and cluster_device_id = #{clusterDeviceId}</if>
<if test="interResistance != null "> and inter_resistance = #{interResistance}</if>
</where>
</select>
@ -69,6 +71,7 @@
<if test="siteId != null">site_id,</if>
<if test="deviceId != null and deviceId != ''">device_id,</if>
<if test="clusterDeviceId != null and clusterDeviceId != ''">cluster_device_id,</if>
<if test="interResistance != null">inter_resistance,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="batteryPack != null">#{batteryPack},</if>
@ -87,6 +90,7 @@
<if test="siteId != null">#{siteId},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="clusterDeviceId != null and clusterDeviceId != ''">#{clusterDeviceId},</if>
<if test="interResistance != null">#{interResistance},</if>
</trim>
</insert>
@ -109,6 +113,7 @@
<if test="siteId != null">site_id = #{siteId},</if>
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
<if test="clusterDeviceId != null and clusterDeviceId != ''">cluster_device_id = #{clusterDeviceId},</if>
<if test="interResistance != null">inter_resistance = #{interResistance},</if>
</trim>
where id = #{id}
</update>
@ -197,21 +202,21 @@
</if>
</select>
<insert id="insertEmsBatteryDataList" parameterType="java.util.List">
INSERT INTO ems_battery_data (
battery_pack, battery_cluster, battery_cell_id,
voltage, temperature, soc, soh, data_timestamp,
create_by, create_time, update_by, update_time,
remark, site_id, device_id, cluster_device_id
remark, site_id, device_id, cluster_device_id, inter_resistance
) VALUES
<foreach collection="list" item="item" separator=",">
(
#{item.batteryPack}, #{item.batteryCluster}, #{item.batteryCellId},
#{item.voltage}, #{item.temperature}, #{item.soc}, #{item.soh}, #{item.dataTimestamp},
#{item.createBy}, #{item.createTime}, #{item.updateBy}, #{item.updateTime},
#{item.remark}, #{item.siteId}, #{item.deviceId}, #{item.clusterDeviceId}
#{item.remark}, #{item.siteId}, #{item.deviceId}, #{item.clusterDeviceId},#{item.interResistance}
)
</foreach>
</insert>
</mapper>

View File

@ -0,0 +1,148 @@
<?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.EmsBatteryGroupMapper">
<resultMap type="EmsBatteryGroup" id="EmsBatteryGroupResult">
<result property="id" column="id" />
<result property="status" column="status" />
<result property="voltage" column="voltage" />
<result property="current" column="current" />
<result property="soc" column="soc" />
<result property="soh" column="soh" />
<result property="estimatedBackupDuration" column="estimated_backup_duration" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="siteId" column="site_id" />
<result property="deviceId" column="device_id" />
</resultMap>
<sql id="selectEmsBatteryGroupVo">
select id, status, voltage, current, soc, soh, estimated_backup_duration, create_by, create_time, update_by, update_time, remark, site_id, device_id from ems_battery_group
</sql>
<select id="selectEmsBatteryGroupList" parameterType="EmsBatteryGroup" resultMap="EmsBatteryGroupResult">
<include refid="selectEmsBatteryGroupVo"/>
<where>
<if test="status != null and status != ''"> and status = #{status}</if>
<if test="voltage != null "> and voltage = #{voltage}</if>
<if test="current != null "> and current = #{current}</if>
<if test="soc != null "> and soc = #{soc}</if>
<if test="soh != null "> and soh = #{soh}</if>
<if test="estimatedBackupDuration != null "> and estimated_backup_duration = #{estimatedBackupDuration}</if>
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
</where>
</select>
<select id="selectEmsBatteryGroupById" parameterType="Long" resultMap="EmsBatteryGroupResult">
<include refid="selectEmsBatteryGroupVo"/>
where id = #{id}
</select>
<insert id="insertEmsBatteryGroup" parameterType="EmsBatteryGroup" useGeneratedKeys="true" keyProperty="id">
insert into ems_battery_group
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="status != null">status,</if>
<if test="voltage != null">voltage,</if>
<if test="current != null">current,</if>
<if test="soc != null">soc,</if>
<if test="soh != null">soh,</if>
<if test="estimatedBackupDuration != null">estimated_backup_duration,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="status != null">#{status},</if>
<if test="voltage != null">#{voltage},</if>
<if test="current != null">#{current},</if>
<if test="soc != null">#{soc},</if>
<if test="soh != null">#{soh},</if>
<if test="estimatedBackupDuration != null">#{estimatedBackupDuration},</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>
</trim>
</insert>
<update id="updateEmsBatteryGroup" parameterType="EmsBatteryGroup">
update ems_battery_group
<trim prefix="SET" suffixOverrides=",">
<if test="status != null">status = #{status},</if>
<if test="voltage != null">voltage = #{voltage},</if>
<if test="current != null">current = #{current},</if>
<if test="soc != null">soc = #{soc},</if>
<if test="soh != null">soh = #{soh},</if>
<if test="estimatedBackupDuration != null">estimated_backup_duration = #{estimatedBackupDuration},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteEmsBatteryGroupById" parameterType="Long">
delete from ems_battery_group where id = #{id}
</delete>
<delete id="deleteEmsBatteryGroupByIds" parameterType="String">
delete from ems_battery_group where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
<insert id="batchInsertGroupData" parameterType="java.util.List">
INSERT INTO ems_battery_group (
status,
voltage,
current,
soc,
soh,
estimated_backup_duration,
create_by,
create_time,
update_by,
update_time,
remark,
site_id,
device_id
) VALUES
<!-- 遍历集合生成多条记录注意separator和括号闭合 -->
<foreach collection="list" item="item" separator=",">
(
#{item.status},
#{item.voltage},
#{item.current},
#{item.soc},
#{item.soh},
#{item.estimatedBackupDuration},
#{item.createBy},
#{item.createTime},
#{item.updateBy},
#{item.updateTime},
#{item.remark},
#{item.siteId},
#{item.deviceId}
)
</foreach>
</insert>
</mapper>

View File

@ -52,10 +52,24 @@
<result property="createBy" column="create_by" />
<result property="updateTime" column="update_time" />
<result property="updateBy" column="update_by" />
<result property="batteryNumber" column="battery_number" />
<result property="batteryAvgVoltage" column="battery_avg_voltage" />
<result property="batteryDifferentPressure" column="battery_different_pressure" />
<result property="avgTemperature" column="avg_temperature" />
<result property="batteryDifferentTemperature" column="battery_different_temperature" />
<result property="maxInternalResistance" column="max_internal_resistance" />
<result property="minInternalResistance" column="min_internal_resistance" />
<result property="avgInternalResistance" column="avg_internal_resistance" />
<result property="batteryDefferentResistance" column="battery_defferent_resistance" />
<result property="maxResistanceCellId" column="max_resistance_cell_id" />
<result property="minResistanceCellId" column="min_resistance_cell_id" />
<result property="environmentTemperature" column="environment_temperature" />
<result property="environmentHumidity" column="environment_humidity" />
<result property="circuitBreakerStatus" column="circuit_breaker_status" />
</resultMap>
<sql id="selectEmsBatteryStackVo">
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
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, battery_number, battery_avg_voltage, battery_different_pressure, avg_temperature, battery_different_temperature, max_internal_resistance, min_internal_resistance, avg_internal_resistance, battery_defferent_resistance, max_resistance_cell_id, min_resistance_cell_id, environment_temperature, environment_humidity, circuit_breaker_status from ems_battery_stack
</sql>
<select id="selectEmsBatteryStackList" parameterType="EmsBatteryStack" resultMap="EmsBatteryStackResult">
@ -103,6 +117,20 @@
<if test="stackInsulationResistance != null "> and stack_insulation_resistance = #{stackInsulationResistance}</if>
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
<if test="batteryNumber != null "> and battery_number = #{batteryNumber}</if>
<if test="batteryAvgVoltage != null "> and battery_avg_voltage = #{batteryAvgVoltage}</if>
<if test="batteryDifferentPressure != null "> and battery_different_pressure = #{batteryDifferentPressure}</if>
<if test="avgTemperature != null "> and avg_temperature = #{avgTemperature}</if>
<if test="batteryDifferentTemperature != null "> and battery_different_temperature = #{batteryDifferentTemperature}</if>
<if test="maxInternalResistance != null "> and max_internal_resistance = #{maxInternalResistance}</if>
<if test="minInternalResistance != null "> and min_internal_resistance = #{minInternalResistance}</if>
<if test="avgInternalResistance != null "> and avg_internal_resistance = #{avgInternalResistance}</if>
<if test="batteryDefferentResistance != null "> and battery_defferent_resistance = #{batteryDefferentResistance}</if>
<if test="maxResistanceCellId != null "> and max_resistance_cell_id = #{maxResistanceCellId}</if>
<if test="minResistanceCellId != null "> and min_resistance_cell_id = #{minResistanceCellId}</if>
<if test="environmentTemperature != null "> and environment_temperature = #{environmentTemperature}</if>
<if test="environmentHumidity != null "> and environment_humidity = #{environmentHumidity}</if>
<if test="circuitBreakerStatus != null and circuitBreakerStatus != ''"> and circuit_breaker_status = #{circuitBreakerStatus}</if>
</where>
</select>
@ -160,6 +188,20 @@
<if test="createBy != null">create_by,</if>
<if test="updateTime != null">update_time,</if>
<if test="updateBy != null">update_by,</if>
<if test="batteryNumber != null">battery_number,</if>
<if test="batteryAvgVoltage != null">battery_avg_voltage,</if>
<if test="batteryDifferentPressure != null">battery_different_pressure,</if>
<if test="avgTemperature != null">avg_temperature,</if>
<if test="batteryDifferentTemperature != null">battery_different_temperature,</if>
<if test="maxInternalResistance != null">max_internal_resistance,</if>
<if test="minInternalResistance != null">min_internal_resistance,</if>
<if test="avgInternalResistance != null">avg_internal_resistance,</if>
<if test="batteryDefferentResistance != null">battery_defferent_resistance,</if>
<if test="maxResistanceCellId != null">max_resistance_cell_id,</if>
<if test="minResistanceCellId != null">min_resistance_cell_id,</if>
<if test="environmentTemperature != null">environment_temperature,</if>
<if test="environmentHumidity != null">environment_humidity,</if>
<if test="circuitBreakerStatus != null">circuit_breaker_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="workStatus != null">#{workStatus},</if>
@ -208,6 +250,20 @@
<if test="createBy != null">#{createBy},</if>
<if test="updateTime != null">#{updateTime},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="batteryNumber != null">#{batteryNumber},</if>
<if test="batteryAvgVoltage != null">#{batteryAvgVoltage},</if>
<if test="batteryDifferentPressure != null">#{batteryDifferentPressure},</if>
<if test="avgTemperature != null">#{avgTemperature},</if>
<if test="batteryDifferentTemperature != null">#{batteryDifferentTemperature},</if>
<if test="maxInternalResistance != null">#{maxInternalResistance},</if>
<if test="minInternalResistance != null">#{minInternalResistance},</if>
<if test="avgInternalResistance != null">#{avgInternalResistance},</if>
<if test="batteryDefferentResistance != null">#{batteryDefferentResistance},</if>
<if test="maxResistanceCellId != null">#{maxResistanceCellId},</if>
<if test="minResistanceCellId != null">#{minResistanceCellId},</if>
<if test="environmentTemperature != null">#{environmentTemperature},</if>
<if test="environmentHumidity != null">#{environmentHumidity},</if>
<if test="circuitBreakerStatus != null">#{circuitBreakerStatus},</if>
</trim>
</insert>
@ -260,6 +316,20 @@
<if test="createBy != null">create_by = #{createBy},</if>
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="updateBy != null">update_by = #{updateBy},</if>
<if test="batteryNumber != null">battery_number = #{batteryNumber},</if>
<if test="batteryAvgVoltage != null">battery_avg_voltage = #{batteryAvgVoltage},</if>
<if test="batteryDifferentPressure != null">battery_different_pressure = #{batteryDifferentPressure},</if>
<if test="avgTemperature != null">avg_temperature = #{avgTemperature},</if>
<if test="batteryDifferentTemperature != null">battery_different_temperature = #{batteryDifferentTemperature},</if>
<if test="maxInternalResistance != null">max_internal_resistance = #{maxInternalResistance},</if>
<if test="minInternalResistance != null">min_internal_resistance = #{minInternalResistance},</if>
<if test="avgInternalResistance != null">avg_internal_resistance = #{avgInternalResistance},</if>
<if test="batteryDefferentResistance != null">battery_defferent_resistance = #{batteryDefferentResistance},</if>
<if test="maxResistanceCellId != null">max_resistance_cell_id = #{maxResistanceCellId},</if>
<if test="minResistanceCellId != null">min_resistance_cell_id = #{minResistanceCellId},</if>
<if test="environmentTemperature != null">environment_temperature = #{environmentTemperature},</if>
<if test="environmentHumidity != null">environment_humidity = #{environmentHumidity},</if>
<if test="circuitBreakerStatus != null">circuit_breaker_status = #{circuitBreakerStatus},</if>
</trim>
where id = #{id}
</update>
@ -277,16 +347,14 @@
<select id="getStackAveTempList" resultType="com.xzzn.ems.domain.vo.StackAveTempVo">
select t.site_id,
t.operating_temp as temp,
t.create_time as createDate
avg(t.operating_temp) as temp,
DATE_FORMAT(t.create_time, '%Y-%m-%d %H:%i:00') AS createDate
from ems_battery_stack t
inner join (select site_id,create_time,MIN(device_id) as device_id
from ems_battery_stack
where site_id = #{siteId}
AND create_time &gt;= Date(#{startDate})
AND create_time &lt;= #{endDate}
GROUP BY site_id,create_time
) temp on t.site_id = temp.site_id and t.create_time = temp.create_time and t.device_id = temp.device_id
where t.site_id = #{siteId}
AND t.create_time &gt;= Date(#{startDate})
AND t.create_time &lt;= #{endDate}
GROUP BY t.site_id,createDate
order by createDate
</select>
<sql id="statisCommonFilter">
@ -358,4 +426,19 @@
AND latest.max_update_time = t.update_time
order by statisDate desc
</select>
<select id="getSiteSumStackInfo" parameterType="String" resultType="com.xzzn.ems.domain.EmsBatteryStack">
select SUM(t.stack_soc) as stackSoc,
sum(t.stack_soh) as stackSoh
from ems_battery_stack t
INNER JOIN (
select p.site_id,p.device_id,MAX(p.create_time) as max_time
from ems_battery_stack p
where p.site_id = #{siteId}
group by p.site_id, p.device_id
) latest on t.site_id = latest.site_id
and t.device_id = latest.device_id
and t.create_time = latest.max_time
where t.site_id = #{siteId}
</select>
</mapper>

View File

@ -161,7 +161,10 @@
</select>
<select id="getDeviceInfoByParentId" parameterType="String" resultType="java.util.Map">
select distinct t.device_id as id,t.device_name as deviceName from ems_devices_setting t where t.parent_id = #{parentId}
select distinct t.device_id as id,t.device_name as deviceName
from ems_devices_setting t
where t.site_id = #{siteId}
and t.parent_id = #{parentId}
</select>
<select id="getAllBatteryDeviceBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.EmsDevicesSetting">

View File

@ -0,0 +1,91 @@
<?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.EmsDhDataMapper">
<resultMap type="EmsDhData" id="EmsDhDataResult">
<result property="id" column="id" />
<result property="humidity" column="humidity" />
<result property="temperature" column="temperature" />
<result property="createBy" column="create_by" />
<result property="createTime" column="create_time" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="siteId" column="site_id" />
<result property="deviceId" column="device_id" />
</resultMap>
<sql id="selectEmsDhDataVo">
select id, humidity, temperature, create_by, create_time, update_by, update_time, remark, site_id, device_id from ems_dh_data
</sql>
<select id="selectEmsDhDataList" parameterType="EmsDhData" resultMap="EmsDhDataResult">
<include refid="selectEmsDhDataVo"/>
<where>
<if test="humidity != null "> and humidity = #{humidity}</if>
<if test="temperature != null "> and temperature = #{temperature}</if>
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
</where>
</select>
<select id="selectEmsDhDataById" parameterType="Long" resultMap="EmsDhDataResult">
<include refid="selectEmsDhDataVo"/>
where id = #{id}
</select>
<insert id="insertEmsDhData" parameterType="EmsDhData" useGeneratedKeys="true" keyProperty="id">
insert into ems_dh_data
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="humidity != null">humidity,</if>
<if test="temperature != null">temperature,</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>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="humidity != null">#{humidity},</if>
<if test="temperature != null">#{temperature},</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>
</trim>
</insert>
<update id="updateEmsDhData" parameterType="EmsDhData">
update ems_dh_data
<trim prefix="SET" suffixOverrides=",">
<if test="humidity != null">humidity = #{humidity},</if>
<if test="temperature != null">temperature = #{temperature},</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>
</trim>
where id = #{id}
</update>
<delete id="deleteEmsDhDataById" parameterType="Long">
delete from ems_dh_data where id = #{id}
</delete>
<delete id="deleteEmsDhDataByIds" parameterType="String">
delete from ems_dh_data where id in
<foreach item="id" collection="array" open="(" separator="," close=")">
#{id}
</foreach>
</delete>
</mapper>

View File

@ -56,10 +56,11 @@
<result property="sysUCurrent" column="sys_u_current" />
<result property="sysVCurrent" column="sys_v_current" />
<result property="sysWCurrent" column="sys_w_current" />
<result property="dwFrequency" column="dw_frequency" />
</resultMap>
<sql id="selectEmsPcsDataVo">
select id, data_update_time, work_status, grid_status, device_status, control_mode, total_active_power, daily_ac_charge_energy, a_phase_voltage, a_phase_current, total_reactive_power, daily_ac_discharge_energy, b_phase_voltage, b_phase_current, total_apparent_power, pcs_module_temperature, c_phase_voltage, c_phase_current, total_power_factor, pcs_environment_temperature, ac_frequency, branch_status, discharge_status, dc_power, dc_voltage, dc_current, create_by, create_time, update_by, update_time, remark, site_id, device_id, date_month, date_day, total_ac_charge_energy, total_ac_discharge_energy, ac_charge_active_power, ac_capacitive_reactive_power, ac_discharge_active_power, ac_inductive_reactive_power, max_capacitive_power_capacity, max_inductive_power_capacity, max_charge_power_capacity, max_discharge_power_capacity, ac_switch_status, dc_switch_status, remote_control_status, sys_u_current, sys_v_current, sys_w_current from ems_pcs_data
select id, data_update_time, work_status, grid_status, device_status, control_mode, total_active_power, daily_ac_charge_energy, a_phase_voltage, a_phase_current, total_reactive_power, daily_ac_discharge_energy, b_phase_voltage, b_phase_current, total_apparent_power, pcs_module_temperature, c_phase_voltage, c_phase_current, total_power_factor, pcs_environment_temperature, ac_frequency, branch_status, discharge_status, dc_power, dc_voltage, dc_current, create_by, create_time, update_by, update_time, remark, site_id, device_id, date_month, date_day, total_ac_charge_energy, total_ac_discharge_energy, ac_charge_active_power, ac_capacitive_reactive_power, ac_discharge_active_power, ac_inductive_reactive_power, max_capacitive_power_capacity, max_inductive_power_capacity, max_charge_power_capacity, max_discharge_power_capacity, ac_switch_status, dc_switch_status, remote_control_status, sys_u_current, sys_v_current, sys_w_current, dw_frequency from ems_pcs_data
</sql>
<select id="selectEmsPcsDataList" parameterType="EmsPcsData" resultMap="EmsPcsDataResult">
@ -110,6 +111,7 @@
<if test="sysUCurrent != null "> and sys_u_current = #{sysUCurrent}</if>
<if test="sysVCurrent != null "> and sys_v_current = #{sysVCurrent}</if>
<if test="sysWCurrent != null "> and sys_w_current = #{sysWCurrent}</if>
<if test="dwFrequency != null "> and dw_frequency = #{dwFrequency}</if>
</where>
</select>
@ -171,6 +173,7 @@
<if test="sysUCurrent != null">sys_u_current,</if>
<if test="sysVCurrent != null">sys_v_current,</if>
<if test="sysWCurrent != null">sys_w_current,</if>
<if test="dwFrequency != null">dw_frequency,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dataUpdateTime != null">#{dataUpdateTime},</if>
@ -223,6 +226,7 @@
<if test="sysUCurrent != null">#{sysUCurrent},</if>
<if test="sysVCurrent != null">#{sysVCurrent},</if>
<if test="sysWCurrent != null">#{sysWCurrent},</if>
<if test="dwFrequency != null">#{dwFrequency},</if>
</trim>
</insert>
@ -279,6 +283,7 @@
<if test="sysUCurrent != null">sys_u_current = #{sysUCurrent},</if>
<if test="sysVCurrent != null">sys_v_current = #{sysVCurrent},</if>
<if test="sysWCurrent != null">sys_w_current = #{sysWCurrent},</if>
<if test="dwFrequency != null">dw_frequency = #{dwFrequency},</if>
</trim>
where id = #{id}
</update>
@ -295,36 +300,43 @@
</delete>
<select id="getPcsDataBySiteId" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
select latest.dateDay 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,DATE_FORMAT(p.data_update_time, '%m-%d') as dateDay, MAX(p.data_update_time) AS max_update_time
FROM ems_pcs_data p
where p.site_id = #{siteId} and p.create_time >= CURDATE() - INTERVAL #{limitTime} DAY
GROUP BY p.site_id,p.device_id,dateDay
) 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 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 ems_pcs_data t
inner join( 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}
and p.data_update_time >= CURDATE() - INTERVAL #{limitTime} DAY
GROUP BY p.site_id,p.device_id,p.date_month,p.date_day
) latest ON t.site_id = latest.site_id
AND t.device_id = latest.device_id
AND t.date_month = latest.date_month
AND t.date_day = latest.date_day
AND t.data_update_time = latest.max_update_time
group by ammeterDate
order by ammeterDate desc
order by ammeterDate
</select>
<select id="getPcsTotalChargeData" resultType="map">
SELECT
SUM(t.total_ac_charge_energy) AS totalChargedCap,
SUM(t.total_ac_discharge_energy) AS totalDischargedCap,
SUM(t.total_active_power) as gridNrtPower
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
SUM(p.total_ac_charge_energy) AS totalChargedCap,
SUM(p.total_ac_discharge_energy) AS totalDischargedCap,
SUM(p.total_active_power) AS gridNrtPower
FROM ems_pcs_data p
INNER JOIN ems_site_setting s ON p.site_id = s.site_id
INNER JOIN ( SELECT site_id, device_id, MAX(data_update_time) AS max_update_time
FROM ems_pcs_data
<if test="siteId !=null and siteId !=''">
where site_id = #{siteId}
</if>
GROUP BY site_id, device_id
) latest ON p.site_id = latest.site_id
AND p.device_id = latest.device_id
AND p.data_update_time = latest.max_update_time
<if test="siteId !=null and siteId !=''">
where p.site_id = #{siteId}
</if>
</select>
<select id="getSiteRunningHeadInfo" parameterType="String" resultType="com.xzzn.ems.domain.vo.SiteMonitorRunningHeadInfoVo">
@ -332,8 +344,7 @@
SUM(t.total_active_power) as totalActivePower,
SUM(t.total_reactive_power) as totalReactivePower,
sum(t.daily_ac_charge_energy) as dayChargedCap,
sum(t.daily_ac_discharge_energy) as dayDisChargedCap,
#{siteId} as siteId
sum(t.daily_ac_discharge_energy) as dayDisChargedCap
FROM (
SELECT p.device_id, MAX(p.data_update_time) AS max_update_time
FROM ems_pcs_data p
@ -350,15 +361,16 @@
SUM(t.daily_ac_charge_energy) AS chargeEnergy,
SUM(t.daily_ac_discharge_energy) AS disChargeEnergy
FROM ems_pcs_data t
INNER JOIN ( SELECT site_id, device_id, date_month, date_day, MAX(data_update_time) AS max_update_time
FROM ems_pcs_data GROUP BY site_id, device_id, date_month, date_day
INNER JOIN ( SELECT site_id, device_id, date_month, date_day, MAX(data_update_time) AS max_update_time
FROM ems_pcs_data
GROUP BY site_id, device_id, date_month, date_day
) max_dates ON t.site_id = max_dates.site_id
AND t.device_id = max_dates.device_id
AND t.date_month = max_dates.date_month
AND t.date_day = max_dates.date_day
AND t.data_update_time = max_dates.max_update_time
GROUP BY dateMonth
ORDER BY dateMonth;
ORDER BY dateMonth
</select>
<select id="getPcsDetailInfoBySiteId" parameterType="String" resultType="com.xzzn.ems.domain.vo.PcsDetailInfoVo">
@ -413,18 +425,16 @@
</select>
<select id="getStoragePowerList" resultType="com.xzzn.ems.domain.vo.EnergyStoragePowVo">
select t.site_id,
t.total_active_power as pcsTotalActPower,
t.total_reactive_power as pcsTotalReactivePower,
t.create_time as createDate
from ems_pcs_data t
inner join (select site_id,create_time,MIN(device_id) as device_id
from ems_pcs_data
where site_id = #{siteId}
AND create_time &gt;= Date(#{startDate})
AND create_time &lt;= #{endDate}
GROUP BY site_id,create_time
) temp on t.site_id = temp.site_id and t.create_time = temp.create_time and t.device_id = temp.device_id
SELECT t.site_id,
SUM(t.total_active_power) AS pcsTotalActPower,
SUM(t.total_reactive_power) AS pcsTotalReactivePower,
DATE_FORMAT(t.data_update_time, '%Y-%m-%d %H:%i:00') AS createDate
FROM ems_pcs_data t
WHERE t.site_id = #{siteId}
AND t.data_update_time &gt;= Date(#{startDate})
AND t.data_update_time &lt;= #{endDate}
GROUP BY t.site_id, DATE_FORMAT(t.data_update_time, '%Y-%m-%d %H:%i:00')
ORDER BY createDate
</select>
<select id="getPcsDataByMonth" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">

View File

@ -139,7 +139,8 @@
ed.device_type as deviceType,ed.communication_status as communicationStatus,
ed.device_category as deviceCategory,
ed.picture_url as pictureUrl,
ed.id
ed.id,
ed.parent_id as parentId
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 != ''">

View File

@ -17,10 +17,13 @@
<result property="updateTime" column="update_time" />
<result property="remark" column="remark" />
<result property="siteId" column="site_id" />
<result property="templateId" column="template_id" />
<result property="month" column="month" />
<result property="isDelete" column="isDelete" />
</resultMap>
<sql id="selectEmsStrategyCurveVo">
select id, strategy_id, task_number, start_date, end_date, power_data, create_by, create_time, update_by, update_time, remark, site_id from ems_strategy_curve
select id, strategy_id, task_number, start_date, end_date, power_data, create_by, create_time, update_by, update_time, remark, site_id, template_id, month, isDelete from ems_strategy_curve
</sql>
<select id="selectEmsStrategyCurveList" parameterType="EmsStrategyCurve" resultMap="EmsStrategyCurveResult">
@ -32,6 +35,9 @@
<if test="endDate != null "> and end_date = #{endDate}</if>
<if test="powerData != null and powerData != ''"> and power_data = #{powerData}</if>
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
<if test="month != null "> and month = #{month}</if>
<if test="isDelete != null "> and isDelete = #{isDelete}</if>
</where>
</select>
@ -54,6 +60,9 @@
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="siteId != null">site_id,</if>
<if test="templateId != null">template_id,</if>
<if test="month != null">month,</if>
<if test="isDelete != null">isDelete,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="strategyId != null">#{strategyId},</if>
@ -67,6 +76,9 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="siteId != null">#{siteId},</if>
<if test="templateId != null">#{templateId},</if>
<if test="month != null">#{month},</if>
<if test="isDelete != null">#{isDelete},</if>
</trim>
</insert>
@ -84,6 +96,9 @@
<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="templateId != null">template_id = #{templateId},</if>
<if test="month != null">month = #{month},</if>
<if test="isDelete != null">isDelete = #{isDelete},</if>
</trim>
where id = #{id}
</update>
@ -98,4 +113,22 @@
#{id}
</foreach>
</delete>
<select id="getTemplateCurve" parameterType="String" resultMap="EmsStrategyCurveResult">
<include refid="selectEmsStrategyCurveVo"/>
<where> template_id = #{templateId}
and isDelete = 1
</where>
</select>
<update id="physicalDeleteCurve">
update ems_strategy_curve set isDelete = 0
where site_id = #{siteId}
and strategy_id = #{strategyId}
</update>
<update id="physicalDeleteByTemplateId">
update ems_strategy_curve set isDelete = 0
where template_id = #{templateId}
</update>
</mapper>

View File

@ -97,8 +97,10 @@
from ems_strategy_running t
LEFT JOIN ems_strategy main on t.main_strategy_id = main.id
LEFT JOIN ems_strategy aux on t.auxiliary_strategy_id = aux.id
where t.site_id = #{siteId}
and t.`status` != 4
where t.`status` != 4
<if test="siteId != null and siteId != ''">
and t.site_id = #{siteId}
</if>
</select>
<update id="stopEmsStrategyRunning" parameterType="Long">

View File

@ -16,10 +16,11 @@
<result property="remark" column="remark" />
<result property="siteId" column="site_id" />
<result property="templateId" column="template_id" />
<result property="isPost" column="isPost" />
</resultMap>
<sql id="selectEmsStrategyTimeConfigVo">
select id, strategy_id, month, charge_discharge_mode, create_by, create_time, update_by, update_time, remark, site_id, template_id from ems_strategy_time_config
select id, strategy_id, month, charge_discharge_mode, create_by, create_time, update_by, update_time, remark, site_id, template_id, isPost from ems_strategy_time_config
</sql>
<select id="selectEmsStrategyTimeConfigList" parameterType="EmsStrategyTimeConfig" resultMap="EmsStrategyTimeConfigResult">
@ -30,6 +31,7 @@
<if test="chargeDischargeMode != null and chargeDischargeMode != ''"> and charge_discharge_mode = #{chargeDischargeMode}</if>
<if test="siteId != null and siteId != ''"> and site_id = #{siteId}</if>
<if test="templateId != null and templateId != ''"> and template_id = #{templateId}</if>
<if test="isPost != null "> and isPost = #{isPost}</if>
</where>
</select>
@ -51,6 +53,7 @@
<if test="remark != null">remark,</if>
<if test="siteId != null">site_id,</if>
<if test="templateId != null">template_id,</if>
<if test="isPost != null">isPost,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="strategyId != null">#{strategyId},</if>
@ -63,6 +66,7 @@
<if test="remark != null">#{remark},</if>
<if test="siteId != null">#{siteId},</if>
<if test="templateId != null">#{templateId},</if>
<if test="isPost != null">#{isPost},</if>
</trim>
</insert>
@ -79,6 +83,7 @@
<if test="remark != null">remark = #{remark},</if>
<if test="siteId != null">site_id = #{siteId},</if>
<if test="templateId != null">template_id = #{templateId},</if>
<if test="isPost != null">isPost = #{isPost},</if>
</trim>
where id = #{id}
</update>
@ -99,7 +104,9 @@
t.month,
t.charge_discharge_mode as chargeDischargeMode,
t.template_id as templateId,
temp.template_name as templateName
temp.template_name as templateName,
t.site_id as siteId,
t.strategy_id as strategyId
from ems_strategy_time_config t
LEFT JOIN ems_strategy_temp temp on t.template_id = temp.template_id
where t.site_id = #{siteId}
@ -110,4 +117,14 @@
<update id="cleanTemplateId" parameterType="String">
update ems_strategy_time_config set template_id = '' where template_id = #{templateId}
</update>
<select id="getAllTimeConfigByTempId" parameterType="String" resultMap="EmsStrategyTimeConfigResult">
<include refid="selectEmsStrategyTimeConfigVo"/>
where template_id = #{templateId}
and isPost = 1
</select>
<update id="updateTimeConfigWaitingPost" parameterType="String">
update ems_strategy_time_config set isPost = 1 where template_id = #{templateId}
</update>
</mapper>

View File

@ -12,8 +12,9 @@
<result property="content" column="content" />
<result property="images" column="images" />
<result property="status" column="status" />
<result property="createTime" column="create_time" />
<result property="expectedCompleteTime" column="expected_complete_time" />
<result property="completeTime" column="complete_time" />
<result property="createTime" column="create_time" />
<result property="createBy" column="create_by" />
<result property="updateBy" column="update_by" />
<result property="updateTime" column="update_time" />
@ -22,28 +23,28 @@
</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, isDelete from ems_ticket
select id, ticket_no, user_id, title, content, images, status, expected_complete_time, complete_time, create_time, create_by, update_by, update_time, work_user_id, isDelete from ems_ticket
</sql>
<select id="selectEmsTicketList" parameterType="EmsTicket" resultMap="EmsTicketResult">
<include refid="selectEmsTicketVo"/>
<where>
isDelete = 1
<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="expectedCompleteTime != null "> and expected_complete_time = #{expectedCompleteTime}</if>
<if test="completeTime != null "> and complete_time = #{completeTime}</if>
<if test="workUserId != null "> and work_user_id = #{workUserId}</if>
<if test="isDelete != null "> and isDelete = #{isDelete}</if>
</where>
</select>
<select id="selectEmsTicketById" parameterType="String" resultMap="EmsTicketResult">
<include refid="selectEmsTicketVo"/>
where id = #{id}
and isDelete = 1
</select>
<insert id="insertEmsTicket" parameterType="EmsTicket" useGeneratedKeys="true" keyProperty="id">
@ -55,8 +56,9 @@
<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="expectedCompleteTime != null">expected_complete_time,</if>
<if test="completeTime != null">complete_time,</if>
<if test="createTime != null">create_time,</if>
<if test="createBy != null">create_by,</if>
<if test="updateBy != null">update_by,</if>
<if test="updateTime != null">update_time,</if>
@ -70,8 +72,9 @@
<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="expectedCompleteTime != null">#{expectedCompleteTime},</if>
<if test="completeTime != null">#{completeTime},</if>
<if test="createTime != null">#{createTime},</if>
<if test="createBy != null">#{createBy},</if>
<if test="updateBy != null">#{updateBy},</if>
<if test="updateTime != null">#{updateTime},</if>
@ -89,8 +92,9 @@
<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="expectedCompleteTime != null">expected_complete_time = #{expectedCompleteTime},</if>
<if test="completeTime != null">complete_time = #{completeTime},</if>
<if test="createTime != null">create_time = #{createTime},</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>
@ -123,10 +127,37 @@
s.user_name as userName,
s1.user_name as workName,
t.create_time as createTime,
t.id
t.id,
t.images,
t.expected_complete_time as expectedCompleteTime
FROM ems_ticket t
LEFT JOIN sys_user s on t.user_id = s.user_id
LEFT JOIN sys_user s1 on t.work_user_id = s1.user_id
where isDelete = 1
</select>
<if test="statusList != null and statusList.length > 0">
AND t.status IN
<foreach collection="statusList" item="status" open="(" separator="," close=")">
#{status}
</foreach>
</if>
</select>
<select id="getTicketDetailInfo" resultType="com.xzzn.ems.domain.vo.TicketListVo">
SELECT t.ticket_no as ticketNo,
t.title as title,
t.content as content,
t.`status` as status,
s.user_name as userName,
s1.user_name as workName,
t.create_time as createTime,
t.complete_time as completeTime,
t.id, t.images,
t.user_id as userId, t.work_user_id as workUserId,
t.expected_complete_time as expectedCompleteTime
FROM ems_ticket t
LEFT JOIN sys_user s on t.user_id = s.user_id
LEFT JOIN sys_user s1 on t.work_user_id = s1.user_id
where t.isDelete = 1
and t.id = #{id}
</select>
</mapper>

17
pom.xml
View File

@ -165,6 +165,23 @@
<artifactId>spring-integration-mqtt</artifactId>
</dependency>
<!-- modbus -->
<dependency>
<groupId>net.wimpi</groupId>
<artifactId>j2mod</artifactId>
<version>3.1.0</version> <!-- 提供TCPMasterConnection、SerialConnection等类 -->
</dependency>
<!-- Resilience4j 断路器核心 -->
<dependency>
<groupId>io.github.resilience4j</groupId>
<artifactId>resilience4j-annotations</artifactId>
<version>1.7.1</version>
</dependency>
<dependency>
<groupId>org.springframework.retry</groupId>
<artifactId>spring-retry</artifactId>
<version>1.3.4</version> <!-- 根据你的 Spring 版本选择兼容的版本 -->
</dependency>
<!-- velocity代码生成使用模板 -->
<dependency>
<groupId>org.apache.velocity</groupId>