修改 device id

This commit is contained in:
2025-06-28 23:07:49 +08:00
parent 1a56bd6526
commit 177e235c0e
4 changed files with 380 additions and 115 deletions

View File

@ -12,7 +12,7 @@ import com.xzzn.common.annotation.Excel;
* PCS数据对象 ems_pcs_data
*
* @author xzzn
* @date 2025-06-17
* @date 2025-06-28
*/
public class EmsPcsData extends BaseEntity
{
@ -22,7 +22,7 @@ public class EmsPcsData extends BaseEntity
private Long id;
/** 数据更新时间 */
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@JsonFormat(pattern = "yyyy-MM-dd")
@Excel(name = "数据更新时间", width = 30, dateFormat = "yyyy-MM-dd")
private Date dataUpdateTime;
@ -132,11 +132,63 @@ public class EmsPcsData extends BaseEntity
/** 月 */
@Excel(name = "")
private int dateMonth;
private Long dateMonth;
/** 日 */
@Excel(name = "")
private int dateDay;
private Long dateDay;
/** 总交流充电量 (kWh) */
@Excel(name = "总交流充电量 (kWh)")
private BigDecimal totalAcChargeEnergy;
/** 总交流放电量 (kWh) */
@Excel(name = "总交流放电量 (kWh)")
private BigDecimal totalAcDischargeEnergy;
/** 交流侧充电有功功率 */
@Excel(name = "交流侧充电有功功率")
private BigDecimal acChargeActivePower;
/** 交流侧容性无功功率 */
@Excel(name = "交流侧容性无功功率")
private BigDecimal acCapacitiveReactivePower;
/** 交流侧放电有功功率 */
@Excel(name = "交流侧放电有功功率")
private BigDecimal acDischargeActivePower;
/** 交流侧感性无功功率 */
@Excel(name = "交流侧感性无功功率")
private BigDecimal acInductiveReactivePower;
/** 最大容性无功能力 */
@Excel(name = "最大容性无功能力")
private BigDecimal maxCapacitivePowerCapacity;
/** 最大感性无功能力 */
@Excel(name = "最大感性无功能力")
private BigDecimal maxInductivePowerCapacity;
/** 最大可冲功率 */
@Excel(name = "最大可冲功率")
private BigDecimal maxChargePowerCapacity;
/** 最大可放功率 */
@Excel(name = "最大可放功率")
private BigDecimal maxDischargePowerCapacity;
/** 交流开关状态 */
@Excel(name = "交流开关状态")
private String acSwitchStatus;
/** 直流开关状态 */
@Excel(name = "直流开关状态")
private String dcSwitchStatus;
/** 远程投退状态 */
@Excel(name = "远程投退状态")
private String remoteControlStatus;
public void setId(Long id)
{
@ -418,20 +470,154 @@ public class EmsPcsData extends BaseEntity
return deviceId;
}
public int getDateMonth() {
return dateMonth;
}
public void setDateMonth(int dateMonth) {
public void setDateMonth(Long dateMonth)
{
this.dateMonth = dateMonth;
}
public int getDateDay() {
public Long getDateMonth()
{
return dateMonth;
}
public void setDateDay(Long dateDay)
{
this.dateDay = dateDay;
}
public Long getDateDay()
{
return dateDay;
}
public void setDateDay(int dateDay) {
this.dateDay = dateDay;
public void setTotalAcChargeEnergy(BigDecimal totalAcChargeEnergy)
{
this.totalAcChargeEnergy = totalAcChargeEnergy;
}
public BigDecimal getTotalAcChargeEnergy()
{
return totalAcChargeEnergy;
}
public void setTotalAcDischargeEnergy(BigDecimal totalAcDischargeEnergy)
{
this.totalAcDischargeEnergy = totalAcDischargeEnergy;
}
public BigDecimal getTotalAcDischargeEnergy()
{
return totalAcDischargeEnergy;
}
public void setAcChargeActivePower(BigDecimal acChargeActivePower)
{
this.acChargeActivePower = acChargeActivePower;
}
public BigDecimal getAcChargeActivePower()
{
return acChargeActivePower;
}
public void setAcCapacitiveReactivePower(BigDecimal acCapacitiveReactivePower)
{
this.acCapacitiveReactivePower = acCapacitiveReactivePower;
}
public BigDecimal getAcCapacitiveReactivePower()
{
return acCapacitiveReactivePower;
}
public void setAcDischargeActivePower(BigDecimal acDischargeActivePower)
{
this.acDischargeActivePower = acDischargeActivePower;
}
public BigDecimal getAcDischargeActivePower()
{
return acDischargeActivePower;
}
public void setAcInductiveReactivePower(BigDecimal acInductiveReactivePower)
{
this.acInductiveReactivePower = acInductiveReactivePower;
}
public BigDecimal getAcInductiveReactivePower()
{
return acInductiveReactivePower;
}
public void setMaxCapacitivePowerCapacity(BigDecimal maxCapacitivePowerCapacity)
{
this.maxCapacitivePowerCapacity = maxCapacitivePowerCapacity;
}
public BigDecimal getMaxCapacitivePowerCapacity()
{
return maxCapacitivePowerCapacity;
}
public void setMaxInductivePowerCapacity(BigDecimal maxInductivePowerCapacity)
{
this.maxInductivePowerCapacity = maxInductivePowerCapacity;
}
public BigDecimal getMaxInductivePowerCapacity()
{
return maxInductivePowerCapacity;
}
public void setMaxChargePowerCapacity(BigDecimal maxChargePowerCapacity)
{
this.maxChargePowerCapacity = maxChargePowerCapacity;
}
public BigDecimal getMaxChargePowerCapacity()
{
return maxChargePowerCapacity;
}
public void setMaxDischargePowerCapacity(BigDecimal maxDischargePowerCapacity)
{
this.maxDischargePowerCapacity = maxDischargePowerCapacity;
}
public BigDecimal getMaxDischargePowerCapacity()
{
return maxDischargePowerCapacity;
}
public void setAcSwitchStatus(String acSwitchStatus)
{
this.acSwitchStatus = acSwitchStatus;
}
public String getAcSwitchStatus()
{
return acSwitchStatus;
}
public void setDcSwitchStatus(String dcSwitchStatus)
{
this.dcSwitchStatus = dcSwitchStatus;
}
public String getDcSwitchStatus()
{
return dcSwitchStatus;
}
public void setRemoteControlStatus(String remoteControlStatus)
{
this.remoteControlStatus = remoteControlStatus;
}
public String getRemoteControlStatus()
{
return remoteControlStatus;
}
@Override
@ -472,7 +658,19 @@ public class EmsPcsData extends BaseEntity
.append("deviceId", getDeviceId())
.append("dateMonth", getDateMonth())
.append("dateDay", getDateDay())
.append("totalAcChargeEnergy", getTotalAcChargeEnergy())
.append("totalAcDischargeEnergy", getTotalAcDischargeEnergy())
.append("acChargeActivePower", getAcChargeActivePower())
.append("acCapacitiveReactivePower", getAcCapacitiveReactivePower())
.append("acDischargeActivePower", getAcDischargeActivePower())
.append("acInductiveReactivePower", getAcInductiveReactivePower())
.append("maxCapacitivePowerCapacity", getMaxCapacitivePowerCapacity())
.append("maxInductivePowerCapacity", getMaxInductivePowerCapacity())
.append("maxChargePowerCapacity", getMaxChargePowerCapacity())
.append("maxDischargePowerCapacity", getMaxDischargePowerCapacity())
.append("acSwitchStatus", getAcSwitchStatus())
.append("dcSwitchStatus", getDcSwitchStatus())
.append("remoteControlStatus", getRemoteControlStatus())
.toString();
}
}

View File

@ -40,11 +40,23 @@
<result property="deviceId" column="device_id" />
<result property="dateMonth" column="date_month" />
<result property="dateDay" column="date_day" />
<result property="communicationStatus" column="communication_status" />
<result property="totalAcChargeEnergy" column="total_ac_charge_energy" />
<result property="totalAcDischargeEnergy" column="total_ac_discharge_energy" />
<result property="acChargeActivePower" column="ac_charge_active_power" />
<result property="acCapacitiveReactivePower" column="ac_capacitive_reactive_power" />
<result property="acDischargeActivePower" column="ac_discharge_active_power" />
<result property="acInductiveReactivePower" column="ac_inductive_reactive_power" />
<result property="maxCapacitivePowerCapacity" column="max_capacitive_power_capacity" />
<result property="maxInductivePowerCapacity" column="max_inductive_power_capacity" />
<result property="maxChargePowerCapacity" column="max_charge_power_capacity" />
<result property="maxDischargePowerCapacity" column="max_discharge_power_capacity" />
<result property="acSwitchStatus" column="ac_switch_status" />
<result property="dcSwitchStatus" column="dc_switch_status" />
<result property="remoteControlStatus" column="remote_control_status" />
</resultMap>
<sql id="selectEmsPcsDataVo">
select id, data_update_time, work_status, grid_status, device_status, control_mode, total_active_power, daily_ac_charge_energy, a_phase_voltage, a_phase_current, total_reactive_power, daily_ac_discharge_energy, b_phase_voltage, b_phase_current, total_apparent_power, pcs_module_temperature, c_phase_voltage, c_phase_current, total_power_factor, pcs_environment_temperature, ac_frequency, branch_status, discharge_status, dc_power, dc_voltage, dc_current, create_by, create_time, update_by, update_time, remark, site_id, device_id, date_month, date_day, communication_status from ems_pcs_data
select id, data_update_time, work_status, grid_status, device_status, control_mode, total_active_power, daily_ac_charge_energy, a_phase_voltage, a_phase_current, total_reactive_power, daily_ac_discharge_energy, b_phase_voltage, b_phase_current, total_apparent_power, pcs_module_temperature, c_phase_voltage, c_phase_current, total_power_factor, pcs_environment_temperature, ac_frequency, branch_status, discharge_status, dc_power, dc_voltage, dc_current, create_by, create_time, update_by, update_time, remark, site_id, device_id, date_month, date_day, total_ac_charge_energy, total_ac_discharge_energy, ac_charge_active_power, ac_capacitive_reactive_power, ac_discharge_active_power, ac_inductive_reactive_power, max_capacitive_power_capacity, max_inductive_power_capacity, max_charge_power_capacity, max_discharge_power_capacity, ac_switch_status, dc_switch_status, remote_control_status from ems_pcs_data
</sql>
<select id="selectEmsPcsDataList" parameterType="EmsPcsData" resultMap="EmsPcsDataResult">
@ -76,10 +88,22 @@
<if test="dcVoltage != null "> and dc_voltage = #{dcVoltage}</if>
<if test="dcCurrent != null "> and dc_current = #{dcCurrent}</if>
<if test="siteId != null "> and site_id = #{siteId}</if>
<if test="deviceId != null "> and device_id = #{deviceId}</if>
<if test="deviceId != null and deviceId != ''"> and device_id = #{deviceId}</if>
<if test="dateMonth != null "> and date_month = #{dateMonth}</if>
<if test="dateDay != null "> and date_day = #{dateDay}</if>
<if test="communicationStatus != null and communicationStatus != ''"> and communication_status = #{communicationStatus}</if>
<if test="totalAcChargeEnergy != null "> and total_ac_charge_energy = #{totalAcChargeEnergy}</if>
<if test="totalAcDischargeEnergy != null "> and total_ac_discharge_energy = #{totalAcDischargeEnergy}</if>
<if test="acChargeActivePower != null "> and ac_charge_active_power = #{acChargeActivePower}</if>
<if test="acCapacitiveReactivePower != null "> and ac_capacitive_reactive_power = #{acCapacitiveReactivePower}</if>
<if test="acDischargeActivePower != null "> and ac_discharge_active_power = #{acDischargeActivePower}</if>
<if test="acInductiveReactivePower != null "> and ac_inductive_reactive_power = #{acInductiveReactivePower}</if>
<if test="maxCapacitivePowerCapacity != null "> and max_capacitive_power_capacity = #{maxCapacitivePowerCapacity}</if>
<if test="maxInductivePowerCapacity != null "> and max_inductive_power_capacity = #{maxInductivePowerCapacity}</if>
<if test="maxChargePowerCapacity != null "> and max_charge_power_capacity = #{maxChargePowerCapacity}</if>
<if test="maxDischargePowerCapacity != null "> and max_discharge_power_capacity = #{maxDischargePowerCapacity}</if>
<if test="acSwitchStatus != null and acSwitchStatus != ''"> and ac_switch_status = #{acSwitchStatus}</if>
<if test="dcSwitchStatus != null and dcSwitchStatus != ''"> and dc_switch_status = #{dcSwitchStatus}</if>
<if test="remoteControlStatus != null and remoteControlStatus != ''"> and remote_control_status = #{remoteControlStatus}</if>
</where>
</select>
@ -122,10 +146,22 @@
<if test="updateTime != null">update_time,</if>
<if test="remark != null">remark,</if>
<if test="siteId != null">site_id,</if>
<if test="deviceId != null">device_id,</if>
<if test="deviceId != null and deviceId != ''">device_id,</if>
<if test="dateMonth != null">date_month,</if>
<if test="dateDay != null">date_day,</if>
<if test="communicationStatus != null">communication_status,</if>
<if test="totalAcChargeEnergy != null">total_ac_charge_energy,</if>
<if test="totalAcDischargeEnergy != null">total_ac_discharge_energy,</if>
<if test="acChargeActivePower != null">ac_charge_active_power,</if>
<if test="acCapacitiveReactivePower != null">ac_capacitive_reactive_power,</if>
<if test="acDischargeActivePower != null">ac_discharge_active_power,</if>
<if test="acInductiveReactivePower != null">ac_inductive_reactive_power,</if>
<if test="maxCapacitivePowerCapacity != null">max_capacitive_power_capacity,</if>
<if test="maxInductivePowerCapacity != null">max_inductive_power_capacity,</if>
<if test="maxChargePowerCapacity != null">max_charge_power_capacity,</if>
<if test="maxDischargePowerCapacity != null">max_discharge_power_capacity,</if>
<if test="acSwitchStatus != null">ac_switch_status,</if>
<if test="dcSwitchStatus != null">dc_switch_status,</if>
<if test="remoteControlStatus != null">remote_control_status,</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="dataUpdateTime != null">#{dataUpdateTime},</if>
@ -159,10 +195,22 @@
<if test="updateTime != null">#{updateTime},</if>
<if test="remark != null">#{remark},</if>
<if test="siteId != null">#{siteId},</if>
<if test="deviceId != null">#{deviceId},</if>
<if test="deviceId != null and deviceId != ''">#{deviceId},</if>
<if test="dateMonth != null">#{dateMonth},</if>
<if test="dateDay != null">#{dateDay},</if>
<if test="communicationStatus != null">#{communicationStatus},</if>
<if test="totalAcChargeEnergy != null">#{totalAcChargeEnergy},</if>
<if test="totalAcDischargeEnergy != null">#{totalAcDischargeEnergy},</if>
<if test="acChargeActivePower != null">#{acChargeActivePower},</if>
<if test="acCapacitiveReactivePower != null">#{acCapacitiveReactivePower},</if>
<if test="acDischargeActivePower != null">#{acDischargeActivePower},</if>
<if test="acInductiveReactivePower != null">#{acInductiveReactivePower},</if>
<if test="maxCapacitivePowerCapacity != null">#{maxCapacitivePowerCapacity},</if>
<if test="maxInductivePowerCapacity != null">#{maxInductivePowerCapacity},</if>
<if test="maxChargePowerCapacity != null">#{maxChargePowerCapacity},</if>
<if test="maxDischargePowerCapacity != null">#{maxDischargePowerCapacity},</if>
<if test="acSwitchStatus != null">#{acSwitchStatus},</if>
<if test="dcSwitchStatus != null">#{dcSwitchStatus},</if>
<if test="remoteControlStatus != null">#{remoteControlStatus},</if>
</trim>
</insert>
@ -200,10 +248,22 @@
<if test="updateTime != null">update_time = #{updateTime},</if>
<if test="remark != null">remark = #{remark},</if>
<if test="siteId != null">site_id = #{siteId},</if>
<if test="deviceId != null">device_id = #{deviceId},</if>
<if test="deviceId != null and deviceId != ''">device_id = #{deviceId},</if>
<if test="dateMonth != null">date_month = #{dateMonth},</if>
<if test="dateDay != null">date_day = #{dateDay},</if>
<if test="communicationStatus != null">communication_status = #{communicationStatus},</if>
<if test="totalAcChargeEnergy != null">total_ac_charge_energy = #{totalAcChargeEnergy},</if>
<if test="totalAcDischargeEnergy != null">total_ac_discharge_energy = #{totalAcDischargeEnergy},</if>
<if test="acChargeActivePower != null">ac_charge_active_power = #{acChargeActivePower},</if>
<if test="acCapacitiveReactivePower != null">ac_capacitive_reactive_power = #{acCapacitiveReactivePower},</if>
<if test="acDischargeActivePower != null">ac_discharge_active_power = #{acDischargeActivePower},</if>
<if test="acInductiveReactivePower != null">ac_inductive_reactive_power = #{acInductiveReactivePower},</if>
<if test="maxCapacitivePowerCapacity != null">max_capacitive_power_capacity = #{maxCapacitivePowerCapacity},</if>
<if test="maxInductivePowerCapacity != null">max_inductive_power_capacity = #{maxInductivePowerCapacity},</if>
<if test="maxChargePowerCapacity != null">max_charge_power_capacity = #{maxChargePowerCapacity},</if>
<if test="maxDischargePowerCapacity != null">max_discharge_power_capacity = #{maxDischargePowerCapacity},</if>
<if test="acSwitchStatus != null">ac_switch_status = #{acSwitchStatus},</if>
<if test="dcSwitchStatus != null">dc_switch_status = #{dcSwitchStatus},</if>
<if test="remoteControlStatus != null">remote_control_status = #{remoteControlStatus},</if>
</trim>
where id = #{id}
</update>
@ -218,81 +278,4 @@
#{id}
</foreach>
</delete>
<select id="getPcsDataBySiteId" parameterType="Long" resultType="com.xzzn.ems.domain.vo.SiteMonitorDataVo">
select CONCAT(date_month,'/',date_day) as ammeterDate,
sum(daily_ac_charge_energy) as chargedCap,
sum(daily_ac_discharge_energy) as disChargedCap
from ems_pcs_data
where site_id = #{siteId}
and date_sub(CURDATE(), interval 6 day) &lt;= create_time
group by date_month,date_day
</select>
<select id="getGridNrtPower" parameterType="Long" resultType="java.math.BigDecimal">
select sum(total_active_power) as gridNrtPower
from ems_pcs_data
where site_id = #{siteId}
</select>
<select id="getPcsTotalChargeData" resultType="map">
select SUM(t.daily_ac_charge_energy) as totalChargedCap,
SUM(t.daily_ac_discharge_energy) as totalDischargedCap
from ems_pcs_data t
where t.data_update_time = (select MAX(data_update_time) FROM ems_pcs_data
where site_id = t.site_id and device_id = t.device_id and date_month = t.date_month and date_day = t.date_day)
</select>
<select id="getSiteRunningHeadInfo" parameterType="Long" resultType="com.xzzn.ems.domain.vo.SiteMonitorRuningHeadInfoVo">
select sum(a.total_active_power) as totalActivePower,
sum(a.total_reactive_power) as totalReactivePower,
sum(a.daily_ac_charge_energy) as dayChargedCap,
sum(a.daily_ac_discharge_energy) as dayDisChargedCap
from (
select t.total_active_power,t.total_reactive_power,
t.daily_ac_charge_energy,t.daily_ac_discharge_energy,
t.device_id,t.site_id,t.create_time
from ems_pcs_data t
where t.site_id = #{siteId}
and t.create_time = (select MAX(create_time) FROM ems_pcs_data where site_id = t.site_id and device_id = t.device_id)
group by t.device_id,t.total_active_power, total_reactive_power,
t.daily_ac_charge_energy,t.daily_ac_discharge_energy,t.site_id,t.create_time
) a
</select>
<select id="getElectDataList" resultType="com.xzzn.ems.domain.vo.ElectricIndexList">
select tmp.date_month as dateMonth,
SUM(tmp.daily_ac_charge_energy) as chargeEnergy,
SUM(tmp.daily_ac_discharge_energy) as disChargeEnergy
from
(
select date_month,date_day,
t.daily_ac_charge_energy,t.daily_ac_discharge_energy,t.create_time
from ems_pcs_data t
where t.create_time = (select MAX(create_time) FROM ems_pcs_data where site_id = t.site_id
and device_id = t.device_id and date_day = t.date_day and date_month = t.date_month)
) as tmp
group by dateMonth
</select>
<select id="getPcsDetailInfoBySiteId" parameterType="Long" resultType="com.xzzn.ems.domain.vo.PcsDetailInfoVo">
select td.device_name as deviceName,td.communication_status as communicationStatus,
tmp.site_id as siteId,tmp.device_id as deviceId,
tmp.data_update_time as dataUpdateTime,tmp.work_status as workStatus,
tmp.grid_status as gridStatus,tmp.device_status as deviceStatus,tmp.control_mode as controlMode,
tmp.total_active_power as totalActivePower,tmp.daily_ac_charge_energy as dailyAcChargeEnergy,
tmp.a_phase_voltage as aPhaseVoltage,tmp.a_phase_current as aPhaseCurrent,
tmp.total_reactive_power as totalReactivePower,tmp.daily_ac_discharge_energy as dailyAcDischargeEnergy,
tmp.b_phase_voltage as bPhaseVoltage,tmp.b_phase_current as bPhaseCurrent,
tmp.total_apparent_power as totalApparentPower,tmp.pcs_module_temperature as pcsModuleTemperature,
tmp.c_phase_current as cPhaseVoltage,tmp.c_phase_current as cPhaseCurrent,
tmp.total_power_factor as totalPowerFactor,
tmp.pcs_environment_temperature as pcsEnvironmentTemperature,tmp.ac_frequency as acFrequency
from ems_pcs_data tmp left join ems_devices_setting td on tmp.device_id = td.id and tmp.site_id = td.site_id
where tmp.site_id = #{siteId}
and tmp.data_update_time = (select MAX(data_update_time) FROM ems_pcs_data where site_id = tmp.site_id
and device_id = tmp.device_id)
order by tmp.device_id
</select>
</mapper>