Merge remote-tracking branch 'origin/dev' into dev
This commit is contained in:
@ -2,6 +2,7 @@ package com.xzzn.web.controller.ems;
|
|||||||
|
|
||||||
import com.xzzn.common.core.controller.BaseController;
|
import com.xzzn.common.core.controller.BaseController;
|
||||||
import com.xzzn.common.core.domain.AjaxResult;
|
import com.xzzn.common.core.domain.AjaxResult;
|
||||||
|
import com.xzzn.ems.service.IEmsSiteService;
|
||||||
import com.xzzn.ems.service.ISingleSiteService;
|
import com.xzzn.ems.service.ISingleSiteService;
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
import org.springframework.web.bind.annotation.*;
|
import org.springframework.web.bind.annotation.*;
|
||||||
@ -17,6 +18,8 @@ public class EmsSiteMonitorController extends BaseController{
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private ISingleSiteService iSingleSiteService;
|
private ISingleSiteService iSingleSiteService;
|
||||||
|
@Autowired
|
||||||
|
private IEmsSiteService iEmsSiteService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取单站首页数据
|
* 获取单站首页数据
|
||||||
@ -78,16 +81,16 @@ public class EmsSiteMonitorController extends BaseController{
|
|||||||
@GetMapping("/getStackNameList")
|
@GetMapping("/getStackNameList")
|
||||||
public AjaxResult getStackNameList(@RequestParam Long siteId)
|
public AjaxResult getStackNameList(@RequestParam Long siteId)
|
||||||
{
|
{
|
||||||
return success(iSingleSiteService.getBMSBatteryCluster(siteId));
|
return success(iEmsSiteService.getAllStackInfo(siteId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取所有电池簇
|
* 获取所有电池簇
|
||||||
*/
|
*/
|
||||||
@GetMapping("/getClusterNameList")
|
@GetMapping("/getClusterNameList")
|
||||||
public AjaxResult getClusterNameList(@RequestParam Long siteId)
|
public AjaxResult getClusterNameList(@RequestParam Long stackDeviceId)
|
||||||
{
|
{
|
||||||
return success(iSingleSiteService.getBMSBatteryCluster(siteId));
|
return success(iEmsSiteService.getAllClusterInfo(stackDeviceId));
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -98,4 +101,13 @@ public class EmsSiteMonitorController extends BaseController{
|
|||||||
{
|
{
|
||||||
return success(iSingleSiteService.getCoolingDataList(siteId));
|
return success(iSingleSiteService.getCoolingDataList(siteId));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取电池簇下面的单体电池数据
|
||||||
|
*/
|
||||||
|
@GetMapping("/getClusterDataInfoList")
|
||||||
|
public AjaxResult getClusterDataInfoList(@RequestParam Long clusterDeviceId)
|
||||||
|
{
|
||||||
|
return success(iEmsSiteService.getClusterDataInfoList(clusterDeviceId));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -0,0 +1,61 @@
|
|||||||
|
package com.xzzn.ems.domain.vo;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单站监控-单体电池数据
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BatteryDataStatsListVo {
|
||||||
|
/**
|
||||||
|
* 电压List
|
||||||
|
*/
|
||||||
|
private List<BatteryDataStatsTemplate> voltageDataList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 温度List
|
||||||
|
*/
|
||||||
|
private List<BatteryDataStatsTemplate> tempDataList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SOCList
|
||||||
|
*/
|
||||||
|
private List<BatteryDataStatsTemplate> socDataList;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* SOHList
|
||||||
|
*/
|
||||||
|
private List<BatteryDataStatsTemplate> sohDataList;
|
||||||
|
|
||||||
|
public List<BatteryDataStatsTemplate> getVoltageDataList() {
|
||||||
|
return voltageDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setVoltageDataList(List<BatteryDataStatsTemplate> voltageDataList) {
|
||||||
|
this.voltageDataList = voltageDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BatteryDataStatsTemplate> getTempDataList() {
|
||||||
|
return tempDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTempDataList(List<BatteryDataStatsTemplate> tempDataList) {
|
||||||
|
this.tempDataList = tempDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BatteryDataStatsTemplate> getSocDataList() {
|
||||||
|
return socDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSocDataList(List<BatteryDataStatsTemplate> socDataList) {
|
||||||
|
this.socDataList = socDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public List<BatteryDataStatsTemplate> getSohDataList() {
|
||||||
|
return sohDataList;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSohDataList(List<BatteryDataStatsTemplate> sohDataList) {
|
||||||
|
this.sohDataList = sohDataList;
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,48 @@
|
|||||||
|
package com.xzzn.ems.domain.vo;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 单体电池-数据统计模板
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
public class BatteryDataStatsTemplate {
|
||||||
|
/**
|
||||||
|
* 月份
|
||||||
|
*/
|
||||||
|
private String dataMonth;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据一
|
||||||
|
*/
|
||||||
|
private BigDecimal dataOne;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据二
|
||||||
|
*/
|
||||||
|
private BigDecimal dataTwo;
|
||||||
|
|
||||||
|
public String getDataMonth() {
|
||||||
|
return dataMonth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataMonth(String dataMonth) {
|
||||||
|
this.dataMonth = dataMonth;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getDataOne() {
|
||||||
|
return dataOne;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataOne(BigDecimal dataOne) {
|
||||||
|
this.dataOne = dataOne;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BigDecimal getDataTwo() {
|
||||||
|
return dataTwo;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setDataTwo(BigDecimal dataTwo) {
|
||||||
|
this.dataTwo = dataTwo;
|
||||||
|
}
|
||||||
|
}
|
@ -1,6 +1,8 @@
|
|||||||
package com.xzzn.ems.mapper;
|
package com.xzzn.ems.mapper;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
import com.xzzn.ems.domain.EmsDevicesSetting;
|
import com.xzzn.ems.domain.EmsDevicesSetting;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -58,4 +60,18 @@ public interface EmsDevicesSettingMapper
|
|||||||
* @return 结果
|
* @return 结果
|
||||||
*/
|
*/
|
||||||
public int deleteEmsDevicesSettingByIds(Long[] ids);
|
public int deleteEmsDevicesSettingByIds(Long[] ids);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据site_id获取所有电池堆
|
||||||
|
* @param siteId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getAllStackInfoBySiteId(Long siteId);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据电池堆id获取所有电池簇
|
||||||
|
* @param stackDeviceId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public List<Map<String, Object>> getAllClusterInfoByStackId(Long stackDeviceId);
|
||||||
}
|
}
|
||||||
|
@ -1,9 +1,11 @@
|
|||||||
package com.xzzn.ems.service;
|
package com.xzzn.ems.service;
|
||||||
|
|
||||||
import com.xzzn.ems.domain.EmsSiteSetting;
|
import com.xzzn.ems.domain.EmsSiteSetting;
|
||||||
|
import com.xzzn.ems.domain.vo.BatteryDataStatsListVo;
|
||||||
import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
|
import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 站点信息 服务层
|
* 站点信息 服务层
|
||||||
@ -16,4 +18,10 @@ public interface IEmsSiteService
|
|||||||
|
|
||||||
|
|
||||||
public SiteTotalInfoVo getSiteTotalInfo();
|
public SiteTotalInfoVo getSiteTotalInfo();
|
||||||
|
|
||||||
|
public List<Map<String,Object>> getAllStackInfo(Long siteId);
|
||||||
|
|
||||||
|
public List<Map<String,Object>> getAllClusterInfo(Long stackDeviceId);
|
||||||
|
|
||||||
|
public BatteryDataStatsListVo getClusterDataInfoList(Long clusterDeviceId);
|
||||||
}
|
}
|
||||||
|
@ -1,13 +1,16 @@
|
|||||||
package com.xzzn.ems.service.impl;
|
package com.xzzn.ems.service.impl;
|
||||||
|
|
||||||
import com.xzzn.ems.domain.EmsSiteSetting;
|
import com.xzzn.ems.domain.EmsSiteSetting;
|
||||||
|
import com.xzzn.ems.domain.vo.BatteryDataStatsListVo;
|
||||||
import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
|
import com.xzzn.ems.domain.vo.SiteTotalInfoVo;
|
||||||
|
import com.xzzn.ems.mapper.EmsDevicesSettingMapper;
|
||||||
import com.xzzn.ems.mapper.EmsSiteSettingMapper;
|
import com.xzzn.ems.mapper.EmsSiteSettingMapper;
|
||||||
import com.xzzn.ems.service.IEmsSiteService;
|
import com.xzzn.ems.service.IEmsSiteService;
|
||||||
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 java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 站点信息 服务层实现
|
* 站点信息 服务层实现
|
||||||
@ -19,6 +22,8 @@ public class EmsSiteServiceImpl implements IEmsSiteService
|
|||||||
|
|
||||||
@Autowired
|
@Autowired
|
||||||
private EmsSiteSettingMapper emsSiteMapper;
|
private EmsSiteSettingMapper emsSiteMapper;
|
||||||
|
@Autowired
|
||||||
|
private EmsDevicesSettingMapper emsDevicesMapper;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public List<EmsSiteSetting> getAllSites() {
|
public List<EmsSiteSetting> getAllSites() {
|
||||||
@ -30,4 +35,28 @@ public class EmsSiteServiceImpl implements IEmsSiteService
|
|||||||
return emsSiteMapper.getSiteTotalInfo();
|
return emsSiteMapper.getSiteTotalInfo();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据site_id获取所有电池堆
|
||||||
|
* @param siteId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getAllStackInfo(Long siteId) {
|
||||||
|
return emsDevicesMapper.getAllStackInfoBySiteId(siteId);
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<Map<String, Object>> getAllClusterInfo(Long stackDeviceId) {
|
||||||
|
return emsDevicesMapper.getAllClusterInfoByStackId(stackDeviceId);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 根据电池堆获取单体柱状数据
|
||||||
|
* @param clusterDeviceId
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public BatteryDataStatsListVo getClusterDataInfoList(Long clusterDeviceId) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -157,4 +157,16 @@
|
|||||||
and t.device_id = tmp.device_id)
|
and t.device_id = tmp.device_id)
|
||||||
order by tmp.device_id
|
order by tmp.device_id
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getBmsBatteryData" resultType="com.xzzn.ems.domain.vo.BMSBatteryDataList">
|
||||||
|
select t.cluster_voltage as clusterVoltage,t.cluster_current as clusterCurrent,
|
||||||
|
t.current_soc as currentSoc,MAX(tb.voltage) as maxVoltage,MIN(tb.voltage) as minVoltage,
|
||||||
|
MAX(tb.temperature) as maxTemperature,MIN(tb.temperature) as minTemperature,
|
||||||
|
tb.site_id as siteId,tb.cluster_device_id as clusterId,tb.device_id as stackDeviceId
|
||||||
|
from ems_battery_cluster t left join ems_battery_data tb on t.device_id = tb.cluster_device_id
|
||||||
|
where t.site_id = #{siteId} and t.stack_device_id = #{stackDeviceId}
|
||||||
|
and t.update_time = (select MAX(update_time) FROM ems_battery_cluster where site_id = t.site_id
|
||||||
|
and device_id = t.device_id and stack_device_id = t.stack_device_id)
|
||||||
|
group by t.cluster_voltage,t.cluster_current,t.current_soc,tb.site_id,tb.cluster_device_id,tb.device_id
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -21,10 +21,11 @@
|
|||||||
<result property="remark" column="remark" />
|
<result property="remark" column="remark" />
|
||||||
<result property="siteId" column="site_id" />
|
<result property="siteId" column="site_id" />
|
||||||
<result property="deviceId" column="device_id" />
|
<result property="deviceId" column="device_id" />
|
||||||
|
<result property="clusterDeviceId" column="cluster_device_id" />
|
||||||
</resultMap>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEmsBatteryDataVo">
|
<sql id="selectEmsBatteryDataVo">
|
||||||
select id, battery_pack, battery_cluster, battery_cell_id, voltage, temperature, soc, soh, data_timestamp, create_by, create_time, update_by, update_time, remark, site_id, device_id from ems_battery_data
|
select id, battery_pack, battery_cluster, battery_cell_id, voltage, temperature, soc, soh, data_timestamp, create_by, create_time, update_by, update_time, remark, site_id, device_id, cluster_device_id from ems_battery_data
|
||||||
</sql>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEmsBatteryDataList" parameterType="EmsBatteryData" resultMap="EmsBatteryDataResult">
|
<select id="selectEmsBatteryDataList" parameterType="EmsBatteryData" resultMap="EmsBatteryDataResult">
|
||||||
@ -40,6 +41,7 @@
|
|||||||
<if test="dataTimestamp != null "> and data_timestamp = #{dataTimestamp}</if>
|
<if test="dataTimestamp != null "> and data_timestamp = #{dataTimestamp}</if>
|
||||||
<if test="siteId != null "> and site_id = #{siteId}</if>
|
<if test="siteId != null "> and site_id = #{siteId}</if>
|
||||||
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
<if test="deviceId != null "> and device_id = #{deviceId}</if>
|
||||||
|
<if test="clusterDeviceId != null "> and cluster_device_id = #{clusterDeviceId}</if>
|
||||||
</where>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -66,6 +68,7 @@
|
|||||||
<if test="remark != null">remark,</if>
|
<if test="remark != null">remark,</if>
|
||||||
<if test="siteId != null">site_id,</if>
|
<if test="siteId != null">site_id,</if>
|
||||||
<if test="deviceId != null">device_id,</if>
|
<if test="deviceId != null">device_id,</if>
|
||||||
|
<if test="clusterDeviceId != null">cluster_device_id,</if>
|
||||||
</trim>
|
</trim>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="batteryPack != null">#{batteryPack},</if>
|
<if test="batteryPack != null">#{batteryPack},</if>
|
||||||
@ -83,6 +86,7 @@
|
|||||||
<if test="remark != null">#{remark},</if>
|
<if test="remark != null">#{remark},</if>
|
||||||
<if test="siteId != null">#{siteId},</if>
|
<if test="siteId != null">#{siteId},</if>
|
||||||
<if test="deviceId != null">#{deviceId},</if>
|
<if test="deviceId != null">#{deviceId},</if>
|
||||||
|
<if test="clusterDeviceId != null">#{clusterDeviceId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -104,6 +108,7 @@
|
|||||||
<if test="remark != null">remark = #{remark},</if>
|
<if test="remark != null">remark = #{remark},</if>
|
||||||
<if test="siteId != null">site_id = #{siteId},</if>
|
<if test="siteId != null">site_id = #{siteId},</if>
|
||||||
<if test="deviceId != null">device_id = #{deviceId},</if>
|
<if test="deviceId != null">device_id = #{deviceId},</if>
|
||||||
|
<if test="clusterDeviceId != null">cluster_device_id = #{clusterDeviceId},</if>
|
||||||
</trim>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
@ -124,4 +129,51 @@
|
|||||||
where site_id = #{siteId}
|
where site_id = #{siteId}
|
||||||
and DATE(data_timestamp) = DATE(NOW())
|
and DATE(data_timestamp) = DATE(NOW())
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
|
<select id="getBatteryDataByClusterId" resultType="com.xzzn.ems.domain.vo.BatteryClusterDataDetailVo">
|
||||||
|
select t.site_id as siteId,t.cluster_device_id as clusterId,
|
||||||
|
AVG(t.voltage) as avgVoltage,MAX(t.voltage) as maxVoltage,MIN(t.voltage) as minVoltage,
|
||||||
|
AVG(t.temperature) as avgTemp,MAX(t.temperature) as maxTemp,MIN(t.temperature) as minTemp,
|
||||||
|
AVG(t.soc) as avgSoc,MAX(t.soc) as maxSoc,MIN(t.soc) as minSoc
|
||||||
|
from ems_battery_data t
|
||||||
|
where t.site_id = #{siteId}
|
||||||
|
and t.cluster_device_id = #{clusterDeviceId}
|
||||||
|
and t.update_time = (select MAX(update_time) FROM ems_battery_data where site_id = t.site_id
|
||||||
|
and device_id = t.device_id and cluster_device_id = t.cluster_device_id)
|
||||||
|
group by t.site_id,t.cluster_device_id
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getDataIdsMap" parameterType="com.xzzn.ems.domain.vo.BatteryClusterDataDetailVo" resultType="java.util.Map">
|
||||||
|
<if test="maxVoltage != null">
|
||||||
|
select 'maxVoltageId' as type, t.device_id from ems_battery_data t
|
||||||
|
where t.site_id = #{siteId} and t.cluster_device_id = #{clusterId} and t.voltage = #{maxVoltage}
|
||||||
|
union all
|
||||||
|
</if>
|
||||||
|
<if test="minVoltage != null">
|
||||||
|
select 'minVoltageId' as type, t.device_id from ems_battery_data t
|
||||||
|
where t.site_id = #{siteId} and t.cluster_device_id = #{clusterId} and t.voltage = #{minVoltage}
|
||||||
|
union all
|
||||||
|
</if>
|
||||||
|
<if test="maxTemp != null">
|
||||||
|
select 'maxTempId' as type, t.device_id from ems_battery_data t
|
||||||
|
where t.site_id = #{siteId} and t.cluster_device_id = #{clusterId} and t.temperature = #{maxTemp}
|
||||||
|
union all
|
||||||
|
</if>
|
||||||
|
<if test="minTemp != null">
|
||||||
|
select 'minTempId' as type, t.device_id from ems_battery_data t
|
||||||
|
where t.site_id = #{siteId} and t.cluster_device_id = #{clusterId} and t.temperature = #{minTemp}
|
||||||
|
union all
|
||||||
|
</if>
|
||||||
|
<if test="maxSoc != null">
|
||||||
|
select 'maxSocId' as type, t.device_id from ems_battery_data t
|
||||||
|
where t.site_id = #{siteId} and t.cluster_device_id = #{clusterId} and t.soc = #{maxSoc}
|
||||||
|
union all
|
||||||
|
</if>
|
||||||
|
<if test="minSoc != null">
|
||||||
|
select 'minSocId' as type, t.device_id from ems_battery_data t
|
||||||
|
where t.site_id = #{siteId} and t.cluster_device_id = #{clusterId} and t.soc = #{minSoc}
|
||||||
|
union all
|
||||||
|
</if>
|
||||||
|
SELECT NULL AS type, NULL AS device_id FROM DUAL WHERE 1=0
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
@ -133,4 +133,16 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</delete>
|
||||||
|
|
||||||
|
<select id="getAllStackInfoBySiteId" parameterType="Long" resultType="java.util.Map">
|
||||||
|
select id,device_name as deviceName from ems_devices_setting
|
||||||
|
where id in (
|
||||||
|
select distinct eb.device_id from ems_battery_stack eb where eb.site_id = #{siteId})
|
||||||
|
</select>
|
||||||
|
|
||||||
|
<select id="getAllClusterInfoByStackId" parameterType="Long" resultType="java.util.Map">
|
||||||
|
select id,device_name as deviceName
|
||||||
|
from ems_devices_setting
|
||||||
|
where id in (select distinct eb.device_id from ems_battery_cluster eb where eb.stack_device_id = #{stackDeviceId})
|
||||||
|
</select>
|
||||||
</mapper>
|
</mapper>
|
Reference in New Issue
Block a user