单体电池添加入参site_id
This commit is contained in:
@ -110,10 +110,10 @@ public class EmsSiteMonitorController extends BaseController{
|
||||
* 获取电池簇下面的单体电池数据
|
||||
*/
|
||||
@GetMapping("/getClusterDataInfoList")
|
||||
public TableDataInfo getClusterDataInfoList(@RequestParam String clusterDeviceId)
|
||||
public TableDataInfo getClusterDataInfoList(@RequestParam String clusterDeviceId,@RequestParam String siteId)
|
||||
{
|
||||
startPage();
|
||||
List<BatteryDataStatsListVo> list = iSingleSiteService.getClusterDataInfoList(clusterDeviceId);
|
||||
List<BatteryDataStatsListVo> list = iSingleSiteService.getClusterDataInfoList(clusterDeviceId,siteId);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
|
@ -91,7 +91,7 @@ public interface EmsBatteryDataMapper
|
||||
* @param clusterDeviceId
|
||||
* @return
|
||||
*/
|
||||
public List<BatteryDataStatsListVo> getAllBatteryDataByClusterId(String clusterDeviceId);
|
||||
public List<BatteryDataStatsListVo> getAllBatteryDataByClusterId(@Param("clusterDeviceId") String clusterDeviceId,@Param("siteId") String siteId);
|
||||
|
||||
|
||||
int insertEmsBatteryDataList(List<EmsBatteryData> emsBatteryDataList);
|
||||
|
@ -1,6 +1,7 @@
|
||||
package com.xzzn.ems.mapper;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -99,4 +100,12 @@ public interface EmsPcsDataMapper
|
||||
* @return
|
||||
*/
|
||||
public Map<String, BigDecimal> getPcsTotalChargeData(String siteId);
|
||||
|
||||
/**
|
||||
* 根据时间按天获取充放电量
|
||||
* @param startDate
|
||||
* @param endDate
|
||||
* @return
|
||||
*/
|
||||
public List<SiteMonitorDataVo> getPcsDataByDate(Date startDate, Date endDate);
|
||||
}
|
||||
|
@ -27,7 +27,7 @@ public interface ISingleSiteService
|
||||
|
||||
public List<EmsCoolingData> getCoolingDataList(String siteId);
|
||||
|
||||
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId);
|
||||
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId,String siteId);
|
||||
|
||||
public List<AmmeterDataVo> getAmmeterDataList(String siteId);
|
||||
}
|
||||
|
@ -242,9 +242,9 @@ public class SingleSiteServiceImpl implements ISingleSiteService {
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId) {
|
||||
public List<BatteryDataStatsListVo> getClusterDataInfoList(String clusterDeviceId,String siteId) {
|
||||
List<BatteryDataStatsListVo> batteryDataStatsListVo = new ArrayList<>();
|
||||
batteryDataStatsListVo = emsBatteryDataMapper.getAllBatteryDataByClusterId(clusterDeviceId);
|
||||
batteryDataStatsListVo = emsBatteryDataMapper.getAllBatteryDataByClusterId(clusterDeviceId,siteId);
|
||||
return batteryDataStatsListVo;
|
||||
}
|
||||
|
||||
|
@ -177,21 +177,22 @@
|
||||
SELECT NULL AS type, NULL AS device_id FROM DUAL WHERE 1=0
|
||||
</select>
|
||||
|
||||
<select id="getAllBatteryDataByClusterId" parameterType="String" resultType="com.xzzn.ems.domain.vo.BatteryDataStatsListVo">
|
||||
SELECT
|
||||
update_time as updateTime,
|
||||
voltage, temperature, soc, soh,
|
||||
device_id as deviceId
|
||||
FROM (
|
||||
SELECT
|
||||
t.update_time, t.voltage, t.temperature, t.soc, t.soh, t.device_id,
|
||||
ROW_NUMBER() OVER (
|
||||
PARTITION BY t.device_id ORDER BY t.update_time DESC
|
||||
) AS rn
|
||||
<select id="getAllBatteryDataByClusterId" resultType="com.xzzn.ems.domain.vo.BatteryDataStatsListVo">
|
||||
SELECT t.update_time as updateTime, t.voltage, t.temperature,
|
||||
t.soc, t.soh, t.device_id as deviceId
|
||||
FROM ems_battery_data t
|
||||
WHERE t.cluster_device_id = #{clusterDeviceId}
|
||||
) ranked
|
||||
WHERE rn = 1
|
||||
JOIN ( SELECT device_id, MAX(update_time) AS max_update_time
|
||||
FROM ems_battery_data
|
||||
WHERE site_id = #{siteId}
|
||||
<if test="clusterDeviceId != null and clusterDeviceId != ''">
|
||||
and cluster_device_id = #{clusterDeviceId}
|
||||
</if>
|
||||
GROUP BY device_id
|
||||
) latest ON t.device_id = latest.device_id AND t.update_time = latest.max_update_time
|
||||
WHERE t.site_id = #{siteId}
|
||||
<if test="clusterDeviceId != null and clusterDeviceId != ''">
|
||||
and t.cluster_device_id = #{clusterDeviceId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
|
||||
|
@ -371,4 +371,21 @@
|
||||
WHERE tmp.site_id = #{siteId}
|
||||
order by tmp.device_id
|
||||
</select>
|
||||
|
||||
<select id="getPcsDataByDate" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
|
||||
select CONCAT(t.date_month,'/',t.date_day) as ammeterDate,
|
||||
sum(t.daily_ac_charge_energy) as chargedCap,
|
||||
sum(t.daily_ac_discharge_energy) as disChargedCap
|
||||
from ( SELECT p.site_id, p.device_id,p.date_month,p.date_day, MAX(p.data_update_time) AS max_update_time
|
||||
FROM ems_pcs_data p
|
||||
where p.site_id = #{siteId}
|
||||
GROUP BY p.site_id,p.device_id,p.date_month,p.date_day
|
||||
) latest inner join ems_pcs_data t ON latest.site_id = t.site_id
|
||||
AND latest.device_id = t.device_id
|
||||
AND latest.max_update_time = t.data_update_time
|
||||
and latest.date_month = t.date_month
|
||||
and latest.date_day = t.date_day
|
||||
group by ammeterDate
|
||||
order by ammeterDate desc
|
||||
</select>
|
||||
</mapper>
|
Reference in New Issue
Block a user