车辆位置,极值,位置等重要数据数据
This commit is contained in:
parent
0de7503010
commit
3290319ba7
Binary file not shown.
@ -8,8 +8,8 @@ import java.util.List;
|
|||||||
import javax.sql.DataSource;
|
import javax.sql.DataSource;
|
||||||
import org.apache.ibatis.io.VFS;
|
import org.apache.ibatis.io.VFS;
|
||||||
import org.apache.ibatis.session.SqlSessionFactory;
|
import org.apache.ibatis.session.SqlSessionFactory;
|
||||||
import org.mybatis.spring.SqlSessionFactoryBean;
|
|
||||||
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
|
import org.mybatis.spring.boot.autoconfigure.SpringBootVFS;
|
||||||
|
import com.baomidou.mybatisplus.extension.spring.MybatisSqlSessionFactoryBean;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.context.annotation.Bean;
|
import org.springframework.context.annotation.Bean;
|
||||||
import org.springframework.context.annotation.Configuration;
|
import org.springframework.context.annotation.Configuration;
|
||||||
@ -122,7 +122,7 @@ public class MyBatisConfig
|
|||||||
typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
|
typeAliasesPackage = setTypeAliasesPackage(typeAliasesPackage);
|
||||||
VFS.addImplClass(SpringBootVFS.class);
|
VFS.addImplClass(SpringBootVFS.class);
|
||||||
|
|
||||||
final SqlSessionFactoryBean sessionFactory = new SqlSessionFactoryBean();
|
final MybatisSqlSessionFactoryBean sessionFactory = new MybatisSqlSessionFactoryBean();
|
||||||
sessionFactory.setDataSource(dataSource);
|
sessionFactory.setDataSource(dataSource);
|
||||||
sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
|
sessionFactory.setTypeAliasesPackage(typeAliasesPackage);
|
||||||
sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
|
sessionFactory.setMapperLocations(resolveMapperLocations(StringUtils.split(mapperLocations, ",")));
|
||||||
|
|||||||
@ -4,6 +4,7 @@ import java.io.Serializable;
|
|||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.HashMap;
|
import java.util.HashMap;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
import com.baomidou.mybatisplus.annotation.TableField;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||||
@ -19,6 +20,7 @@ public class BaseEntity implements Serializable
|
|||||||
|
|
||||||
/** 搜索值 */
|
/** 搜索值 */
|
||||||
@JsonIgnore
|
@JsonIgnore
|
||||||
|
@TableField(exist = false)
|
||||||
private String searchValue;
|
private String searchValue;
|
||||||
|
|
||||||
/** 创建者 */
|
/** 创建者 */
|
||||||
@ -36,10 +38,12 @@ public class BaseEntity implements Serializable
|
|||||||
private Date updateTime;
|
private Date updateTime;
|
||||||
|
|
||||||
/** 备注 */
|
/** 备注 */
|
||||||
|
@TableField(exist = false)
|
||||||
private String remark;
|
private String remark;
|
||||||
|
|
||||||
/** 请求参数 */
|
/** 请求参数 */
|
||||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||||
|
@TableField(exist = false)
|
||||||
private Map<String, Object> params;
|
private Map<String, Object> params;
|
||||||
|
|
||||||
public String getSearchValue()
|
public String getSearchValue()
|
||||||
|
|||||||
@ -1,58 +0,0 @@
|
|||||||
package com.evobms.project.Battery.domain;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.evobms.framework.aspectj.lang.annotation.Excel;
|
|
||||||
import com.evobms.framework.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
public class ChargeDischargeSummary extends BaseEntity {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
@Excel(name = "设备ID")
|
|
||||||
private String deviceId;
|
|
||||||
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@Excel(name = "数据时间戳", width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
private Date timestamp;
|
|
||||||
|
|
||||||
@Excel(name = "累计放电电量(kWh)")
|
|
||||||
private BigDecimal dischargeKwh;
|
|
||||||
|
|
||||||
@Excel(name = "累计充电电量(kWh)")
|
|
||||||
private BigDecimal chargeKwh;
|
|
||||||
|
|
||||||
public Long getId() { return id; }
|
|
||||||
public void setId(Long id) { this.id = id; }
|
|
||||||
|
|
||||||
public String getDeviceId() { return deviceId; }
|
|
||||||
public void setDeviceId(String deviceId) { this.deviceId = deviceId; }
|
|
||||||
|
|
||||||
public Date getTimestamp() { return timestamp; }
|
|
||||||
public void setTimestamp(Date timestamp) { this.timestamp = timestamp; }
|
|
||||||
|
|
||||||
public BigDecimal getDischargeKwh() { return dischargeKwh; }
|
|
||||||
public void setDischargeKwh(BigDecimal dischargeKwh) { this.dischargeKwh = dischargeKwh; }
|
|
||||||
|
|
||||||
public BigDecimal getChargeKwh() { return chargeKwh; }
|
|
||||||
public void setChargeKwh(BigDecimal chargeKwh) { this.chargeKwh = chargeKwh; }
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this, ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("deviceId", getDeviceId())
|
|
||||||
.append("timestamp", getTimestamp())
|
|
||||||
.append("dischargeKwh", getDischargeKwh())
|
|
||||||
.append("chargeKwh", getChargeKwh())
|
|
||||||
.append("createTime", getCreateTime())
|
|
||||||
.append("updateTime", getUpdateTime())
|
|
||||||
.append("createBy", getCreateBy())
|
|
||||||
.append("updateBy", getUpdateBy())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,223 +0,0 @@
|
|||||||
package com.evobms.project.Battery.domain;
|
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
import java.util.Date;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.evobms.framework.aspectj.lang.annotation.Excel;
|
|
||||||
import com.evobms.framework.web.domain.BaseEntity;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 可充电储能子系统电压信息对象 subsystem_voltage
|
|
||||||
*
|
|
||||||
* @author 田志阳
|
|
||||||
* @date 2025-11-15
|
|
||||||
*/
|
|
||||||
public class SubsystemVoltage extends BaseEntity
|
|
||||||
{
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 主键ID */
|
|
||||||
private Long id;
|
|
||||||
|
|
||||||
/** 设备ID */
|
|
||||||
@Excel(name = "设备ID")
|
|
||||||
private String deviceId;
|
|
||||||
|
|
||||||
/** 数据时间戳 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@Excel(name = "数据时间戳", width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
private Date timestamp;
|
|
||||||
|
|
||||||
/** 可充电储能子系统个数 */
|
|
||||||
@Excel(name = "可充电储能子系统个数")
|
|
||||||
private Integer subsystemCount;
|
|
||||||
|
|
||||||
/** 可充电储能子系统号 */
|
|
||||||
@Excel(name = "可充电储能子系统号")
|
|
||||||
private Integer subsystemNo;
|
|
||||||
|
|
||||||
/** 可充电储能装置电压(V) */
|
|
||||||
@Excel(name = "可充电储能装置电压(V)")
|
|
||||||
private BigDecimal subsystemVoltage;
|
|
||||||
|
|
||||||
/** 可充电储能装置电流(A) */
|
|
||||||
@Excel(name = "可充电储能装置电流(A)")
|
|
||||||
private BigDecimal subsystemCurrent;
|
|
||||||
|
|
||||||
/** 单体电池总数 */
|
|
||||||
@Excel(name = "单体电池总数")
|
|
||||||
private Integer totalBatteryCount;
|
|
||||||
|
|
||||||
/** 本帧起始电池序号 */
|
|
||||||
@Excel(name = "本帧起始电池序号")
|
|
||||||
private Integer frameStartBatteryNo;
|
|
||||||
|
|
||||||
/** 本帧单体电池总数 */
|
|
||||||
@Excel(name = "本帧单体电池总数")
|
|
||||||
private Integer frameBatteryCount;
|
|
||||||
|
|
||||||
/** 单体电池电压数组(V) */
|
|
||||||
@Excel(name = "单体电池电压数组(V)")
|
|
||||||
private String batteryVoltages;
|
|
||||||
|
|
||||||
/** 创建时间 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
private Date createdAt;
|
|
||||||
|
|
||||||
/** 更新时间 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
|
||||||
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
|
||||||
private Date updatedAt;
|
|
||||||
|
|
||||||
public void setId(Long id)
|
|
||||||
{
|
|
||||||
this.id = id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getId()
|
|
||||||
{
|
|
||||||
return id;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceId(String deviceId)
|
|
||||||
{
|
|
||||||
this.deviceId = deviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeviceId()
|
|
||||||
{
|
|
||||||
return deviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTimestamp(Date timestamp)
|
|
||||||
{
|
|
||||||
this.timestamp = timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getTimestamp()
|
|
||||||
{
|
|
||||||
return timestamp;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubsystemCount(Integer subsystemCount)
|
|
||||||
{
|
|
||||||
this.subsystemCount = subsystemCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSubsystemCount()
|
|
||||||
{
|
|
||||||
return subsystemCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubsystemNo(Integer subsystemNo)
|
|
||||||
{
|
|
||||||
this.subsystemNo = subsystemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getSubsystemNo()
|
|
||||||
{
|
|
||||||
return subsystemNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubsystemVoltage(BigDecimal subsystemVoltage)
|
|
||||||
{
|
|
||||||
this.subsystemVoltage = subsystemVoltage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getSubsystemVoltage()
|
|
||||||
{
|
|
||||||
return subsystemVoltage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setSubsystemCurrent(BigDecimal subsystemCurrent)
|
|
||||||
{
|
|
||||||
this.subsystemCurrent = subsystemCurrent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public BigDecimal getSubsystemCurrent()
|
|
||||||
{
|
|
||||||
return subsystemCurrent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTotalBatteryCount(Integer totalBatteryCount)
|
|
||||||
{
|
|
||||||
this.totalBatteryCount = totalBatteryCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getTotalBatteryCount()
|
|
||||||
{
|
|
||||||
return totalBatteryCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFrameStartBatteryNo(Integer frameStartBatteryNo)
|
|
||||||
{
|
|
||||||
this.frameStartBatteryNo = frameStartBatteryNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getFrameStartBatteryNo()
|
|
||||||
{
|
|
||||||
return frameStartBatteryNo;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setFrameBatteryCount(Integer frameBatteryCount)
|
|
||||||
{
|
|
||||||
this.frameBatteryCount = frameBatteryCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getFrameBatteryCount()
|
|
||||||
{
|
|
||||||
return frameBatteryCount;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBatteryVoltages(String batteryVoltages)
|
|
||||||
{
|
|
||||||
this.batteryVoltages = batteryVoltages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getBatteryVoltages()
|
|
||||||
{
|
|
||||||
return batteryVoltages;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCreatedAt(Date createdAt)
|
|
||||||
{
|
|
||||||
this.createdAt = createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getCreatedAt()
|
|
||||||
{
|
|
||||||
return createdAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setUpdatedAt(Date updatedAt)
|
|
||||||
{
|
|
||||||
this.updatedAt = updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getUpdatedAt()
|
|
||||||
{
|
|
||||||
return updatedAt;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
|
||||||
.append("id", getId())
|
|
||||||
.append("deviceId", getDeviceId())
|
|
||||||
.append("timestamp", getTimestamp())
|
|
||||||
.append("subsystemCount", getSubsystemCount())
|
|
||||||
.append("subsystemNo", getSubsystemNo())
|
|
||||||
.append("subsystemVoltage", getSubsystemVoltage())
|
|
||||||
.append("subsystemCurrent", getSubsystemCurrent())
|
|
||||||
.append("totalBatteryCount", getTotalBatteryCount())
|
|
||||||
.append("frameStartBatteryNo", getFrameStartBatteryNo())
|
|
||||||
.append("frameBatteryCount", getFrameBatteryCount())
|
|
||||||
.append("batteryVoltages", getBatteryVoltages())
|
|
||||||
.append("createdAt", getCreatedAt())
|
|
||||||
.append("updatedAt", getUpdatedAt())
|
|
||||||
.toString();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package com.evobms.project.Battery.mapper;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.evobms.project.Battery.domain.ChargeDischargeSummary;
|
|
||||||
|
|
||||||
public interface ChargeDischargeSummaryMapper {
|
|
||||||
ChargeDischargeSummary selectChargeDischargeSummaryById(Long id);
|
|
||||||
List<ChargeDischargeSummary> selectChargeDischargeSummaryList(ChargeDischargeSummary summary);
|
|
||||||
int insertChargeDischargeSummary(ChargeDischargeSummary summary);
|
|
||||||
int updateChargeDischargeSummary(ChargeDischargeSummary summary);
|
|
||||||
int deleteChargeDischargeSummaryById(Long id);
|
|
||||||
int deleteChargeDischargeSummaryByIds(Long[] ids);
|
|
||||||
}
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package com.evobms.project.Battery.service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import com.evobms.project.Battery.domain.ChargeDischargeSummary;
|
|
||||||
|
|
||||||
public interface IChargeDischargeSummaryService {
|
|
||||||
ChargeDischargeSummary selectChargeDischargeSummaryById(Long id);
|
|
||||||
List<ChargeDischargeSummary> selectChargeDischargeSummaryList(ChargeDischargeSummary summary);
|
|
||||||
int insertChargeDischargeSummary(ChargeDischargeSummary summary);
|
|
||||||
int updateChargeDischargeSummary(ChargeDischargeSummary summary);
|
|
||||||
int deleteChargeDischargeSummaryByIds(Long[] ids);
|
|
||||||
int deleteChargeDischargeSummaryById(Long id);
|
|
||||||
}
|
|
||||||
@ -1,47 +0,0 @@
|
|||||||
package com.evobms.project.Battery.service.impl;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.evobms.project.Battery.mapper.ChargeDischargeSummaryMapper;
|
|
||||||
import com.evobms.project.Battery.domain.ChargeDischargeSummary;
|
|
||||||
import com.evobms.project.Battery.service.IChargeDischargeSummaryService;
|
|
||||||
import com.evobms.common.utils.DateUtils;
|
|
||||||
|
|
||||||
@Service
|
|
||||||
public class ChargeDischargeSummaryServiceImpl implements IChargeDischargeSummaryService {
|
|
||||||
@Autowired
|
|
||||||
private ChargeDischargeSummaryMapper chargeDischargeSummaryMapper;
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ChargeDischargeSummary selectChargeDischargeSummaryById(Long id) {
|
|
||||||
return chargeDischargeSummaryMapper.selectChargeDischargeSummaryById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<ChargeDischargeSummary> selectChargeDischargeSummaryList(ChargeDischargeSummary summary) {
|
|
||||||
return chargeDischargeSummaryMapper.selectChargeDischargeSummaryList(summary);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int insertChargeDischargeSummary(ChargeDischargeSummary summary) {
|
|
||||||
summary.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return chargeDischargeSummaryMapper.insertChargeDischargeSummary(summary);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int updateChargeDischargeSummary(ChargeDischargeSummary summary) {
|
|
||||||
summary.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return chargeDischargeSummaryMapper.updateChargeDischargeSummary(summary);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int deleteChargeDischargeSummaryByIds(Long[] ids) {
|
|
||||||
return chargeDischargeSummaryMapper.deleteChargeDischargeSummaryByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public int deleteChargeDischargeSummaryById(Long id) {
|
|
||||||
return chargeDischargeSummaryMapper.deleteChargeDischargeSummaryById(id);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,104 +0,0 @@
|
|||||||
package com.evobms.project.VehicleData.service.impl;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.evobms.project.VehicleData.mapper.VehicleDataMapper;
|
|
||||||
import com.evobms.project.VehicleData.domain.VehicleData;
|
|
||||||
import com.evobms.project.VehicleData.service.IVehicleDataService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 整车数据Service业务层处理
|
|
||||||
*
|
|
||||||
* @author 田志阳
|
|
||||||
* @date 2025-11-15
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class VehicleDataServiceImpl implements IVehicleDataService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private VehicleDataMapper vehicleDataMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询整车数据
|
|
||||||
*
|
|
||||||
* @param id 整车数据主键
|
|
||||||
* @return 整车数据
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public VehicleData selectVehicleDataById(Long id)
|
|
||||||
{
|
|
||||||
return vehicleDataMapper.selectVehicleDataById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询整车数据列表
|
|
||||||
*
|
|
||||||
* @param vehicleData 整车数据
|
|
||||||
* @return 整车数据
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<VehicleData> selectVehicleDataList(VehicleData vehicleData)
|
|
||||||
{
|
|
||||||
return vehicleDataMapper.selectVehicleDataList(vehicleData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增整车数据
|
|
||||||
*
|
|
||||||
* @param vehicleData 整车数据
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertVehicleData(VehicleData vehicleData)
|
|
||||||
{
|
|
||||||
return vehicleDataMapper.insertVehicleData(vehicleData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改整车数据
|
|
||||||
*
|
|
||||||
* @param vehicleData 整车数据
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateVehicleData(VehicleData vehicleData)
|
|
||||||
{
|
|
||||||
return vehicleDataMapper.updateVehicleData(vehicleData);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除整车数据
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的整车数据主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteVehicleDataByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return vehicleDataMapper.deleteVehicleDataByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除整车数据信息
|
|
||||||
*
|
|
||||||
* @param id 整车数据主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteVehicleDataById(Long id)
|
|
||||||
{
|
|
||||||
return vehicleDataMapper.deleteVehicleDataById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<VehicleData> selectByDeviceAndStartTime(String deviceId, Date startTime) {
|
|
||||||
return vehicleDataMapper.selectByDeviceAndStartTime(deviceId, startTime);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VehicleData selectLatestByDeviceId(String deviceId) {
|
|
||||||
return vehicleDataMapper.selectLatestByDeviceId(deviceId);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,105 +0,0 @@
|
|||||||
package com.evobms.project.VehicleData.service.impl;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
import java.util.List;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
||||||
import com.evobms.project.VehicleData.mapper.VehicleLocationMapper;
|
|
||||||
import com.evobms.project.VehicleData.domain.VehicleLocation;
|
|
||||||
import com.evobms.project.VehicleData.service.IVehicleLocationService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 车辆位置数据Service业务层处理
|
|
||||||
*
|
|
||||||
* @author ruoyi
|
|
||||||
* @date 2025-11-15
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class VehicleLocationServiceImpl implements IVehicleLocationService
|
|
||||||
{
|
|
||||||
@Autowired
|
|
||||||
private VehicleLocationMapper vehicleLocationMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询车辆位置数据
|
|
||||||
*
|
|
||||||
* @param id 车辆位置数据主键
|
|
||||||
* @return 车辆位置数据
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public VehicleLocation selectVehicleLocationById(Long id)
|
|
||||||
{
|
|
||||||
return vehicleLocationMapper.selectVehicleLocationById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询车辆位置数据列表
|
|
||||||
*
|
|
||||||
* @param vehicleLocation 车辆位置数据
|
|
||||||
* @return 车辆位置数据
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<VehicleLocation> selectVehicleLocationList(VehicleLocation vehicleLocation)
|
|
||||||
{
|
|
||||||
return vehicleLocationMapper.selectVehicleLocationList(vehicleLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增车辆位置数据
|
|
||||||
*
|
|
||||||
* @param vehicleLocation 车辆位置数据
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertVehicleLocation(VehicleLocation vehicleLocation)
|
|
||||||
{
|
|
||||||
return vehicleLocationMapper.insertVehicleLocation(vehicleLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改车辆位置数据
|
|
||||||
*
|
|
||||||
* @param vehicleLocation 车辆位置数据
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateVehicleLocation(VehicleLocation vehicleLocation)
|
|
||||||
{
|
|
||||||
return vehicleLocationMapper.updateVehicleLocation(vehicleLocation);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除车辆位置数据
|
|
||||||
*
|
|
||||||
* @param ids 需要删除的车辆位置数据主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteVehicleLocationByIds(Long[] ids)
|
|
||||||
{
|
|
||||||
return vehicleLocationMapper.deleteVehicleLocationByIds(ids);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除车辆位置数据信息
|
|
||||||
*
|
|
||||||
* @param id 车辆位置数据主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteVehicleLocationById(Long id)
|
|
||||||
{
|
|
||||||
return vehicleLocationMapper.deleteVehicleLocationById(id);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public VehicleLocation selectLatestByDeviceId(String deviceId) {
|
|
||||||
return vehicleLocationMapper.selectLatestByDeviceId(deviceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public List<VehicleLocation> selectByDeviceAndRange(String deviceId, Date start, Date end, Integer limit) {
|
|
||||||
return vehicleLocationMapper.selectByDeviceAndRange(deviceId, start, end, limit);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.evobms.project.Battery.controller;
|
package com.evobms.project.battery.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.evobms.framework.aspectj.lang.annotation.Log;
|
import com.evobms.framework.aspectj.lang.annotation.Log;
|
||||||
import com.evobms.framework.aspectj.lang.enums.BusinessType;
|
import com.evobms.framework.aspectj.lang.enums.BusinessType;
|
||||||
import com.evobms.project.Battery.domain.ExtremeValues;
|
import com.evobms.project.battery.domain.ExtremeValues;
|
||||||
import com.evobms.project.Battery.service.IExtremeValuesService;
|
import com.evobms.project.battery.service.IExtremeValuesService;
|
||||||
import com.evobms.framework.web.controller.BaseController;
|
import com.evobms.framework.web.controller.BaseController;
|
||||||
import com.evobms.framework.web.domain.AjaxResult;
|
import com.evobms.framework.web.domain.AjaxResult;
|
||||||
import com.evobms.common.utils.poi.ExcelUtil;
|
import com.evobms.common.utils.poi.ExcelUtil;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.evobms.project.Battery.controller;
|
package com.evobms.project.battery.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.evobms.framework.aspectj.lang.annotation.Log;
|
import com.evobms.framework.aspectj.lang.annotation.Log;
|
||||||
import com.evobms.framework.aspectj.lang.enums.BusinessType;
|
import com.evobms.framework.aspectj.lang.enums.BusinessType;
|
||||||
import com.evobms.project.Battery.domain.SubsystemTemperature;
|
import com.evobms.project.battery.domain.SubsystemTemperature;
|
||||||
import com.evobms.project.Battery.service.ISubsystemTemperatureService;
|
import com.evobms.project.battery.service.ISubsystemTemperatureService;
|
||||||
import com.evobms.framework.web.controller.BaseController;
|
import com.evobms.framework.web.controller.BaseController;
|
||||||
import com.evobms.framework.web.domain.AjaxResult;
|
import com.evobms.framework.web.domain.AjaxResult;
|
||||||
import com.evobms.common.utils.poi.ExcelUtil;
|
import com.evobms.common.utils.poi.ExcelUtil;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.evobms.project.Battery.controller;
|
package com.evobms.project.battery.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.evobms.framework.aspectj.lang.annotation.Log;
|
import com.evobms.framework.aspectj.lang.annotation.Log;
|
||||||
import com.evobms.framework.aspectj.lang.enums.BusinessType;
|
import com.evobms.framework.aspectj.lang.enums.BusinessType;
|
||||||
import com.evobms.project.Battery.domain.SubsystemVoltage;
|
import com.evobms.project.battery.domain.SubsystemVoltage;
|
||||||
import com.evobms.project.Battery.service.ISubsystemVoltageService;
|
import com.evobms.project.battery.service.ISubsystemVoltageService;
|
||||||
import com.evobms.framework.web.controller.BaseController;
|
import com.evobms.framework.web.controller.BaseController;
|
||||||
import com.evobms.framework.web.domain.AjaxResult;
|
import com.evobms.framework.web.domain.AjaxResult;
|
||||||
import com.evobms.common.utils.poi.ExcelUtil;
|
import com.evobms.common.utils.poi.ExcelUtil;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.evobms.project.Battery.domain;
|
package com.evobms.project.battery.domain;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -26,8 +26,8 @@ public class ExtremeValues extends BaseEntity
|
|||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
/** 数据时间戳 */
|
/** 数据时间戳 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "数据时间戳", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "数据时间戳", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date timestamp;
|
private Date timestamp;
|
||||||
|
|
||||||
/** 最高电压电池子系统号 */
|
/** 最高电压电池子系统号 */
|
||||||
@ -1,10 +1,8 @@
|
|||||||
package com.evobms.project.Battery.domain;
|
package com.evobms.project.battery.domain;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
|
||||||
import org.apache.commons.lang3.builder.ToStringStyle;
|
|
||||||
import com.evobms.framework.aspectj.lang.annotation.Excel;
|
import com.evobms.framework.aspectj.lang.annotation.Excel;
|
||||||
import com.evobms.framework.web.domain.BaseEntity;
|
import com.evobms.framework.web.domain.BaseEntity;
|
||||||
|
|
||||||
@ -27,8 +25,8 @@ public class SubsystemTemperature extends BaseEntity
|
|||||||
private String deviceId;
|
private String deviceId;
|
||||||
|
|
||||||
/** 数据时间戳 */
|
/** 数据时间戳 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "数据时间戳", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "数据时间戳", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date timestamp;
|
private Date timestamp;
|
||||||
|
|
||||||
/** 可充电储能子系统个数 */
|
/** 可充电储能子系统个数 */
|
||||||
@ -0,0 +1,77 @@
|
|||||||
|
package com.evobms.project.battery.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import lombok.Data;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.evobms.framework.aspectj.lang.annotation.Excel;
|
||||||
|
import com.evobms.framework.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 可充电储能子系统电压信息对象 subsystem_voltage
|
||||||
|
*
|
||||||
|
* @author 田志阳
|
||||||
|
* @date 2025-11-15
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class SubsystemVoltage extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 设备ID */
|
||||||
|
@Excel(name = "设备ID")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/** 数据时间戳 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
@Excel(name = "数据时间戳", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date timestamp;
|
||||||
|
|
||||||
|
/** 可充电储能子系统个数 */
|
||||||
|
@Excel(name = "可充电储能子系统个数")
|
||||||
|
private Integer subsystemCount;
|
||||||
|
|
||||||
|
/** 可充电储能子系统号 */
|
||||||
|
@Excel(name = "可充电储能子系统号")
|
||||||
|
private Integer subsystemNo;
|
||||||
|
|
||||||
|
/** 可充电储能装置电压(V) */
|
||||||
|
@Excel(name = "可充电储能装置电压(V)")
|
||||||
|
private BigDecimal subsystemVoltage;
|
||||||
|
|
||||||
|
/** 可充电储能装置电流(A) */
|
||||||
|
@Excel(name = "可充电储能装置电流(A)")
|
||||||
|
private BigDecimal subsystemCurrent;
|
||||||
|
|
||||||
|
/** 单体电池总数 */
|
||||||
|
@Excel(name = "单体电池总数")
|
||||||
|
private Integer totalBatteryCount;
|
||||||
|
|
||||||
|
/** 本帧起始电池序号 */
|
||||||
|
@Excel(name = "本帧起始电池序号")
|
||||||
|
private Integer frameStartBatteryNo;
|
||||||
|
|
||||||
|
/** 本帧单体电池总数 */
|
||||||
|
@Excel(name = "本帧单体电池总数")
|
||||||
|
private Integer frameBatteryCount;
|
||||||
|
|
||||||
|
/** 单体电池电压数组(V) */
|
||||||
|
@Excel(name = "单体电池电压数组(V)")
|
||||||
|
private String batteryVoltages;
|
||||||
|
|
||||||
|
/** 创建时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "创建时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date createTime;
|
||||||
|
|
||||||
|
/** 更新时间 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
|
@Excel(name = "更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
|
private Date updateTime;
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,7 +1,9 @@
|
|||||||
package com.evobms.project.Battery.mapper;
|
package com.evobms.project.battery.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.evobms.project.Battery.domain.ExtremeValues;
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.evobms.project.battery.domain.ExtremeValues;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -11,8 +13,7 @@ import java.util.Date;
|
|||||||
* @author 田志阳
|
* @author 田志阳
|
||||||
* @date 2025-10-14
|
* @date 2025-10-14
|
||||||
*/
|
*/
|
||||||
public interface ExtremeValuesMapper
|
public interface ExtremeValuesMapper extends BaseMapper<ExtremeValues> {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 查询电池极值数据
|
* 查询电池极值数据
|
||||||
*
|
*
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package com.evobms.project.Battery.mapper;
|
package com.evobms.project.battery.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.evobms.project.Battery.domain.SubsystemTemperature;
|
import com.evobms.project.battery.domain.SubsystemTemperature;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package com.evobms.project.Battery.mapper;
|
package com.evobms.project.battery.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.evobms.project.Battery.domain.SubsystemVoltage;
|
import com.evobms.project.battery.domain.SubsystemVoltage;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package com.evobms.project.Battery.service;
|
package com.evobms.project.battery.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.evobms.project.Battery.domain.ExtremeValues;
|
import com.evobms.project.battery.domain.ExtremeValues;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电池极值数据Service接口
|
* 电池极值数据Service接口
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package com.evobms.project.Battery.service;
|
package com.evobms.project.battery.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.evobms.project.Battery.domain.SubsystemTemperature;
|
import com.evobms.project.battery.domain.SubsystemTemperature;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 可充电储能子系统温度信息Service接口
|
* 可充电储能子系统温度信息Service接口
|
||||||
@ -1,7 +1,7 @@
|
|||||||
package com.evobms.project.Battery.service;
|
package com.evobms.project.battery.service;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.evobms.project.Battery.domain.SubsystemVoltage;
|
import com.evobms.project.battery.domain.SubsystemVoltage;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 可充电储能子系统电压信息Service接口
|
* 可充电储能子系统电压信息Service接口
|
||||||
@ -1,12 +1,14 @@
|
|||||||
package com.evobms.project.Battery.service.impl;
|
package com.evobms.project.battery.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.evobms.common.utils.DateUtils;
|
import com.evobms.common.utils.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.evobms.project.Battery.mapper.ExtremeValuesMapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.evobms.project.Battery.domain.ExtremeValues;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.evobms.project.Battery.service.IExtremeValuesService;
|
import com.evobms.project.battery.mapper.ExtremeValuesMapper;
|
||||||
|
import com.evobms.project.battery.domain.ExtremeValues;
|
||||||
|
import com.evobms.project.battery.service.IExtremeValuesService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电池极值数据Service业务层处理
|
* 电池极值数据Service业务层处理
|
||||||
@ -15,7 +17,7 @@ import com.evobms.project.Battery.service.IExtremeValuesService;
|
|||||||
* @date 2025-10-14
|
* @date 2025-10-14
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class ExtremeValuesServiceImpl implements IExtremeValuesService
|
public class ExtremeValuesServiceImpl extends ServiceImpl<ExtremeValuesMapper, ExtremeValues> implements IExtremeValuesService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private ExtremeValuesMapper extremeValuesMapper;
|
private ExtremeValuesMapper extremeValuesMapper;
|
||||||
@ -41,7 +43,28 @@ public class ExtremeValuesServiceImpl implements IExtremeValuesService
|
|||||||
@Override
|
@Override
|
||||||
public List<ExtremeValues> selectExtremeValuesList(ExtremeValues extremeValues)
|
public List<ExtremeValues> selectExtremeValuesList(ExtremeValues extremeValues)
|
||||||
{
|
{
|
||||||
return extremeValuesMapper.selectExtremeValuesList(extremeValues);
|
LambdaQueryWrapper<ExtremeValues> qw = new LambdaQueryWrapper<>();
|
||||||
|
if (extremeValues != null) {
|
||||||
|
if (extremeValues.getDeviceId() != null && !extremeValues.getDeviceId().isEmpty()) {
|
||||||
|
qw.eq(ExtremeValues::getDeviceId, extremeValues.getDeviceId());
|
||||||
|
}
|
||||||
|
if (extremeValues.getTimestamp() != null) {
|
||||||
|
qw.ge(ExtremeValues::getTimestamp, extremeValues.getTimestamp());
|
||||||
|
}
|
||||||
|
java.util.Map<String, Object> params = extremeValues.getParams();
|
||||||
|
if (params != null) {
|
||||||
|
java.util.Date begin = com.evobms.common.utils.DateUtils.parseDate(params.get("beginTime"));
|
||||||
|
java.util.Date end = com.evobms.common.utils.DateUtils.parseDate(params.get("endTime"));
|
||||||
|
if (begin != null) {
|
||||||
|
qw.ge(ExtremeValues::getTimestamp, begin);
|
||||||
|
}
|
||||||
|
if (end != null) {
|
||||||
|
qw.le(ExtremeValues::getTimestamp, end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qw.orderByDesc(ExtremeValues::getTimestamp);
|
||||||
|
return extremeValuesMapper.selectList(qw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1,12 +1,13 @@
|
|||||||
package com.evobms.project.Battery.service.impl;
|
package com.evobms.project.battery.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.evobms.project.Battery.mapper.SubsystemTemperatureMapper;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.evobms.project.Battery.domain.SubsystemTemperature;
|
import com.evobms.project.battery.mapper.SubsystemTemperatureMapper;
|
||||||
import com.evobms.project.Battery.service.ISubsystemTemperatureService;
|
import com.evobms.project.battery.domain.SubsystemTemperature;
|
||||||
|
import com.evobms.project.battery.service.ISubsystemTemperatureService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 可充电储能子系统温度信息Service业务层处理
|
* 可充电储能子系统温度信息Service业务层处理
|
||||||
@ -15,7 +16,7 @@ import com.evobms.project.Battery.service.ISubsystemTemperatureService;
|
|||||||
* @date 2025-11-15
|
* @date 2025-11-15
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SubsystemTemperatureServiceImpl implements ISubsystemTemperatureService
|
public class SubsystemTemperatureServiceImpl extends ServiceImpl<SubsystemTemperatureMapper, SubsystemTemperature> implements ISubsystemTemperatureService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private SubsystemTemperatureMapper subsystemTemperatureMapper;
|
private SubsystemTemperatureMapper subsystemTemperatureMapper;
|
||||||
@ -41,7 +42,28 @@ public class SubsystemTemperatureServiceImpl implements ISubsystemTemperatureSer
|
|||||||
@Override
|
@Override
|
||||||
public List<SubsystemTemperature> selectSubsystemTemperatureList(SubsystemTemperature subsystemTemperature)
|
public List<SubsystemTemperature> selectSubsystemTemperatureList(SubsystemTemperature subsystemTemperature)
|
||||||
{
|
{
|
||||||
return subsystemTemperatureMapper.selectSubsystemTemperatureList(subsystemTemperature);
|
LambdaQueryWrapper<SubsystemTemperature> qw = new LambdaQueryWrapper<>();
|
||||||
|
if (subsystemTemperature != null) {
|
||||||
|
if (subsystemTemperature.getDeviceId() != null && !subsystemTemperature.getDeviceId().isEmpty()) {
|
||||||
|
qw.eq(SubsystemTemperature::getDeviceId, subsystemTemperature.getDeviceId());
|
||||||
|
}
|
||||||
|
if (subsystemTemperature.getTimestamp() != null) {
|
||||||
|
qw.ge(SubsystemTemperature::getTimestamp, subsystemTemperature.getTimestamp());
|
||||||
|
}
|
||||||
|
java.util.Map<String, Object> params = subsystemTemperature.getParams();
|
||||||
|
if (params != null) {
|
||||||
|
java.util.Date begin = com.evobms.common.utils.DateUtils.parseDate(params.get("beginTime"));
|
||||||
|
java.util.Date end = com.evobms.common.utils.DateUtils.parseDate(params.get("endTime"));
|
||||||
|
if (begin != null) {
|
||||||
|
qw.ge(SubsystemTemperature::getTimestamp, begin);
|
||||||
|
}
|
||||||
|
if (end != null) {
|
||||||
|
qw.le(SubsystemTemperature::getTimestamp, end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qw.orderByDesc(SubsystemTemperature::getTimestamp);
|
||||||
|
return subsystemTemperatureMapper.selectList(qw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1,12 +1,13 @@
|
|||||||
package com.evobms.project.Battery.service.impl;
|
package com.evobms.project.battery.service.impl;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
import com.evobms.project.Battery.mapper.SubsystemVoltageMapper;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.evobms.project.Battery.domain.SubsystemVoltage;
|
import com.evobms.project.battery.mapper.SubsystemVoltageMapper;
|
||||||
import com.evobms.project.Battery.service.ISubsystemVoltageService;
|
import com.evobms.project.battery.domain.SubsystemVoltage;
|
||||||
|
import com.evobms.project.battery.service.ISubsystemVoltageService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 可充电储能子系统电压信息Service业务层处理
|
* 可充电储能子系统电压信息Service业务层处理
|
||||||
@ -15,7 +16,7 @@ import com.evobms.project.Battery.service.ISubsystemVoltageService;
|
|||||||
* @date 2025-11-15
|
* @date 2025-11-15
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class SubsystemVoltageServiceImpl implements ISubsystemVoltageService
|
public class SubsystemVoltageServiceImpl extends ServiceImpl<SubsystemVoltageMapper, SubsystemVoltage> implements ISubsystemVoltageService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private SubsystemVoltageMapper subsystemVoltageMapper;
|
private SubsystemVoltageMapper subsystemVoltageMapper;
|
||||||
@ -41,7 +42,28 @@ public class SubsystemVoltageServiceImpl implements ISubsystemVoltageService
|
|||||||
@Override
|
@Override
|
||||||
public List<SubsystemVoltage> selectSubsystemVoltageList(SubsystemVoltage subsystemVoltage)
|
public List<SubsystemVoltage> selectSubsystemVoltageList(SubsystemVoltage subsystemVoltage)
|
||||||
{
|
{
|
||||||
return subsystemVoltageMapper.selectSubsystemVoltageList(subsystemVoltage);
|
LambdaQueryWrapper<SubsystemVoltage> qw = new LambdaQueryWrapper<>();
|
||||||
|
if (subsystemVoltage != null) {
|
||||||
|
if (subsystemVoltage.getDeviceId() != null && !subsystemVoltage.getDeviceId().isEmpty()) {
|
||||||
|
qw.eq(SubsystemVoltage::getDeviceId, subsystemVoltage.getDeviceId());
|
||||||
|
}
|
||||||
|
if (subsystemVoltage.getTimestamp() != null) {
|
||||||
|
qw.ge(SubsystemVoltage::getTimestamp, subsystemVoltage.getTimestamp());
|
||||||
|
}
|
||||||
|
java.util.Map<String, Object> params = subsystemVoltage.getParams();
|
||||||
|
if (params != null) {
|
||||||
|
java.util.Date begin = com.evobms.common.utils.DateUtils.parseDate(params.get("beginTime"));
|
||||||
|
java.util.Date end = com.evobms.common.utils.DateUtils.parseDate(params.get("endTime"));
|
||||||
|
if (begin != null) {
|
||||||
|
qw.ge(SubsystemVoltage::getTimestamp, begin);
|
||||||
|
}
|
||||||
|
if (end != null) {
|
||||||
|
qw.le(SubsystemVoltage::getTimestamp, end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qw.orderByDesc(SubsystemVoltage::getTimestamp);
|
||||||
|
return subsystemVoltageMapper.selectList(qw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1,196 +0,0 @@
|
|||||||
package com.evobms.project.bms.controller;
|
|
||||||
|
|
||||||
import com.evobms.framework.aspectj.lang.annotation.Log;
|
|
||||||
import com.evobms.framework.aspectj.lang.enums.BusinessType;
|
|
||||||
import com.evobms.framework.web.controller.BaseController;
|
|
||||||
import com.evobms.framework.web.domain.AjaxResult;
|
|
||||||
import com.evobms.framework.web.page.TableDataInfo;
|
|
||||||
import com.evobms.project.bms.domain.BmsDevice;
|
|
||||||
import com.evobms.project.bms.service.IBmsDeviceService;
|
|
||||||
//import com.evobms.project.bms.service.MqttService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.security.access.prepost.PreAuthorize;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BMS设备Controller
|
|
||||||
*
|
|
||||||
* @author evobms
|
|
||||||
* @date 2025-01-22
|
|
||||||
*/
|
|
||||||
@RestController
|
|
||||||
@RequestMapping("/bms/device")
|
|
||||||
public class BmsDeviceController extends BaseController {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private IBmsDeviceService bmsDeviceService;
|
|
||||||
|
|
||||||
// @Autowired(required = false)
|
|
||||||
// private MqttService mqttService;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询BMS设备列表
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('bms:device:list')")
|
|
||||||
@GetMapping("/list")
|
|
||||||
public TableDataInfo list(BmsDevice bmsDevice) {
|
|
||||||
startPage();
|
|
||||||
List<BmsDevice> list = bmsDeviceService.selectBmsDeviceList(bmsDevice);
|
|
||||||
return getDataTable(list);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取BMS设备详细信息
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('bms:device:query')")
|
|
||||||
@GetMapping(value = "/{deviceId}")
|
|
||||||
public AjaxResult getInfo(@PathVariable("deviceId") Long deviceId) {
|
|
||||||
return success(bmsDeviceService.selectBmsDeviceByDeviceId(deviceId));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增BMS设备
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('bms:device:add')")
|
|
||||||
@Log(title = "BMS设备", businessType = BusinessType.INSERT)
|
|
||||||
@PostMapping
|
|
||||||
public AjaxResult add(@RequestBody BmsDevice bmsDevice) {
|
|
||||||
return toAjax(bmsDeviceService.insertBmsDevice(bmsDevice));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改BMS设备
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('bms:device:edit')")
|
|
||||||
@Log(title = "BMS设备", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping
|
|
||||||
public AjaxResult edit(@RequestBody BmsDevice bmsDevice) {
|
|
||||||
return toAjax(bmsDeviceService.updateBmsDevice(bmsDevice));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除BMS设备
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('bms:device:remove')")
|
|
||||||
@Log(title = "BMS设备", businessType = BusinessType.DELETE)
|
|
||||||
@DeleteMapping("/{deviceIds}")
|
|
||||||
public AjaxResult remove(@PathVariable Long[] deviceIds) {
|
|
||||||
return toAjax(bmsDeviceService.deleteBmsDeviceByDeviceIds(deviceIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量更新设备状态
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('bms:device:edit')")
|
|
||||||
@Log(title = "BMS设备状态", businessType = BusinessType.UPDATE)
|
|
||||||
@PutMapping("/status")
|
|
||||||
public AjaxResult updateStatus(@RequestBody Map<String, Object> params) {
|
|
||||||
Long[] deviceIds = (Long[]) params.get("deviceIds");
|
|
||||||
String status = (String) params.get("status");
|
|
||||||
return toAjax(bmsDeviceService.updateBmsDeviceStatus(deviceIds, status));
|
|
||||||
}
|
|
||||||
|
|
||||||
// /**
|
|
||||||
// * 查询设备状态
|
|
||||||
// */
|
|
||||||
// @PreAuthorize("@ss.hasPermi('bms:device:query')")
|
|
||||||
// @PostMapping("/queryStatus/{deviceCode}")
|
|
||||||
// public AjaxResult queryDeviceStatus(@PathVariable String deviceCode) {
|
|
||||||
// if (mqttService != null) {
|
|
||||||
// mqttService.queryDeviceStatus(deviceCode);
|
|
||||||
// return success("设备状态查询命令已发送");
|
|
||||||
// } else {
|
|
||||||
// return error("MQTT服务未启用,无法发送查询命令");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 重启设备
|
|
||||||
// */
|
|
||||||
// @PreAuthorize("@ss.hasPermi('bms:device:edit')")
|
|
||||||
// @Log(title = "重启BMS设备", businessType = BusinessType.UPDATE)
|
|
||||||
// @PostMapping("/restart/{deviceCode}")
|
|
||||||
// public AjaxResult restartDevice(@PathVariable String deviceCode) {
|
|
||||||
// if (mqttService != null) {
|
|
||||||
// mqttService.restartDevice(deviceCode);
|
|
||||||
// return success("设备重启命令已发送");
|
|
||||||
// } else {
|
|
||||||
// return error("MQTT服务未启用,无法发送重启命令");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 配置设备参数
|
|
||||||
// */
|
|
||||||
// @PreAuthorize("@ss.hasPermi('bms:device:edit')")
|
|
||||||
// @Log(title = "配置BMS设备", businessType = BusinessType.UPDATE)
|
|
||||||
// @PostMapping("/config/{deviceCode}")
|
|
||||||
// public AjaxResult configDevice(@PathVariable String deviceCode, @RequestBody Map<String, Object> config) {
|
|
||||||
// if (mqttService != null) {
|
|
||||||
// mqttService.configDevice(deviceCode, config);
|
|
||||||
// return success("设备配置命令已发送");
|
|
||||||
// } else {
|
|
||||||
// return error("MQTT服务未启用,无法发送配置命令");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// /**
|
|
||||||
// * 发送自定义MQTT消息
|
|
||||||
// */
|
|
||||||
// @PreAuthorize("@ss.hasPermi('bms:device:edit')")
|
|
||||||
// @Log(title = "发送MQTT消息", businessType = BusinessType.OTHER)
|
|
||||||
// @PostMapping("/mqtt/send")
|
|
||||||
// public AjaxResult sendMqttMessage(@RequestBody Map<String, String> params) {
|
|
||||||
// if (mqttService != null) {
|
|
||||||
// String topic = params.get("topic");
|
|
||||||
// String message = params.get("message");
|
|
||||||
// mqttService.sendMessage(topic, message);
|
|
||||||
// return success("MQTT消息已发送");
|
|
||||||
// } else {
|
|
||||||
// return error("MQTT服务未启用,无法发送消息");
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取设备统计信息
|
|
||||||
*/
|
|
||||||
@PreAuthorize("@ss.hasPermi('bms:device:list')")
|
|
||||||
@GetMapping("/statistics")
|
|
||||||
public AjaxResult getStatistics() {
|
|
||||||
Map<String, Object> statistics = new HashMap<>();
|
|
||||||
|
|
||||||
// 查询所有设备
|
|
||||||
List<BmsDevice> allDevices = bmsDeviceService.selectBmsDeviceList(new BmsDevice());
|
|
||||||
|
|
||||||
// 统计设备数量
|
|
||||||
long totalCount = allDevices.size();
|
|
||||||
long onlineCount = allDevices.stream().filter(device -> "0".equals(device.getStatus())).count();
|
|
||||||
long offlineCount = totalCount - onlineCount;
|
|
||||||
|
|
||||||
// 计算平均温度
|
|
||||||
double avgTemperature = allDevices.stream()
|
|
||||||
.filter(device -> device.getTemperature() != null)
|
|
||||||
.mapToDouble(BmsDevice::getTemperature)
|
|
||||||
.average()
|
|
||||||
.orElse(0.0);
|
|
||||||
|
|
||||||
// 计算平均剩余电量
|
|
||||||
double avgCapacity = allDevices.stream()
|
|
||||||
.filter(device -> device.getRemainingCapacity() != null)
|
|
||||||
.mapToDouble(BmsDevice::getRemainingCapacity)
|
|
||||||
.average()
|
|
||||||
.orElse(0.0);
|
|
||||||
|
|
||||||
statistics.put("totalCount", totalCount);
|
|
||||||
statistics.put("onlineCount", onlineCount);
|
|
||||||
statistics.put("offlineCount", offlineCount);
|
|
||||||
statistics.put("avgTemperature", Math.round(avgTemperature * 100.0) / 100.0);
|
|
||||||
statistics.put("avgCapacity", Math.round(avgCapacity * 100.0) / 100.0);
|
|
||||||
|
|
||||||
return success(statistics);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -7,7 +7,7 @@ import org.springframework.context.annotation.Configuration;
|
|||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
public class GBT32960MqttReceiver {
|
public class GBT32960MqttReceiver {
|
||||||
private static final String BROKER = "tcp://61.182.73.218:1883";
|
private static final String BROKER = "tcp://localhost:1883";
|
||||||
private static final String CLIENT_ID = "evobms-client";
|
private static final String CLIENT_ID = "evobms-client";
|
||||||
private static final String TOPIC = "/bbox/EVO0002/#";
|
private static final String TOPIC = "/bbox/EVO0002/#";
|
||||||
private static final String DEVICE_SN = "EVO0002";
|
private static final String DEVICE_SN = "EVO0002";
|
||||||
|
|||||||
@ -1,203 +0,0 @@
|
|||||||
package com.evobms.project.bms.domain;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.annotation.*;
|
|
||||||
import com.evobms.framework.aspectj.lang.annotation.Excel;
|
|
||||||
import com.evobms.framework.web.domain.BaseEntity;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
|
||||||
|
|
||||||
import java.util.Date;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BMS设备对象 bms_device
|
|
||||||
*
|
|
||||||
* @author evobms
|
|
||||||
* @date 2025-01-22
|
|
||||||
*/
|
|
||||||
@TableName("bms_device")
|
|
||||||
public class BmsDevice extends BaseEntity {
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
/** 设备ID */
|
|
||||||
@TableId(type = IdType.AUTO)
|
|
||||||
private Long deviceId;
|
|
||||||
|
|
||||||
/** 设备编号 */
|
|
||||||
@Excel(name = "设备编号")
|
|
||||||
private String deviceCode;
|
|
||||||
|
|
||||||
/** 设备名称 */
|
|
||||||
@Excel(name = "设备名称")
|
|
||||||
private String deviceName;
|
|
||||||
|
|
||||||
/** 设备类型 */
|
|
||||||
@Excel(name = "设备类型")
|
|
||||||
private String deviceType;
|
|
||||||
|
|
||||||
/** 设备状态(0正常 1停用) */
|
|
||||||
@Excel(name = "设备状态", readConverterExp = "0=正常,1=停用")
|
|
||||||
private String status;
|
|
||||||
|
|
||||||
/** 电池容量(Ah) */
|
|
||||||
@Excel(name = "电池容量")
|
|
||||||
private Double batteryCapacity;
|
|
||||||
|
|
||||||
/** 额定电压(V) */
|
|
||||||
@Excel(name = "额定电压")
|
|
||||||
private Double ratedVoltage;
|
|
||||||
|
|
||||||
/** 当前电压(V) */
|
|
||||||
private Double currentVoltage;
|
|
||||||
|
|
||||||
/** 当前电流(A) */
|
|
||||||
private Double currentCurrent;
|
|
||||||
|
|
||||||
/** 剩余电量(%) */
|
|
||||||
private Double remainingCapacity;
|
|
||||||
|
|
||||||
/** 温度(℃) */
|
|
||||||
private Double temperature;
|
|
||||||
|
|
||||||
/** 最后通信时间 */
|
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
|
||||||
private Date lastCommTime;
|
|
||||||
|
|
||||||
/** 删除标志(0代表存在 2代表删除) */
|
|
||||||
@TableLogic
|
|
||||||
private String delFlag;
|
|
||||||
|
|
||||||
/** 版本号(乐观锁) */
|
|
||||||
@Version
|
|
||||||
private Integer version;
|
|
||||||
|
|
||||||
public void setDeviceId(Long deviceId) {
|
|
||||||
this.deviceId = deviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Long getDeviceId() {
|
|
||||||
return deviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceCode(String deviceCode) {
|
|
||||||
this.deviceCode = deviceCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeviceCode() {
|
|
||||||
return deviceCode;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceName(String deviceName) {
|
|
||||||
this.deviceName = deviceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeviceName() {
|
|
||||||
return deviceName;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDeviceType(String deviceType) {
|
|
||||||
this.deviceType = deviceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDeviceType() {
|
|
||||||
return deviceType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setStatus(String status) {
|
|
||||||
this.status = status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setBatteryCapacity(Double batteryCapacity) {
|
|
||||||
this.batteryCapacity = batteryCapacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getBatteryCapacity() {
|
|
||||||
return batteryCapacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRatedVoltage(Double ratedVoltage) {
|
|
||||||
this.ratedVoltage = ratedVoltage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getRatedVoltage() {
|
|
||||||
return ratedVoltage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCurrentVoltage(Double currentVoltage) {
|
|
||||||
this.currentVoltage = currentVoltage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getCurrentVoltage() {
|
|
||||||
return currentVoltage;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setCurrentCurrent(Double currentCurrent) {
|
|
||||||
this.currentCurrent = currentCurrent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getCurrentCurrent() {
|
|
||||||
return currentCurrent;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setRemainingCapacity(Double remainingCapacity) {
|
|
||||||
this.remainingCapacity = remainingCapacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getRemainingCapacity() {
|
|
||||||
return remainingCapacity;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setTemperature(Double temperature) {
|
|
||||||
this.temperature = temperature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Double getTemperature() {
|
|
||||||
return temperature;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLastCommTime(Date lastCommTime) {
|
|
||||||
this.lastCommTime = lastCommTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Date getLastCommTime() {
|
|
||||||
return lastCommTime;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setDelFlag(String delFlag) {
|
|
||||||
this.delFlag = delFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getDelFlag() {
|
|
||||||
return delFlag;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setVersion(Integer version) {
|
|
||||||
this.version = version;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Integer getVersion() {
|
|
||||||
return version;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public String toString() {
|
|
||||||
return "BmsDevice{" +
|
|
||||||
"deviceId=" + deviceId +
|
|
||||||
", deviceCode='" + deviceCode + '\'' +
|
|
||||||
", deviceName='" + deviceName + '\'' +
|
|
||||||
", deviceType='" + deviceType + '\'' +
|
|
||||||
", status='" + status + '\'' +
|
|
||||||
", batteryCapacity=" + batteryCapacity +
|
|
||||||
", ratedVoltage=" + ratedVoltage +
|
|
||||||
", currentVoltage=" + currentVoltage +
|
|
||||||
", currentCurrent=" + currentCurrent +
|
|
||||||
", remainingCapacity=" + remainingCapacity +
|
|
||||||
", temperature=" + temperature +
|
|
||||||
", lastCommTime=" + lastCommTime +
|
|
||||||
", delFlag='" + delFlag + '\'' +
|
|
||||||
", version=" + version +
|
|
||||||
'}';
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,43 +0,0 @@
|
|||||||
package com.evobms.project.bms.mapper;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
|
||||||
import com.evobms.project.bms.domain.BmsDevice;
|
|
||||||
import org.apache.ibatis.annotations.Mapper;
|
|
||||||
import org.apache.ibatis.annotations.Param;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BMS设备Mapper接口
|
|
||||||
*
|
|
||||||
* @author evobms
|
|
||||||
* @date 2025-01-22
|
|
||||||
*/
|
|
||||||
@Mapper
|
|
||||||
public interface BmsDeviceMapper extends BaseMapper<BmsDevice> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询BMS设备列表
|
|
||||||
*
|
|
||||||
* @param bmsDevice BMS设备
|
|
||||||
* @return BMS设备集合
|
|
||||||
*/
|
|
||||||
List<BmsDevice> selectBmsDeviceList(BmsDevice bmsDevice);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据设备编号查询设备信息
|
|
||||||
*
|
|
||||||
* @param deviceCode 设备编号
|
|
||||||
* @return BMS设备
|
|
||||||
*/
|
|
||||||
BmsDevice selectBmsDeviceByCode(@Param("deviceCode") String deviceCode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量更新设备状态
|
|
||||||
*
|
|
||||||
* @param deviceIds 设备ID数组
|
|
||||||
* @param status 状态
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int updateBmsDeviceStatus(@Param("deviceIds") Long[] deviceIds, @Param("status") String status);
|
|
||||||
}
|
|
||||||
@ -1,80 +0,0 @@
|
|||||||
package com.evobms.project.bms.service;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.IService;
|
|
||||||
import com.evobms.project.bms.domain.BmsDevice;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BMS设备Service接口
|
|
||||||
*
|
|
||||||
* @author evobms
|
|
||||||
* @date 2025-01-22
|
|
||||||
*/
|
|
||||||
public interface IBmsDeviceService extends IService<BmsDevice> {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询BMS设备
|
|
||||||
*
|
|
||||||
* @param deviceId BMS设备主键
|
|
||||||
* @return BMS设备
|
|
||||||
*/
|
|
||||||
BmsDevice selectBmsDeviceByDeviceId(Long deviceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询BMS设备列表
|
|
||||||
*
|
|
||||||
* @param bmsDevice BMS设备
|
|
||||||
* @return BMS设备集合
|
|
||||||
*/
|
|
||||||
List<BmsDevice> selectBmsDeviceList(BmsDevice bmsDevice);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增BMS设备
|
|
||||||
*
|
|
||||||
* @param bmsDevice BMS设备
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int insertBmsDevice(BmsDevice bmsDevice);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改BMS设备
|
|
||||||
*
|
|
||||||
* @param bmsDevice BMS设备
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int updateBmsDevice(BmsDevice bmsDevice);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除BMS设备
|
|
||||||
*
|
|
||||||
* @param deviceIds 需要删除的BMS设备主键集合
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteBmsDeviceByDeviceIds(Long[] deviceIds);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除BMS设备信息
|
|
||||||
*
|
|
||||||
* @param deviceId BMS设备主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int deleteBmsDeviceByDeviceId(Long deviceId);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据设备编号查询设备信息
|
|
||||||
*
|
|
||||||
* @param deviceCode 设备编号
|
|
||||||
* @return BMS设备
|
|
||||||
*/
|
|
||||||
BmsDevice selectBmsDeviceByCode(String deviceCode);
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量更新设备状态
|
|
||||||
*
|
|
||||||
* @param deviceIds 设备ID数组
|
|
||||||
* @param status 状态
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
int updateBmsDeviceStatus(Long[] deviceIds, String status);
|
|
||||||
}
|
|
||||||
@ -1,20 +1,20 @@
|
|||||||
package com.evobms.project.bms.service;
|
package com.evobms.project.bms.service;
|
||||||
|
|
||||||
import com.alibaba.fastjson2.JSON;
|
import com.alibaba.fastjson2.JSON;
|
||||||
import com.evobms.project.Battery.domain.ExtremeValues;
|
import com.evobms.common.utils.DateUtils;
|
||||||
import com.evobms.project.Battery.domain.SubsystemVoltage;
|
import com.evobms.project.battery.domain.ExtremeValues;
|
||||||
import com.evobms.project.Battery.domain.SubsystemTemperature;
|
import com.evobms.project.battery.domain.SubsystemVoltage;
|
||||||
import com.evobms.project.Battery.service.IExtremeValuesService;
|
import com.evobms.project.battery.domain.SubsystemTemperature;
|
||||||
import com.evobms.project.Battery.service.ISubsystemVoltageService;
|
import com.evobms.project.battery.service.IExtremeValuesService;
|
||||||
import com.evobms.project.Battery.service.ISubsystemTemperatureService;
|
import com.evobms.project.battery.service.ISubsystemVoltageService;
|
||||||
import com.evobms.project.Battery.domain.ChargeDischargeSummary;
|
import com.evobms.project.battery.service.ISubsystemTemperatureService;
|
||||||
import com.evobms.project.Battery.service.IChargeDischargeSummaryService;
|
import com.evobms.project.summary.domain.ChargeDischargeSummary;
|
||||||
import com.evobms.project.VehicleData.domain.VehicleData;
|
import com.evobms.project.summary.service.IChargeDischargeSummaryService;
|
||||||
import com.evobms.project.VehicleData.domain.VehicleLocation;
|
import com.evobms.project.system.mapper.BmsDevicesMapper;
|
||||||
import com.evobms.project.VehicleData.service.IVehicleDataService;
|
import com.evobms.project.vehicledata.domain.VehicleData;
|
||||||
import com.evobms.project.VehicleData.service.IVehicleLocationService;
|
import com.evobms.project.vehicledata.domain.VehicleLocation;
|
||||||
import com.evobms.project.bms.domain.BmsDevice;
|
import com.evobms.project.vehicledata.service.IVehicleDataService;
|
||||||
import org.eclipse.paho.client.mqttv3.MqttMessage;
|
import com.evobms.project.vehicledata.service.IVehicleLocationService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.beans.factory.annotation.Value;
|
import org.springframework.beans.factory.annotation.Value;
|
||||||
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
import org.springframework.boot.autoconfigure.condition.ConditionalOnProperty;
|
||||||
@ -36,7 +36,6 @@ import com.evobms.project.system.service.IBmsDevicesService;
|
|||||||
import com.evobms.project.system.domain.BmsDevices;
|
import com.evobms.project.system.domain.BmsDevices;
|
||||||
|
|
||||||
import static com.evobms.project.bms.controller.GBT32960FullDecoder.parseGBT32960Data;
|
import static com.evobms.project.bms.controller.GBT32960FullDecoder.parseGBT32960Data;
|
||||||
import static oshi.util.ParseUtil.hexStringToByteArray;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* MQTT服务类
|
* MQTT服务类
|
||||||
@ -72,7 +71,8 @@ public class MqttService {
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private IChargeDischargeSummaryService chargeDischargeSummaryService;
|
private IChargeDischargeSummaryService chargeDischargeSummaryService;
|
||||||
|
@Autowired
|
||||||
|
private BmsDevicesMapper bmsDevicesMapper;
|
||||||
|
|
||||||
@Value("${mqtt.publishTopic}")
|
@Value("${mqtt.publishTopic}")
|
||||||
private String publishTopic;
|
private String publishTopic;
|
||||||
@ -184,7 +184,6 @@ public class MqttService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 处理接收到的设备数据
|
* 处理接收到的设备数据
|
||||||
*
|
|
||||||
* @param topic 主题
|
* @param topic 主题
|
||||||
* @param message 消息内容
|
* @param message 消息内容
|
||||||
*/
|
*/
|
||||||
@ -223,7 +222,6 @@ public class MqttService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 逐字段解析数据字符串 - 直接解析十六进制数据
|
* 逐字段解析数据字符串 - 直接解析十六进制数据
|
||||||
*
|
|
||||||
* @param data 十六进制数据字符串
|
* @param data 十六进制数据字符串
|
||||||
* @param deviceSn 设备SN码
|
* @param deviceSn 设备SN码
|
||||||
*/
|
*/
|
||||||
@ -245,6 +243,10 @@ public class MqttService {
|
|||||||
|
|
||||||
// 将十六进制字符串转换为字节数组
|
// 将十六进制字符串转换为字节数组
|
||||||
byte[] message = hexStringToByteArray(cleanData);
|
byte[] message = hexStringToByteArray(cleanData);
|
||||||
|
if (message.length >= 3 && (message[0] & 0xFF) == 0xAA && (message[1] & 0xFF) == 0x55 && (message[2] & 0xFF) == 0xA5) {
|
||||||
|
log.info("设备 {} 调试无效帧(AA 55 A5),跳过", deviceSn);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
// 按照协议索引逐段解析
|
// 按照协议索引逐段解析
|
||||||
parseByProtocolIndex(message, deviceSn);
|
parseByProtocolIndex(message, deviceSn);
|
||||||
@ -309,8 +311,7 @@ public class MqttService {
|
|||||||
int second = message[startIndex + 5] & 0xFF; // 索引29: 秒
|
int second = message[startIndex + 5] & 0xFF; // 索引29: 秒
|
||||||
|
|
||||||
if (isValidTime(year, month, day, hour, minute, second)) {
|
if (isValidTime(year, month, day, hour, minute, second)) {
|
||||||
String time = String.format("%04d-%02d-%02d %02d:%02d:%02d",
|
String time = String.format("%04d-%02d-%02d %02d:%02d:%02d", year, month, day, hour, minute, second);
|
||||||
year, month, day, hour, minute, second);
|
|
||||||
log.info("设备 {} - 时间: {}", deviceSn, time);
|
log.info("设备 {} - 时间: {}", deviceSn, time);
|
||||||
saveTimeData(deviceSn, time);
|
saveTimeData(deviceSn, time);
|
||||||
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
|
Calendar cal = Calendar.getInstance(TimeZone.getDefault());
|
||||||
@ -318,8 +319,7 @@ public class MqttService {
|
|||||||
cal.set(Calendar.MILLISECOND, 0);
|
cal.set(Calendar.MILLISECOND, 0);
|
||||||
return cal.getTime();
|
return cal.getTime();
|
||||||
} else {
|
} else {
|
||||||
log.info("设备 {} - 时间: 无效数据({}-{}-{} {}:{}:{})",
|
log.info("设备 {} - 时间: 无效数据({}-{}-{} {}:{}:{})", deviceSn, year, month, day, hour, minute, second);
|
||||||
deviceSn, year, month, day, hour, minute, second);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -830,8 +830,30 @@ public class MqttService {
|
|||||||
* 保存时间数据
|
* 保存时间数据
|
||||||
*/
|
*/
|
||||||
private void saveTimeData(String deviceSn, String time) {
|
private void saveTimeData(String deviceSn, String time) {
|
||||||
// TODO: 实现时间数据保存逻辑
|
try {
|
||||||
|
Date ts = DateUtils.dateTime(DateUtils.YYYY_MM_DD_HH_MM_SS, time);
|
||||||
|
if (ts == null) {
|
||||||
|
log.warn("设备 {} 时间解析失败: {}", deviceSn, time);
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
BmsDevices existing = bmsDevicesService.selectBmsDevicesBySn(deviceSn);
|
||||||
|
if (existing != null) {
|
||||||
|
existing.setLastOnline(ts);
|
||||||
|
existing.setStatus("online");
|
||||||
|
existing.setUpdateTime(new Date());
|
||||||
|
bmsDevicesMapper.updateBmsDevices(existing);
|
||||||
|
} else {
|
||||||
|
BmsDevices dev = new BmsDevices();
|
||||||
|
dev.setDeviceSn(deviceSn);
|
||||||
|
dev.setStatus("online");
|
||||||
|
dev.setLastOnline(ts);
|
||||||
|
dev.setCreateTime(new Date());
|
||||||
|
bmsDevicesMapper.insertBmsDevices(dev);
|
||||||
|
}
|
||||||
log.debug("保存设备 {} 时间数据: {}", deviceSn, time);
|
log.debug("保存设备 {} 时间数据: {}", deviceSn, time);
|
||||||
|
} catch (Exception e) {
|
||||||
|
log.error("保存设备 {} 时间数据失败: {}", deviceSn, e.getMessage(), e);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -913,29 +935,6 @@ public class MqttService {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 更新设备数据
|
|
||||||
*
|
|
||||||
* @param device 设备对象
|
|
||||||
* @param data 数据
|
|
||||||
*/
|
|
||||||
private void updateDeviceData(BmsDevice device, Map<String, Object> data) {
|
|
||||||
if (data.containsKey("voltage")) {
|
|
||||||
device.setCurrentVoltage(Double.valueOf(data.get("voltage").toString()));
|
|
||||||
}
|
|
||||||
if (data.containsKey("current")) {
|
|
||||||
device.setCurrentCurrent(Double.valueOf(data.get("current").toString()));
|
|
||||||
}
|
|
||||||
if (data.containsKey("capacity")) {
|
|
||||||
device.setRemainingCapacity(Double.valueOf(data.get("capacity").toString()));
|
|
||||||
}
|
|
||||||
if (data.containsKey("temperature")) {
|
|
||||||
device.setTemperature(Double.valueOf(data.get("temperature").toString()));
|
|
||||||
}
|
|
||||||
|
|
||||||
device.setLastCommTime(new Date());
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 发送设备状态查询命令
|
* 发送设备状态查询命令
|
||||||
*
|
*
|
||||||
|
|||||||
@ -1,115 +0,0 @@
|
|||||||
package com.evobms.project.bms.service.impl;
|
|
||||||
|
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
||||||
import com.evobms.common.utils.DateUtils;
|
|
||||||
import com.evobms.project.bms.domain.BmsDevice;
|
|
||||||
import com.evobms.project.bms.mapper.BmsDeviceMapper;
|
|
||||||
import com.evobms.project.bms.service.IBmsDeviceService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.stereotype.Service;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* BMS设备Service业务层处理
|
|
||||||
*
|
|
||||||
* @author evobms
|
|
||||||
* @date 2025-01-22
|
|
||||||
*/
|
|
||||||
@Service
|
|
||||||
public class BmsDeviceServiceImpl extends ServiceImpl<BmsDeviceMapper, BmsDevice> implements IBmsDeviceService {
|
|
||||||
|
|
||||||
@Autowired
|
|
||||||
private BmsDeviceMapper bmsDeviceMapper;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询BMS设备
|
|
||||||
*
|
|
||||||
* @param deviceId BMS设备主键
|
|
||||||
* @return BMS设备
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public BmsDevice selectBmsDeviceByDeviceId(Long deviceId) {
|
|
||||||
return bmsDeviceMapper.selectById(deviceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 查询BMS设备列表
|
|
||||||
*
|
|
||||||
* @param bmsDevice BMS设备
|
|
||||||
* @return BMS设备
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public List<BmsDevice> selectBmsDeviceList(BmsDevice bmsDevice) {
|
|
||||||
return bmsDeviceMapper.selectBmsDeviceList(bmsDevice);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 新增BMS设备
|
|
||||||
*
|
|
||||||
* @param bmsDevice BMS设备
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int insertBmsDevice(BmsDevice bmsDevice) {
|
|
||||||
bmsDevice.setCreateTime(DateUtils.getNowDate());
|
|
||||||
return bmsDeviceMapper.insert(bmsDevice);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 修改BMS设备
|
|
||||||
*
|
|
||||||
* @param bmsDevice BMS设备
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateBmsDevice(BmsDevice bmsDevice) {
|
|
||||||
bmsDevice.setUpdateTime(DateUtils.getNowDate());
|
|
||||||
return bmsDeviceMapper.updateById(bmsDevice);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量删除BMS设备
|
|
||||||
*
|
|
||||||
* @param deviceIds 需要删除的BMS设备主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteBmsDeviceByDeviceIds(Long[] deviceIds) {
|
|
||||||
return bmsDeviceMapper.deleteBatchIds(java.util.Arrays.asList(deviceIds));
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 删除BMS设备信息
|
|
||||||
*
|
|
||||||
* @param deviceId BMS设备主键
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int deleteBmsDeviceByDeviceId(Long deviceId) {
|
|
||||||
return bmsDeviceMapper.deleteById(deviceId);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 根据设备编号查询设备信息
|
|
||||||
*
|
|
||||||
* @param deviceCode 设备编号
|
|
||||||
* @return BMS设备
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public BmsDevice selectBmsDeviceByCode(String deviceCode) {
|
|
||||||
return bmsDeviceMapper.selectBmsDeviceByCode(deviceCode);
|
|
||||||
}
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 批量更新设备状态
|
|
||||||
*
|
|
||||||
* @param deviceIds 设备ID数组
|
|
||||||
* @param status 状态
|
|
||||||
* @return 结果
|
|
||||||
*/
|
|
||||||
@Override
|
|
||||||
public int updateBmsDeviceStatus(Long[] deviceIds, String status) {
|
|
||||||
return bmsDeviceMapper.updateBmsDeviceStatus(deviceIds, status);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -65,7 +65,7 @@ public class IotAuthController {
|
|||||||
@Value("${token.header:Authorization}")
|
@Value("${token.header:Authorization}")
|
||||||
private String tokenHeader;
|
private String tokenHeader;
|
||||||
|
|
||||||
@Value("${mqtt.host:tcp://localhost:1883}")
|
@Value("${mqtt.host:tcp://192.168.5.23:1883}")
|
||||||
private String mqttHostUri;
|
private String mqttHostUri;
|
||||||
@Value("${mqtt.username:00000001}")
|
@Value("${mqtt.username:00000001}")
|
||||||
private String mqttUsername;
|
private String mqttUsername;
|
||||||
@ -79,7 +79,7 @@ public class IotAuthController {
|
|||||||
private String otaCount;
|
private String otaCount;
|
||||||
|
|
||||||
// OTA文件存储位置:支持 classpath 或 文件系统目录,例如:classpath:/ota 或 /data/ota
|
// OTA文件存储位置:支持 classpath 或 文件系统目录,例如:classpath:/ota 或 /data/ota
|
||||||
@Value("${ota.repo:classpath:/ota}")
|
@Value("${ota.repo:D:/OTA}")
|
||||||
private String otaRepo;
|
private String otaRepo;
|
||||||
|
|
||||||
// OTA分片大小(字节),规范为1KB=1024字节
|
// OTA分片大小(字节),规范为1KB=1024字节
|
||||||
@ -120,10 +120,8 @@ public class IotAuthController {
|
|||||||
BmsDevices query = new BmsDevices();
|
BmsDevices query = new BmsDevices();
|
||||||
// 依据设备上报的SN,使用系统侧BmsDevices的deviceSn字段进行校验
|
// 依据设备上报的SN,使用系统侧BmsDevices的deviceSn字段进行校验
|
||||||
query.setDeviceSn(sn);
|
query.setDeviceSn(sn);
|
||||||
List<BmsDevices> list = bmsDevicesService.selectBmsDevicesList(query);
|
device = bmsDevicesService.selectBmsDevicesList1(query);
|
||||||
if (list != null && !list.isEmpty()) {
|
|
||||||
device = list.get(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
@ -185,7 +183,7 @@ public class IotAuthController {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// 解析 MQTT 主机与端口
|
// 解析 MQTT 主机与端口
|
||||||
String host = "61.182.73.218";
|
String host = "192.168.5.23";
|
||||||
int port = 1883;
|
int port = 1883;
|
||||||
try {
|
try {
|
||||||
URI uri = new URI(mqttHostUri);
|
URI uri = new URI(mqttHostUri);
|
||||||
@ -215,6 +213,9 @@ public class IotAuthController {
|
|||||||
if (sn.equals("EVO0001")) {
|
if (sn.equals("EVO0001")) {
|
||||||
String key161 = fixLengthRight("EVO0001", 16);
|
String key161 = fixLengthRight("EVO0001", 16);
|
||||||
encryptedBase64 = AesEcbPkcs5Utils.encryptToAscII16(json, key161);
|
encryptedBase64 = AesEcbPkcs5Utils.encryptToAscII16(json, key161);
|
||||||
|
} else if (sn.equals("EVO0002")) {
|
||||||
|
String key161 = fixLengthRight("EVO0002", 16);
|
||||||
|
encryptedBase64 = AesEcbPkcs5Utils.encryptToAscII16(json, key161);
|
||||||
}else {
|
}else {
|
||||||
String keyTail6 = sn.length() >= 16 ? sn.substring(sn.length() - 16) : sn;
|
String keyTail6 = sn.length() >= 16 ? sn.substring(sn.length() - 16) : sn;
|
||||||
encryptedBase64 = AesEcbPkcs5Utils.encryptToAscII16(json, keyTail6);
|
encryptedBase64 = AesEcbPkcs5Utils.encryptToAscII16(json, keyTail6);
|
||||||
@ -288,10 +289,8 @@ public class IotAuthController {
|
|||||||
if (bmsDevicesService != null) {
|
if (bmsDevicesService != null) {
|
||||||
BmsDevices query = new BmsDevices();
|
BmsDevices query = new BmsDevices();
|
||||||
query.setDeviceSn(sn);
|
query.setDeviceSn(sn);
|
||||||
List<BmsDevices> list = bmsDevicesService.selectBmsDevicesList(query);
|
device = bmsDevicesService.selectBmsDevicesList1(query);
|
||||||
if (list != null && !list.isEmpty()) {
|
|
||||||
device = list.get(0);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if (device == null) {
|
if (device == null) {
|
||||||
|
|||||||
@ -0,0 +1,104 @@
|
|||||||
|
package com.evobms.project.summary.controller;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import javax.servlet.http.HttpServletResponse;
|
||||||
|
import org.springframework.security.access.prepost.PreAuthorize;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PostMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PutMapping;
|
||||||
|
import org.springframework.web.bind.annotation.DeleteMapping;
|
||||||
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
|
import org.springframework.web.bind.annotation.RequestBody;
|
||||||
|
import org.springframework.web.bind.annotation.RequestMapping;
|
||||||
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
|
import com.evobms.framework.aspectj.lang.annotation.Log;
|
||||||
|
import com.evobms.framework.aspectj.lang.enums.BusinessType;
|
||||||
|
import com.evobms.project.summary.domain.ChargeDischargeSummary;
|
||||||
|
import com.evobms.project.summary.service.IChargeDischargeSummaryService;
|
||||||
|
import com.evobms.framework.web.controller.BaseController;
|
||||||
|
import com.evobms.framework.web.domain.AjaxResult;
|
||||||
|
import com.evobms.common.utils.poi.ExcelUtil;
|
||||||
|
import com.evobms.framework.web.page.TableDataInfo;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 累计充放电量Controller
|
||||||
|
*
|
||||||
|
* @author 田志阳
|
||||||
|
* @date 2026-01-09
|
||||||
|
*/
|
||||||
|
@RestController
|
||||||
|
@RequestMapping("/summary/summary")
|
||||||
|
public class ChargeDischargeSummaryController extends BaseController
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private IChargeDischargeSummaryService chargeDischargeSummaryService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询累计充放电量列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('summary:summary:list')")
|
||||||
|
@GetMapping("/list")
|
||||||
|
public TableDataInfo list(ChargeDischargeSummary chargeDischargeSummary)
|
||||||
|
{
|
||||||
|
startPage();
|
||||||
|
List<ChargeDischargeSummary> list = chargeDischargeSummaryService.selectChargeDischargeSummaryList(chargeDischargeSummary);
|
||||||
|
return getDataTable(list);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 导出累计充放电量列表
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('summary:summary:export')")
|
||||||
|
@Log(title = "累计充放电量", businessType = BusinessType.EXPORT)
|
||||||
|
@PostMapping("/export")
|
||||||
|
public void export(HttpServletResponse response, ChargeDischargeSummary chargeDischargeSummary)
|
||||||
|
{
|
||||||
|
List<ChargeDischargeSummary> list = chargeDischargeSummaryService.selectChargeDischargeSummaryList(chargeDischargeSummary);
|
||||||
|
ExcelUtil<ChargeDischargeSummary> util = new ExcelUtil<ChargeDischargeSummary>(ChargeDischargeSummary.class);
|
||||||
|
util.exportExcel(response, list, "累计充放电量数据");
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取累计充放电量详细信息
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('summary:summary:query')")
|
||||||
|
@GetMapping(value = "/{id}")
|
||||||
|
public AjaxResult getInfo(@PathVariable("id") Long id)
|
||||||
|
{
|
||||||
|
return success(chargeDischargeSummaryService.selectChargeDischargeSummaryById(id));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增累计充放电量
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('summary:summary:add')")
|
||||||
|
@Log(title = "累计充放电量", businessType = BusinessType.INSERT)
|
||||||
|
@PostMapping
|
||||||
|
public AjaxResult add(@RequestBody ChargeDischargeSummary chargeDischargeSummary)
|
||||||
|
{
|
||||||
|
return toAjax(chargeDischargeSummaryService.insertChargeDischargeSummary(chargeDischargeSummary));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改累计充放电量
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('summary:summary:edit')")
|
||||||
|
@Log(title = "累计充放电量", businessType = BusinessType.UPDATE)
|
||||||
|
@PutMapping
|
||||||
|
public AjaxResult edit(@RequestBody ChargeDischargeSummary chargeDischargeSummary)
|
||||||
|
{
|
||||||
|
return toAjax(chargeDischargeSummaryService.updateChargeDischargeSummary(chargeDischargeSummary));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除累计充放电量
|
||||||
|
*/
|
||||||
|
@PreAuthorize("@ss.hasPermi('summary:summary:remove')")
|
||||||
|
@Log(title = "累计充放电量", businessType = BusinessType.DELETE)
|
||||||
|
@DeleteMapping("/{ids}")
|
||||||
|
public AjaxResult remove(@PathVariable Long[] ids)
|
||||||
|
{
|
||||||
|
return toAjax(chargeDischargeSummaryService.deleteChargeDischargeSummaryByIds(ids));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,105 @@
|
|||||||
|
package com.evobms.project.summary.domain;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
import java.util.Date;
|
||||||
|
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||||
|
import org.apache.commons.lang3.builder.ToStringStyle;
|
||||||
|
import com.evobms.framework.aspectj.lang.annotation.Excel;
|
||||||
|
import com.evobms.framework.web.domain.BaseEntity;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 累计充放电量对象 charge_discharge_summary
|
||||||
|
*
|
||||||
|
* @author 田志阳
|
||||||
|
* @date 2026-01-09
|
||||||
|
*/
|
||||||
|
public class ChargeDischargeSummary extends BaseEntity
|
||||||
|
{
|
||||||
|
private static final long serialVersionUID = 1L;
|
||||||
|
|
||||||
|
/** 主键ID */
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
/** 设备ID */
|
||||||
|
@Excel(name = "设备ID")
|
||||||
|
private String deviceId;
|
||||||
|
|
||||||
|
/** 时间戳 */
|
||||||
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss ")
|
||||||
|
@Excel(name = "时间戳", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
|
private Date timestamp;
|
||||||
|
|
||||||
|
/** 累计放电(kWh) */
|
||||||
|
@Excel(name = "累计放电(kWh)")
|
||||||
|
private BigDecimal dischargeKwh;
|
||||||
|
|
||||||
|
/** 累计充电kWh) */
|
||||||
|
@Excel(name = "累计充电kWh)")
|
||||||
|
private BigDecimal chargeKwh;
|
||||||
|
|
||||||
|
public void setId(Long id)
|
||||||
|
{
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getId()
|
||||||
|
{
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDeviceId(String deviceId)
|
||||||
|
{
|
||||||
|
this.deviceId = deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getDeviceId()
|
||||||
|
{
|
||||||
|
return deviceId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimestamp(Date timestamp)
|
||||||
|
{
|
||||||
|
this.timestamp = timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getTimestamp()
|
||||||
|
{
|
||||||
|
return timestamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDischargeKwh(BigDecimal dischargeKwh)
|
||||||
|
{
|
||||||
|
this.dischargeKwh = dischargeKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getDischargeKwh()
|
||||||
|
{
|
||||||
|
return dischargeKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setChargeKwh(BigDecimal chargeKwh)
|
||||||
|
{
|
||||||
|
this.chargeKwh = chargeKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getChargeKwh()
|
||||||
|
{
|
||||||
|
return chargeKwh;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String toString() {
|
||||||
|
return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE)
|
||||||
|
.append("id", getId())
|
||||||
|
.append("deviceId", getDeviceId())
|
||||||
|
.append("timestamp", getTimestamp())
|
||||||
|
.append("dischargeKwh", getDischargeKwh())
|
||||||
|
.append("chargeKwh", getChargeKwh())
|
||||||
|
.append("createTime", getCreateTime())
|
||||||
|
.append("updateTime", getUpdateTime())
|
||||||
|
.append("createBy", getCreateBy())
|
||||||
|
.append("updateBy", getUpdateBy())
|
||||||
|
.toString();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,62 @@
|
|||||||
|
package com.evobms.project.summary.mapper;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
import com.evobms.project.summary.domain.ChargeDischargeSummary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 累计充放电量Mapper接口
|
||||||
|
*
|
||||||
|
* @author 田志阳
|
||||||
|
* @date 2026-01-09
|
||||||
|
*/
|
||||||
|
public interface ChargeDischargeSummaryMapper extends BaseMapper<ChargeDischargeSummary> {
|
||||||
|
/**
|
||||||
|
* 查询累计充放电量
|
||||||
|
*
|
||||||
|
* @param id 累计充放电量主键
|
||||||
|
* @return 累计充放电量
|
||||||
|
*/
|
||||||
|
public ChargeDischargeSummary selectChargeDischargeSummaryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询累计充放电量列表
|
||||||
|
*
|
||||||
|
* @param chargeDischargeSummary 累计充放电量
|
||||||
|
* @return 累计充放电量集合
|
||||||
|
*/
|
||||||
|
public List<ChargeDischargeSummary> selectChargeDischargeSummaryList(ChargeDischargeSummary chargeDischargeSummary);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增累计充放电量
|
||||||
|
*
|
||||||
|
* @param chargeDischargeSummary 累计充放电量
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertChargeDischargeSummary(ChargeDischargeSummary chargeDischargeSummary);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改累计充放电量
|
||||||
|
*
|
||||||
|
* @param chargeDischargeSummary 累计充放电量
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateChargeDischargeSummary(ChargeDischargeSummary chargeDischargeSummary);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除累计充放电量
|
||||||
|
*
|
||||||
|
* @param id 累计充放电量主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteChargeDischargeSummaryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除累计充放电量
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的数据主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteChargeDischargeSummaryByIds(Long[] ids);
|
||||||
|
}
|
||||||
@ -0,0 +1,61 @@
|
|||||||
|
package com.evobms.project.summary.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.evobms.project.summary.domain.ChargeDischargeSummary;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 累计充放电量Service接口
|
||||||
|
*
|
||||||
|
* @author 田志阳
|
||||||
|
* @date 2026-01-09
|
||||||
|
*/
|
||||||
|
public interface IChargeDischargeSummaryService
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* 查询累计充放电量
|
||||||
|
*
|
||||||
|
* @param id 累计充放电量主键
|
||||||
|
* @return 累计充放电量
|
||||||
|
*/
|
||||||
|
public ChargeDischargeSummary selectChargeDischargeSummaryById(Long id);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询累计充放电量列表
|
||||||
|
*
|
||||||
|
* @param chargeDischargeSummary 累计充放电量
|
||||||
|
* @return 累计充放电量集合
|
||||||
|
*/
|
||||||
|
public List<ChargeDischargeSummary> selectChargeDischargeSummaryList(ChargeDischargeSummary chargeDischargeSummary);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增累计充放电量
|
||||||
|
*
|
||||||
|
* @param chargeDischargeSummary 累计充放电量
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int insertChargeDischargeSummary(ChargeDischargeSummary chargeDischargeSummary);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改累计充放电量
|
||||||
|
*
|
||||||
|
* @param chargeDischargeSummary 累计充放电量
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int updateChargeDischargeSummary(ChargeDischargeSummary chargeDischargeSummary);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除累计充放电量
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的累计充放电量主键集合
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteChargeDischargeSummaryByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除累计充放电量信息
|
||||||
|
*
|
||||||
|
* @param id 累计充放电量主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
public int deleteChargeDischargeSummaryById(Long id);
|
||||||
|
}
|
||||||
@ -0,0 +1,102 @@
|
|||||||
|
package com.evobms.project.summary.service.impl;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.evobms.common.utils.DateUtils;
|
||||||
|
import com.evobms.project.vehicledata.domain.VehicleData;
|
||||||
|
import com.evobms.project.vehicledata.mapper.VehicleDataMapper;
|
||||||
|
import com.evobms.project.vehicledata.service.IVehicleDataService;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.evobms.project.summary.mapper.ChargeDischargeSummaryMapper;
|
||||||
|
import com.evobms.project.summary.domain.ChargeDischargeSummary;
|
||||||
|
import com.evobms.project.summary.service.IChargeDischargeSummaryService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 累计充放电量Service业务层处理
|
||||||
|
*
|
||||||
|
* @author 田志阳
|
||||||
|
* @date 2026-01-09
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class ChargeDischargeSummaryServiceImpl extends ServiceImpl<ChargeDischargeSummaryMapper, ChargeDischargeSummary> implements IChargeDischargeSummaryService
|
||||||
|
{
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ChargeDischargeSummaryMapper chargeDischargeSummaryMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询累计充放电量
|
||||||
|
*
|
||||||
|
* @param id 累计充放电量主键
|
||||||
|
* @return 累计充放电量
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public ChargeDischargeSummary selectChargeDischargeSummaryById(Long id)
|
||||||
|
{
|
||||||
|
return chargeDischargeSummaryMapper.selectChargeDischargeSummaryById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询累计充放电量列表
|
||||||
|
*
|
||||||
|
* @param chargeDischargeSummary 累计充放电量
|
||||||
|
* @return 累计充放电量
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<ChargeDischargeSummary> selectChargeDischargeSummaryList(ChargeDischargeSummary chargeDischargeSummary)
|
||||||
|
{
|
||||||
|
return chargeDischargeSummaryMapper.selectChargeDischargeSummaryList(chargeDischargeSummary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增累计充放电量
|
||||||
|
*
|
||||||
|
* @param chargeDischargeSummary 累计充放电量
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertChargeDischargeSummary(ChargeDischargeSummary chargeDischargeSummary)
|
||||||
|
{
|
||||||
|
chargeDischargeSummary.setCreateTime(DateUtils.getNowDate());
|
||||||
|
return chargeDischargeSummaryMapper.insertChargeDischargeSummary(chargeDischargeSummary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改累计充放电量
|
||||||
|
*
|
||||||
|
* @param chargeDischargeSummary 累计充放电量
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateChargeDischargeSummary(ChargeDischargeSummary chargeDischargeSummary)
|
||||||
|
{
|
||||||
|
chargeDischargeSummary.setUpdateTime(DateUtils.getNowDate());
|
||||||
|
return chargeDischargeSummaryMapper.updateChargeDischargeSummary(chargeDischargeSummary);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除累计充放电量
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的累计充放电量主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteChargeDischargeSummaryByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return chargeDischargeSummaryMapper.deleteChargeDischargeSummaryByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除累计充放电量信息
|
||||||
|
*
|
||||||
|
* @param id 累计充放电量主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteChargeDischargeSummaryById(Long id)
|
||||||
|
{
|
||||||
|
return chargeDischargeSummaryMapper.deleteChargeDischargeSummaryById(id);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -52,8 +52,8 @@ public class BmsDevices extends BaseEntity
|
|||||||
private String firmwareVersion;
|
private String firmwareVersion;
|
||||||
|
|
||||||
/** 最后在线时间 */
|
/** 最后在线时间 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "最后在线时间", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "最后在线时间", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date lastOnline;
|
private Date lastOnline;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,6 +1,8 @@
|
|||||||
package com.evobms.project.system.mapper;
|
package com.evobms.project.system.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import com.evobms.project.system.domain.BmsDevices;
|
import com.evobms.project.system.domain.BmsDevices;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -9,8 +11,7 @@ import com.evobms.project.system.domain.BmsDevices;
|
|||||||
* @author 田志阳
|
* @author 田志阳
|
||||||
* @date 2025-10-10
|
* @date 2025-10-10
|
||||||
*/
|
*/
|
||||||
public interface BmsDevicesMapper
|
public interface BmsDevicesMapper extends BaseMapper<BmsDevices> {
|
||||||
{
|
|
||||||
/**
|
/**
|
||||||
* 查询BBOX管理
|
* 查询BBOX管理
|
||||||
*
|
*
|
||||||
|
|||||||
@ -58,4 +58,8 @@ public interface IBmsDevicesService
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteBmsDevicesById(String id);
|
public int deleteBmsDevicesById(String id);
|
||||||
|
|
||||||
|
BmsDevices selectBmsDevicesBySn(String deviceSn);
|
||||||
|
|
||||||
|
BmsDevices selectBmsDevicesList1(BmsDevices query);
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,9 +1,14 @@
|
|||||||
package com.evobms.project.system.service.impl;
|
package com.evobms.project.system.service.impl;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.evobms.common.utils.DateUtils;
|
import com.evobms.common.utils.DateUtils;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.evobms.project.system.mapper.BmsDevicesMapper;
|
import com.evobms.project.system.mapper.BmsDevicesMapper;
|
||||||
import com.evobms.project.system.domain.BmsDevices;
|
import com.evobms.project.system.domain.BmsDevices;
|
||||||
import com.evobms.project.system.service.IBmsDevicesService;
|
import com.evobms.project.system.service.IBmsDevicesService;
|
||||||
@ -15,7 +20,7 @@ import com.evobms.project.system.service.IBmsDevicesService;
|
|||||||
* @date 2025-10-10
|
* @date 2025-10-10
|
||||||
*/
|
*/
|
||||||
@Service
|
@Service
|
||||||
public class BmsDevicesServiceImpl implements IBmsDevicesService
|
public class BmsDevicesServiceImpl extends ServiceImpl<BmsDevicesMapper, BmsDevices> implements IBmsDevicesService
|
||||||
{
|
{
|
||||||
@Autowired
|
@Autowired
|
||||||
private BmsDevicesMapper bmsDevicesMapper;
|
private BmsDevicesMapper bmsDevicesMapper;
|
||||||
@ -41,7 +46,25 @@ public class BmsDevicesServiceImpl implements IBmsDevicesService
|
|||||||
@Override
|
@Override
|
||||||
public List<BmsDevices> selectBmsDevicesList(BmsDevices bmsDevices)
|
public List<BmsDevices> selectBmsDevicesList(BmsDevices bmsDevices)
|
||||||
{
|
{
|
||||||
return bmsDevicesMapper.selectBmsDevicesList(bmsDevices);
|
LambdaQueryWrapper<BmsDevices> qw = new LambdaQueryWrapper<>();
|
||||||
|
if (bmsDevices != null) {
|
||||||
|
if (bmsDevices.getDeviceId() != null && !bmsDevices.getDeviceId().isEmpty()) {
|
||||||
|
qw.eq(BmsDevices::getDeviceId, bmsDevices.getDeviceId());
|
||||||
|
}
|
||||||
|
Map<String, Object> params = bmsDevices.getParams();
|
||||||
|
if (params != null) {
|
||||||
|
Date begin = DateUtils.parseDate(params.get("beginTime"));
|
||||||
|
Date end = DateUtils.parseDate(params.get("endTime"));
|
||||||
|
if (begin != null) {
|
||||||
|
qw.and(w -> w.ge(BmsDevices::getUpdateTime, begin).or().ge(BmsDevices::getCreateTime, begin));
|
||||||
|
}
|
||||||
|
if (end != null) {
|
||||||
|
qw.and(w -> w.le(BmsDevices::getUpdateTime, end).or().le(BmsDevices::getCreateTime, end));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qw.orderByDesc(BmsDevices::getUpdateTime).orderByDesc(BmsDevices::getCreateTime);
|
||||||
|
return bmsDevicesMapper.selectList(qw);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -93,4 +116,22 @@ public class BmsDevicesServiceImpl implements IBmsDevicesService
|
|||||||
{
|
{
|
||||||
return bmsDevicesMapper.deleteBmsDevicesById(id);
|
return bmsDevicesMapper.deleteBmsDevicesById(id);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BmsDevices selectBmsDevicesBySn(String deviceSn) {
|
||||||
|
LambdaQueryWrapper<BmsDevices> bmslq = new LambdaQueryWrapper<>();
|
||||||
|
bmslq.eq(BmsDevices::getDeviceSn, deviceSn);
|
||||||
|
return baseMapper.selectOne(bmslq);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public BmsDevices selectBmsDevicesList1(BmsDevices bmsDevices) {
|
||||||
|
LambdaQueryWrapper<BmsDevices> eq = new LambdaQueryWrapper<>();
|
||||||
|
if (bmsDevices != null) {
|
||||||
|
eq.eq(BmsDevices::getDeviceSn, bmsDevices.getDeviceSn());
|
||||||
|
return baseMapper.selectOne(eq);
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -1,24 +1,30 @@
|
|||||||
package com.evobms.project.VehicleData.controller;
|
package com.evobms.project.vehicledata.controller;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
|
import com.evobms.framework.web.domain.R;
|
||||||
|
import com.evobms.project.vehicledata.domain.HomeDashboardDTO;
|
||||||
|
import org.apache.ibatis.annotations.Result;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
import org.springframework.web.bind.annotation.GetMapping;
|
import org.springframework.web.bind.annotation.GetMapping;
|
||||||
import org.springframework.web.bind.annotation.PathVariable;
|
import org.springframework.web.bind.annotation.PathVariable;
|
||||||
import org.springframework.web.bind.annotation.RequestParam;
|
import org.springframework.web.bind.annotation.RequestParam;
|
||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.evobms.project.VehicleData.service.IVehicleDataService;
|
import com.evobms.project.vehicledata.service.IVehicleDataService;
|
||||||
import com.evobms.project.VehicleData.service.IVehicleLocationService;
|
import com.evobms.project.vehicledata.service.IVehicleLocationService;
|
||||||
import com.evobms.project.VehicleData.domain.VehicleData;
|
import com.evobms.project.vehicledata.domain.VehicleData;
|
||||||
import com.evobms.project.VehicleData.domain.VehicleLocation;
|
import com.evobms.project.vehicledata.domain.VehicleLocation;
|
||||||
import com.evobms.project.VehicleData.dto.ChartDataPoint;
|
import com.evobms.project.vehicledata.dto.ChartDataPoint;
|
||||||
import com.evobms.project.Battery.service.ISubsystemVoltageService;
|
import com.evobms.project.battery.service.ISubsystemVoltageService;
|
||||||
import com.evobms.project.Battery.service.ISubsystemTemperatureService;
|
import com.evobms.project.battery.service.ISubsystemTemperatureService;
|
||||||
import com.evobms.project.Battery.domain.SubsystemVoltage;
|
import com.evobms.project.battery.domain.SubsystemVoltage;
|
||||||
import com.evobms.project.Battery.domain.SubsystemTemperature;
|
import com.evobms.project.battery.domain.SubsystemTemperature;
|
||||||
import com.evobms.project.Battery.service.IExtremeValuesService;
|
import com.evobms.project.battery.service.IExtremeValuesService;
|
||||||
import com.evobms.project.Battery.domain.ExtremeValues;
|
import com.evobms.project.battery.domain.ExtremeValues;
|
||||||
import java.text.ParseException;
|
import java.text.ParseException;
|
||||||
import java.text.SimpleDateFormat;
|
import java.text.SimpleDateFormat;
|
||||||
import io.swagger.annotations.Api;
|
import io.swagger.annotations.Api;
|
||||||
@ -80,10 +86,7 @@ public class BatteryChartController {
|
|||||||
// 位置轨迹:按时间范围返回位置列表,start/end 为毫秒时间戳,可选 limit 限制条数
|
// 位置轨迹:按时间范围返回位置列表,start/end 为毫秒时间戳,可选 limit 限制条数
|
||||||
@GetMapping("/vehicle-location/{deviceId}")
|
@GetMapping("/vehicle-location/{deviceId}")
|
||||||
@ApiOperation(value = "车辆位置轨迹", notes = "按时间范围返回位置列表")
|
@ApiOperation(value = "车辆位置轨迹", notes = "按时间范围返回位置列表")
|
||||||
public List<VehicleLocation> locationRange(@PathVariable("deviceId") String deviceId,
|
public List<VehicleLocation> locationRange(@PathVariable("deviceId") String deviceId, @RequestParam("start") long startMillis, @RequestParam("end") long endMillis, @RequestParam(value = "limit", required = false) Integer limit) {
|
||||||
@RequestParam("start") long startMillis,
|
|
||||||
@RequestParam("end") long endMillis,
|
|
||||||
@RequestParam(value = "limit", required = false) Integer limit) {
|
|
||||||
Date start = new Date(startMillis);
|
Date start = new Date(startMillis);
|
||||||
Date end = new Date(endMillis);
|
Date end = new Date(endMillis);
|
||||||
return vehicleLocationService.selectByDeviceAndRange(deviceId, start, end, limit);
|
return vehicleLocationService.selectByDeviceAndRange(deviceId, start, end, limit);
|
||||||
@ -122,4 +125,12 @@ public class BatteryChartController {
|
|||||||
}
|
}
|
||||||
return extremeValuesService.selectLatestByDeviceIdBefore(deviceId, beforeTime);
|
return extremeValuesService.selectLatestByDeviceIdBefore(deviceId, beforeTime);
|
||||||
}
|
}
|
||||||
|
@GetMapping("/api/dashboard/home")
|
||||||
|
@ApiOperation(value = "首页所有分布数据", notes = "返回指定设备极值数据,支持before筛选")
|
||||||
|
public R<HomeDashboardDTO> home(){
|
||||||
|
HomeDashboardDTO dto = vehicleDataService.getHomeDashboard();
|
||||||
|
return R.ok(dto);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.evobms.project.VehicleData.controller;
|
package com.evobms.project.vehicledata.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.evobms.framework.aspectj.lang.annotation.Log;
|
import com.evobms.framework.aspectj.lang.annotation.Log;
|
||||||
import com.evobms.framework.aspectj.lang.enums.BusinessType;
|
import com.evobms.framework.aspectj.lang.enums.BusinessType;
|
||||||
import com.evobms.project.VehicleData.domain.VehicleData;
|
import com.evobms.project.vehicledata.domain.VehicleData;
|
||||||
import com.evobms.project.VehicleData.service.IVehicleDataService;
|
import com.evobms.project.vehicledata.service.IVehicleDataService;
|
||||||
import com.evobms.framework.web.controller.BaseController;
|
import com.evobms.framework.web.controller.BaseController;
|
||||||
import com.evobms.framework.web.domain.AjaxResult;
|
import com.evobms.framework.web.domain.AjaxResult;
|
||||||
import com.evobms.common.utils.poi.ExcelUtil;
|
import com.evobms.common.utils.poi.ExcelUtil;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.evobms.project.VehicleData.controller;
|
package com.evobms.project.vehicledata.controller;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import javax.servlet.http.HttpServletResponse;
|
import javax.servlet.http.HttpServletResponse;
|
||||||
@ -14,8 +14,8 @@ import org.springframework.web.bind.annotation.RequestMapping;
|
|||||||
import org.springframework.web.bind.annotation.RestController;
|
import org.springframework.web.bind.annotation.RestController;
|
||||||
import com.evobms.framework.aspectj.lang.annotation.Log;
|
import com.evobms.framework.aspectj.lang.annotation.Log;
|
||||||
import com.evobms.framework.aspectj.lang.enums.BusinessType;
|
import com.evobms.framework.aspectj.lang.enums.BusinessType;
|
||||||
import com.evobms.project.VehicleData.domain.VehicleLocation;
|
import com.evobms.project.vehicledata.domain.VehicleLocation;
|
||||||
import com.evobms.project.VehicleData.service.IVehicleLocationService;
|
import com.evobms.project.vehicledata.service.IVehicleLocationService;
|
||||||
import com.evobms.framework.web.controller.BaseController;
|
import com.evobms.framework.web.controller.BaseController;
|
||||||
import com.evobms.framework.web.domain.AjaxResult;
|
import com.evobms.framework.web.domain.AjaxResult;
|
||||||
import com.evobms.common.utils.poi.ExcelUtil;
|
import com.evobms.common.utils.poi.ExcelUtil;
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package com.evobms.project.vehicledata.domain;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public class HomeDashboardDTO {
|
||||||
|
private Long deviceCount; // 设备总数
|
||||||
|
private Integer onlineCount; // 在线设备数
|
||||||
|
private Double avgSoc; // 平均 SOC
|
||||||
|
private Double maxTemp; // 当前最高温度
|
||||||
|
private Double maxVoltageDiff; // 最大单体压差
|
||||||
|
private Integer alarmCount; // 未恢复告警数
|
||||||
|
|
||||||
|
private Map<String, Integer> socDistribution; // SOC 分布
|
||||||
|
private Map<String, Integer> tempDistribution; // 温度分布
|
||||||
|
}
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.evobms.project.VehicleData.domain;
|
package com.evobms.project.vehicledata.domain;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.evobms.project.VehicleData.domain;
|
package com.evobms.project.vehicledata.domain;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
@ -32,8 +32,8 @@ public class VehicleLocation extends BaseEntity {
|
|||||||
/**
|
/**
|
||||||
* 数据时间戳
|
* 数据时间戳
|
||||||
*/
|
*/
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||||
@Excel(name = "数据时间戳", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "数据时间戳", width = 30, dateFormat = "yyyy-MM-dd HH:mm:ss")
|
||||||
private Date timestamp;
|
private Date timestamp;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -1,4 +1,4 @@
|
|||||||
package com.evobms.project.VehicleData.dto;
|
package com.evobms.project.vehicledata.dto;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
@ -8,7 +8,6 @@ public class ChartDataPoint {
|
|||||||
private double current;
|
private double current;
|
||||||
private int soc;
|
private int soc;
|
||||||
|
|
||||||
public ChartDataPoint() {}
|
|
||||||
|
|
||||||
public ChartDataPoint(Date timestamp, double voltage, double current, int soc) {
|
public ChartDataPoint(Date timestamp, double voltage, double current, int soc) {
|
||||||
this.timestamp = timestamp;
|
this.timestamp = timestamp;
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package com.evobms.project.VehicleData.mapper;
|
package com.evobms.project.vehicledata.mapper;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.evobms.project.VehicleData.domain.VehicleData;
|
import com.evobms.project.vehicledata.domain.VehicleData;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
|
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package com.evobms.project.VehicleData.mapper;
|
package com.evobms.project.vehicledata.mapper;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.evobms.project.VehicleData.domain.VehicleLocation;
|
import com.evobms.project.vehicledata.domain.VehicleLocation;
|
||||||
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
|
||||||
import org.apache.ibatis.annotations.Param;
|
import org.apache.ibatis.annotations.Param;
|
||||||
|
|
||||||
@ -1,8 +1,10 @@
|
|||||||
package com.evobms.project.VehicleData.service;
|
package com.evobms.project.vehicledata.service;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.evobms.project.VehicleData.domain.VehicleData;
|
|
||||||
|
import com.evobms.project.vehicledata.domain.HomeDashboardDTO;
|
||||||
|
import com.evobms.project.vehicledata.domain.VehicleData;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 整车数据Service接口
|
* 整车数据Service接口
|
||||||
@ -63,4 +65,6 @@ public interface IVehicleDataService
|
|||||||
List<VehicleData> selectByDeviceAndStartTime(String deviceId, Date startTime);
|
List<VehicleData> selectByDeviceAndStartTime(String deviceId, Date startTime);
|
||||||
|
|
||||||
VehicleData selectLatestByDeviceId(String deviceId);
|
VehicleData selectLatestByDeviceId(String deviceId);
|
||||||
|
|
||||||
|
HomeDashboardDTO getHomeDashboard();
|
||||||
}
|
}
|
||||||
@ -1,8 +1,8 @@
|
|||||||
package com.evobms.project.VehicleData.service;
|
package com.evobms.project.vehicledata.service;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import com.evobms.project.VehicleData.domain.VehicleLocation;
|
import com.evobms.project.vehicledata.domain.VehicleLocation;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 车辆位置数据Service接口
|
* 车辆位置数据Service接口
|
||||||
@ -61,6 +61,11 @@ public interface IVehicleLocationService
|
|||||||
public int deleteVehicleLocationById(Long id);
|
public int deleteVehicleLocationById(Long id);
|
||||||
|
|
||||||
VehicleLocation selectLatestByDeviceId(String deviceId);
|
VehicleLocation selectLatestByDeviceId(String deviceId);
|
||||||
|
/**
|
||||||
|
* 删除车辆位置数据信息
|
||||||
|
* 位置轨迹:按时间范围返回位置列表,start/end 为毫秒时间戳,可选 limit 限制条数
|
||||||
|
* @param deviceId
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
List<VehicleLocation> selectByDeviceAndRange(String deviceId, Date start, Date end, Integer limit);
|
List<VehicleLocation> selectByDeviceAndRange(String deviceId, Date start, Date end, Integer limit);
|
||||||
}
|
}
|
||||||
@ -0,0 +1,185 @@
|
|||||||
|
package com.evobms.project.vehicledata.service.impl;
|
||||||
|
|
||||||
|
import java.time.LocalDateTime;
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.evobms.common.utils.DateUtils;
|
||||||
|
import com.evobms.project.battery.mapper.ExtremeValuesMapper;
|
||||||
|
import com.evobms.project.system.domain.BmsDevices;
|
||||||
|
import com.evobms.project.system.mapper.BmsDevicesMapper;
|
||||||
|
import com.evobms.project.vehicledata.domain.HomeDashboardDTO;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.scheduling.annotation.Scheduled;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.evobms.project.vehicledata.mapper.VehicleDataMapper;
|
||||||
|
import com.evobms.project.vehicledata.domain.VehicleData;
|
||||||
|
import com.evobms.project.vehicledata.service.IVehicleDataService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 整车数据Service业务层处理
|
||||||
|
*
|
||||||
|
* @author 田志阳
|
||||||
|
* @date 2025-11-15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class VehicleDataServiceImpl extends ServiceImpl<VehicleDataMapper, VehicleData> implements IVehicleDataService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private VehicleDataMapper vehicleDataMapper;
|
||||||
|
@Autowired
|
||||||
|
private BmsDevicesMapper bmsDevicesMapper;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private ExtremeValuesMapper extremeValuesMapper;
|
||||||
|
/**
|
||||||
|
* 查询整车数据
|
||||||
|
*
|
||||||
|
* @param id 整车数据主键
|
||||||
|
* @return 整车数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public VehicleData selectVehicleDataById(Long id)
|
||||||
|
{
|
||||||
|
return vehicleDataMapper.selectVehicleDataById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询整车数据列表
|
||||||
|
*
|
||||||
|
* @param vehicleData 整车数据
|
||||||
|
* @return 整车数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<VehicleData> selectVehicleDataList(VehicleData vehicleData)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<VehicleData> qw = new LambdaQueryWrapper<>();
|
||||||
|
if (vehicleData != null) {
|
||||||
|
if (vehicleData.getDeviceId() != null && !vehicleData.getDeviceId().isEmpty()) {
|
||||||
|
qw.eq(VehicleData::getDeviceId, vehicleData.getDeviceId());
|
||||||
|
}
|
||||||
|
if (vehicleData.getTimestamp() != null) {
|
||||||
|
qw.ge(VehicleData::getTimestamp, vehicleData.getTimestamp());
|
||||||
|
}
|
||||||
|
Map<String, Object> params = vehicleData.getParams();
|
||||||
|
if (params != null) {
|
||||||
|
Date begin = DateUtils.parseDate(params.get("beginTime"));
|
||||||
|
Date end = DateUtils.parseDate(params.get("endTime"));
|
||||||
|
if (begin != null) {
|
||||||
|
qw.ge(VehicleData::getTimestamp, begin);
|
||||||
|
}
|
||||||
|
if (end != null) {
|
||||||
|
qw.le(VehicleData::getTimestamp, end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qw.orderByDesc(VehicleData::getTimestamp);
|
||||||
|
return vehicleDataMapper.selectList(qw);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增整车数据
|
||||||
|
*
|
||||||
|
* @param vehicleData 整车数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertVehicleData(VehicleData vehicleData)
|
||||||
|
{
|
||||||
|
return vehicleDataMapper.insertVehicleData(vehicleData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改整车数据
|
||||||
|
*
|
||||||
|
* @param vehicleData 整车数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateVehicleData(VehicleData vehicleData)
|
||||||
|
{
|
||||||
|
return vehicleDataMapper.updateVehicleData(vehicleData);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除整车数据
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的整车数据主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteVehicleDataByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return vehicleDataMapper.deleteVehicleDataByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除整车数据信息
|
||||||
|
*
|
||||||
|
* @param id 整车数据主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteVehicleDataById(Long id)
|
||||||
|
{
|
||||||
|
return vehicleDataMapper.deleteVehicleDataById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VehicleData> selectByDeviceAndStartTime(String deviceId, Date startTime) {
|
||||||
|
LambdaQueryWrapper<VehicleData> byTimestamp = new LambdaQueryWrapper<>();
|
||||||
|
byTimestamp.eq(VehicleData::getDeviceId, deviceId)
|
||||||
|
.ge(VehicleData::getTimestamp, startTime)
|
||||||
|
.orderByAsc(VehicleData::getTimestamp);
|
||||||
|
List<VehicleData> rows = vehicleDataMapper.selectList(byTimestamp);
|
||||||
|
if (rows == null || rows.isEmpty()) {
|
||||||
|
LambdaQueryWrapper<VehicleData> byCreateTime = new LambdaQueryWrapper<>();
|
||||||
|
byCreateTime.eq(VehicleData::getDeviceId, deviceId)
|
||||||
|
.ge(VehicleData::getCreateTime, startTime)
|
||||||
|
.orderByAsc(VehicleData::getCreateTime);
|
||||||
|
rows = vehicleDataMapper.selectList(byCreateTime);
|
||||||
|
}
|
||||||
|
return rows;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VehicleData selectLatestByDeviceId(String deviceId) {
|
||||||
|
LambdaQueryWrapper<VehicleData> byTimestamp = new LambdaQueryWrapper<>();
|
||||||
|
byTimestamp.eq(VehicleData::getDeviceId, deviceId)
|
||||||
|
.orderByDesc(VehicleData::getTimestamp)
|
||||||
|
.last("limit 1");
|
||||||
|
VehicleData latest = vehicleDataMapper.selectOne(byTimestamp);
|
||||||
|
if (latest == null) {
|
||||||
|
LambdaQueryWrapper<VehicleData> byCreateTime = new LambdaQueryWrapper<>();
|
||||||
|
byCreateTime.eq(VehicleData::getDeviceId, deviceId)
|
||||||
|
.orderByDesc(VehicleData::getCreateTime)
|
||||||
|
.last("limit 1");
|
||||||
|
latest = vehicleDataMapper.selectOne(byCreateTime);
|
||||||
|
}
|
||||||
|
return latest;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public HomeDashboardDTO getHomeDashboard() {
|
||||||
|
HomeDashboardDTO dto = new HomeDashboardDTO();
|
||||||
|
// 1️⃣ 设备总数
|
||||||
|
Long deviceCount = bmsDevicesMapper.selectCount(null);
|
||||||
|
dto.setDeviceCount(deviceCount);
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Scheduled(fixedDelay = 60000)
|
||||||
|
public void checkDeviceOffline() {
|
||||||
|
LocalDateTime threshold = LocalDateTime.now().minusMinutes(5);
|
||||||
|
bmsDevicesMapper.update(null, new UpdateWrapper<BmsDevices>()
|
||||||
|
.set("status", "offline")
|
||||||
|
.lt("last_online", threshold));
|
||||||
|
bmsDevicesMapper.update(null, new UpdateWrapper<BmsDevices>()
|
||||||
|
.set("status", "online")
|
||||||
|
.ge("last_online", threshold));
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,139 @@
|
|||||||
|
package com.evobms.project.vehicledata.service.impl;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||||
|
import com.evobms.project.vehicledata.mapper.VehicleLocationMapper;
|
||||||
|
import com.evobms.project.vehicledata.domain.VehicleLocation;
|
||||||
|
import com.evobms.project.vehicledata.service.IVehicleLocationService;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 车辆位置数据Service业务层处理
|
||||||
|
*
|
||||||
|
* @author ruoyi
|
||||||
|
* @date 2025-11-15
|
||||||
|
*/
|
||||||
|
@Service
|
||||||
|
public class VehicleLocationServiceImpl extends ServiceImpl<VehicleLocationMapper, VehicleLocation> implements IVehicleLocationService
|
||||||
|
{
|
||||||
|
@Autowired
|
||||||
|
private VehicleLocationMapper vehicleLocationMapper;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆位置数据
|
||||||
|
*
|
||||||
|
* @param id 车辆位置数据主键
|
||||||
|
* @return 车辆位置数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public VehicleLocation selectVehicleLocationById(Long id)
|
||||||
|
{
|
||||||
|
return vehicleLocationMapper.selectVehicleLocationById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询车辆位置数据列表
|
||||||
|
*
|
||||||
|
* @param vehicleLocation 车辆位置数据
|
||||||
|
* @return 车辆位置数据
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<VehicleLocation> selectVehicleLocationList(VehicleLocation vehicleLocation)
|
||||||
|
{
|
||||||
|
LambdaQueryWrapper<VehicleLocation> qw = new LambdaQueryWrapper<>();
|
||||||
|
if (vehicleLocation != null) {
|
||||||
|
if (vehicleLocation.getDeviceId() != null && !vehicleLocation.getDeviceId().isEmpty()) {
|
||||||
|
qw.eq(VehicleLocation::getDeviceId, vehicleLocation.getDeviceId());
|
||||||
|
}
|
||||||
|
if (vehicleLocation.getTimestamp() != null) {
|
||||||
|
qw.ge(VehicleLocation::getTimestamp, vehicleLocation.getTimestamp());
|
||||||
|
}
|
||||||
|
java.util.Map<String, Object> params = vehicleLocation.getParams();
|
||||||
|
if (params != null) {
|
||||||
|
java.util.Date begin = com.evobms.common.utils.DateUtils.parseDate(params.get("beginTime"));
|
||||||
|
java.util.Date end = com.evobms.common.utils.DateUtils.parseDate(params.get("endTime"));
|
||||||
|
if (begin != null) {
|
||||||
|
qw.ge(VehicleLocation::getTimestamp, begin);
|
||||||
|
}
|
||||||
|
if (end != null) {
|
||||||
|
qw.le(VehicleLocation::getTimestamp, end);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
qw.orderByDesc(VehicleLocation::getTimestamp);
|
||||||
|
return vehicleLocationMapper.selectList(qw);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 新增车辆位置数据
|
||||||
|
*
|
||||||
|
* @param vehicleLocation 车辆位置数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int insertVehicleLocation(VehicleLocation vehicleLocation)
|
||||||
|
{
|
||||||
|
return vehicleLocationMapper.insertVehicleLocation(vehicleLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 修改车辆位置数据
|
||||||
|
*
|
||||||
|
* @param vehicleLocation 车辆位置数据
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int updateVehicleLocation(VehicleLocation vehicleLocation)
|
||||||
|
{
|
||||||
|
return vehicleLocationMapper.updateVehicleLocation(vehicleLocation);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 批量删除车辆位置数据
|
||||||
|
*
|
||||||
|
* @param ids 需要删除的车辆位置数据主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteVehicleLocationByIds(Long[] ids)
|
||||||
|
{
|
||||||
|
return vehicleLocationMapper.deleteVehicleLocationByIds(ids);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除车辆位置数据信息
|
||||||
|
*
|
||||||
|
* @param id 车辆位置数据主键
|
||||||
|
* @return 结果
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public int deleteVehicleLocationById(Long id)
|
||||||
|
{
|
||||||
|
return vehicleLocationMapper.deleteVehicleLocationById(id);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public VehicleLocation selectLatestByDeviceId(String deviceId) {
|
||||||
|
LambdaQueryWrapper<VehicleLocation> qw = new LambdaQueryWrapper<>();
|
||||||
|
qw.eq(VehicleLocation::getDeviceId, deviceId)
|
||||||
|
.orderByDesc(VehicleLocation::getTimestamp)
|
||||||
|
.last("limit 1");
|
||||||
|
return vehicleLocationMapper.selectOne(qw);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<VehicleLocation> selectByDeviceAndRange(String deviceId, Date start, Date end, Integer limit) {
|
||||||
|
LambdaQueryWrapper<VehicleLocation> qw = new LambdaQueryWrapper<>();
|
||||||
|
qw.eq(VehicleLocation::getDeviceId, deviceId)
|
||||||
|
.ge(VehicleLocation::getTimestamp, start)
|
||||||
|
.le(VehicleLocation::getTimestamp, end)
|
||||||
|
.orderByAsc(VehicleLocation::getTimestamp);
|
||||||
|
if (limit != null && limit > 0) {
|
||||||
|
qw.last("limit " + limit);
|
||||||
|
}
|
||||||
|
return vehicleLocationMapper.selectList(qw);
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -16,7 +16,7 @@ ruoyi:
|
|||||||
# 开发环境配置
|
# 开发环境配置
|
||||||
server:
|
server:
|
||||||
# 服务器HTTP端口,支持环境变量覆盖:SERVER_PORT,默认8080
|
# 服务器HTTP端口,支持环境变量覆盖:SERVER_PORT,默认8080
|
||||||
port: ${SERVER_PORT:8081}
|
port: ${SERVER_PORT:8080}
|
||||||
servlet:
|
servlet:
|
||||||
# 应用的访问路径
|
# 应用的访问路径
|
||||||
context-path: /
|
context-path: /
|
||||||
@ -154,7 +154,7 @@ swagger:
|
|||||||
# 是否开启swagger
|
# 是否开启swagger
|
||||||
enabled: true
|
enabled: true
|
||||||
# 请求前缀
|
# 请求前缀
|
||||||
pathMapping: /dev-api
|
pathMapping: /prod-api
|
||||||
|
|
||||||
# 防盗链配置
|
# 防盗链配置
|
||||||
referer:
|
referer:
|
||||||
@ -175,7 +175,7 @@ xss:
|
|||||||
# 代码生成
|
# 代码生成
|
||||||
gen:
|
gen:
|
||||||
# 作者
|
# 作者
|
||||||
author: ruoyi
|
author: tzy
|
||||||
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
|
# 默认生成包路径 system 需改成自己的模块名称 如 system monitor tool
|
||||||
packageName: com.evobms.project.system
|
packageName: com.evobms.project.system
|
||||||
# 自动去除表前缀,默认是true
|
# 自动去除表前缀,默认是true
|
||||||
@ -190,13 +190,13 @@ mqtt:
|
|||||||
# 是否启用MQTT功能(设置为false可在没有MQTT服务器时正常启动)
|
# 是否启用MQTT功能(设置为false可在没有MQTT服务器时正常启动)
|
||||||
enabled: true
|
enabled: true
|
||||||
# MQTT服务器地址
|
# MQTT服务器地址
|
||||||
host: tcp://61.182.73.218:1883
|
host: ${MQTT_HOST_URI:tcp://61.182.73.218:1883}
|
||||||
# 客户端ID
|
# 客户端ID(避免冲突,随机后缀)
|
||||||
clientId: evobms-client
|
clientId: evobms-client-${random.int}
|
||||||
# 用户名
|
# 用户名(如需认证请填写)
|
||||||
username:
|
username: ${MQTT_USERNAME:00000001}
|
||||||
# 密码
|
# 密码(如需认证请填写)
|
||||||
password:
|
password: ${MQTT_PASSWORD:741a03a10f3de6b2}
|
||||||
# 连接超时时间(秒)
|
# 连接超时时间(秒)
|
||||||
connectionTimeout: 30
|
connectionTimeout: 30
|
||||||
# 心跳间隔(秒)
|
# 心跳间隔(秒)
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.evobms.project.Battery.mapper.ChargeDischargeSummaryMapper">
|
<mapper namespace="com.evobms.project.battery.mapper.ChargeDischargeSummaryMapper">
|
||||||
|
|
||||||
<resultMap type="ChargeDischargeSummary" id="ChargeDischargeSummaryResult">
|
<resultMap type="ChargeDischargeSummary" id="ChargeDischargeSummaryResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.evobms.project.Battery.mapper.ExtremeValuesMapper">
|
<mapper namespace="com.evobms.project.battery.mapper.ExtremeValuesMapper">
|
||||||
|
|
||||||
<resultMap type="ExtremeValues" id="ExtremeValuesResult">
|
<resultMap type="ExtremeValues" id="ExtremeValuesResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
@ -1,66 +0,0 @@
|
|||||||
<?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.evobms.project.bms.mapper.BmsDeviceMapper">
|
|
||||||
|
|
||||||
<resultMap type="BmsDevice" id="BmsDeviceResult">
|
|
||||||
<result property="deviceId" column="device_id" />
|
|
||||||
<result property="deviceCode" column="device_code" />
|
|
||||||
<result property="deviceName" column="device_name" />
|
|
||||||
<result property="deviceType" column="device_type" />
|
|
||||||
<result property="status" column="status" />
|
|
||||||
<result property="batteryCapacity" column="battery_capacity" />
|
|
||||||
<result property="ratedVoltage" column="rated_voltage" />
|
|
||||||
<result property="currentVoltage" column="current_voltage" />
|
|
||||||
<result property="currentCurrent" column="current_current" />
|
|
||||||
<result property="remainingCapacity" column="remaining_capacity" />
|
|
||||||
<result property="temperature" column="temperature" />
|
|
||||||
<result property="lastCommTime" column="last_comm_time" />
|
|
||||||
<result property="delFlag" column="del_flag" />
|
|
||||||
<result property="version" column="version" />
|
|
||||||
<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" />
|
|
||||||
</resultMap>
|
|
||||||
|
|
||||||
<sql id="selectBmsDeviceVo">
|
|
||||||
select device_id, device_code, device_name, device_type, status, battery_capacity,
|
|
||||||
rated_voltage, current_voltage, current_current, remaining_capacity, temperature,
|
|
||||||
last_comm_time, del_flag, version, create_by, create_time, update_by, update_time, remark
|
|
||||||
from bms_device
|
|
||||||
</sql>
|
|
||||||
|
|
||||||
<select id="selectBmsDeviceList" parameterType="BmsDevice" resultMap="BmsDeviceResult">
|
|
||||||
<include refid="selectBmsDeviceVo"/>
|
|
||||||
<where>
|
|
||||||
<if test="deviceCode != null and deviceCode != ''"> and device_code like concat('%', #{deviceCode}, '%')</if>
|
|
||||||
<if test="deviceName != null and deviceName != ''"> and device_name like concat('%', #{deviceName}, '%')</if>
|
|
||||||
<if test="deviceType != null and deviceType != ''"> and device_type = #{deviceType}</if>
|
|
||||||
<if test="status != null and status != ''"> and status = #{status}</if>
|
|
||||||
<if test="batteryCapacity != null "> and battery_capacity = #{batteryCapacity}</if>
|
|
||||||
<if test="ratedVoltage != null "> and rated_voltage = #{ratedVoltage}</if>
|
|
||||||
<if test="currentVoltage != null "> and current_voltage = #{currentVoltage}</if>
|
|
||||||
<if test="currentCurrent != null "> and current_current = #{currentCurrent}</if>
|
|
||||||
<if test="remainingCapacity != null "> and remaining_capacity = #{remainingCapacity}</if>
|
|
||||||
<if test="temperature != null "> and temperature = #{temperature}</if>
|
|
||||||
<if test="lastCommTime != null "> and last_comm_time = #{lastCommTime}</if>
|
|
||||||
</where>
|
|
||||||
order by device_id desc
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<select id="selectBmsDeviceByCode" parameterType="String" resultMap="BmsDeviceResult">
|
|
||||||
<include refid="selectBmsDeviceVo"/>
|
|
||||||
where device_code = #{deviceCode} and del_flag = '0'
|
|
||||||
</select>
|
|
||||||
|
|
||||||
<update id="updateBmsDeviceStatus">
|
|
||||||
update bms_device set status = #{status} where device_id in
|
|
||||||
<foreach item="deviceId" collection="deviceIds" open="(" separator="," close=")">
|
|
||||||
#{deviceId}
|
|
||||||
</foreach>
|
|
||||||
</update>
|
|
||||||
|
|
||||||
</mapper>
|
|
||||||
@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.evobms.project.VehicleData.mapper.VehicleLocationMapper">
|
<mapper namespace="com.evobms.project.vehicledata.mapper.VehicleLocationMapper">
|
||||||
|
|
||||||
<resultMap type="VehicleLocation" id="VehicleLocationResult">
|
<resultMap type="VehicleLocation" id="VehicleLocationResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
|
|||||||
@ -0,0 +1,87 @@
|
|||||||
|
<?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.evobms.project.summary.mapper.ChargeDischargeSummaryMapper">
|
||||||
|
|
||||||
|
<resultMap type="ChargeDischargeSummary" id="ChargeDischargeSummaryResult">
|
||||||
|
<result property="id" column="id" />
|
||||||
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="timestamp" column="timestamp" />
|
||||||
|
<result property="dischargeKwh" column="discharge_kwh" />
|
||||||
|
<result property="chargeKwh" column="charge_kwh" />
|
||||||
|
<result property="createTime" column="create_time" />
|
||||||
|
<result property="updateTime" column="update_time" />
|
||||||
|
<result property="createBy" column="create_by" />
|
||||||
|
<result property="updateBy" column="update_by" />
|
||||||
|
</resultMap>
|
||||||
|
|
||||||
|
<sql id="selectChargeDischargeSummaryVo">
|
||||||
|
select id, device_id, timestamp, discharge_kwh, charge_kwh, create_time, update_time, create_by, update_by from charge_discharge_summary
|
||||||
|
</sql>
|
||||||
|
|
||||||
|
<select id="selectChargeDischargeSummaryList" parameterType="ChargeDischargeSummary" resultMap="ChargeDischargeSummaryResult">
|
||||||
|
<include refid="selectChargeDischargeSummaryVo"/>
|
||||||
|
<where>
|
||||||
|
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
|
||||||
|
<if test="timestamp != null "> and timestamp = #{timestamp}</if>
|
||||||
|
<if test="dischargeKwh != null "> and discharge_kwh = #{dischargeKwh}</if>
|
||||||
|
<if test="chargeKwh != null "> and charge_kwh = #{chargeKwh}</if>
|
||||||
|
</where>
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="selectChargeDischargeSummaryById" parameterType="Long" resultMap="ChargeDischargeSummaryResult">
|
||||||
|
<include refid="selectChargeDischargeSummaryVo"/>
|
||||||
|
where id = #{id}
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<insert id="insertChargeDischargeSummary" parameterType="ChargeDischargeSummary" useGeneratedKeys="true" keyProperty="id">
|
||||||
|
insert into charge_discharge_summary
|
||||||
|
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="deviceId != null and deviceId != ''">device_id,</if>
|
||||||
|
<if test="timestamp != null">timestamp,</if>
|
||||||
|
<if test="dischargeKwh != null">discharge_kwh,</if>
|
||||||
|
<if test="chargeKwh != null">charge_kwh,</if>
|
||||||
|
<if test="createTime != null">create_time,</if>
|
||||||
|
<if test="updateTime != null">update_time,</if>
|
||||||
|
<if test="createBy != null">create_by,</if>
|
||||||
|
<if test="updateBy != null">update_by,</if>
|
||||||
|
</trim>
|
||||||
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
|
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
|
||||||
|
<if test="timestamp != null">#{timestamp},</if>
|
||||||
|
<if test="dischargeKwh != null">#{dischargeKwh},</if>
|
||||||
|
<if test="chargeKwh != null">#{chargeKwh},</if>
|
||||||
|
<if test="createTime != null">#{createTime},</if>
|
||||||
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
|
<if test="createBy != null">#{createBy},</if>
|
||||||
|
<if test="updateBy != null">#{updateBy},</if>
|
||||||
|
</trim>
|
||||||
|
</insert>
|
||||||
|
|
||||||
|
<update id="updateChargeDischargeSummary" parameterType="ChargeDischargeSummary">
|
||||||
|
update charge_discharge_summary
|
||||||
|
<trim prefix="SET" suffixOverrides=",">
|
||||||
|
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
|
||||||
|
<if test="timestamp != null">timestamp = #{timestamp},</if>
|
||||||
|
<if test="dischargeKwh != null">discharge_kwh = #{dischargeKwh},</if>
|
||||||
|
<if test="chargeKwh != null">charge_kwh = #{chargeKwh},</if>
|
||||||
|
<if test="createTime != null">create_time = #{createTime},</if>
|
||||||
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
|
<if test="createBy != null">create_by = #{createBy},</if>
|
||||||
|
<if test="updateBy != null">update_by = #{updateBy},</if>
|
||||||
|
</trim>
|
||||||
|
where id = #{id}
|
||||||
|
</update>
|
||||||
|
|
||||||
|
<delete id="deleteChargeDischargeSummaryById" parameterType="Long">
|
||||||
|
delete from charge_discharge_summary where id = #{id}
|
||||||
|
</delete>
|
||||||
|
|
||||||
|
<delete id="deleteChargeDischargeSummaryByIds" parameterType="String">
|
||||||
|
delete from charge_discharge_summary where id in
|
||||||
|
<foreach item="id" collection="array" open="(" separator="," close=")">
|
||||||
|
#{id}
|
||||||
|
</foreach>
|
||||||
|
</delete>
|
||||||
|
</mapper>
|
||||||
@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.evobms.project.Battery.mapper.SubsystemTemperatureMapper">
|
<mapper namespace="com.evobms.project.battery.mapper.SubsystemTemperatureMapper">
|
||||||
|
|
||||||
<resultMap type="SubsystemTemperature" id="SubsystemTemperatureResult">
|
<resultMap type="SubsystemTemperature" id="SubsystemTemperatureResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
|
|||||||
@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.evobms.project.VehicleData.mapper.VehicleDataMapper">
|
<mapper namespace="com.evobms.project.vehicledata.mapper.VehicleDataMapper">
|
||||||
|
|
||||||
<resultMap type="VehicleData" id="VehicleDataResult">
|
<resultMap type="VehicleData" id="VehicleDataResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
@ -2,7 +2,7 @@
|
|||||||
<!DOCTYPE mapper
|
<!DOCTYPE mapper
|
||||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||||
<mapper namespace="com.evobms.project.Battery.mapper.SubsystemVoltageMapper">
|
<mapper namespace="com.evobms.project.battery.mapper.SubsystemVoltageMapper">
|
||||||
|
|
||||||
<resultMap type="SubsystemVoltage" id="SubsystemVoltageResult">
|
<resultMap type="SubsystemVoltage" id="SubsystemVoltageResult">
|
||||||
<result property="id" column="id" />
|
<result property="id" column="id" />
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user