修改 device id
This commit is contained in:
@ -6,6 +6,8 @@ import com.alibaba.fastjson2.JSONArray;
|
|||||||
import com.alibaba.fastjson2.JSONObject;
|
import com.alibaba.fastjson2.JSONObject;
|
||||||
import com.alibaba.fastjson2.TypeReference;
|
import com.alibaba.fastjson2.TypeReference;
|
||||||
import com.fasterxml.jackson.databind.json.JsonMapper;
|
import com.fasterxml.jackson.databind.json.JsonMapper;
|
||||||
|
import com.xzzn.common.utils.DateUtils;
|
||||||
|
import com.xzzn.common.utils.StringUtils;
|
||||||
import com.xzzn.ems.domain.EmsBatteryData;
|
import com.xzzn.ems.domain.EmsBatteryData;
|
||||||
import com.xzzn.ems.domain.EmsMqttMessage;
|
import com.xzzn.ems.domain.EmsMqttMessage;
|
||||||
import com.xzzn.ems.domain.EmsPcsData;
|
import com.xzzn.ems.domain.EmsPcsData;
|
||||||
@ -26,10 +28,7 @@ import org.springframework.stereotype.Service;
|
|||||||
|
|
||||||
import javax.annotation.PostConstruct;
|
import javax.annotation.PostConstruct;
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
@Service
|
@Service
|
||||||
public class MqttMessageController implements MqttPublisher, MqttSubscriber {
|
public class MqttMessageController implements MqttPublisher, MqttSubscriber {
|
||||||
@ -90,7 +89,7 @@ public class MqttMessageController implements MqttPublisher, MqttSubscriber {
|
|||||||
System.out.println("[DEVICE] data: " + payload);
|
System.out.println("[DEVICE] data: " + payload);
|
||||||
try {
|
try {
|
||||||
// 业务处理逻辑
|
// 业务处理逻辑
|
||||||
// handleFxData(JSONArray.parseArray(payload).get(0).toString());
|
handleFxData(payload);
|
||||||
|
|
||||||
EmsMqttMessage mqttMessage = new EmsMqttMessage();
|
EmsMqttMessage mqttMessage = new EmsMqttMessage();
|
||||||
mqttMessage.setMqttTopic(topic);
|
mqttMessage.setMqttTopic(topic);
|
||||||
@ -135,18 +134,19 @@ public class MqttMessageController implements MqttPublisher, MqttSubscriber {
|
|||||||
|
|
||||||
|
|
||||||
private void handleFxData(String message) {
|
private void handleFxData(String message) {
|
||||||
|
JSONArray arraylist = JSONArray.parseArray(message);
|
||||||
|
|
||||||
|
for (int i = 0; i < arraylist.size(); i++) {
|
||||||
List<String> upAll = JSON.parseObject(message, new TypeReference<ArrayList<String>>() {});
|
JSONObject obj = JSONObject.parseObject(arraylist.get(i).toString());
|
||||||
|
|
||||||
for (int i = 0; i < upAll.size(); i++) {
|
|
||||||
JSONObject obj = JSONObject.parseObject(upAll.get(i));
|
|
||||||
|
|
||||||
String deviceId = obj.get("Device").toString();
|
String deviceId = obj.get("Device").toString();
|
||||||
String jsonData = obj.get("Data").toString();
|
String jsonData = obj.get("Data").toString();
|
||||||
|
|
||||||
|
log.info("deviceId:" + deviceId);
|
||||||
if (deviceId.contains("BMS")) {
|
if (deviceId.contains("BMS")) {
|
||||||
|
log.info("====================");
|
||||||
|
log.info("BMS data:"+ jsonData);
|
||||||
|
|
||||||
Map<String, Map<String, Object>> records = processData(JSON.parseObject(jsonData, new TypeReference<Map<String, Object>>() {}));
|
Map<String, Map<String, Object>> records = processData(JSON.parseObject(jsonData, new TypeReference<Map<String, Object>>() {}));
|
||||||
|
|
||||||
//单体电池
|
//单体电池
|
||||||
@ -157,19 +157,85 @@ public class MqttMessageController implements MqttPublisher, MqttSubscriber {
|
|||||||
EmsBatteryData data = new EmsBatteryData();
|
EmsBatteryData data = new EmsBatteryData();
|
||||||
data.setDeviceId(recordId);
|
data.setDeviceId(recordId);
|
||||||
data.setBatteryCellId(recordId);
|
data.setBatteryCellId(recordId);
|
||||||
data.setSoc(new BigDecimal(fields.get("DTSOC").toString()));
|
data.setSoc(StringUtils.getBigDecimal(fields.get("DTSOC")));
|
||||||
data.setSoh(new BigDecimal(fields.get("DTSOH").toString()));
|
data.setSoh(StringUtils.getBigDecimal(fields.get("DTSOH")));
|
||||||
data.setTemperature(new BigDecimal(fields.get("DTWD").toString()));
|
data.setTemperature(StringUtils.getBigDecimal(fields.get("DTWD")));
|
||||||
data.setVoltage(new BigDecimal(fields.get("DTDY").toString()));
|
data.setVoltage(StringUtils.getBigDecimal(fields.get("DTDY")));
|
||||||
|
|
||||||
data.setBatteryCluster(deviceId);
|
data.setBatteryCluster(deviceId);
|
||||||
data.setBatteryPack(deviceId);
|
data.setBatteryPack(deviceId);
|
||||||
|
|
||||||
|
// 时间戳
|
||||||
|
data.setDataTimestamp(new Date());
|
||||||
|
|
||||||
|
// ID字段
|
||||||
|
data.setSiteId(Long.parseLong("021"));
|
||||||
|
data.setClusterDeviceId(Long.parseLong("021"));
|
||||||
|
|
||||||
|
|
||||||
emsBatteryDataService.insertEmsBatteryData(data);
|
emsBatteryDataService.insertEmsBatteryData(data);
|
||||||
}
|
}
|
||||||
} else if (deviceId.contains("PCS")) {
|
} else if (deviceId.contains("PCS")) {
|
||||||
|
log.info("====================");
|
||||||
|
|
||||||
|
log.info("PCS data:"+ jsonData);
|
||||||
//pcs
|
//pcs
|
||||||
EmsPcsData data = new EmsPcsData();
|
EmsPcsData data = new EmsPcsData();
|
||||||
|
// 时间与状态类字段
|
||||||
|
data.setDataUpdateTime(new Date());
|
||||||
|
data.setWorkStatus("A");
|
||||||
|
data.setGridStatus("B");
|
||||||
|
data.setDeviceStatus("C");
|
||||||
|
data.setControlMode("D");
|
||||||
|
|
||||||
|
// 功率与能量类字段
|
||||||
|
data.setTotalActivePower(BigDecimal.ZERO);
|
||||||
|
data.setDailyAcChargeEnergy(BigDecimal.ZERO);
|
||||||
|
data.setTotalReactivePower(BigDecimal.ZERO);
|
||||||
|
data.setDailyAcDischargeEnergy(BigDecimal.ZERO);
|
||||||
|
data.setTotalApparentPower(BigDecimal.ZERO);
|
||||||
|
data.setTotalPowerFactor(BigDecimal.ZERO);
|
||||||
|
data.setDcPower(BigDecimal.ZERO);
|
||||||
|
data.setTotalAcChargeEnergy(BigDecimal.ZERO);
|
||||||
|
data.setTotalAcDischargeEnergy(BigDecimal.ZERO);
|
||||||
|
data.setAcChargeActivePower(BigDecimal.ZERO);
|
||||||
|
data.setAcCapacitiveReactivePower(BigDecimal.ZERO);
|
||||||
|
data.setAcDischargeActivePower(BigDecimal.ZERO);
|
||||||
|
data.setAcInductiveReactivePower(BigDecimal.ZERO);
|
||||||
|
data.setMaxCapacitivePowerCapacity(BigDecimal.ZERO);
|
||||||
|
data.setMaxInductivePowerCapacity(BigDecimal.ZERO);
|
||||||
|
data.setMaxChargePowerCapacity(BigDecimal.ZERO);
|
||||||
|
data.setMaxDischargePowerCapacity(BigDecimal.ZERO);
|
||||||
|
|
||||||
|
|
||||||
|
// 温度与环境参数
|
||||||
|
data.setPcsModuleTemperature(BigDecimal.ZERO);
|
||||||
|
data.setPcsEnvironmentTemperature(BigDecimal.ZERO);
|
||||||
|
data.setAcFrequency(BigDecimal.ZERO);
|
||||||
|
|
||||||
|
// 状态指示类
|
||||||
|
data.setBranchStatus("A");
|
||||||
|
data.setDischargeStatus("A");
|
||||||
|
data.setAcSwitchStatus("A");
|
||||||
|
data.setDcSwitchStatus("A");
|
||||||
|
data.setRemoteControlStatus("A");
|
||||||
|
|
||||||
|
// 直流参数
|
||||||
|
data.setDcVoltage(BigDecimal.ZERO);
|
||||||
|
data.setDcCurrent(BigDecimal.ZERO);
|
||||||
|
|
||||||
|
// 系统管理字段
|
||||||
|
// data.setCreateBy(BigDecimal.ZERO);
|
||||||
|
// data.setCreateTime(BigDecimal.ZERO);
|
||||||
|
// data.setUpdateBy(BigDecimal.ZERO);
|
||||||
|
// data.setUpdateTime(BigDecimal.ZERO);
|
||||||
|
// data.setRemark(BigDecimal.ZERO);
|
||||||
|
data.setSiteId(Long.parseLong("021"));
|
||||||
|
data.setDeviceId(deviceId);
|
||||||
|
data.setDateMonth(Long.parseLong("6"));
|
||||||
|
data.setDateDay(Long.parseLong("28"));
|
||||||
|
|
||||||
|
data.setDeviceId(deviceId);
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -191,6 +257,12 @@ public class MqttMessageController implements MqttPublisher, MqttSubscriber {
|
|||||||
String key = entry.getKey();
|
String key = entry.getKey();
|
||||||
// 提取记录ID(最后3位)
|
// 提取记录ID(最后3位)
|
||||||
String recordId = key.substring(key.length() - 3);
|
String recordId = key.substring(key.length() - 3);
|
||||||
|
try {
|
||||||
|
Long.parseLong(recordId);
|
||||||
|
} catch (Exception e) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
// 提取字段类型(前缀)
|
// 提取字段类型(前缀)
|
||||||
String fieldType = key.substring(0, key.length() - 3);
|
String fieldType = key.substring(0, key.length() - 3);
|
||||||
|
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package com.xzzn.common.utils;
|
package com.xzzn.common.utils;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Collection;
|
import java.util.Collection;
|
||||||
import java.util.HashSet;
|
import java.util.HashSet;
|
||||||
@ -719,4 +720,15 @@ public class StringUtils extends org.apache.commons.lang3.StringUtils
|
|||||||
}
|
}
|
||||||
return sb.toString();
|
return sb.toString();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
public static BigDecimal getBigDecimal(Object s){
|
||||||
|
|
||||||
|
try {
|
||||||
|
return new BigDecimal(s.toString());
|
||||||
|
} catch (NumberFormatException e) {
|
||||||
|
return BigDecimal.ZERO;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
@ -12,7 +12,7 @@ import com.xzzn.common.annotation.Excel;
|
|||||||
* PCS数据对象 ems_pcs_data
|
* PCS数据对象 ems_pcs_data
|
||||||
*
|
*
|
||||||
* @author xzzn
|
* @author xzzn
|
||||||
* @date 2025-06-17
|
* @date 2025-06-28
|
||||||
*/
|
*/
|
||||||
public class EmsPcsData extends BaseEntity
|
public class EmsPcsData extends BaseEntity
|
||||||
{
|
{
|
||||||
@ -22,7 +22,7 @@ public class EmsPcsData extends BaseEntity
|
|||||||
private Long id;
|
private Long id;
|
||||||
|
|
||||||
/** 数据更新时间 */
|
/** 数据更新时间 */
|
||||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||||
@Excel(name = "数据更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
@Excel(name = "数据更新时间", width = 30, dateFormat = "yyyy-MM-dd")
|
||||||
private Date dataUpdateTime;
|
private Date dataUpdateTime;
|
||||||
|
|
||||||
@ -132,11 +132,63 @@ public class EmsPcsData extends BaseEntity
|
|||||||
|
|
||||||
/** 月 */
|
/** 月 */
|
||||||
@Excel(name = "月")
|
@Excel(name = "月")
|
||||||
private int dateMonth;
|
private Long dateMonth;
|
||||||
|
|
||||||
/** 日 */
|
/** 日 */
|
||||||
@Excel(name = "日")
|
@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)
|
public void setId(Long id)
|
||||||
{
|
{
|
||||||
@ -418,20 +470,154 @@ public class EmsPcsData extends BaseEntity
|
|||||||
return deviceId;
|
return deviceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getDateMonth() {
|
public void setDateMonth(Long dateMonth)
|
||||||
return dateMonth;
|
{
|
||||||
}
|
|
||||||
|
|
||||||
public void setDateMonth(int dateMonth) {
|
|
||||||
this.dateMonth = 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;
|
return dateDay;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setDateDay(int dateDay) {
|
public void setTotalAcChargeEnergy(BigDecimal totalAcChargeEnergy)
|
||||||
this.dateDay = dateDay;
|
{
|
||||||
|
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
|
@Override
|
||||||
@ -472,7 +658,19 @@ public class EmsPcsData extends BaseEntity
|
|||||||
.append("deviceId", getDeviceId())
|
.append("deviceId", getDeviceId())
|
||||||
.append("dateMonth", getDateMonth())
|
.append("dateMonth", getDateMonth())
|
||||||
.append("dateDay", getDateDay())
|
.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();
|
.toString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,11 +40,23 @@
|
|||||||
<result property="deviceId" column="device_id" />
|
<result property="deviceId" column="device_id" />
|
||||||
<result property="dateMonth" column="date_month" />
|
<result property="dateMonth" column="date_month" />
|
||||||
<result property="dateDay" column="date_day" />
|
<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>
|
</resultMap>
|
||||||
|
|
||||||
<sql id="selectEmsPcsDataVo">
|
<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>
|
</sql>
|
||||||
|
|
||||||
<select id="selectEmsPcsDataList" parameterType="EmsPcsData" resultMap="EmsPcsDataResult">
|
<select id="selectEmsPcsDataList" parameterType="EmsPcsData" resultMap="EmsPcsDataResult">
|
||||||
@ -76,10 +88,22 @@
|
|||||||
<if test="dcVoltage != null "> and dc_voltage = #{dcVoltage}</if>
|
<if test="dcVoltage != null "> and dc_voltage = #{dcVoltage}</if>
|
||||||
<if test="dcCurrent != null "> and dc_current = #{dcCurrent}</if>
|
<if test="dcCurrent != null "> and dc_current = #{dcCurrent}</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 deviceId != ''"> and device_id = #{deviceId}</if>
|
||||||
<if test="dateMonth != null "> and date_month = #{dateMonth}</if>
|
<if test="dateMonth != null "> and date_month = #{dateMonth}</if>
|
||||||
<if test="dateDay != null "> and date_day = #{dateDay}</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>
|
</where>
|
||||||
</select>
|
</select>
|
||||||
|
|
||||||
@ -122,10 +146,22 @@
|
|||||||
<if test="updateTime != null">update_time,</if>
|
<if test="updateTime != null">update_time,</if>
|
||||||
<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 and deviceId != ''">device_id,</if>
|
||||||
<if test="dateMonth != null">date_month,</if>
|
<if test="dateMonth != null">date_month,</if>
|
||||||
<if test="dateDay != null">date_day,</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>
|
||||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||||
<if test="dataUpdateTime != null">#{dataUpdateTime},</if>
|
<if test="dataUpdateTime != null">#{dataUpdateTime},</if>
|
||||||
@ -159,10 +195,22 @@
|
|||||||
<if test="updateTime != null">#{updateTime},</if>
|
<if test="updateTime != null">#{updateTime},</if>
|
||||||
<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 and deviceId != ''">#{deviceId},</if>
|
||||||
<if test="dateMonth != null">#{dateMonth},</if>
|
<if test="dateMonth != null">#{dateMonth},</if>
|
||||||
<if test="dateDay != null">#{dateDay},</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>
|
</trim>
|
||||||
</insert>
|
</insert>
|
||||||
|
|
||||||
@ -200,10 +248,22 @@
|
|||||||
<if test="updateTime != null">update_time = #{updateTime},</if>
|
<if test="updateTime != null">update_time = #{updateTime},</if>
|
||||||
<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 and deviceId != ''">device_id = #{deviceId},</if>
|
||||||
<if test="dateMonth != null">date_month = #{dateMonth},</if>
|
<if test="dateMonth != null">date_month = #{dateMonth},</if>
|
||||||
<if test="dateDay != null">date_day = #{dateDay},</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>
|
</trim>
|
||||||
where id = #{id}
|
where id = #{id}
|
||||||
</update>
|
</update>
|
||||||
@ -218,81 +278,4 @@
|
|||||||
#{id}
|
#{id}
|
||||||
</foreach>
|
</foreach>
|
||||||
</delete>
|
</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) <= 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>
|
</mapper>
|
Reference in New Issue
Block a user