对接成都市平台接口
This commit is contained in:
parent
4a5f38b6ae
commit
f445cb9c83
@ -0,0 +1,34 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-20 14:13
|
||||
*/
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
@Data
|
||||
public class CDChargeFeeDetail {
|
||||
|
||||
@JsonProperty("EquipmentType")
|
||||
Integer equipmentType;
|
||||
|
||||
@JsonProperty("StartTime")
|
||||
String startTime;
|
||||
|
||||
@JsonProperty("EndTime")
|
||||
String endTime;
|
||||
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
@JsonProperty("ElectricityFee")
|
||||
Double electricityFee;
|
||||
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
@JsonProperty("serviceFee")
|
||||
Double serviceFee;
|
||||
}
|
||||
@ -6,6 +6,8 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-07 15:16
|
||||
@ -15,13 +17,9 @@ import lombok.Data;
|
||||
"StartChargeSeq",
|
||||
"ConnectorID",
|
||||
"ConnectorStatus",
|
||||
"Vin",
|
||||
"OrderStatus",
|
||||
"CurrentA",
|
||||
"CurrentB",
|
||||
"CurrentC",
|
||||
"VoltageA",
|
||||
"VoltageB",
|
||||
"VoltageC",
|
||||
"Soc",
|
||||
"StartTime",
|
||||
"EndTime",
|
||||
@ -30,7 +28,11 @@ import lombok.Data;
|
||||
"TotalPower",
|
||||
"ElecMoney",
|
||||
"SeviceMoney",
|
||||
"TotalMoney"
|
||||
"TotalMoney",
|
||||
"OperatorID",
|
||||
"EquipmentOwnerID",
|
||||
"StationID",
|
||||
"EquipmentID"
|
||||
})
|
||||
@Data
|
||||
public class CDConnectorChargeStatusInfo {
|
||||
@ -50,44 +52,52 @@ public class CDConnectorChargeStatusInfo {
|
||||
@JsonProperty("ConnectorStatus")
|
||||
public Integer connectorStatus;
|
||||
/**
|
||||
* 车辆识别码
|
||||
*/
|
||||
@JsonProperty("Vin")
|
||||
public String vin;
|
||||
* 充电订单状态
|
||||
* */
|
||||
@JsonProperty("OrderStatus")
|
||||
public Integer orderStatus;
|
||||
|
||||
|
||||
// /**
|
||||
// * 车辆识别码
|
||||
// */
|
||||
// @JsonProperty("Vin")
|
||||
// public String vin;
|
||||
/**
|
||||
* A 相电流
|
||||
*/
|
||||
@JsonProperty("CurrentA")
|
||||
public Double currentA;
|
||||
/**
|
||||
* B 相电流
|
||||
*/
|
||||
@JsonProperty("CurrentB")
|
||||
public Double currentB;
|
||||
/**
|
||||
* C 相电流
|
||||
*/
|
||||
@JsonProperty("CurrentC")
|
||||
public Double currentC;
|
||||
// /**
|
||||
// * B 相电流
|
||||
// */
|
||||
// @JsonProperty("CurrentB")
|
||||
// public Double currentB;
|
||||
// /**
|
||||
// * C 相电流
|
||||
// */
|
||||
// @JsonProperty("CurrentC")
|
||||
// public Double currentC;
|
||||
/**
|
||||
* A 相电压
|
||||
*/
|
||||
@JsonProperty("VoltageA")
|
||||
public Double voltageA;
|
||||
/**
|
||||
* B 相电压
|
||||
*/
|
||||
@JsonProperty("VoltageB")
|
||||
public Double voltageB;
|
||||
/**
|
||||
* C 相电压
|
||||
*/
|
||||
@JsonProperty("VoltageC")
|
||||
public Double voltageC;
|
||||
// /**
|
||||
// * B 相电压
|
||||
// */
|
||||
// @JsonProperty("VoltageB")
|
||||
// public Double voltageB;
|
||||
// /**
|
||||
// * C 相电压
|
||||
// */
|
||||
// @JsonProperty("VoltageC")
|
||||
// public Double voltageC;
|
||||
/**
|
||||
* 电池剩余电量
|
||||
*/
|
||||
@JsonProperty("Soc")
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
public Double soc;
|
||||
/**
|
||||
* 开始充电时间
|
||||
@ -113,21 +123,44 @@ public class CDConnectorChargeStatusInfo {
|
||||
* 累计充电量
|
||||
*/
|
||||
@JsonProperty("TotalPower")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double totalPower;
|
||||
/**
|
||||
* 累计电费
|
||||
*/
|
||||
@JsonProperty("ElecMoney")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double elecMoney;
|
||||
/**
|
||||
* 累计服务费
|
||||
*/
|
||||
@JsonProperty("SeviceMoney")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double seviceMoney;
|
||||
/**
|
||||
* 累计总金额
|
||||
*/
|
||||
@JsonProperty("TotalMoney")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double totalMoney;
|
||||
|
||||
/**
|
||||
* 运营平台 ID
|
||||
*/
|
||||
@JsonProperty("OperatorID")
|
||||
public String operatorID;
|
||||
/**
|
||||
* 产权所属单位ID
|
||||
*/
|
||||
@JsonProperty("EquipmentOwnerID")
|
||||
public String equipmentOwnerID;
|
||||
/**
|
||||
* 充电站ID
|
||||
*/
|
||||
@JsonProperty("StationID")
|
||||
public String stationID;
|
||||
/**
|
||||
* 充电设备编码
|
||||
*/
|
||||
@JsonProperty("EquipmentID")
|
||||
public String equipmentID;
|
||||
}
|
||||
|
||||
@ -0,0 +1,81 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-27 17:35
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"ConnectorID",
|
||||
"ConnectorName",
|
||||
"ConnectorType",
|
||||
"VoltageUpperLimits",
|
||||
"VoltageLowerLimits",
|
||||
"Current",
|
||||
"Power",
|
||||
"NationalStandard",
|
||||
"EquipmentClassification",
|
||||
"AuxPower",
|
||||
"OpreateStatus"
|
||||
})
|
||||
@Data
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class CDConnectorInfo {
|
||||
|
||||
@JsonProperty("ConnectorID")
|
||||
public String connectorID;
|
||||
@JsonProperty("ConnectorName")
|
||||
public String connectorName;
|
||||
// 1:家用插座(模式 2)
|
||||
// 2:交流接口插座(模式 3, 连接方式 B )
|
||||
// 3:交流接口插头(带枪线, 模式 3,连接方式 C)
|
||||
// 4:直流接口枪头(带枪线, 模式 4)
|
||||
// 5:无线充电座
|
||||
// 6:其他
|
||||
@JsonProperty("ConnectorType")
|
||||
public Integer connectorType;
|
||||
@JsonProperty("VoltageUpperLimits")
|
||||
public Integer voltageUpperLimits;
|
||||
@JsonProperty("VoltageLowerLimits")
|
||||
public Integer voltageLowerLimits;
|
||||
@JsonProperty("Current")
|
||||
public Integer current;
|
||||
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
@JsonProperty("Power")
|
||||
public Double power;
|
||||
// @JsonProperty("ParkNo")
|
||||
// public String ParkNo;
|
||||
@JsonProperty("NationalStandard")
|
||||
public Integer nationalStandard;
|
||||
/**
|
||||
* 设备接口分类
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("EquipmentClassification")
|
||||
public Integer equipmentClassification;
|
||||
/**
|
||||
* 辅助电源
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("AuxPower")
|
||||
public Integer auxPower;
|
||||
/**
|
||||
* 运营状态
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("OpreateStatus")
|
||||
public Integer opreateStatus;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-28 9:51
|
||||
*/
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"OperatorID",
|
||||
"EquipmentOwnerID",
|
||||
"StationID",
|
||||
"EquipmentID",
|
||||
"EquipmentClassification",
|
||||
"ConnectorID",
|
||||
"Status"
|
||||
})
|
||||
@Setter
|
||||
@Getter
|
||||
public class CDConnectorStatusInfo {
|
||||
|
||||
/**
|
||||
* 运营平台 ID
|
||||
*/
|
||||
@JsonProperty("OperatorID")
|
||||
public String operatorID;
|
||||
/**
|
||||
* 产权所属单位ID
|
||||
*/
|
||||
@JsonProperty("EquipmentOwnerID")
|
||||
public String equipmentOwnerID;
|
||||
/**
|
||||
* 充电站 ID
|
||||
*/
|
||||
@JsonProperty("StationID")
|
||||
public String stationID;
|
||||
/**
|
||||
* 充电设备编码
|
||||
*/
|
||||
@JsonProperty("EquipmentID")
|
||||
public String equipmentID;
|
||||
/**
|
||||
* 设备接口分类
|
||||
*/
|
||||
@JsonProperty("EquipmentClassification")
|
||||
public Integer equipmentClassification;
|
||||
/**
|
||||
* 充电设备接口编码
|
||||
*/
|
||||
@JsonProperty("ConnectorID")
|
||||
public String connectorID;
|
||||
/**
|
||||
* 充电设备接口状态
|
||||
*/
|
||||
@JsonProperty("Status")
|
||||
public Integer status;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,44 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-10-08 15:18
|
||||
*/
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class CDConnectorStatusInfoReq {
|
||||
@JsonProperty("ConnectorStatusInfo")
|
||||
private CDConnectorStatusInfo connectorStatusInfo;
|
||||
|
||||
@JsonIgnore
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
|
||||
@JsonProperty("ConnectorStatusInfo")
|
||||
public CDConnectorStatusInfo getConnectorStatusInfo() {
|
||||
|
||||
return connectorStatusInfo;
|
||||
}
|
||||
|
||||
@JsonProperty("ConnectorStatusInfo")
|
||||
public void setConnectorStatusInfo(CDConnectorStatusInfo connectorStatusInfo) {
|
||||
|
||||
this.connectorStatusInfo = connectorStatusInfo;
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
public Map<String, Object> getAdditionalProperties() {
|
||||
|
||||
return this.additionalProperties;
|
||||
}
|
||||
|
||||
@JsonAnySetter
|
||||
public void setAdditionalProperty(String name, Object value) {
|
||||
|
||||
this.additionalProperties.put(name, value);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-20 15:24
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class CDEquipAuthRequest {
|
||||
|
||||
@JsonProperty("EquipAuthSeq")
|
||||
String equipAuthSeq;
|
||||
@JsonProperty("ConnectorID")
|
||||
String connectorId;
|
||||
@JsonProperty("QRCode")
|
||||
String qRCode;
|
||||
}
|
||||
@ -29,7 +29,8 @@ import java.util.List;
|
||||
"EquipmentPower",
|
||||
"NewNationalStandard",
|
||||
"ConnectorInfos",
|
||||
"VinFlag"
|
||||
"VinFlag",
|
||||
"EquipmentClassificatlon"
|
||||
})
|
||||
@Data
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
@ -111,7 +112,7 @@ public class CDEquipmentInfo {
|
||||
* 充电设备 接口列表
|
||||
*/
|
||||
@JsonProperty("ConnectorInfos")
|
||||
public List<ConnectorInfo> connectorInfos;
|
||||
public List<CDConnectorInfo> connectorInfos;
|
||||
/**
|
||||
* 充 电 设 备 经度
|
||||
*/
|
||||
@ -127,4 +128,9 @@ public class CDEquipmentInfo {
|
||||
*/
|
||||
@JsonProperty("VinFlag")
|
||||
public Integer vinFlag;
|
||||
/**
|
||||
* 设备分类
|
||||
*/
|
||||
@JsonProperty("EquipmentClassificatlon")
|
||||
public Integer equipmentClassificatlon;
|
||||
}
|
||||
|
||||
@ -0,0 +1,75 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-27 10:41
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"StartChargeSeq",
|
||||
"ConnectorID",
|
||||
"TotalPower",
|
||||
"TotalMoney",
|
||||
"TaxiOrder",
|
||||
"SubsidyMoney",
|
||||
"SettlementMoney"
|
||||
})
|
||||
@Data
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class CDNotificationOrderSettlementInfoRequest {
|
||||
|
||||
/**
|
||||
* 充电订单号
|
||||
*/
|
||||
@JsonProperty("StartChargeSeq")
|
||||
public String startChargeSeq;
|
||||
|
||||
/**
|
||||
* 充电设备接口 编码
|
||||
*/
|
||||
@JsonProperty("ConnectorID")
|
||||
public String connectorID;
|
||||
|
||||
/**
|
||||
* 累计充电量
|
||||
*/
|
||||
@JsonProperty("TotalPower")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double totalPower;
|
||||
|
||||
/**
|
||||
* 累计总金额
|
||||
*/
|
||||
@JsonProperty("TotalMoney")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double totalMoney;
|
||||
|
||||
/**
|
||||
* 是否出租车订单
|
||||
*/
|
||||
@JsonProperty("TaxiOrder")
|
||||
public Integer taxiOrder;
|
||||
|
||||
/**
|
||||
* 补贴金额
|
||||
*/
|
||||
@JsonProperty("SubsidyMoney")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double subsidyMoney;
|
||||
|
||||
/**
|
||||
* 结算金额
|
||||
*/
|
||||
@JsonProperty("SettlementMoney")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double settlementMoney;
|
||||
}
|
||||
@ -3,9 +3,17 @@ package com.xhpc.evcs.cdjgpc.dto;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.xhpc.evcs.dto.ConnectorInfo;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.domain.XhpcStatisticsTimeInterval;
|
||||
import com.xhpc.evcs.dto.ChargeDetails;
|
||||
import com.xhpc.evcs.utils.DateUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.Date;
|
||||
import java.util.LinkedList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@ -19,15 +27,16 @@ import java.util.List;
|
||||
"StationID",
|
||||
"EquipmentID",
|
||||
"ConnectorID",
|
||||
"EquipmentClassification",
|
||||
"StartChargeSeq",
|
||||
"UserChargeType",
|
||||
"MobileNumber",
|
||||
"Money",
|
||||
"ElectMoney",
|
||||
"ServiceMoney",
|
||||
"Elect",
|
||||
"StartTime",
|
||||
"EndTime",
|
||||
"SwapOrderID",
|
||||
"PaymentAmount",
|
||||
"PayTime",
|
||||
"PayChannel",
|
||||
@ -38,7 +47,8 @@ import java.util.List;
|
||||
"ChargeLast",
|
||||
"MeterValueStart",
|
||||
"MeterValueEnd",
|
||||
"ChargeDetails"
|
||||
"ChargeDetails",
|
||||
"PushTimeStamp"
|
||||
})
|
||||
@Data
|
||||
public class CDOrderInfo {
|
||||
@ -67,6 +77,11 @@ public class CDOrderInfo {
|
||||
*/
|
||||
@JsonProperty("ConnectorID")
|
||||
public String connectorID;
|
||||
/**
|
||||
* 设备接口分类
|
||||
*/
|
||||
@JsonProperty("EquipmentClassification")
|
||||
public Integer equipmentClassification;
|
||||
/**
|
||||
* 充电订单号
|
||||
*/
|
||||
@ -80,27 +95,31 @@ public class CDOrderInfo {
|
||||
/**
|
||||
* 用户手机号
|
||||
*/
|
||||
@JsonProperty("MobileNumber")
|
||||
public String mobileNumber;
|
||||
// @JsonProperty("MobileNumber")
|
||||
// public String mobileNumber;
|
||||
/**
|
||||
* 本次充电消费总金额
|
||||
*/
|
||||
@JsonProperty("Money")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double money;
|
||||
/**
|
||||
* 本本次充电电费总金额
|
||||
*/
|
||||
@JsonProperty("ElectMoney")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double electMoney;
|
||||
/**
|
||||
* 本次充电 服务费金额
|
||||
*/
|
||||
@JsonProperty("ServiceMoney")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double serviceMoney;
|
||||
/**
|
||||
* 本次充电电量
|
||||
*/
|
||||
@JsonProperty("Elect")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double elect;
|
||||
/**
|
||||
* 本次充电开始时间
|
||||
@ -112,10 +131,16 @@ public class CDOrderInfo {
|
||||
*/
|
||||
@JsonProperty("EndTime")
|
||||
public String endTime;
|
||||
/**
|
||||
* 换电订单编号
|
||||
*/
|
||||
@JsonProperty("SwapOrderID")
|
||||
public String swapOrderID;
|
||||
/**
|
||||
* 支付金额
|
||||
*/
|
||||
@JsonProperty("PaymentAmount")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double paymentAmount;
|
||||
/**
|
||||
* 支付时
|
||||
@ -147,6 +172,7 @@ public class CDOrderInfo {
|
||||
* 接口额定功 率
|
||||
*/
|
||||
@JsonProperty("Power")
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
public Double power;
|
||||
/**
|
||||
* 充电时长
|
||||
@ -157,18 +183,110 @@ public class CDOrderInfo {
|
||||
* 电表总起值
|
||||
*/
|
||||
@JsonProperty("MeterValueStart")
|
||||
@Column(columnDefinition = "Decimal(10,3)")
|
||||
public Double meterValueStart;
|
||||
/**
|
||||
* 电表总止值
|
||||
*/
|
||||
@JsonProperty("MeterValueEnd")
|
||||
@Column(columnDefinition = "Decimal(10,3)")
|
||||
public Double meterValueEnd;
|
||||
/**
|
||||
* 充电明细信息
|
||||
*/
|
||||
@JsonProperty("ChargeDetails")
|
||||
public List<CDChargeDetails> chargeDetails;
|
||||
public ChargeDetails[] chargeDetails;
|
||||
/**
|
||||
* 推送时间
|
||||
*/
|
||||
@JsonProperty("PushTimeStamp")
|
||||
public String pushTimeStamp;
|
||||
|
||||
|
||||
public CDOrderInfo(XhpcHistoryOrder xhpcHistoryOrder, EtOrderMapping etOrderMapping) {
|
||||
this.operatorID =xhpcHistoryOrder.getOperatorIdEvcs();
|
||||
//this.operatorID = xhpcHistoryOrder.getOperatorId3rdptyEvcs();
|
||||
this.stationID =xhpcHistoryOrder.getChargingStationId().toString();
|
||||
this.equipmentID = xhpcHistoryOrder.getSerialNumber().substring(0, 14);
|
||||
this.connectorID = xhpcHistoryOrder.getSerialNumber().substring(0, 16);
|
||||
this.startChargeSeq = etOrderMapping.getEvcsOrderNo();
|
||||
this.equipmentClassification =1;
|
||||
this.userChargeType ="1";
|
||||
this.money = xhpcHistoryOrder.getTotalPrice().doubleValue();
|
||||
this.electMoney =xhpcHistoryOrder.getTotalPrice().doubleValue();
|
||||
this.serviceMoney = xhpcHistoryOrder.getServicePriceTotal().doubleValue();
|
||||
this.elect = xhpcHistoryOrder.getTotalPower();
|
||||
this.endTime = DateUtil.date2String(xhpcHistoryOrder.getEndTime(), DateUtil.DATE_FORMAT_DATE_TIME);
|
||||
this.startTime = DateUtil.date2String(xhpcHistoryOrder.getStartTime(), DateUtil.DATE_FORMAT_DATE_TIME);
|
||||
this.pushTimeStamp = DateUtil.date2String(new Date(), DateUtil.DATE_FORMAT_DATE_TIME);
|
||||
this.paymentAmount = xhpcHistoryOrder.getActPrice().doubleValue();
|
||||
if(xhpcHistoryOrder.getTotalPrice().compareTo(xhpcHistoryOrder.getActPrice())!=0){
|
||||
this.discountInfo ="优惠金额:"+xhpcHistoryOrder.getPromotionDiscount();
|
||||
}
|
||||
this.payTime =DateUtil.date2String(xhpcHistoryOrder.getEndTime(), DateUtil.DATE_FORMAT_DATE_TIME);
|
||||
if("支付宝".equals(xhpcHistoryOrder.getChargingMode())){
|
||||
this.payChannel =1;
|
||||
}else if("微信".equals(xhpcHistoryOrder.getChargingMode())){
|
||||
this.payChannel =2;
|
||||
}else{
|
||||
this.payChannel =6;
|
||||
}
|
||||
if(xhpcHistoryOrder.getStopReasonEvcs() !=null){
|
||||
String stopReasonEvcs = xhpcHistoryOrder.getStopReasonEvcs();
|
||||
if("40".equals(stopReasonEvcs)||"0".equals(stopReasonEvcs)||"00".equals(stopReasonEvcs)||"45".equals(stopReasonEvcs)||"APP 远程停止".equals(stopReasonEvcs)
|
||||
||"72".equals(stopReasonEvcs)){
|
||||
this.stopReason =0;
|
||||
}else if("41".equals(stopReasonEvcs) ||"42".equals(stopReasonEvcs)||"43".equals(stopReasonEvcs)||"44".equals(stopReasonEvcs)||"4E".equals(stopReasonEvcs)||"平台停止".equals(stopReasonEvcs)){
|
||||
this.stopReason =1;
|
||||
}else if("4A".equals(stopReasonEvcs) ||"4B".equals(stopReasonEvcs)||"4C".equals(stopReasonEvcs)||"4D".equals(stopReasonEvcs)||"4F".equals(stopReasonEvcs) ||
|
||||
"55".equals(stopReasonEvcs)||"57".equals(stopReasonEvcs)||"62".equals(stopReasonEvcs)||"63".equals(stopReasonEvcs)||"74".equals(stopReasonEvcs)||"75".equals(stopReasonEvcs)
|
||||
||"78".equals(stopReasonEvcs)||"79".equals(stopReasonEvcs)||"7A".equals(stopReasonEvcs)||"7B".equals(stopReasonEvcs)||"7C".equals(stopReasonEvcs)||"7D".equals(stopReasonEvcs)
|
||||
||"7E".equals(stopReasonEvcs)||"7F".equals(stopReasonEvcs)||"83".equals(stopReasonEvcs)){
|
||||
this.stopReason =3;
|
||||
}else if("5A".equals(stopReasonEvcs)||"82".equals(stopReasonEvcs)){
|
||||
this.stopReason =2;
|
||||
}else if("6B".equals(stopReasonEvcs) ||"6D".equals(stopReasonEvcs)||"5E".equals(stopReasonEvcs)){
|
||||
this.stopReason =4;
|
||||
}else{
|
||||
this.stopReason =0;
|
||||
}
|
||||
}else{
|
||||
this.stopReason =0;
|
||||
}
|
||||
this.power = xhpcHistoryOrder.getConnectorPowerEvcs();
|
||||
Date starttime = xhpcHistoryOrder.getStartTime();
|
||||
Date endtime = xhpcHistoryOrder.getEndTime();
|
||||
int cl = 0;
|
||||
if (starttime != null && endtime != null) {
|
||||
cl = Math.toIntExact((endtime.getTime() - starttime.getTime()) / 1000);
|
||||
}
|
||||
this.chargeLast = Math.abs(cl);
|
||||
if(xhpcHistoryOrder.getMeterValueStartEvcs() !=null && xhpcHistoryOrder.getMeterValueStartEvcs()>0){
|
||||
double v = xhpcHistoryOrder.getMeterValueStartEvcs() / 10000;
|
||||
DecimalFormat df = new DecimalFormat("#.000");
|
||||
this.meterValueStart =Double.parseDouble(df.format(v));
|
||||
}else{
|
||||
this.meterValueStart = xhpcHistoryOrder.getMeterValueStartEvcs();
|
||||
}
|
||||
if(xhpcHistoryOrder.getMeterValueEndEvcs() !=null && xhpcHistoryOrder.getMeterValueEndEvcs()>0){
|
||||
double v = xhpcHistoryOrder.getMeterValueEndEvcs() / 10000;
|
||||
DecimalFormat df = new DecimalFormat("#.000");
|
||||
this.meterValueEnd =Double.parseDouble(df.format(v));
|
||||
} else{
|
||||
this.meterValueEnd = xhpcHistoryOrder.getMeterValueEndEvcs();
|
||||
}
|
||||
final List<XhpcStatisticsTimeInterval> xhpcStatisticsTimeIntervalList =
|
||||
xhpcHistoryOrder.getXhpcStatisticsTimeIntervalList();
|
||||
this.sumPeriod = xhpcStatisticsTimeIntervalList == null ? 0 : xhpcStatisticsTimeIntervalList.size();
|
||||
this.chargeDetails = translate(xhpcStatisticsTimeIntervalList);
|
||||
}
|
||||
private ChargeDetails[] translate(List< XhpcStatisticsTimeInterval > xhpcStatisticsTimeIntervalList) {
|
||||
|
||||
List<ChargeDetails> details = new LinkedList<>();
|
||||
for (XhpcStatisticsTimeInterval statistics : xhpcStatisticsTimeIntervalList) {
|
||||
details.add(new ChargeDetails(statistics));
|
||||
}
|
||||
ChargeDetails[] a = new ChargeDetails[details.size()];
|
||||
return details.toArray(a);
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-10-11 19:38
|
||||
*/
|
||||
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
@Getter
|
||||
@Setter
|
||||
public class CDPageRequest {
|
||||
@JsonProperty("LastQueryTime")
|
||||
String lastQueryTime = "";
|
||||
@JsonProperty(value = "PageNo", defaultValue = "1") //CAUTION: PageNo must not wrote as PageNon or anything else
|
||||
Integer pageNo = 1;
|
||||
@JsonProperty(value = "PageSize", defaultValue = "10")
|
||||
Integer pageSize = 10;
|
||||
@JsonIgnore
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.xhpc.evcs.dto.StationInfo;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-16 18:10
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class CDPageStationsInfoResponse {
|
||||
@JsonProperty("PageCount")
|
||||
Integer PageCount;
|
||||
@JsonProperty("ItemSize")
|
||||
Integer ItemSize;
|
||||
@JsonProperty(value = "PageNo", defaultValue = "1") //CAUTION: PageNo must not wrote as PageNon or anything else
|
||||
Integer PageNo = 1;
|
||||
@JsonProperty("StationInfos")
|
||||
List<CDStationInfo> stationInfos = new ArrayList<>();
|
||||
}
|
||||
@ -0,0 +1,30 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-10-07 10:40
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class CDQuerySupEquipmentStatsInfoRequest {
|
||||
|
||||
@JsonProperty("StationID")
|
||||
String stationID;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonProperty("StartTime")
|
||||
String startTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
@JsonProperty("EndTime")
|
||||
String endTime;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-20 14:09
|
||||
*/
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
@Data
|
||||
public class CDStationFee {
|
||||
|
||||
@JsonProperty("OperatorID")
|
||||
String operatorID;
|
||||
|
||||
@JsonProperty("StationID")
|
||||
String stationID;
|
||||
|
||||
@JsonProperty("ChargeFeeDetail")
|
||||
List<CDChargeFeeDetail> chargeFeeDetails;
|
||||
|
||||
}
|
||||
@ -0,0 +1,15 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-20 14:57
|
||||
*/
|
||||
@Data
|
||||
public class CDStationFeeRequest {
|
||||
|
||||
@JsonProperty("StationIDs")
|
||||
String [] stationIDs;
|
||||
}
|
||||
@ -7,6 +7,7 @@ import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.xhpc.evcs.dto.CommonStationInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Transient;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
@ -26,6 +27,7 @@ import java.util.List;
|
||||
"Capacity",
|
||||
"CountryCode",
|
||||
"AreaCode",
|
||||
"AreaCodeCountryside",
|
||||
"Address",
|
||||
"StationTel",
|
||||
"ServiceTel",
|
||||
@ -36,7 +38,9 @@ import java.util.List;
|
||||
"StationLng",
|
||||
"StationLat",
|
||||
"Construction",
|
||||
"SwapMatchCars",
|
||||
"OpenAllDay",
|
||||
"ElectricityFee",
|
||||
"ServiceFee",
|
||||
"ParkFree",
|
||||
"ParkFee",
|
||||
@ -52,7 +56,18 @@ import java.util.List;
|
||||
"ParkingLockFlag",
|
||||
"IsDemandResponse",
|
||||
"IsSupportOrderlyCharging",
|
||||
"ISEnergystorage"
|
||||
"IsEnergyStorage",
|
||||
"stationClassification",
|
||||
"GeneralApplicationType",
|
||||
"RoundTheClock",
|
||||
"ParkType",
|
||||
"ElectncityType",
|
||||
"BusinessExpandType",
|
||||
"RatedPower",
|
||||
"PeriodFee",
|
||||
"OfficialRunTime",
|
||||
"VideoMonitor",
|
||||
"SwapEquipmentlnfos"
|
||||
})
|
||||
@Data
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
@ -77,12 +92,22 @@ public class CDStationInfo extends CommonStationInfo {
|
||||
@Transient
|
||||
@JsonProperty("Capacity")
|
||||
public Double capacity;
|
||||
|
||||
@Transient
|
||||
@JsonProperty("CountryCode")
|
||||
public String countryCcode;
|
||||
/**
|
||||
* 充电站省市辖区编码
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("AreaCode")
|
||||
public String areaCode;
|
||||
/**
|
||||
* 充电站省市辖区编码
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("AreaCodeCountryside")
|
||||
public String areaCodeCountryside;
|
||||
/**
|
||||
* 详情地址
|
||||
*/
|
||||
@ -161,6 +186,16 @@ public class CDStationInfo extends CommonStationInfo {
|
||||
// @Transient
|
||||
// @JsonProperty("MatchCars")
|
||||
// public String matchCars;
|
||||
/**
|
||||
* 服务车型描述
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("SwapMatchCars")
|
||||
public String[] swapMatchCars;
|
||||
|
||||
public String swapMatchCarsName;
|
||||
|
||||
|
||||
/**
|
||||
* 车位楼层及数量描述
|
||||
*/
|
||||
@ -194,9 +229,9 @@ public class CDStationInfo extends CommonStationInfo {
|
||||
/**
|
||||
* 充 电 电 费 率
|
||||
*/
|
||||
// @Transient
|
||||
// @JsonProperty("ElectricityFee")
|
||||
// public String electricityFee;
|
||||
@Transient
|
||||
@JsonProperty("ElectricityFee")
|
||||
public String electricityFee;
|
||||
/**
|
||||
* 服务费率
|
||||
*/
|
||||
@ -303,7 +338,71 @@ public class CDStationInfo extends CommonStationInfo {
|
||||
* 有是否有储能设备
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("ISEnergystorage")
|
||||
public Integer iSEnergystorage;
|
||||
@JsonProperty("IsEnergyStorage")
|
||||
public Integer isEnergyStorage;
|
||||
/**
|
||||
* 站点分类
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("StationClassification")
|
||||
public Integer stationClassification;
|
||||
/**
|
||||
* 通用类型
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("GeneralApplicationType")
|
||||
public Integer generalApplicationType;
|
||||
/**
|
||||
* 7*24小时营业
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("RoundTheClock")
|
||||
public Integer roundTheClock;
|
||||
/**
|
||||
* 停车费类型
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("ParkType")
|
||||
public Integer parkType;
|
||||
/**
|
||||
* 电费类型
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("ElectncityType")
|
||||
public Integer electncityType;
|
||||
/**
|
||||
* 报装类型
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("BusinessExpandType")
|
||||
public Integer businessExpandType;
|
||||
/**
|
||||
* 站点额定总功率
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("RatedPower")
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
public Double ratedPower;
|
||||
/**
|
||||
* 峰谷分时
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("PeriodFee")
|
||||
public Integer periodFee;
|
||||
/**
|
||||
* 正式投运时间
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("OfficialRunTime")
|
||||
public String officialRunTime;
|
||||
/**
|
||||
* 视频监控配套情况
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("VideoMonitor")
|
||||
public Integer videoMonitor;
|
||||
|
||||
@Transient
|
||||
@JsonProperty("SwapEquipmentlnfos")
|
||||
public List<CDSwapEquipmentlnfos> swapEquipmentlnfos = null;
|
||||
}
|
||||
|
||||
@ -0,0 +1,93 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.xhpc.evcs.dto.EquipmentStatsInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-28 10:18
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"StationID",
|
||||
"StartTime",
|
||||
"EndTime",
|
||||
"StationElectricity",
|
||||
"EquipmentStatsInfos",
|
||||
"StationClassification",
|
||||
"OperatorID",
|
||||
"EquipmentOnwerID",
|
||||
"StationTotalChargeTime",
|
||||
"StationTotalChargeNum",
|
||||
"StationTotalWarningNum"
|
||||
})
|
||||
@Data
|
||||
public class CDStationStatslnfo {
|
||||
|
||||
/**
|
||||
* 充电设ID
|
||||
*/
|
||||
@JsonProperty("StationID")
|
||||
public String stationID;
|
||||
/**
|
||||
* 统计的开始时间
|
||||
*/
|
||||
@JsonProperty("StartTime")
|
||||
public String startTime;
|
||||
/**
|
||||
* 统计结束时间
|
||||
*/
|
||||
@JsonProperty("EndTime")
|
||||
public String endTime;
|
||||
/**
|
||||
* 充电站累计电量
|
||||
*/
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
@JsonProperty("StationElectricity")
|
||||
public Double stationElectricity;
|
||||
/**
|
||||
* 充电设备统计信息列表
|
||||
*/
|
||||
@JsonProperty("EquipmentStatsInfos")
|
||||
List<CDSuqEquipmentStatslnfo> equipmentStatsInfo;
|
||||
/**
|
||||
* 站点分类
|
||||
*/
|
||||
@JsonProperty("StationClassification")
|
||||
public Integer stationClassification;
|
||||
/**
|
||||
* 运营平台ID
|
||||
*/
|
||||
@JsonProperty("OperatorID")
|
||||
public String operatorID;
|
||||
/**
|
||||
* 产权所属单位ID
|
||||
*/
|
||||
@JsonProperty("EquipmentOnwerID")
|
||||
public String equipmentOnwerID;
|
||||
|
||||
/**
|
||||
* 充电站累计用电时长
|
||||
*/
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
@JsonProperty("StationTotalChargeTime")
|
||||
public Double stationTotalChargeTime;
|
||||
/**
|
||||
* 充电站累计充电次数
|
||||
*/
|
||||
@JsonProperty("StationTotalChargeNum")
|
||||
public Integer stationTotalChargeNum;
|
||||
/**
|
||||
* 充电站累计告警数量
|
||||
*/
|
||||
@JsonProperty("StationTotalWarningNum")
|
||||
public Integer stationTotalWarningNum;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-28 10:09
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"OperatorID",
|
||||
"EquipmentOnwerID",
|
||||
"StatlonID",
|
||||
"ConnectorStatusInfos"
|
||||
})
|
||||
@Data
|
||||
public class CDStationStatusInfo {
|
||||
/**
|
||||
* 运营平台ID
|
||||
*/
|
||||
@JsonProperty("OperatorID")
|
||||
public String operatorID;
|
||||
/**
|
||||
* 产权所属单位
|
||||
*/
|
||||
@JsonProperty("EquipmentOnwerID")
|
||||
public String equipmentOnwerID;
|
||||
/**
|
||||
* 充电设ID
|
||||
*/
|
||||
@JsonProperty("StationID")
|
||||
public String stationID;
|
||||
|
||||
/**
|
||||
* 充电设备接口状态列表
|
||||
*/
|
||||
@JsonProperty("ConnectorStatusInfos")
|
||||
public List<CDConnectorStatusInfo> connectorStatusInfos;
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-10-08 15:52
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"Total",
|
||||
"StationStatusInfos"
|
||||
})
|
||||
public class CDStationStatusInfoWrapper {
|
||||
@JsonProperty("Total")
|
||||
private Integer total;
|
||||
@JsonProperty("StationStatusInfos")
|
||||
private List<CDStationStatusInfo> stationStatusInfos = null;
|
||||
@JsonIgnore
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
|
||||
@JsonProperty("Total")
|
||||
public Integer getTotal() {
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
@JsonProperty("Total")
|
||||
public void setTotal(Integer total) {
|
||||
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
@JsonProperty("StationStatusInfos")
|
||||
public List<CDStationStatusInfo> getStationStatusInfos() {
|
||||
|
||||
return stationStatusInfos;
|
||||
}
|
||||
|
||||
@JsonProperty("StationStatusInfos")
|
||||
public void setStationStatusInfos(List<CDStationStatusInfo> stationStatusInfos) {
|
||||
|
||||
this.stationStatusInfos = stationStatusInfos;
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
public Map<String, Object> getAdditionalProperties() {
|
||||
|
||||
return this.additionalProperties;
|
||||
}
|
||||
|
||||
@JsonAnySetter
|
||||
public void setAdditionalProperty(String name, Object value) {
|
||||
|
||||
this.additionalProperties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
return new ToStringBuilder(this).append("total", total).append("stationStatusInfos", stationStatusInfos).append(
|
||||
"additionalProperties", additionalProperties).toString();
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,52 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.Column;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-28 10:51
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"ConnectorID",
|
||||
"EquipmentClassification",
|
||||
"DataTime",
|
||||
"ConnectorRealTimePower"
|
||||
})
|
||||
@Data
|
||||
public class CDSupConnectorPowerInfo {
|
||||
|
||||
/**
|
||||
* 充电设备接口编码
|
||||
*/
|
||||
@JsonProperty("ConnectorID")
|
||||
public String connectorID;
|
||||
/**
|
||||
* 设备分类
|
||||
*/
|
||||
@JsonProperty("EquipmentClassification")
|
||||
public Integer equipmentClassification;
|
||||
/**
|
||||
* 统计时间
|
||||
*/
|
||||
@JsonProperty("DataTime")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
public String dataTime;
|
||||
/**
|
||||
* 充电设备接口实时功率
|
||||
*/
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
@JsonProperty("ConnectorRealTimePower")
|
||||
public Double connectorRealTimePower;
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,61 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-28 10:37
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"ConnectorID",
|
||||
"ConnectorElectricity",
|
||||
"EquipmentClassification",
|
||||
"ConnectorTotalChargeTime",
|
||||
"ConnectorTotalChargeNum",
|
||||
"ConnectorTotalWarningNum"
|
||||
})
|
||||
@Setter
|
||||
@Getter
|
||||
public class CDSupConnectorStatslnfo {
|
||||
|
||||
/**
|
||||
* 充电设备接口编码
|
||||
*/
|
||||
@JsonProperty("ConnectorID")
|
||||
public String connectorID;
|
||||
/**
|
||||
* 充电设备接口累计电量
|
||||
*/
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
@JsonProperty("ConnectorElectricity")
|
||||
public Double connectorElectricity;
|
||||
/**
|
||||
* 设备分类
|
||||
*/
|
||||
@JsonProperty("EquipmentClassification")
|
||||
public Integer equipmentClassification;
|
||||
/**
|
||||
* 充电设备接口累计充电时长
|
||||
*/
|
||||
@JsonProperty("ConnectorTotalChargeTime")
|
||||
public Integer connectorTotalChargeTime;
|
||||
/**
|
||||
* 充电设备接口累计充电次数
|
||||
*/
|
||||
@JsonProperty("ConnectorTotalChargeNum")
|
||||
public Integer connectorTotalChargeNum;
|
||||
/**
|
||||
* 充电设备接口累计告警
|
||||
*/
|
||||
@JsonProperty("ConnectorTotalWarningNum")
|
||||
public Integer connectorTotalWarningNum;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,83 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-28 11:03
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"AreaCode",
|
||||
"Address",
|
||||
"AccidentEntity",
|
||||
"Type",
|
||||
"AccidentReason",
|
||||
"Level",
|
||||
"AccidentTime",
|
||||
"Description",
|
||||
"Pictures",
|
||||
"AnalysisReport"
|
||||
})
|
||||
@Data
|
||||
public class CDSupEquipmentAccidentInfo {
|
||||
|
||||
/**
|
||||
* 区域代码
|
||||
*/
|
||||
@JsonProperty("AreaCode")
|
||||
public String areaCode;
|
||||
/**
|
||||
* 事故地点
|
||||
*/
|
||||
@JsonProperty("Address")
|
||||
public String address;
|
||||
/**
|
||||
* 事故主体
|
||||
*/
|
||||
@JsonProperty("AccidentEntity")
|
||||
public Integer accidentEntity;
|
||||
/**
|
||||
* 事故类型
|
||||
*/
|
||||
@JsonProperty("Type")
|
||||
public Integer type;
|
||||
/**
|
||||
* 事故原因
|
||||
*/
|
||||
@JsonProperty("AccidentReason")
|
||||
public String accidentReason;
|
||||
/**
|
||||
* 事故分级
|
||||
*/
|
||||
@JsonProperty("Level")
|
||||
public Integer level;
|
||||
/**
|
||||
* 发生时间
|
||||
*/
|
||||
@JsonProperty("AccidentTime")
|
||||
public String accidentTime;
|
||||
/**
|
||||
* 事故文字描述
|
||||
*/
|
||||
@JsonProperty("Description")
|
||||
public String description;
|
||||
/**
|
||||
* 现场图片
|
||||
*/
|
||||
@JsonProperty("Pictures")
|
||||
public String [] pictures;
|
||||
|
||||
public String picturesName;
|
||||
|
||||
/**
|
||||
* 事故分析报
|
||||
*/
|
||||
@JsonProperty("AnalysisReport")
|
||||
public String [] analysisReport;
|
||||
|
||||
public String analysisReportName;
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-10-09 19:20
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
|
||||
public class CDSupEquipmentAccidentInfoResponse {
|
||||
@JsonProperty("PageCount")
|
||||
Integer PageCount;
|
||||
@JsonProperty("ItemSize")
|
||||
Integer ItemSize;
|
||||
@JsonProperty(value = "PageNo", defaultValue = "1") //CAUTION: PageNo must not wrote as PageNon or anything else
|
||||
Integer PageNo = 1;
|
||||
@JsonProperty("EquipmentAccidentInfos")
|
||||
List<CDSupEquipmentAccidentInfo> supEquipmentAccidentInfos = new ArrayList<>();
|
||||
}
|
||||
@ -0,0 +1,54 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-28 10:47
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"EquipmentID",
|
||||
"EquipmentClassification",
|
||||
"DataTime",
|
||||
"EquipRealTimePower",
|
||||
"ConnectorPowerInfos"
|
||||
})
|
||||
@Data
|
||||
public class CDSupEquipmentPowerInfo {
|
||||
|
||||
public String pileID;
|
||||
/**
|
||||
* 充电设备编码
|
||||
*/
|
||||
@JsonProperty("EquipmentID")
|
||||
public String equipmentID;
|
||||
/**
|
||||
* 设备分类
|
||||
*/
|
||||
@JsonProperty("EquipmentClassification")
|
||||
public Integer equipmentClassification;
|
||||
/**
|
||||
* 统计时间
|
||||
*/
|
||||
@JsonProperty("DataTime")
|
||||
public String dataTime;
|
||||
/**
|
||||
* 统计时间
|
||||
*/
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
@JsonProperty("EquipRealTimePower")
|
||||
public Double equipRealTimePower;
|
||||
/**
|
||||
* 充电设备接口功率信息列表
|
||||
*/
|
||||
@JsonProperty("ConnectorPowerInfos")
|
||||
List<CDSupConnectorPowerInfo> connectorPowerInfos;
|
||||
|
||||
}
|
||||
@ -0,0 +1,63 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-28 10:44
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"OperatorlD",
|
||||
"EquipmentOnwerID",
|
||||
"StationID",
|
||||
"StationClassification",
|
||||
"DataTime",
|
||||
"StationRealTimePower",
|
||||
"EquipmentPowerInfos"
|
||||
})
|
||||
@Data
|
||||
public class CDSupStationPowerInfo {
|
||||
/**
|
||||
* 充电设备接口编码
|
||||
*/
|
||||
@JsonProperty("OperatorlD")
|
||||
public String operatorlD;
|
||||
/**
|
||||
* 产权所属单位ID
|
||||
*/
|
||||
@JsonProperty("EquipmentOnwerID")
|
||||
public String equipmentOnwerID;
|
||||
/**
|
||||
* 充电站
|
||||
*/
|
||||
@JsonProperty("StationID")
|
||||
public String stationID;
|
||||
/**
|
||||
* 站点分类
|
||||
*/
|
||||
@JsonProperty("StationClassification")
|
||||
public Integer stationClassification;
|
||||
/**
|
||||
* 统计时间
|
||||
*/
|
||||
@JsonProperty("DataTime")
|
||||
public String dataTime;
|
||||
/**
|
||||
* 充电站实时功率
|
||||
*/
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
@JsonProperty("StationRealTimePower")
|
||||
public Double stationRealTimePower;
|
||||
/**
|
||||
* 充电设备功率信息列表
|
||||
*/
|
||||
@JsonProperty("EquipmentPowerInfos")
|
||||
List<CDSupEquipmentPowerInfo> equipmentPowerInfos;
|
||||
}
|
||||
@ -0,0 +1,23 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-10-07 10:52
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class CDSuperviseQueryEquipmentPowerInfoRequest {
|
||||
|
||||
@JsonProperty("StationID")
|
||||
String stationID;
|
||||
|
||||
@JsonProperty("DataTime")
|
||||
String dataTime;
|
||||
}
|
||||
@ -0,0 +1,27 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-10-07 10:48
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class CDSuperviseQueryStationPowerInfoRequest {
|
||||
|
||||
@JsonProperty("StationIDs")
|
||||
String [] stationIDs;
|
||||
|
||||
@JsonProperty("DataTime")
|
||||
@JsonFormat(pattern = "yyyy-MM-dd")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd")
|
||||
String dataTime;
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-28 10:32
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"EquipmentID",
|
||||
"EquipmentClassification",
|
||||
"EquipmentElectncity",
|
||||
"EquipmentTotalChargeTime",
|
||||
"EquipmentTotalChargeNum",
|
||||
"EquipmentTotalWarningNum",
|
||||
"ConnectorStatsInfos"
|
||||
})
|
||||
@Setter
|
||||
@Getter
|
||||
public class CDSuqEquipmentStatslnfo {
|
||||
|
||||
/**
|
||||
* 充电设备编码
|
||||
*/
|
||||
@JsonProperty("EquipmentID")
|
||||
public String equipmentID;
|
||||
/**
|
||||
* 设备分类
|
||||
*/
|
||||
@JsonProperty("EquipmentClassification")
|
||||
public Integer equipmentClassification;
|
||||
/**
|
||||
* 充电设备累计电量
|
||||
*/
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
@JsonProperty("EquipmentElectncity")
|
||||
public Double equipmentElectncity;
|
||||
/**
|
||||
* 充电设备累计充电时长
|
||||
*/
|
||||
@JsonProperty("EquipmentTotalChargeTime")
|
||||
public Integer equipmentTotalChargeTime;
|
||||
/**
|
||||
* 充电累计充电次数
|
||||
*/
|
||||
@JsonProperty("EquipmentTotalChargeNum")
|
||||
public Integer equipmentTotalChargeNum;
|
||||
/**
|
||||
* 充电设备累计告警数量
|
||||
*/
|
||||
@JsonProperty("EquipmentTotalWarningNum")
|
||||
public Integer equipmentTotalWarningNum;
|
||||
/**
|
||||
* 充电设备接口运行统计列表
|
||||
*/
|
||||
@JsonProperty("ConnectorStatsInfos")
|
||||
List<CDSupConnectorStatslnfo> connectorStatsInfos;
|
||||
|
||||
}
|
||||
@ -0,0 +1,9 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-27 17:25
|
||||
*/
|
||||
public class CDSwapEquipmentlnfos {
|
||||
|
||||
}
|
||||
@ -130,6 +130,13 @@ public class XhpcChargingPile extends BaseEntity {
|
||||
@Column(name = "manufacturer_id")
|
||||
private String manufacturerId;
|
||||
|
||||
@Column(name = "equipment_classificatlon")
|
||||
private Integer equipmentClassificatlon;
|
||||
|
||||
@Column(name = "aux_power")
|
||||
private Integer auxPower;
|
||||
|
||||
|
||||
private String constructionTime;
|
||||
|
||||
public Integer getEquipmentType() {
|
||||
@ -486,6 +493,22 @@ public class XhpcChargingPile extends BaseEntity {
|
||||
this.constructionTime = constructionTime;
|
||||
}
|
||||
|
||||
public Integer getEquipmentClassificatlon() {
|
||||
return equipmentClassificatlon;
|
||||
}
|
||||
|
||||
public void setEquipmentClassificatlon(Integer equipmentClassificatlon) {
|
||||
this.equipmentClassificatlon = equipmentClassificatlon;
|
||||
}
|
||||
|
||||
public Integer getAuxPower() {
|
||||
return auxPower;
|
||||
}
|
||||
|
||||
public void setAuxPower(Integer auxPower) {
|
||||
this.auxPower = auxPower;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "XhpcChargingPile{" +
|
||||
@ -525,6 +548,7 @@ public class XhpcChargingPile extends BaseEntity {
|
||||
", equipmentStatus=" + equipmentStatus +
|
||||
", equipmentPurpose=" + equipmentPurpose +
|
||||
", manufacturerId='" + manufacturerId + '\'' +
|
||||
", equipmentClassificatlon='" + equipmentClassificatlon + '\'' +
|
||||
", constructionTime='" + constructionTime + '\'' +
|
||||
'}';
|
||||
}
|
||||
|
||||
@ -27,4 +27,8 @@ public class EquipAuthResponse {
|
||||
|
||||
@JsonProperty("FailReason")
|
||||
Integer failReason;
|
||||
|
||||
@JsonProperty("FailReasonMsg")
|
||||
String failReasonMsg;
|
||||
|
||||
}
|
||||
|
||||
@ -27,6 +27,9 @@ public class NotificationStartChargeResultRequestData {
|
||||
@JsonProperty("IdentCode")
|
||||
private String identCode;
|
||||
|
||||
@JsonProperty("FailReasonMsg")
|
||||
private String failReasonMsg;
|
||||
|
||||
@JsonProperty("StartChargeSeq")
|
||||
public String getStartChargeSeq() {
|
||||
|
||||
@ -87,6 +90,15 @@ public class NotificationStartChargeResultRequestData {
|
||||
this.identCode = identCode;
|
||||
}
|
||||
|
||||
@JsonProperty("FailReasonMsg")
|
||||
public String getFailReasonMsg() {
|
||||
return failReasonMsg;
|
||||
}
|
||||
|
||||
@JsonProperty("FailReasonMsg")
|
||||
public void setFailReasonMsg(String failReasonMsg) {
|
||||
this.failReasonMsg = failReasonMsg;
|
||||
}
|
||||
|
||||
@JsonIgnore
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
@ -103,6 +115,8 @@ public class NotificationStartChargeResultRequestData {
|
||||
this.additionalProperties.put(name, value);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
|
||||
@ -16,6 +16,7 @@ import lombok.Setter;
|
||||
"StartChargeSeqStat",
|
||||
"SuccStat",
|
||||
"FailReason",
|
||||
"FailReasonMsg",
|
||||
})
|
||||
public class QueryStopChargeResponse {
|
||||
|
||||
@ -27,5 +28,6 @@ public class QueryStopChargeResponse {
|
||||
int succStat;
|
||||
@JsonProperty("FailReason")
|
||||
int failReason;
|
||||
|
||||
@JsonProperty("FailReasonMsg")
|
||||
String failReasonMsg;
|
||||
}
|
||||
|
||||
@ -18,6 +18,9 @@ public class StartChargeRequest {
|
||||
@JsonProperty("QRCode")
|
||||
String qRCode;
|
||||
|
||||
@JsonProperty("PhoneNum")
|
||||
String PhoneNum;
|
||||
|
||||
@JsonProperty("PlateNum")
|
||||
String plateNum;
|
||||
|
||||
@ -33,6 +36,9 @@ public class StartChargeRequest {
|
||||
@JsonProperty("UserId")
|
||||
String userId3rdpty;
|
||||
|
||||
@JsonProperty("FailReasonMsg")
|
||||
String failReasonMsg;
|
||||
|
||||
@JsonIgnore
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
|
||||
@ -84,6 +90,16 @@ public class StartChargeRequest {
|
||||
this.qRCode = qRCode;
|
||||
}
|
||||
|
||||
@JsonProperty("PhoneNum")
|
||||
public String getPhoneNum() {
|
||||
return PhoneNum;
|
||||
}
|
||||
|
||||
@JsonProperty("PhoneNum")
|
||||
public void setPhoneNum(String phoneNum) {
|
||||
PhoneNum = phoneNum;
|
||||
}
|
||||
|
||||
@JsonProperty("PlateNum")
|
||||
public String getPlateNum() {
|
||||
|
||||
@ -144,4 +160,13 @@ public class StartChargeRequest {
|
||||
this.userId3rdpty = userId3rdpty;
|
||||
}
|
||||
|
||||
@JsonProperty("FailReasonMsg")
|
||||
public String getFailReasonMsg() {
|
||||
return failReasonMsg;
|
||||
}
|
||||
|
||||
@JsonProperty("FailReasonMsg")
|
||||
public void setFailReasonMsg(String failReasonMsg) {
|
||||
this.failReasonMsg = failReasonMsg;
|
||||
}
|
||||
}
|
||||
|
||||
@ -26,4 +26,7 @@ public class StartChargeResponse {
|
||||
|
||||
@JsonProperty("FailReason")
|
||||
Integer failReason;
|
||||
|
||||
@JsonProperty("FailReasonMsg")
|
||||
String failReasonMsg;
|
||||
}
|
||||
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
@ -11,10 +12,11 @@ import java.util.Map;
|
||||
"StartTime",
|
||||
"EndTime"
|
||||
})
|
||||
@Data
|
||||
public class StationStatsRequest {
|
||||
|
||||
@JsonProperty("StationID")
|
||||
private Integer stationID;
|
||||
private String stationID;
|
||||
@JsonProperty("StartTime")
|
||||
private String startTime;
|
||||
@JsonProperty("EndTime")
|
||||
@ -34,4 +36,16 @@ public class StationStatsRequest {
|
||||
this.additionalProperties.put(name, value);
|
||||
}
|
||||
|
||||
public String getStationID() {
|
||||
return stationID;
|
||||
}
|
||||
|
||||
public String getStartTime() {
|
||||
return startTime;
|
||||
}
|
||||
|
||||
public String getEndTime() {
|
||||
return endTime;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -113,4 +113,62 @@ public class QueryTokenController {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@PostMapping("/v10/query_token")
|
||||
public CommonResponse queryTokenV10(@RequestHeader(value = "enc.out", defaultValue = "true") String encout,
|
||||
@RequestBody TokenRequest tokenRequest) throws IOException {
|
||||
log.debug("<<query token request body: " + tokenRequest);
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
String operatorID = tokenRequest.getOperatorId();
|
||||
if (operatorID == null) {
|
||||
String decodedData = (String) tokenRequest.getAdditionalProperties().get("Data");
|
||||
tokenRequest = JSONUtil.readParams(decodedData, TokenRequest.class);
|
||||
}
|
||||
if (tokenRequest == null) {
|
||||
resp.setMsg("Request params validation failed");
|
||||
} else {
|
||||
operatorID = tokenRequest.getOperatorId();
|
||||
TokenResponse tokenResponse = new TokenResponse();
|
||||
tokenResponse.setOperatorId(REDIS.getCacheObject("global:EVCS_OPID"));
|
||||
tokenResponse.setSuccStat(0);
|
||||
tokenResponse.setFailReason(0);
|
||||
XhpcInternetUser xhpcInternetUser =
|
||||
xhpcInternetUserRepository.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(tokenRequest.getOperatorId(), Instant.now(), Instant.now());
|
||||
if (xhpcInternetUser != null) {
|
||||
String operatorSecret = tokenRequest.getOperatorSecret();
|
||||
AuthSecretToken authSecretTokenIn =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(
|
||||
operatorID, AuthSecretToken.SECRET_TOKEN_TYPE_IN, operatorSecret).orElse(null);
|
||||
if (authSecretTokenIn == null) {
|
||||
resp.setRet("4003");
|
||||
resp.setMsg("Invalid OperatorID/Secret");
|
||||
tokenResponse.setSuccStat(1);
|
||||
tokenResponse.setFailReason(2);
|
||||
} else {
|
||||
String token;
|
||||
if (authSecretTokenIn.getTokenExpiry() != null && !authSecretTokenIn.getTokenExpiry().before(Calendar.getInstance().getTime())) {
|
||||
token = authSecretTokenIn.getToken();
|
||||
} else {
|
||||
token = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
authSecretTokenIn.setToken(token);
|
||||
authSecretTokenIn.setTokenExpiry(getTokenExpiry(xhpcInternetUser));
|
||||
authSecretTokenRepository.save(authSecretTokenIn);
|
||||
}
|
||||
tokenResponse.setAccessToken(token);
|
||||
Instant te = authSecretTokenIn.getTokenExpiry().toInstant();
|
||||
tokenResponse.setTokenAvailableTime(Long.valueOf(ChronoUnit.SECONDS.between(Instant.now(), te)).intValue());
|
||||
tokenResponse.setSuccStat(0);
|
||||
tokenResponse.setFailReason(0);
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
resp.setMsg("Query token success");
|
||||
resp.setData(JSONUtil.toJSONString(tokenResponse));
|
||||
}
|
||||
} else {
|
||||
resp.setMsg("Cooperation settings or start time are not valid");
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,48 @@
|
||||
package com.xhpc.evcs.cdjgpc.api;
|
||||
|
||||
import com.xhpc.evcs.api.NotificationChargeOrderInfoController;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-24 19:15
|
||||
*/
|
||||
public class CDNotificationChargeOrderInfoController {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoController.class);
|
||||
/**
|
||||
* 推送充电订单信息
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v10/notification_charge_order_info")
|
||||
public CommonResponse notificationChargeOrderInfo(@RequestBody CommonRequest<CDChargeOrderInfo4BonusReq> commonRequest) throws IOException {
|
||||
String operatorID = commonRequest.getOperatorId();
|
||||
StationInfo stationInfo = new StationInfo();
|
||||
stationInfo.setOperatorId(operatorID);
|
||||
String data = commonRequest.getData();
|
||||
ChargeOrderInfo chargeOrderInfo = JSONUtil.readParams(data, ChargeOrderInfo.class);
|
||||
chargeOrderInfo.setInfraOperatorId("759588065"); //todo use common request operator id && check NPE
|
||||
chargeOrderInfo.setBillerOperatorId("MA6DFCTD5");
|
||||
// log.info(">>notify charge order OID: " + operatorID);
|
||||
// chargeOrderInfoRepository.save(chargeOrderInfo);
|
||||
CommonResponse response = new CommonResponse();
|
||||
response.setRet(EvcsConst.RET_SUCC);
|
||||
CDChargeOrder4BonusInfoRes resp = new CDChargeOrder4BonusInfoRes();
|
||||
resp.setConfirmResult(0);
|
||||
resp.setConnectorID(chargeOrderInfo.getConnectorID());
|
||||
resp.setStartChargeSeq(chargeOrderInfo.getStartChargeSeq());
|
||||
response.setData(JSONUtil.toJSONString(resp));
|
||||
return response;
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,27 +1,38 @@
|
||||
package com.xhpc.evcs.cdjgpc.api;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDEquipmentInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfoResponse;
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||
import com.xhpc.common.domain.XhpcTerminal;
|
||||
import com.xhpc.evcs.cdjgpc.dto.*;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.XhpcInternetUser;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcInternetUserRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcTerminalRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import static cn.hutool.core.util.NumberUtil.isInteger;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
|
||||
import java.util.stream.Collectors;
|
||||
import static com.xhpc.evcs.config.EvcsFilter.encryptReqOut;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_IN;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
@ -34,31 +45,55 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
||||
|
||||
|
||||
@Resource
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Resource
|
||||
XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
@Resource
|
||||
XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Resource
|
||||
XhpcTerminalRepository terminalRepository;
|
||||
@Resource
|
||||
PowerPileService powerPileService;
|
||||
|
||||
//充电站信息变化推送
|
||||
//充电站信息变化推送(我们平台推送成都市平台) --已推送
|
||||
@PostMapping("/v10/getNotificationStationInfo")
|
||||
public R getNotificationStationInfo(@RequestBody Map<String, Object> map){
|
||||
try{
|
||||
String chargingStationId = map.get("chargingStationId").toString();
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"765367656", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
"MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
// maybe对接第三方
|
||||
if (authSecretTokenOut != null) {
|
||||
//获取场站信息
|
||||
String key = "cdjgpc:station:".concat(chargingStationId)+".notification";
|
||||
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
|
||||
cdStationInfo.setEquipmentInfos(new ArrayList<>());
|
||||
//查询场站是桩是否对应上
|
||||
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+chargingStationId);
|
||||
Set<String> pks = stationDto.getPiles();
|
||||
if (pks != null) {
|
||||
List<CDEquipmentInfo> cdEquipmentInfos = new ArrayList<>();
|
||||
for (String pileNo : pks) {
|
||||
String pk = "pile:".concat(pileNo);
|
||||
String skey = "cdjgpc:".concat(pk)+".notification";
|
||||
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
|
||||
if(cdEquipmentInfo==null || "".equals(cdEquipmentInfo.getEquipmentID())){
|
||||
log.info("该场站下面:"+pileNo+"桩未录入");
|
||||
}else{
|
||||
cdEquipmentInfos.add(cdEquipmentInfo);
|
||||
}
|
||||
}
|
||||
cdStationInfo.setEquipmentInfos(cdEquipmentInfos);
|
||||
}
|
||||
cdStationInfo.setSwapMatchCarsName(null);
|
||||
CommonRequest<CDStationInfo> commonRequest = new CommonRequest<>();
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("StationInfo",cdStationInfo);
|
||||
String data =JSONUtil.toJSONString(mapStationInfo);
|
||||
commonRequest.setData(data);
|
||||
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut,"MA6DFCTD5");
|
||||
System.out.println("=======responseBody========"+result);
|
||||
CDStationInfoResponse cdStationInfoResponse = DTOJsonHelper.parseResponseData(result, CDStationInfoResponse.class, authSecretTokenOut);
|
||||
System.out.println("=======cdStationInfoResponse========"+cdStationInfoResponse.getStatus());
|
||||
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut);
|
||||
System.out.println("=======result========"+result);
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
@ -66,35 +101,725 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/v10/getNotificationStationStatus")
|
||||
public R getNotificationStationStatus(@RequestBody Map<String, Object> map){
|
||||
/**
|
||||
* 查询充电站信息(成都市平台调用我们平台) --已推送
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v10/query_stations_info")
|
||||
public CommonResponse queryStationsInfo(@RequestBody(required = false) CommonRequest<PageRequest> commonRequest) {
|
||||
|
||||
System.out.println("================查询充电站信息=======================");
|
||||
CommonResponse resp = new CommonResponse();
|
||||
try{
|
||||
//当前页数
|
||||
PageRequest pageRequest = commonRequest.transformDataType(PageRequest.class);
|
||||
Integer pageNo = pageRequest.getPageNo();
|
||||
CDPageStationsInfoResponse response = new CDPageStationsInfoResponse();
|
||||
response.setPageNo(pageNo);
|
||||
//页码总数
|
||||
String operatorId = commonRequest.getOperatorId();
|
||||
Instant now = Instant.now();
|
||||
XhpcInternetUser xhpcInternetUser =
|
||||
xhpcInternetUserRepository
|
||||
.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(operatorId, now, now);
|
||||
Long internetUserId = xhpcInternetUser.getInternetUserId();
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist =
|
||||
xhpcStationInternetBlacklistRepo.findByInternetUserId(internetUserId);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
List<String> validStationKeys = new ArrayList<>();
|
||||
for (String stationKey : stationKeys) {
|
||||
boolean isValid = true;
|
||||
//查询不合作的电桩
|
||||
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
|
||||
if (stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationKey);
|
||||
if (chargingStationDto.getPiles() != null) {
|
||||
if (isValid) {
|
||||
validStationKeys.add(stationKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (validStationKeys.size() > 0) {
|
||||
Integer pageSize = pageRequest.getPageSize();
|
||||
int totalPage = validStationKeys.size() % pageSize == 0 ? validStationKeys.size() / pageSize :
|
||||
(validStationKeys.size() / pageSize) + 1;
|
||||
response.setPageCount(totalPage);
|
||||
}
|
||||
//总记录条数
|
||||
response.setItemSize(validStationKeys.size());
|
||||
|
||||
//充电站信息列表
|
||||
List<CDStationInfo> stationInfos = new ArrayList<>();
|
||||
//计算每页开始索引
|
||||
int startIndex = -1;
|
||||
int endIndex = -1;
|
||||
if (pageNo == 1 && validStationKeys.size() <= 10) {
|
||||
startIndex = 0;
|
||||
endIndex = validStationKeys.size() - 1;
|
||||
} else {
|
||||
Integer pageSize = pageRequest.getPageSize();
|
||||
startIndex = (pageNo - 1) * pageSize;
|
||||
endIndex = startIndex + (pageSize - 1);
|
||||
}
|
||||
for (int i = startIndex; i <= endIndex; i++) {
|
||||
String stationKey = null;
|
||||
try {
|
||||
stationKey = validStationKeys.get(i);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
String stationId = stationKey.replace("station:", "");
|
||||
stationInfos.add(getNotificationStationInfo(stationId));
|
||||
}
|
||||
response.setStationInfos(stationInfos);
|
||||
resp.setRet("0");
|
||||
resp.setMsg("Query station info success");
|
||||
resp.setData(JSONUtil.toJSONString(response));
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设备充电中状态变化推送(我们平台推送成都市平台) --已推送
|
||||
* 实时数据没15秒一帧
|
||||
*/
|
||||
@PostMapping("/v10/getNotificationConnectorChargeStatus")
|
||||
public void getNotificationConnectorChargeStatus(@RequestBody Map<String, Object> orderMap){
|
||||
//先查订单号 在查实时数据 最后计算金额
|
||||
try {
|
||||
AuthSecretToken authSecretTokenOut = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType("765367656", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
log.debug("nss pushing to: {}", authSecretTokenOut.getOperatorId3irdpty());
|
||||
if (authSecretTokenOut != null) {
|
||||
ConnectorStatusInfoReq connectorStatusInfoReq = new ConnectorStatusInfoReq();
|
||||
ConnectorStatusInfo connectorStatusInfo = new ConnectorStatusInfo();
|
||||
connectorStatusInfo.setConnectorID(map.get("connectorID").toString());
|
||||
connectorStatusInfo.setStatus(ConnectorStatusInfo.FREE);
|
||||
connectorStatusInfoReq.setConnectorStatusInfo(connectorStatusInfo);
|
||||
String data = JSONUtil.toJSONString(connectorStatusInfoReq);
|
||||
log.info("===============data=================="+data);
|
||||
String orderNo = orderMap.get("orderNo").toString();
|
||||
CacheRealtimeData lord = REDIS.getCacheObject("order:"+orderNo+".lord");
|
||||
String formatTime = DateUtil.format(new Date(), "yyyy-MM-dd HH:mm:ss");
|
||||
Map<String, Object> cacheMap =REDIS.getCacheMap("order:"+orderNo+".notification");
|
||||
if(cacheMap==null || cacheMap.get("startTime")==null || "".equals(cacheMap.get("startTime"))){
|
||||
cacheMap.put("lastPushTime", formatTime);
|
||||
}else{
|
||||
cacheMap.put("lastPushTime", cacheMap.get("pushTime"));
|
||||
}
|
||||
cacheMap.put("pushTime", formatTime);
|
||||
CDConnectorChargeStatusInfo cdConnectorChargeStatusInfo = new CDConnectorChargeStatusInfo();
|
||||
Map<String, Object> cacheMapOrder = REDIS.getCacheMap("order:"+orderNo);
|
||||
if(cacheMap.get("startTime")==null ){
|
||||
if(cacheMapOrder !=null && cacheMapOrder.get("startTime")!=null){
|
||||
cdConnectorChargeStatusInfo.setStartTime(cacheMapOrder.get("startTime").toString());
|
||||
cacheMap.put("startTime", cacheMapOrder.get("startTime").toString());
|
||||
}
|
||||
}else{
|
||||
cdConnectorChargeStatusInfo.setStartTime(cacheMap.get("startTime").toString());
|
||||
}
|
||||
if(cacheMapOrder !=null && cacheMapOrder.get("status")!=null){
|
||||
if("已结束".equals(cacheMapOrder.get("status").toString())){
|
||||
cdConnectorChargeStatusInfo.setConnectorStatus(1);
|
||||
cdConnectorChargeStatusInfo.setOrderStatus(4);
|
||||
}else{
|
||||
cdConnectorChargeStatusInfo.setConnectorStatus(3);
|
||||
cdConnectorChargeStatusInfo.setOrderStatus(2);
|
||||
}
|
||||
}
|
||||
REDIS.setCacheMap("order:"+orderNo+".notification",cacheMap);
|
||||
cdConnectorChargeStatusInfo.setStartChargeSeq(lord.getOrderNo());
|
||||
cdConnectorChargeStatusInfo.setConnectorID(lord.getPileNo()+lord.getGunId());
|
||||
cdConnectorChargeStatusInfo.setCurrentA((double)(lord.getWorkingCurrent()/10));
|
||||
cdConnectorChargeStatusInfo.setVoltageA((double)(lord.getWorkingVoltage()/10));
|
||||
cdConnectorChargeStatusInfo.setSoc((double)lord.getSoc());
|
||||
cdConnectorChargeStatusInfo.setEndTime(formatTime);
|
||||
cdConnectorChargeStatusInfo.setPushTime(formatTime);
|
||||
cdConnectorChargeStatusInfo.setLastPushTime(cacheMap.get("lastPushTime").toString());
|
||||
BigDecimal chargingDegree = new BigDecimal(lord.getChargingDegree()).divide(new BigDecimal(10000).setScale(2, BigDecimal.ROUND_UP));
|
||||
BigDecimal amountCharged = new BigDecimal(lord.getAmountCharged()).divide(new BigDecimal(10000).setScale(2, BigDecimal.ROUND_UP));
|
||||
cdConnectorChargeStatusInfo.setTotalPower(chargingDegree.doubleValue());
|
||||
cdConnectorChargeStatusInfo.setTotalMoney(amountCharged.doubleValue());
|
||||
|
||||
String key = "pile:"+orderNo.substring(0,14);
|
||||
Map<String, Object> cachePile = REDIS.getCacheMap(key);
|
||||
String stationId = cachePile.get("stationId").toString();
|
||||
cdConnectorChargeStatusInfo.setEquipmentID(orderNo.substring(0,14));
|
||||
cdConnectorChargeStatusInfo.setStationID(stationId);
|
||||
|
||||
String stationSey = "cdjgpc:station:".concat(stationId)+".notification";
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(stationSey);
|
||||
cdConnectorChargeStatusInfo.setOperatorID(cdStationInfo.getOperatorId());
|
||||
cdConnectorChargeStatusInfo.setEquipmentOwnerID(cdStationInfo.getEquipmentOwnerId());
|
||||
|
||||
|
||||
Map<String, Object> cacheOrder = REDIS.getCacheMap("order:" + orderNo);
|
||||
|
||||
if(cacheOrder !=null && cacheOrder.get("rateModelId") !=null){
|
||||
CacheRateModel rateModel = REDIS.getCacheObject("rateModel:" + cacheOrder.get("rateModelId").toString());
|
||||
if(rateModel.getT1SvcPrice().equals(rateModel.getT2SvcPrice()) && rateModel.getT3SvcPrice().equals(rateModel.getT4SvcPrice()) &&
|
||||
rateModel.getT1SvcPrice().equals(rateModel.getT3SvcPrice())){
|
||||
|
||||
BigDecimal divide = new BigDecimal(rateModel.getT1SvcPrice()).divide(new BigDecimal(100000)).setScale(2, BigDecimal.ROUND_UP);
|
||||
|
||||
BigDecimal bigDecimal = chargingDegree.multiply(divide).setScale(2, BigDecimal.ROUND_UP);
|
||||
cdConnectorChargeStatusInfo.setSeviceMoney(bigDecimal.doubleValue());
|
||||
BigDecimal subtract = amountCharged.subtract(bigDecimal);
|
||||
cdConnectorChargeStatusInfo.setElecMoney(subtract.doubleValue());
|
||||
}else{
|
||||
//暂时不考虑不同服务费 默认为0.2
|
||||
BigDecimal multiply = chargingDegree.multiply(new BigDecimal(0.2)).setScale(2, BigDecimal.ROUND_UP);;
|
||||
cdConnectorChargeStatusInfo.setSeviceMoney(multiply.doubleValue());
|
||||
BigDecimal subtract = amountCharged.subtract(multiply);
|
||||
cdConnectorChargeStatusInfo.setElecMoney(subtract.doubleValue());
|
||||
}
|
||||
AuthSecretToken authSecretTokenOut = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType("MA6CC2LK7", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
Map<String, Object> map =new HashMap<>();
|
||||
map.put("ConnectorChargeStatusInfo",cdConnectorChargeStatusInfo);
|
||||
String data = JSONUtil.toJSONString(map);
|
||||
CommonRequest<ConnectorStatusInfoReq> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String ok = ok(commonRequest, "/notification_stationStatus", authSecretTokenOut);
|
||||
log.info("===============3333=================="+ok);
|
||||
String result = ok(commonRequest, "/notification_connector_charge_status", authSecretTokenOut);
|
||||
System.out.println("=======result========"+result);
|
||||
}
|
||||
}catch (Exception e){
|
||||
log.info("===============eeee==================");
|
||||
} catch (JsonProcessingException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 设备接口状态查询(成都市平台调用我们平台) --已调用
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v10/query_station_status")
|
||||
public CommonResponse queryStationsStatus(@RequestBody CommonRequest<StationStatusRequest> commonRequest) throws Exception {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
StationStatusRequest stationStatusRequest = JSONUtil.readParams(commonRequest.getData(), StationStatusRequest.class);
|
||||
if (stationStatusRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
String[] stationIDs = stationStatusRequest.getStationIds();
|
||||
List<CDStationStatusInfo> cdStationStatusInfos = new ArrayList<>();
|
||||
//Loading data through redis at first.
|
||||
Collection<String> guns = REDIS.keys("gun:*");
|
||||
List<String> gunsNewList = new ArrayList<>();
|
||||
for (String value : guns) {
|
||||
gunsNewList.add(value.substring(4));
|
||||
}
|
||||
List<String> gunsIds = new ArrayList<>();
|
||||
for (String value : gunsNewList) {
|
||||
if (value.length() == 16) {
|
||||
gunsIds.add(value);
|
||||
}
|
||||
}
|
||||
Map<String, Integer> statusMap = new HashMap<>();
|
||||
String[] keys = {"离线", "空闲", "故障"};
|
||||
Integer[] values = {0, 1, 255};
|
||||
for (int i = 0; i < keys.length; i++) {
|
||||
statusMap.put(keys[i], values[i]);
|
||||
}
|
||||
|
||||
List<XhpcTerminal> terminalList = terminalRepository.selectStatusBySql();
|
||||
Map<String,Integer> terminalDBMap = terminalList.stream().collect(Collectors.toMap(XhpcTerminal::getSerialNumber,XhpcTerminal::getStatus));
|
||||
|
||||
for (String stationID : stationIDs) {
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject("station:" + stationID);
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject("cdjgpc:station:"+stationID+".notification");
|
||||
|
||||
Set<String> pileIds = new HashSet<>();
|
||||
if (null != chargingStationDto) {
|
||||
pileIds = chargingStationDto.getPiles();
|
||||
}
|
||||
boolean existsGun = false;
|
||||
List<CDConnectorStatusInfo> connectorStatusInfos = new ArrayList<>();
|
||||
for (String pileId : pileIds) {
|
||||
for (String value : gunsIds) {
|
||||
if (pileId.equals(value.substring(0, 14))) {
|
||||
existsGun = true;
|
||||
CDConnectorStatusInfo cdConnectorStatusInfo = new CDConnectorStatusInfo();
|
||||
Integer gunStatus = terminalDBMap.get(value);
|
||||
if (gunStatus == null){
|
||||
existsGun = false;
|
||||
} else {
|
||||
if (gunStatus == 0){
|
||||
Object status = REDIS.getCacheMapValue("gun:" + value, "status");
|
||||
if (isInteger(status.toString())) {
|
||||
cdConnectorStatusInfo.setStatus(3);
|
||||
} else {
|
||||
cdConnectorStatusInfo.setStatus(statusMap.get(status));
|
||||
}
|
||||
} else {
|
||||
cdConnectorStatusInfo.setStatus(0);
|
||||
}
|
||||
cdConnectorStatusInfo.setConnectorID(value);
|
||||
cdConnectorStatusInfo.setEquipmentClassification(1);
|
||||
cdConnectorStatusInfo.setOperatorID(cdStationInfo.getOperatorId());
|
||||
cdConnectorStatusInfo.setEquipmentOwnerID(cdStationInfo.getEquipmentOwnerId());
|
||||
cdConnectorStatusInfo.setStationID(cdStationInfo.getStationId());
|
||||
cdConnectorStatusInfo.setEquipmentID(cdStationInfo.getOperatorId());
|
||||
connectorStatusInfos.add(cdConnectorStatusInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (existsGun) {
|
||||
CDStationStatusInfo cdStationStatusInfo = new CDStationStatusInfo();
|
||||
cdStationStatusInfo.setStationID(stationID);
|
||||
cdStationStatusInfo.setConnectorStatusInfos(connectorStatusInfos);
|
||||
cdStationStatusInfo.setOperatorID(cdStationInfo.getOperatorId());
|
||||
cdStationStatusInfo.setEquipmentOnwerID(cdStationInfo.getEquipmentOwnerId());
|
||||
cdStationStatusInfos.add(cdStationStatusInfo);
|
||||
}
|
||||
}
|
||||
CDStationStatusInfoWrapper stationStatusInfoWrappers = new CDStationStatusInfoWrapper();
|
||||
stationStatusInfoWrappers.setTotal(cdStationStatusInfos.size());
|
||||
if (cdStationStatusInfos.size() != 0) {
|
||||
stationStatusInfoWrappers.setStationStatusInfos(cdStationStatusInfos);
|
||||
}
|
||||
resp.setRet("0");
|
||||
resp.setMsg("Query station status success");
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("StationStats",stationStatusInfoWrappers);
|
||||
resp.setData(JSONUtil.toJSONString(mapStationInfo));
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询统计信息(成都市平台调用我们平台) --已调用
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v10/query_station_stats")
|
||||
public CommonResponse queryStationsStats(@RequestBody CommonRequest<StationStatsRequest> commonRequest) throws Exception{
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
StationStatsRequest stationStatsRequest = JSONUtil.readParams(commonRequest.getData(), StationStatsRequest.class);
|
||||
if (stationStatsRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
resp.setRet("4002");
|
||||
} else {
|
||||
R r = powerPileService.queryStationStats(Long.valueOf(stationStatsRequest.getStationID()), stationStatsRequest.getStartTime(), stationStatsRequest.getEndTime());
|
||||
if(r.getCode() !=200){
|
||||
resp.setRet("-1");
|
||||
resp.setMsg("系统繁忙,此时请求方稍后重试");
|
||||
return resp;
|
||||
}
|
||||
String key ="cdjgpc:station:"+stationStatsRequest.getStationID()+".queryStationStats";
|
||||
CDStationStatslnfo stationStatsInfo =REDIS.getCacheObject(key);
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("StationStats",stationStatsInfo);
|
||||
resp.setRet("0");
|
||||
resp.setData(JSONUtil.toJSONString(mapStationInfo));
|
||||
resp.setMsg("Query station info success");
|
||||
REDIS.deleteObject(key);
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 站点费率变化tuisong(我们平台调用成都市平台) --已推送
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v10/getNotificationStationFee")
|
||||
public void getNotificationStationFee() throws Exception {
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
// maybe对接第三方
|
||||
if (authSecretTokenOut != null) {
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("cdjgpc:stationFee:*"));
|
||||
for (String stationKey : stationKeys) {
|
||||
CDStationFee cdStationFeeRequest = REDIS.getCacheObject(stationKey);
|
||||
Map<String, Object> map =new HashMap<>();
|
||||
map.put("StationFee",cdStationFeeRequest);
|
||||
String data = JSONUtil.toJSONString(map);
|
||||
CommonRequest<CDStationFee> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String ok = ok(commonRequest, "/notification_stationFee", authSecretTokenOut);
|
||||
log.info("===============notification_stationFee=================="+ok);
|
||||
REDIS.deleteObject(stationKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点费率(成都市平台调用我们平台)
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v10/query_station_fee")
|
||||
public CommonResponse queryStationFee(@RequestBody CommonRequest<CDStationFeeRequest> commonRequest) throws Exception{
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
CDStationFeeRequest stationFeeRequest = JSONUtil.readParams(commonRequest.getData(), CDStationFeeRequest.class);
|
||||
if (stationFeeRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
resp.setRet("4002");
|
||||
} else {
|
||||
String[] stationIDs = stationFeeRequest.getStationIDs();
|
||||
if(stationIDs !=null && stationIDs.length>0){
|
||||
List<CDStationFee> cdStationFeeList =new ArrayList<>();
|
||||
for (int i = 0; i < stationIDs.length; i++) {
|
||||
String stationID = stationIDs[i];
|
||||
String skey = "cdjgpc:stationFeeRequest:".concat(stationID);
|
||||
CDStationFee cdStationFeeRequest = REDIS.getCacheObject(skey);
|
||||
cdStationFeeList.add(cdStationFeeRequest);
|
||||
}
|
||||
resp.setData(JSONUtil.toJSONString(cdStationFeeList));
|
||||
resp.setRet("0");
|
||||
}else{
|
||||
resp.setRet("-1");
|
||||
resp.setMsg("系统繁忙,此时请求方稍后重试");
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询站点费率(成都市平台调用我们平台)
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v10/notification_order_settlement_info")
|
||||
public CommonResponse notificationOrderSettlementInfo(@RequestBody CommonRequest<CDNotificationOrderSettlementInfoRequest> commonRequest) throws Exception{
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
CDNotificationOrderSettlementInfoRequest stationFeeRequest = JSONUtil.readParams(commonRequest.getData(), CDNotificationOrderSettlementInfoRequest.class);
|
||||
if (stationFeeRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
resp.setRet("4002");
|
||||
} else {
|
||||
//查询订单
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 查询充电设备运行统计计信息 --已调用
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v10/query_SupEquipment_stats_info")
|
||||
public CommonResponse querySupEquipmentStatsInfo(@RequestBody CommonRequest<CDQuerySupEquipmentStatsInfoRequest> commonRequest)throws Exception{
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
StationStatsRequest stationStatsRequest = JSONUtil.readParams(commonRequest.getData(), StationStatsRequest.class);
|
||||
if (stationStatsRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
resp.setRet("4002");
|
||||
} else {
|
||||
R r = powerPileService.querySupEquipmentStatsInfo(Long.valueOf(stationStatsRequest.getStationID()), stationStatsRequest.getStartTime(), stationStatsRequest.getEndTime());
|
||||
if(r.getCode() !=200){
|
||||
resp.setRet("-1");
|
||||
resp.setMsg("系统繁忙,此时请求方稍后重试");
|
||||
return resp;
|
||||
}
|
||||
String key ="cdjgpc:station:"+stationStatsRequest.getStationID()+".querySupEquipmentStatsInfo";
|
||||
List<CDSuqEquipmentStatslnfo> cdSuqEquipmentStatslnfos =REDIS.getCacheObject(key);
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("EquipmentStatsInfos",cdSuqEquipmentStatslnfos);
|
||||
resp.setRet("0");
|
||||
resp.setData(JSONUtil.toJSONString(mapStationInfo));
|
||||
resp.setMsg("Query station info success");
|
||||
REDIS.deleteObject(key);
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电设备接口运行统计计信息 --已调用
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v10/query_connector_stats_info")
|
||||
public CommonResponse queryConnectorStatsInfo(@RequestBody CommonRequest<CDQuerySupEquipmentStatsInfoRequest> commonRequest)throws Exception{
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
CDQuerySupEquipmentStatsInfoRequest stationStatsRequest = JSONUtil.readParams(commonRequest.getData(), CDQuerySupEquipmentStatsInfoRequest.class);
|
||||
if (stationStatsRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
resp.setRet("4002");
|
||||
} else {
|
||||
R r = powerPileService.queryConnectorStatsInfo(Long.valueOf(stationStatsRequest.getStationID()), stationStatsRequest.getStartTime(), stationStatsRequest.getEndTime());
|
||||
if(r.getCode() !=200){
|
||||
resp.setRet("-1");
|
||||
resp.setMsg("系统繁忙,此时请求方稍后重试");
|
||||
return resp;
|
||||
}
|
||||
String key ="cdjgpc:station:"+stationStatsRequest.getStationID()+".queryConnectorStatsInfo";
|
||||
List<CDSupConnectorStatslnfo> cdSuqEquipmentStatslnfos =REDIS.getCacheObject(key);
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("ConnectorStatsInfos",cdSuqEquipmentStatslnfos);
|
||||
resp.setRet("0");
|
||||
resp.setData(JSONUtil.toJSONString(mapStationInfo));
|
||||
resp.setMsg("Query station info success");
|
||||
REDIS.deleteObject(key);
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电站功率统计信息 --已调用
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v10/supervise_query_station_power_info")
|
||||
public CommonResponse superviseQueryStationPowerInfo(@RequestBody CommonRequest<CDSuperviseQueryStationPowerInfoRequest> commonRequest)throws Exception{
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
CDSuperviseQueryStationPowerInfoRequest stationStatsRequest = JSONUtil.readParams(commonRequest.getData(), CDSuperviseQueryStationPowerInfoRequest.class);
|
||||
if (stationStatsRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
resp.setRet("4002");
|
||||
} else {
|
||||
String replace = UUID.randomUUID().toString().replace("-", "");
|
||||
|
||||
R r = powerPileService.getSuperviseQueryStationPowerInfo(stationStatsRequest.getStationIDs(), stationStatsRequest.getDataTime(),replace);
|
||||
if(r.getCode() !=200){
|
||||
resp.setRet("-1");
|
||||
resp.setMsg("系统繁忙,此时请求方稍后重试");
|
||||
return resp;
|
||||
}
|
||||
String key ="cdjgpc:station:"+replace+".getSuperviseQueryStationPowerInfo";
|
||||
List<CDSupStationPowerInfo> cdSuqEquipmentStatslnfos =REDIS.getCacheObject(key);
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("StationPowerInfos",cdSuqEquipmentStatslnfos);
|
||||
resp.setRet("0");
|
||||
resp.setData(JSONUtil.toJSONString(mapStationInfo));
|
||||
resp.setMsg("Query station info success");
|
||||
REDIS.deleteObject(key);
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电设备功率统计信息---一调用
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v10/supervise_query_equipment_power_info")
|
||||
public CommonResponse superviseQueryEquipmentPowerInfo(@RequestBody CommonRequest<CDSuperviseQueryEquipmentPowerInfoRequest> commonRequest)throws Exception{
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
CDSuperviseQueryEquipmentPowerInfoRequest stationStatsRequest = JSONUtil.readParams(commonRequest.getData(), CDSuperviseQueryEquipmentPowerInfoRequest.class);
|
||||
if (stationStatsRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
resp.setRet("4002");
|
||||
} else {
|
||||
String replace = UUID.randomUUID().toString().replace("-", "");
|
||||
R r = powerPileService.getSuperviseQueryEquipmentPowerInfo(stationStatsRequest.getStationID(), stationStatsRequest.getDataTime(),replace);
|
||||
if(r.getCode() !=200){
|
||||
resp.setRet("-1");
|
||||
resp.setMsg("系统繁忙,此时请求方稍后重试");
|
||||
return resp;
|
||||
}
|
||||
|
||||
String key ="cdjgpc:station:"+replace+".getSuperviseQueryEquipmentPowerInfo";
|
||||
List<CDSupEquipmentPowerInfo> cdSuqEquipmentStatslnfos =REDIS.getCacheObject(key);
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("EquipmentPowerInfos",cdSuqEquipmentStatslnfos);
|
||||
resp.setRet("0");
|
||||
resp.setData(JSONUtil.toJSONString(mapStationInfo));
|
||||
resp.setMsg("Query station info success");
|
||||
REDIS.deleteObject(key);
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询充电事故
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v10/supervise_query_accident_info")
|
||||
public CommonResponse superviseQueryAccidentInfo(@RequestBody(required = false) CommonRequest<PageRequest> commonRequest)throws Exception {
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
|
||||
//当前页数
|
||||
PageRequest pageRequest = commonRequest.transformDataType(PageRequest.class);
|
||||
Integer pageNo = pageRequest.getPageNo();
|
||||
CDSupEquipmentAccidentInfoResponse response = new CDSupEquipmentAccidentInfoResponse();
|
||||
response.setPageNo(pageNo);
|
||||
//页码总数
|
||||
Instant now = Instant.now();
|
||||
String replace = UUID.randomUUID().toString().replace("-", "");
|
||||
//获取事故数据
|
||||
R r = powerPileService.getSuperviseQueryAccidentInfo(pageRequest.getLastQueryTime(),replace);
|
||||
if(r.getCode() !=200){
|
||||
resp.setRet("-1");
|
||||
resp.setMsg("系统繁忙,此时请求方稍后重试");
|
||||
return resp;
|
||||
}
|
||||
String key ="cdjgpc:station:"+replace+".getSuperviseQueryAccidentInfo";
|
||||
List<CDSupEquipmentAccidentInfo> cdSupEquipmentAccidentInfos =REDIS.getCacheObject(key);
|
||||
|
||||
List<CDSupEquipmentAccidentInfo> equipmentAccidentInfoList =new ArrayList<>();
|
||||
|
||||
if (cdSupEquipmentAccidentInfos.size() > 0) {
|
||||
Integer pageSize = pageRequest.getPageSize();
|
||||
int totalPage = cdSupEquipmentAccidentInfos.size() % pageSize == 0 ? cdSupEquipmentAccidentInfos.size() / pageSize :
|
||||
(cdSupEquipmentAccidentInfos.size() / pageSize) + 1;
|
||||
response.setPageCount(totalPage);
|
||||
}
|
||||
//总记录条数
|
||||
response.setItemSize(cdSupEquipmentAccidentInfos.size());
|
||||
|
||||
//计算每页开始索引
|
||||
int startIndex = -1;
|
||||
int endIndex = -1;
|
||||
if (pageNo == 1 && cdSupEquipmentAccidentInfos.size() <= 10) {
|
||||
startIndex = 0;
|
||||
endIndex = cdSupEquipmentAccidentInfos.size() - 1;
|
||||
} else {
|
||||
Integer pageSize = pageRequest.getPageSize();
|
||||
startIndex = (pageNo - 1) * pageSize;
|
||||
endIndex = startIndex + (pageSize - 1);
|
||||
}
|
||||
for (int i = startIndex; i <= endIndex; i++) {
|
||||
CDSupEquipmentAccidentInfo cdSupEquipmentAccidentInfo = cdSupEquipmentAccidentInfos.get(i);
|
||||
String[] split = cdSupEquipmentAccidentInfo.getPicturesName().split(",");
|
||||
cdSupEquipmentAccidentInfo.setPictures(split);
|
||||
String[] split1 = cdSupEquipmentAccidentInfo.getAnalysisReportName().split(",");
|
||||
cdSupEquipmentAccidentInfo.setAnalysisReport(split1);
|
||||
equipmentAccidentInfoList.add(cdSupEquipmentAccidentInfo);
|
||||
}
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("EquipmentAccidentInfos",equipmentAccidentInfoList);
|
||||
resp.setRet("0");
|
||||
resp.setData(JSONUtil.toJSONString(mapStationInfo));
|
||||
resp.setMsg("Query station info success");
|
||||
REDIS.deleteObject(key);
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
//组合场站数据
|
||||
public CDStationInfo getNotificationStationInfo(String stationId){
|
||||
|
||||
String key = "cdjgpc:station:".concat(stationId)+".notification";
|
||||
CDStationInfo cdStationInfo = REDIS.getCacheObject(key);
|
||||
cdStationInfo.setEquipmentInfos(new ArrayList<>());
|
||||
//查询场站是桩是否对应上
|
||||
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+stationId);
|
||||
Set<String> pks = stationDto.getPiles();
|
||||
if (pks != null) {
|
||||
List<CDEquipmentInfo> cdEquipmentInfos = new ArrayList<>();
|
||||
for (String pileNo : pks) {
|
||||
String pk = "pile:".concat(pileNo);
|
||||
String skey = "cdjgpc:".concat(pk) + ".notification";
|
||||
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
|
||||
cdEquipmentInfos.add(cdEquipmentInfo);
|
||||
}
|
||||
cdStationInfo.setEquipmentInfos(cdEquipmentInfos);
|
||||
REDIS.setCacheObject(key, cdStationInfo);
|
||||
}
|
||||
return cdStationInfo;
|
||||
}
|
||||
|
||||
|
||||
//数据加密处理
|
||||
@PostMapping("/v10/getEncrytReqout")
|
||||
public R getEncrytReqout(){
|
||||
try{
|
||||
CommonRequest<StationStatusRequest> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setOperatorId("MA6CC2LK7");
|
||||
// StationStatsRequest stationStatsRequest = new StationStatsRequest();
|
||||
// stationStatsRequest.setStationID("20");
|
||||
// stationStatsRequest.setStartTime("2023-10-01");
|
||||
// stationStatsRequest.setEndTime("2023-10-12");
|
||||
// StationStatusRequest stationStatsRequest =new StationStatusRequest();
|
||||
// String [] st ={"20"};
|
||||
// stationStatsRequest.setStationIds(st);
|
||||
|
||||
// CDQuerySupEquipmentStatsInfoRequest cdQuerySupEquipmentStatsInfoRequest = new CDQuerySupEquipmentStatsInfoRequest();
|
||||
// cdQuerySupEquipmentStatsInfoRequest.setStationID("20");
|
||||
// cdQuerySupEquipmentStatsInfoRequest.setStartTime("2023-10-01");
|
||||
// cdQuerySupEquipmentStatsInfoRequest.setEndTime("2023-10-13");
|
||||
|
||||
// CDSuperviseQueryStationPowerInfoRequest cdSuperviseQueryStationPowerInfoRequest = new CDSuperviseQueryStationPowerInfoRequest();
|
||||
// String [] st ={"20"};
|
||||
// cdSuperviseQueryStationPowerInfoRequest.setStationIDs(st);
|
||||
// cdSuperviseQueryStationPowerInfoRequest.setDataTime("2023-10-13");
|
||||
|
||||
// CDSuperviseQueryEquipmentPowerInfoRequest cdSuperviseQueryEquipmentPowerInfoRequest = new CDSuperviseQueryEquipmentPowerInfoRequest();
|
||||
// cdSuperviseQueryEquipmentPowerInfoRequest.setStationID("20");
|
||||
// cdSuperviseQueryEquipmentPowerInfoRequest.setDataTime("2023-10-13");
|
||||
CDEquipAuthRequest equipAuthRequest = new CDEquipAuthRequest();
|
||||
equipAuthRequest.setEquipAuthSeq("MA6DFCTD5202310161544441234");
|
||||
equipAuthRequest.setConnectorId("8083600020000101");
|
||||
equipAuthRequest.setQRCode("12312312312323");
|
||||
String data = JSONUtil.toJSONString(equipAuthRequest);
|
||||
System.out.println("===data==="+data);
|
||||
commonRequest.setData(data);
|
||||
AuthSecretToken authSecretTokenOut =authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_IN).orElse(null);
|
||||
String tData = encryptReqOut(authSecretTokenOut.getDataSecret(), authSecretTokenOut.getDataSecretIV(),
|
||||
authSecretTokenOut.getSigSecret(), commonRequest);
|
||||
System.out.println("===tData==="+tData);
|
||||
// String bearerToken = authSecretTokenOut.getToken();
|
||||
// okhttp3.RequestBody body = okhttp3.RequestBody.create(JSON, tData);
|
||||
// final Request.Builder req = new Request.Builder()
|
||||
// .url("http://localhost:9009/v10" + "/query_station_stats")
|
||||
// .header("Authorization", "Bearer " + bearerToken);
|
||||
// Request request;
|
||||
// request = req.post(body).build();
|
||||
// OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
// builder.connectTimeout(10, TimeUnit.SECONDS)
|
||||
// .readTimeout(10, TimeUnit.SECONDS)
|
||||
// .writeTimeout(10, TimeUnit.SECONDS);
|
||||
// OkHttpClient client = builder.build();
|
||||
//
|
||||
// String responseBody = null;
|
||||
// try {
|
||||
// Response response = client.newCall(request).execute();
|
||||
// if (response.isSuccessful()) {
|
||||
// okhttp3.ResponseBody body1 = response.body();
|
||||
// responseBody = body1 == null ? null : body1.string();
|
||||
// } else {
|
||||
// int code = response.code();
|
||||
// if (code == 401 || code == 403) {
|
||||
// throw new ForbiddenException("Remote system returned " + code);
|
||||
// }
|
||||
// }
|
||||
// } catch (IOException e) {
|
||||
// String msg = e.getMessage();
|
||||
// log.error(msg);
|
||||
// throw new ServerInternalException(msg);
|
||||
// }
|
||||
// System.out.println("=============responseBody=============="+responseBody);
|
||||
return R.ok(null);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
return R.fail();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,55 @@
|
||||
package com.xhpc.evcs.cdjgpc.api;
|
||||
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.dto.NotificationStartStopChargeResultResponse;
|
||||
import com.xhpc.evcs.dto.NotificationStopChargeResultRequestData;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-24 19:13
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController()
|
||||
public class CDNotificationStopChargeResultController {
|
||||
@Autowired
|
||||
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
|
||||
/**
|
||||
* 推送停止充电结果
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v10/notification_stop_charge_result")
|
||||
public CommonResponse notifyStartChargeResult(@RequestBody CommonRequest<NotificationStopChargeResultRequestData> commonRequest) throws IOException {
|
||||
|
||||
String data = commonRequest.getData();
|
||||
NotificationStopChargeResultRequestData stopChargeResultRequestData = JSONUtil.readParams(data,
|
||||
NotificationStopChargeResultRequestData.class);
|
||||
String startChargeSeq = stopChargeResultRequestData.getStartChargeSeq();
|
||||
// ChargeOrderInfo chargeOrderInfo = chargeOrderInfoRepository.findById(startChargeSeq).orElse(new ChargeOrderInfo()
|
||||
// .setStartChargeSeqAndReturn(startChargeSeq));
|
||||
// chargeOrderInfo.setStartChargeSeqStat(stopChargeResultRequestData.getStartChargeSeqStat());
|
||||
// chargeOrderInfo.setFailReason(stopChargeResultRequestData.getFailReason());
|
||||
// chargeOrderInfoRepository.save(chargeOrderInfo); todo
|
||||
CommonResponse response = new CommonResponse();
|
||||
response.setRet(EvcsConst.RET_SUCC);
|
||||
NotificationStartStopChargeResultResponse resp = new NotificationStartStopChargeResultResponse();
|
||||
resp.setSuccStat(0);
|
||||
resp.setFailReason(0);
|
||||
resp.setStartChargeSeq(stopChargeResultRequestData.getStartChargeSeq());
|
||||
response.setData(JSONUtil.toJSONString(resp));
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,103 @@
|
||||
package com.xhpc.evcs.cdjgpc.api;
|
||||
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDEquipAuthRequest;
|
||||
import com.xhpc.evcs.domain.XhpcInternetUser;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.dto.EquipAuthRequest;
|
||||
import com.xhpc.evcs.dto.EquipAuthResponse;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.XhpcInternetUserRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.hutool.core.util.NumberUtil.isInteger;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-20 15:36
|
||||
*/
|
||||
@RestController
|
||||
public class CDQueryEquipAuthController {
|
||||
@Autowired
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Autowired
|
||||
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
|
||||
/**
|
||||
* 请求设备认证
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/v10/query_equip_auth")
|
||||
public CommonResponse queryEquipAuth(@RequestBody CommonRequest<CDEquipAuthRequest> commonRequest) throws Exception {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
CDEquipAuthRequest equipAuthRequest = JSONUtil.readParams(commonRequest.getData(), CDEquipAuthRequest.class);
|
||||
if (equipAuthRequest == null) {
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
EquipAuthResponse equipAuthResponse = new EquipAuthResponse();
|
||||
String equipAuthSeq = equipAuthRequest.getEquipAuthSeq();
|
||||
String connectorId = equipAuthRequest.getConnectorId();
|
||||
equipAuthResponse.setEquipAuthSeq(equipAuthSeq);
|
||||
equipAuthResponse.setConnectorId(connectorId);
|
||||
String pileId = connectorId.substring(0, connectorId.length() - 2);
|
||||
Map<String, Object> pileDataModel = REDIS.getCacheMap("pile:" + pileId);
|
||||
Long stationId = Long.parseLong(pileDataModel.get("stationId").toString());
|
||||
Instant now = Instant.now();
|
||||
XhpcInternetUser xhpcInternetUser = xhpcInternetUserRepository
|
||||
.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(commonRequest.getOperatorId(), now, now);
|
||||
if (xhpcInternetUser == null) {
|
||||
equipAuthResponse.setSuccStat(1);
|
||||
equipAuthResponse.setFailReason(2);
|
||||
equipAuthResponse.setFailReasonMsg("身份验证失败");
|
||||
resp.setMsg("auth denied");
|
||||
} else {
|
||||
Long internetUserId = xhpcInternetUser.getInternetUserId();
|
||||
XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
|
||||
xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(stationId, internetUserId).orElse(null);
|
||||
if (null != xhpcStationInternetBlacklist) {
|
||||
equipAuthResponse.setSuccStat(1);
|
||||
equipAuthResponse.setFailReason(2);
|
||||
equipAuthResponse.setFailReasonMsg("身份验证失败");
|
||||
resp.setMsg("auth denied");
|
||||
} else {
|
||||
Map<String, Object> cacheGun = REDIS.getCacheMap("gun:".concat(connectorId));
|
||||
String terminalStatus = (String) cacheGun.get("vehicleGunStatus");
|
||||
String status = (String) cacheGun.get("status");
|
||||
if (!"空闲".equals(status)) {
|
||||
resp.setMsg("终端不在空闲状态:[".concat(status == null ? "未注册" : isInteger(status) ? "充电中" : status).concat(
|
||||
"]"));
|
||||
equipAuthResponse.setSuccStat(1);
|
||||
equipAuthResponse.setFailReason(1);
|
||||
} else if ("否".equals(terminalStatus)) {
|
||||
resp.setMsg("未插枪");
|
||||
equipAuthResponse.setSuccStat(1);
|
||||
equipAuthResponse.setFailReason(1);
|
||||
} else {
|
||||
resp.setRet("0");
|
||||
resp.setMsg("success");
|
||||
equipAuthResponse.setSuccStat(0);
|
||||
equipAuthResponse.setFailReason(0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
resp.setData(JSONUtil.toJSONString(equipAuthResponse));
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,154 @@
|
||||
package com.xhpc.evcs.cdjgpc.api;
|
||||
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.dto.ChargeInfoRequest;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.dto.EquipChargeStatus;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.OrderMappingRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.notification.NotificationEquipChargeStatusTask.calculateEm;
|
||||
import static com.xhpc.evcs.utils.DateUtil.orderNo2DateStr;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-20 16:38
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController()
|
||||
public class CDQueryEquipChargeStatusController {
|
||||
@Autowired
|
||||
XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
@Autowired
|
||||
OrderMappingRepository orderMappingRepository;
|
||||
|
||||
/**
|
||||
* 查询充电状态
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v10/query_equip_charge_status")
|
||||
public CommonResponse queryEquipChargeStatus(@RequestBody CommonRequest<ChargeInfoRequest> commonRequest) throws IOException {
|
||||
//创建数据实体类
|
||||
EquipChargeStatus equipChargeStatus = new EquipChargeStatus();
|
||||
//充电订单号 三方传进来都是27位
|
||||
String data = commonRequest.getData();
|
||||
ChargeInfoRequest chargeInfoRequest = JSONUtil.readParams(data, ChargeInfoRequest.class);
|
||||
CommonResponse response = new CommonResponse();
|
||||
if (chargeInfoRequest == null) {
|
||||
response.setRet(EvcsConst.RET_FAIL);
|
||||
response.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
String startChargeSeq = chargeInfoRequest.getStartChargeSeq();
|
||||
equipChargeStatus.setStartChargeSeq(startChargeSeq);
|
||||
//充电订单状态
|
||||
EtOrderMapping etOrderMapping = orderMappingRepository.findByEvcsOrderNo(startChargeSeq).orElse(null);
|
||||
if (etOrderMapping == null) {
|
||||
response.setRet(EvcsConst.RET_FAIL);
|
||||
response.setMsg("Order not found/started");
|
||||
log.error("3rdpty order[{}] not found", startChargeSeq);
|
||||
return response;
|
||||
}
|
||||
String internalOrderNum = etOrderMapping.getXhOrderNo();
|
||||
Map<String, Object> cacheOrder = REDIS.getCacheMap("order:" + internalOrderNum);
|
||||
if (cacheOrder == null) {
|
||||
response.setRet(EvcsConst.RET_FAIL);
|
||||
response.setMsg("Order cache data not found");
|
||||
} else {
|
||||
String orderStatus = (String) cacheOrder.get("status");
|
||||
int startChargeSeqStat;
|
||||
if (orderStatus == null) {
|
||||
startChargeSeqStat = 5;
|
||||
} else switch (orderStatus) {
|
||||
case "启动中":
|
||||
startChargeSeqStat = 1;
|
||||
break;
|
||||
case "充电中":
|
||||
startChargeSeqStat = 2;
|
||||
break;
|
||||
case "停止中":
|
||||
startChargeSeqStat = 3;
|
||||
break;
|
||||
case "已结束":
|
||||
startChargeSeqStat = 4;
|
||||
break;
|
||||
default:
|
||||
startChargeSeqStat = 5;
|
||||
break;
|
||||
}
|
||||
equipChargeStatus.setStartChargeSeqStat(startChargeSeqStat);
|
||||
//充电设备接口编码
|
||||
String connectorId = internalOrderNum.substring(0, 16);
|
||||
equipChargeStatus.setConnectorID(connectorId);
|
||||
//充电设备接口状态
|
||||
Map<String, Object> cacheGunData = REDIS.getCacheMap("gun:" + connectorId);
|
||||
String gunStatus = (String) cacheGunData.get("status");
|
||||
int connectorStatus = 0;
|
||||
switch (gunStatus) {
|
||||
case "空闲":
|
||||
connectorStatus = 1;
|
||||
break;
|
||||
case "离线":
|
||||
connectorStatus = 2;
|
||||
break;
|
||||
case "故障":
|
||||
connectorStatus = 255;
|
||||
break;
|
||||
default:
|
||||
connectorStatus = 3;
|
||||
break;
|
||||
}
|
||||
equipChargeStatus.setConnectorStatus(connectorStatus);
|
||||
//A相电流
|
||||
Double current = (Double) cacheGunData.get("current");
|
||||
equipChargeStatus.setCurrentA(current);
|
||||
//A相电压
|
||||
Double voltage = (Double) cacheGunData.get("voltage");
|
||||
equipChargeStatus.setVoltageA(voltage);
|
||||
//电池剩余电量
|
||||
Integer endSoc = (Integer) cacheOrder.get("endSoc");
|
||||
Double soc = Double.valueOf(endSoc == null ? 0 : endSoc);
|
||||
equipChargeStatus.setSoc(soc);
|
||||
//开始充电时间
|
||||
String startTime = (String) cacheOrder.get("startTime");
|
||||
if (startTime == null) startTime = orderNo2DateStr(internalOrderNum);
|
||||
equipChargeStatus.setStartTime(startTime);
|
||||
//本次采样时间 直接new一个当前时间的Date就可以了
|
||||
CacheRealtimeData lord = REDIS.getCacheObject("order:" + internalOrderNum + ".lord");
|
||||
if (lord != null) {
|
||||
equipChargeStatus.setEndTime(lord.getCreateTime());
|
||||
equipChargeStatus.setTotalMoney(lord.getAmountCharged() / 10000.0);
|
||||
equipChargeStatus.setTotalPower(lord.getChargingDegree() / 10000.0);
|
||||
} else {
|
||||
equipChargeStatus.setEndTime(equipChargeStatus.getStartTime());
|
||||
equipChargeStatus.setTotalMoney(0.0);
|
||||
equipChargeStatus.setTotalPower(0.0);
|
||||
}
|
||||
Integer chargeModel = (Integer) cacheOrder.get("chargeModel");
|
||||
equipChargeStatus.setChargeModel(chargeModel == null ? 0 : chargeModel);
|
||||
final Long rateModelId = REDIS.getCacheMapValue("pile:".concat(connectorId.substring(0, 14)), "rateModelId");
|
||||
final CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
||||
calculateEm(equipChargeStatus, cacheRateModel);
|
||||
response.setRet(EvcsConst.RET_SUCC);
|
||||
response.setData(JSONUtil.toJSONString(equipChargeStatus));
|
||||
response.setMsg("success");
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,163 @@
|
||||
package com.xhpc.evcs.cdjgpc.api;
|
||||
|
||||
import com.xhpc.common.api.PileOrderService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.DateUtils;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.domain.XhpcChargingStation;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.dto.StartChargeRequest;
|
||||
import com.xhpc.evcs.dto.StartChargeResponse;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.*;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.genOrder;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-20 15:38
|
||||
*/
|
||||
public class CDQueryStartChargeController {
|
||||
|
||||
@Autowired
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Autowired
|
||||
private OrderMappingRepository etOrderMappingRepo;
|
||||
@Autowired
|
||||
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
@Autowired
|
||||
private XhpcTerminalRepository xhpcTerminalRepository;
|
||||
@Autowired
|
||||
private PileOrderService pileOrderService;
|
||||
@Autowired
|
||||
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
@Autowired
|
||||
private XhpcChargingStationRepository xhpcChargingStationRepository;
|
||||
|
||||
/**
|
||||
* 请求启动充电
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/v10/query_start_charge")
|
||||
public CommonResponse queryStartCharge(@RequestBody CommonRequest<StartChargeRequest> commonRequest) throws Exception {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
StartChargeRequest startChargeRequest = JSONUtil.readParams(commonRequest.getData(), StartChargeRequest.class);
|
||||
if (startChargeRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
String startChargeSeq = startChargeRequest.getStartChargeSeq();
|
||||
EtOrderMapping orderMapping = etOrderMappingRepo.findByEvcsOrderNo(startChargeSeq).orElse(null);
|
||||
if (orderMapping != null) {
|
||||
resp.setMsg("Duplicated StartChargeSeq");
|
||||
} else {
|
||||
StartChargeResponse startChargeResponse = new StartChargeResponse();
|
||||
startChargeResponse.setFailReason(0);
|
||||
startChargeResponse.setSuccStat(1);
|
||||
startChargeResponse.setStartChargeSeqStat(4);
|
||||
String connectorId = startChargeRequest.getConnectorId();
|
||||
Map<String, Object> cacheGun = REDIS.getCacheMap("gun:".concat(connectorId));
|
||||
String terminalStatus = (String) cacheGun.get("vehicleGunStatus");
|
||||
String status = (String) cacheGun.get("status");
|
||||
EtOrderMapping etOrderMapping = new EtOrderMapping();
|
||||
Date now = DateUtils.getNowDate();
|
||||
etOrderMapping.setCreateTime(now);
|
||||
etOrderMapping.setEvcsOrderNo(startChargeSeq);
|
||||
if (!"空闲".equals(status)) {
|
||||
resp.setMsg("终端状态异常:[".concat(status == null ? "未注册" : status).concat("]"));
|
||||
emptyHorder(startChargeSeq, connectorId, etOrderMapping);
|
||||
} else if ("否".equals(terminalStatus)) {
|
||||
resp.setMsg("未插枪");
|
||||
emptyHorder(startChargeSeq, connectorId, etOrderMapping);
|
||||
} else {
|
||||
String plateNum = startChargeRequest.getPlateNum();
|
||||
plateNum = plateNum == null ? startChargeRequest.getPlateNum2() : plateNum;
|
||||
R res = pileOrderService.pileStartUpBy3rd(startChargeSeq, startChargeRequest.getDriverId(),
|
||||
startChargeRequest.getChargingAmt(), plateNum, -1, connectorId);
|
||||
startChargeResponse.setStartChargeSeq(startChargeSeq);
|
||||
startChargeResponse.setConnectorID(connectorId);
|
||||
resp.setMsg(res.getMsg());
|
||||
if (res.getCode() != 200) {
|
||||
if (res.getCode() != 500) {
|
||||
startChargeResponse.setFailReason(res.getCode());
|
||||
} else {
|
||||
startChargeResponse.setFailReason(3);
|
||||
}
|
||||
startChargeResponse.setFailReasonMsg(res.getMsg());
|
||||
startChargeResponse.setSuccStat(1);
|
||||
startChargeResponse.setStartChargeSeqStat(4);
|
||||
emptyHorder(startChargeSeq, connectorId, etOrderMapping);
|
||||
} else {
|
||||
Map<String, Object> etOrderData = (Map<String, Object>) res.getData();
|
||||
if (etOrderData != null) {
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
startChargeResponse.setStartChargeSeqStat(1);
|
||||
startChargeResponse.setSuccStat(0);
|
||||
startChargeResponse.setFailReason(0);
|
||||
Map<String, Object> pushOrder = new HashMap<>();
|
||||
pushOrder.put("startChargeSeqStat", 1);
|
||||
pushOrder.put("internetSerialNumber", startChargeRequest.getStartChargeSeq());
|
||||
pushOrder.put("connectorID", connectorId);
|
||||
pushOrder.put("startChargeNotificationStat", 0);
|
||||
pushOrder.put("chargeOrderInfoNotificationStat", 0);
|
||||
pushOrder.put("operatorId3rdpty", startChargeSeq.substring(0, 9));
|
||||
pushOrder.put("startTime", etOrderData.get("startTime"));
|
||||
String orderNo = (String) etOrderData.get("orderNo");
|
||||
etOrderMapping.setXhOrderNo(orderNo);
|
||||
REDIS.setCacheMap("pushOrder:".concat(orderNo), pushOrder);
|
||||
} else {
|
||||
emptyHorder(startChargeSeq, connectorId, etOrderMapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
etOrderMappingRepo.save(etOrderMapping);
|
||||
resp.setData(JSONUtil.toJSONString(startChargeResponse));
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
private void emptyHorder(String startChargeSeq, String connectorId, EtOrderMapping etOrderMapping) {
|
||||
|
||||
final Long stationId = REDIS.getCacheMapValue("pile:".concat(connectorId.substring(0, 14)), "stationId");
|
||||
XhpcChargingStation xhpcChargingStation = xhpcChargingStationRepository.findById(stationId).orElse(null);
|
||||
if (xhpcChargingStation != null) {
|
||||
XhpcHistoryOrder emptyHorder = new XhpcHistoryOrder();
|
||||
emptyHorder.setTenantId(xhpcChargingStation.getTenantId());
|
||||
Date now = DateUtils.getNowDate();
|
||||
emptyHorder.setStartTime(now);
|
||||
emptyHorder.setEndTime(now);
|
||||
emptyHorder.setCreateTime(now);
|
||||
emptyHorder.setUpdateTime(now);
|
||||
emptyHorder.setStopReasonEvcs("平台停止");
|
||||
String sn = genOrder(connectorId);
|
||||
etOrderMapping.setXhOrderNo(sn);
|
||||
emptyHorder.setSerialNumber(sn);
|
||||
emptyHorder.setInternetSerialNumber(startChargeSeq);
|
||||
String operatorId3rdpty = startChargeSeq.substring(0, 9);
|
||||
emptyHorder.setOperatorId3rdptyEvcs(operatorId3rdpty);
|
||||
emptyHorder.setUserId(xhpcInternetUserRepository.queryDbId(operatorId3rdpty));
|
||||
emptyHorder.setType(1);
|
||||
emptyHorder.setSource(1);
|
||||
emptyHorder.setState(-1);
|
||||
emptyHorder.setChargingStationId(stationId);
|
||||
emptyHorder.setTerminalId(xhpcTerminalRepository.queryDbId(connectorId));
|
||||
emptyHorder.setConfirmResult(-1);
|
||||
xhpcHistoryOrderRepository.save(emptyHorder);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,149 @@
|
||||
package com.xhpc.evcs.cdjgpc.api;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.domain.XhpcChargingPile;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.dto.QueryStopChargeRequest;
|
||||
import com.xhpc.evcs.dto.QueryStopChargeResponse;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.OrderMappingRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcChargingPileRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-24 19:04
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class CDQueryStopChargeController {
|
||||
|
||||
@Autowired
|
||||
PowerPileService powerPileService;
|
||||
//三方订单与redis内部订单映射表
|
||||
@Autowired
|
||||
private OrderMappingRepository etOrderMappingRepo;
|
||||
|
||||
@Autowired
|
||||
private com.xhpc.evcs.jpa.XhpcChargingPileRepository XhpcChargingPileRepository;
|
||||
|
||||
/**
|
||||
* 请求停止充电
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v10/query_stop_charge")
|
||||
public CommonResponse queryStopCharge(@RequestBody CommonRequest<QueryStopChargeRequest> commonRequest) throws IOException {
|
||||
|
||||
CommonResponse commonResponse = new CommonResponse();
|
||||
commonResponse.setRet(EvcsConst.RET_FAIL);
|
||||
QueryStopChargeRequest queryStopChargeRequest = JSONUtil.readParams(commonRequest.getData(),
|
||||
QueryStopChargeRequest.class);
|
||||
if (queryStopChargeRequest == null) {
|
||||
commonResponse.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
// evcs电订单号(27位)
|
||||
String startChargeSeq = queryStopChargeRequest.getStartChargeSeq();
|
||||
QueryStopChargeResponse queryStopChargeResponse = new QueryStopChargeResponse();
|
||||
queryStopChargeResponse.setStartChargeSeq(startChargeSeq);
|
||||
//判断三方的订单号是否存在
|
||||
EtOrderMapping etOrderMapping = etOrderMappingRepo.findByEvcsOrderNo(startChargeSeq).orElse(null);
|
||||
if (etOrderMapping == null) {
|
||||
return failCommonResponse(queryStopChargeResponse, "错误的充电订单号");
|
||||
}
|
||||
String xhOrderNo = etOrderMapping.getXhOrderNo();
|
||||
String pushOrderkey = "pushOrder:".concat(xhOrderNo);
|
||||
Map<String, Object> pushOrder = REDIS.getCacheMap(pushOrderkey);
|
||||
if (pushOrder == null || (pushOrder.get("isStopNotified") != null && (Boolean) pushOrder.get("isStopNotified"))) {
|
||||
return failCommonResponse(queryStopChargeResponse, "已下发停止充电指令");
|
||||
}
|
||||
//充电设备接口编码(枪编码)
|
||||
String connectorId = queryStopChargeRequest.getConnectorId();
|
||||
String pileNum = connectorId.substring(0, connectorId.length() - 2);
|
||||
//从数据库中查询对应的桩的版本信息
|
||||
XhpcChargingPile pileInfo = XhpcChargingPileRepository.findBySerialNumber(pileNum).orElse(null);
|
||||
String versionNum = pileInfo.getCommunicationProtocolVersion() != null ?
|
||||
pileInfo.getCommunicationProtocolVersion() :
|
||||
"0A";
|
||||
//给对应的枪发送停止充电指令
|
||||
R r = powerPileService.stopCharging(xhOrderNo, pileNum, connectorId, versionNum);
|
||||
// 判断停止指令发送是否成功
|
||||
if (r.getCode() != 200) {
|
||||
//向redis中放入停止充电指令没有下发成功的标识
|
||||
REDIS.setCacheMap(pushOrderkey, pushOrder);
|
||||
//充电订单状态
|
||||
queryStopChargeResponse.setStartChargeSeqStat(5);
|
||||
//操作结果
|
||||
queryStopChargeResponse.setSuccStat(1);
|
||||
//失败原因
|
||||
String errorMsg = r.getMsg();
|
||||
if (errorMsg.contains("未注册")) {
|
||||
queryStopChargeResponse.setFailReasonMsg("此设备不存在");
|
||||
queryStopChargeResponse.setFailReason(1);
|
||||
}
|
||||
if (errorMsg.contains("离线")) {
|
||||
queryStopChargeResponse.setFailReasonMsg("此设备离线");
|
||||
queryStopChargeResponse.setFailReason(2);
|
||||
}
|
||||
if (errorMsg.contains("订单号")) {
|
||||
//4 means error orderNumber
|
||||
queryStopChargeResponse.setFailReasonMsg("订单号不正确");
|
||||
queryStopChargeResponse.setFailReason(4);
|
||||
}
|
||||
if (errorMsg.contains("端口")) {
|
||||
//5 means port is not charging
|
||||
queryStopChargeResponse.setFailReasonMsg("端口不在充电中");
|
||||
queryStopChargeResponse.setFailReason(5);
|
||||
}
|
||||
queryStopChargeResponse.setStartChargeSeqStat(4);
|
||||
queryStopChargeResponse.setSuccStat(1);
|
||||
String data = JSONUtil.toJSONString(queryStopChargeResponse);
|
||||
commonResponse.setMsg("请求停止充电失败");
|
||||
commonResponse.setData(data);
|
||||
return commonResponse;
|
||||
}
|
||||
//设置该订单已经被停止的标识
|
||||
Map<String, Object> order = REDIS.getCacheMap("order:" + xhOrderNo);
|
||||
order.replace("status", "已结束");
|
||||
REDIS.setCacheMap("order:".concat(xhOrderNo), order);
|
||||
REDIS.setCacheMap(pushOrderkey, pushOrder);
|
||||
queryStopChargeResponse.setStartChargeSeqStat(3);
|
||||
queryStopChargeResponse.setSuccStat(0);
|
||||
queryStopChargeResponse.setFailReason(0);
|
||||
String data = JSONUtil.toJSONString(queryStopChargeResponse);
|
||||
commonResponse.setRet("0");
|
||||
commonResponse.setMsg("请求停止充电成功");
|
||||
commonResponse.setData(data);
|
||||
}
|
||||
return commonResponse;
|
||||
}
|
||||
|
||||
private CommonResponse failCommonResponse(QueryStopChargeResponse queryStopChargeResponse, String msg) throws JsonProcessingException {
|
||||
|
||||
queryStopChargeResponse.setStartChargeSeqStat(5);
|
||||
queryStopChargeResponse.setSuccStat(1);
|
||||
queryStopChargeResponse.setFailReason(0);
|
||||
String data = JSONUtil.toJSONString(queryStopChargeResponse);
|
||||
CommonResponse commonResponse = new CommonResponse();
|
||||
commonResponse.setRet("500");
|
||||
commonResponse.setMsg(msg);
|
||||
commonResponse.setData(data);
|
||||
return commonResponse;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,111 @@
|
||||
package com.xhpc.evcs.cdjgpc.notification;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.dto.ChargeOrderInfo;
|
||||
import com.xhpc.evcs.dto.ChargeOrderInfoResponse;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.DTOJsonHelper;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.notification.NotificationChargeOrderInfoTask;
|
||||
import com.xhpc.evcs.utils.DateUtil;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.util.Collection;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-24 19:27
|
||||
*/
|
||||
@Component
|
||||
public class CDNotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
@Autowired
|
||||
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
|
||||
//@Scheduled(fixedRate = 1000 * 15)
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
Collection<String> orderKeys = REDIS.keys("order:*");
|
||||
Instant now = Instant.now();
|
||||
for (String okey : orderKeys) {
|
||||
String orderNo = okey.substring(6);
|
||||
if(orderNo.length() < 32){
|
||||
logger.error("orderNo[{}] is error", orderNo);
|
||||
continue;
|
||||
}
|
||||
|
||||
Date otime = DateUtil.orderNo2Date(orderNo);
|
||||
if (Duration.between(otime.toInstant(), now).toHours() > 24 * 3) {
|
||||
REDIS.deleteObject(okey);
|
||||
REDIS.deleteObject(okey.replace("order", "pushOrder"));
|
||||
logger.info("clear cache..{}", okey);
|
||||
}
|
||||
}
|
||||
List<AuthSecretToken> authSecretTokenList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT);
|
||||
List<XhpcHistoryOrder> xhpcHistoryOrderList =
|
||||
xhpcHistoryOrderRepository.findByConfirmResultNotAndSource(0, 1);
|
||||
for (XhpcHistoryOrder horder : xhpcHistoryOrderList) {
|
||||
for (AuthSecretToken authSecretToken : authSecretTokenList) {
|
||||
if(!"765367656".equals(horder.getInternetSerialNumber().substring(0, 9))){
|
||||
continue;
|
||||
}
|
||||
String operatorId3rdptyEvcs = horder.getOperatorId3rdptyEvcs();
|
||||
if (operatorId3rdptyEvcs == null) {
|
||||
if (horder.getInternetSerialNumber() != null) {
|
||||
operatorId3rdptyEvcs = horder.getInternetSerialNumber().substring(0, 9);
|
||||
horder.setOperatorId3rdptyEvcs(operatorId3rdptyEvcs);
|
||||
xhpcHistoryOrderRepository.save(horder); // mending
|
||||
}
|
||||
}
|
||||
if (authSecretToken.getOperatorId3irdpty().equals(operatorId3rdptyEvcs)) {
|
||||
// final List<XhpcStatisticsTimeInterval> statisticsTimeIntervals =
|
||||
// xhpcStatisticsTimeIntervalRepository.findAllByHistoryOrderId(horder.getHistoryOrderId());
|
||||
// horder.setXhpcStatisticsTimeIntervalList(statisticsTimeIntervals); //似乎并不需要
|
||||
ChargeOrderInfo chargeOrderInfo = new ChargeOrderInfo(horder);
|
||||
chargeOrderInfo.setChargeModel(null);
|
||||
final ChargeOrderInfoResponse pushResp = notify(chargeOrderInfo, authSecretToken);
|
||||
if (pushResp != null) {
|
||||
horder.setConfirmResult(pushResp.getConfirmResult());
|
||||
logger.debug("3rd part order {} push result: {}", horder.getSerialNumber(),
|
||||
pushResp.getConfirmResult());
|
||||
//logger.info("==============推送返回值================="+pushResp.toString());
|
||||
xhpcHistoryOrderRepository.save(horder);
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(horder.getSerialNumber()), "horderpushed", true);
|
||||
} else {
|
||||
logger.error("3dp[{}] order[{}/{}] push fail", operatorId3rdptyEvcs,
|
||||
horder.getSerialNumber(), horder.getInternetSerialNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public ChargeOrderInfoResponse notify(ChargeOrderInfo chargeOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException {
|
||||
|
||||
String data = JSONUtil.toJSONString(chargeOrderInfo);
|
||||
CommonRequest<ChargeOrderInfo> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_charge_order_info", authSecretTokenOut);
|
||||
return DTOJsonHelper.parseResponseData(responseBody,
|
||||
ChargeOrderInfoResponse.class, authSecretTokenOut);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,191 @@
|
||||
package com.xhpc.evcs.cdjgpc.notification;
|
||||
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDOrderInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||
import com.xhpc.evcs.domain.*;
|
||||
import com.xhpc.evcs.dto.CDChargeOrder4BonusInfoRes;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.DTOJsonHelper;
|
||||
import com.xhpc.evcs.jpa.*;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.notification.NotificationChargeOrderInfo4BonusTask;
|
||||
import com.xhpc.evcs.utils.DateUtil;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 订单信息推送
|
||||
* @author yuyang
|
||||
* @date 2023-09-20 9:34
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CDNotificationOrderInfoTask extends CoreDispatcher {
|
||||
@Autowired
|
||||
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
@Autowired
|
||||
private EtPushFailedOrderRepository etPushFailedOrderRepository;
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Autowired
|
||||
private StatisticTimeIntervalRepository statisticTimeIntervalRepository;
|
||||
@Autowired
|
||||
private OrderMappingRepository orderMappingRepository;
|
||||
@Autowired
|
||||
private XhpcChargingStationRepository chargingStationRepo;
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfo4BonusTask.class);
|
||||
|
||||
/**
|
||||
*订单信息推送 ---已推送
|
||||
* @throws IOException
|
||||
*/
|
||||
//@Scheduled(fixedDelay = 1000 * 60)
|
||||
public void run() throws IOException {
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
// maybe对接第三方
|
||||
if (authSecretTokenOut != null) {
|
||||
final List<XhpcHistoryOrder> notYetPushOrder =
|
||||
xhpcHistoryOrderRepository.findTop100ByHistoryOrderIdGreaterThanAndStateGreaterThanOrderByHistoryOrderIdAsc(authSecretTokenOut.getLastPushOrder(), 0);
|
||||
for (XhpcHistoryOrder xhpcHistoryOrder : notYetPushOrder) {
|
||||
List<XhpcStatisticsTimeInterval> statisticTimeIntervalList =
|
||||
statisticTimeIntervalRepository.findByHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
|
||||
xhpcHistoryOrder.setXhpcStatisticsTimeIntervalList(statisticTimeIntervalList);
|
||||
notify(xhpcHistoryOrder, authSecretTokenOut, false);
|
||||
}
|
||||
final List<XhpcHistoryOrder> pushFailedOrders =
|
||||
xhpcHistoryOrderRepository.findTop10JoinPushFailedOrders(authSecretTokenOut.getOperatorId3irdpty());
|
||||
for (XhpcHistoryOrder xhpcHistoryOrder : pushFailedOrders) {
|
||||
List<XhpcStatisticsTimeInterval> statisticTimeIntervalList =
|
||||
statisticTimeIntervalRepository.findByHistoryOrderId(xhpcHistoryOrder.getHistoryOrderId());
|
||||
xhpcHistoryOrder.setXhpcStatisticsTimeIntervalList(statisticTimeIntervalList);
|
||||
final boolean notify = notify(xhpcHistoryOrder, authSecretTokenOut, true);
|
||||
if (notify) {
|
||||
etPushFailedOrderRepository.deleteById(xhpcHistoryOrder.getHistoryOrderId());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public boolean notify(XhpcHistoryOrder xhpcHistoryOrder, AuthSecretToken authSecretTokenOut, boolean isRepush) throws IOException {
|
||||
String operatorIdEvcs = xhpcHistoryOrder.getOperatorIdEvcs();
|
||||
if (operatorIdEvcs == null) {
|
||||
Long chargingStationId = xhpcHistoryOrder.getChargingStationId();
|
||||
XhpcChargingStation station = chargingStationRepo.findById(chargingStationId).orElse(null);
|
||||
if(station == null){
|
||||
logger.error("station[{}] is not exits", chargingStationId);
|
||||
return false;
|
||||
}
|
||||
|
||||
String stationOperatorIdEvcs = station.getOperatorIdEvcs();
|
||||
if (stationOperatorIdEvcs == null) {
|
||||
logger.error("station[{}] operator id evcs not set", chargingStationId);
|
||||
return false;
|
||||
}
|
||||
if (stationOperatorIdEvcs.length() == 18) {
|
||||
operatorIdEvcs = stationOperatorIdEvcs.substring(8, 17);
|
||||
} else {
|
||||
operatorIdEvcs = stationOperatorIdEvcs;
|
||||
}
|
||||
}
|
||||
Long chargingStationId = xhpcHistoryOrder.getChargingStationId();
|
||||
String key = "cdjgpc:station:".concat(chargingStationId.toString())+".notification";
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
|
||||
|
||||
EtOrderMapping etOrderMapping = saveOrderMapping(xhpcHistoryOrder, orderMappingRepository, operatorIdEvcs);
|
||||
CDOrderInfo cdChargeOrderInfo4BonusReq = new CDOrderInfo(xhpcHistoryOrder,etOrderMapping);
|
||||
if(cdStationInfo !=null && cdStationInfo.getOperatorId() !=null){
|
||||
cdChargeOrderInfo4BonusReq.setOperatorID(cdStationInfo.getOperatorId());
|
||||
cdChargeOrderInfo4BonusReq.setEquipmentOwnerID(cdStationInfo.getEquipmentOwnerId());
|
||||
}
|
||||
operatorIdEvcs = operatorIdEvcs == null ? "MA6DFCTD5" : operatorIdEvcs;
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("OrderInfo",cdChargeOrderInfo4BonusReq);
|
||||
String data = JSONUtil.toJSONString(mapStationInfo);
|
||||
CommonRequest<CDOrderInfo> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_orderInfo", authSecretTokenOut);
|
||||
CDChargeOrder4BonusInfoRes cdChargeOrder4BonusInfoRes = DTOJsonHelper.parseResponseData(responseBody,
|
||||
CDChargeOrder4BonusInfoRes.class, authSecretTokenOut);
|
||||
if (!isRepush) {
|
||||
authSecretTokenOut.setLastPushOrder(xhpcHistoryOrder.getHistoryOrderId());
|
||||
authSecretTokenRepository.save(authSecretTokenOut);
|
||||
}
|
||||
if (cdChargeOrder4BonusInfoRes != null && cdChargeOrder4BonusInfoRes.getConfirmResult() == 0) {
|
||||
return true;
|
||||
} else {
|
||||
if (!isRepush) {
|
||||
EtPushFailedOrder etPushFailedOrder = new EtPushFailedOrder();
|
||||
etPushFailedOrder.setId(xhpcHistoryOrder.getHistoryOrderId());
|
||||
etPushFailedOrder.setOperatorId3rdpty(authSecretTokenOut.getOperatorId3irdpty());
|
||||
etPushFailedOrderRepository.save(etPushFailedOrder);
|
||||
}
|
||||
logger.error(String.format("push CD notification order[%s] failed: %s", xhpcHistoryOrder.getSerialNumber(),
|
||||
responseBody));
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
private EtOrderMapping saveOrderMapping(XhpcHistoryOrder xhpcHistoryOrder,
|
||||
OrderMappingRepository orderMappingRepository, String operatorId) {
|
||||
|
||||
String internetSerialNumber = xhpcHistoryOrder.getInternetSerialNumber();
|
||||
String xhOrderNo = xhpcHistoryOrder.getSerialNumber();
|
||||
return saveOrderMapping(xhOrderNo, internetSerialNumber, orderMappingRepository, operatorId);
|
||||
}
|
||||
|
||||
public static String transferInternetOrderNo(String orderKeyOrNo, String operatorId) {
|
||||
//80836000010001012110191723410021
|
||||
//MA6DFCTD5202201111742100140
|
||||
String orderNo = orderKeyOrNo.replace("order:", "");
|
||||
if (operatorId.length() > 9) {
|
||||
operatorId = operatorId.substring(0, 9);
|
||||
}
|
||||
return operatorId.concat(DateUtil.getYYYY()).concat(orderNo.substring(18));
|
||||
}
|
||||
|
||||
public static EtOrderMapping saveOrderMapping(String xhOrderNo, String internetSerialNumber,
|
||||
OrderMappingRepository orderMappingRepository, String operatorId) {
|
||||
|
||||
EtOrderMapping etOrderMapping;
|
||||
EtOrderMapping om;
|
||||
if (internetSerialNumber != null) {
|
||||
om = new EtOrderMapping();
|
||||
om.setEvcsOrderNo(internetSerialNumber);
|
||||
Example<EtOrderMapping> example = Example.of(om);
|
||||
etOrderMapping = orderMappingRepository.findOne(example).orElse(null);
|
||||
if (etOrderMapping == null) {
|
||||
om.setXhOrderNo(xhOrderNo);
|
||||
etOrderMapping = orderMappingRepository.save(om);
|
||||
}
|
||||
} else {
|
||||
om = new EtOrderMapping();
|
||||
om.setXhOrderNo(xhOrderNo);
|
||||
Example<EtOrderMapping> example = Example.of(om);
|
||||
etOrderMapping = orderMappingRepository.findOne(example).orElse(null);
|
||||
if (etOrderMapping == null) {
|
||||
etOrderMapping = new EtOrderMapping();
|
||||
etOrderMapping.setXhOrderNo(xhOrderNo);
|
||||
etOrderMapping.setEvcsOrderNo(transferInternetOrderNo(xhOrderNo, operatorId));
|
||||
etOrderMapping = orderMappingRepository.save(etOrderMapping);
|
||||
}
|
||||
}
|
||||
return etOrderMapping;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,155 @@
|
||||
package com.xhpc.evcs.cdjgpc.notification;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.domain.XhpcTerminal;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDConnectorStatusInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDConnectorStatusInfoReq;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationFee;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.XhpcInternetUser;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.ConnectorStatusInfo;
|
||||
import com.xhpc.evcs.dto.ConnectorStatusInfoReq;
|
||||
import com.xhpc.evcs.dto.PageRequest;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcInternetUserRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcTerminalRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.ChangePoleStatus;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_IN;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
import static com.xhpc.evcs.dto.ConnectorStatusInfo.*;
|
||||
import static com.xhpc.evcs.dto.ConnectorStatusInfo.CHARGING;
|
||||
|
||||
/**
|
||||
* 设备状态变化推送 --已推送
|
||||
* @author yuyang
|
||||
* @date 2023-10-07 10:32
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CDNotificationStationStatusTask extends CoreDispatcher {
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Autowired
|
||||
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
@Autowired
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Resource
|
||||
private XhpcTerminalRepository terminalRepository;
|
||||
|
||||
//@Scheduled(fixedRate = 1000 * 45)
|
||||
protected void run() throws IOException {
|
||||
|
||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||
|
||||
List<XhpcTerminal> terminalList = terminalRepository.selectStatusBySql();
|
||||
Map<String,Integer> terminalDBMap = terminalList.stream().collect(Collectors.toMap(XhpcTerminal::getSerialNumber,XhpcTerminal::getStatus));
|
||||
|
||||
Instant now = Instant.now();
|
||||
|
||||
XhpcInternetUser xhpcInternetUser =
|
||||
xhpcInternetUserRepository.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter("MA6CC2LK7", Instant.now(), Instant.now());
|
||||
|
||||
for (String stationTerminalKey : stationTerminalKeys) {
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationTerminalKey.replace("stationTerminalStatus",
|
||||
"station"));
|
||||
String operatorId = chargingStationDto.getOperatorId();
|
||||
Map<String, String> terminalStatusMap = REDIS.getCacheMap(stationTerminalKey);
|
||||
Set<ConnectorStatusInfo> connectorStatusInfos = translateStatus(operatorId, terminalStatusMap, terminalDBMap);
|
||||
Set<ConnectorStatusInfo> changeStatus = ChangePoleStatus.getChangeStatus(connectorStatusInfos);
|
||||
if (!changeStatus.isEmpty()) {
|
||||
XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
|
||||
xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(Long.valueOf(stationTerminalKey.split(":")[1]),
|
||||
xhpcInternetUser.getInternetUserId()).orElse(null);
|
||||
if (xhpcStationInternetBlacklist != null) continue;
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType("MA6CC2LK7", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
log.debug("nss pushing to: {}", "MA6CC2LK7");
|
||||
if (authSecretTokenOut != null) {
|
||||
for (ConnectorStatusInfo statusInfo : changeStatus) {
|
||||
notify(stationTerminalKey,statusInfo, authSecretTokenOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Set<ConnectorStatusInfo> translateStatus(String operatorId, Map<String, String> terminalStatusMap, Map<String, Integer> terminalDBMap) {
|
||||
|
||||
Set<ConnectorStatusInfo> connectorStatusInfoList = new HashSet<>();
|
||||
final Set<String> connectorIds = terminalStatusMap.keySet();
|
||||
for (String gunId : connectorIds) {
|
||||
ConnectorStatusInfo connectorStatusInfo = new ConnectorStatusInfo();
|
||||
connectorStatusInfo.setConnectorID(gunId);
|
||||
connectorStatusInfo.setOperatorID(operatorId);
|
||||
Integer dbStatus = terminalDBMap.get(gunId);
|
||||
if(dbStatus !=null && dbStatus == 0){
|
||||
connectorStatusInfo.setStatus(translateStatus(terminalStatusMap.get(gunId)));
|
||||
} else {
|
||||
connectorStatusInfo.setStatus(0);
|
||||
}
|
||||
connectorStatusInfoList.add(connectorStatusInfo);
|
||||
}
|
||||
return connectorStatusInfoList;
|
||||
}
|
||||
|
||||
private Integer translateStatus(String statusStr) {
|
||||
|
||||
switch (statusStr) {
|
||||
case "空闲":
|
||||
return FREE;
|
||||
case "离线":
|
||||
return OFF_LINE;
|
||||
case "故障":
|
||||
return ERROR;
|
||||
default:
|
||||
return CHARGING;
|
||||
}
|
||||
}
|
||||
|
||||
public void notify(String stationTerminalKey,ConnectorStatusInfo connectorStatusInfo, AuthSecretToken authSecretTokenOut) throws IOException {
|
||||
|
||||
CDConnectorStatusInfoReq connectorStatusInfoReq = new CDConnectorStatusInfoReq();
|
||||
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(stationTerminalKey.replace("stationTerminalStatus","cdjgpc:station")+".notification");
|
||||
CDConnectorStatusInfo cdConnectorStatusInfo =new CDConnectorStatusInfo();
|
||||
cdConnectorStatusInfo.setOperatorID(cdStationInfo.getOperatorId());
|
||||
cdConnectorStatusInfo.setEquipmentOwnerID(cdStationInfo.getEquipmentOwnerId());
|
||||
cdConnectorStatusInfo.setStationID(cdStationInfo.getStationId());
|
||||
cdConnectorStatusInfo.setEquipmentID(connectorStatusInfo.getConnectorID().substring(0,14));
|
||||
cdConnectorStatusInfo.setEquipmentClassification(1);
|
||||
cdConnectorStatusInfo.setConnectorID(connectorStatusInfo.getConnectorID());
|
||||
cdConnectorStatusInfo.setStatus(connectorStatusInfo.getStatus());
|
||||
|
||||
connectorStatusInfoReq.setConnectorStatusInfo(cdConnectorStatusInfo);
|
||||
String data = JSONUtil.toJSONString(connectorStatusInfoReq);
|
||||
CommonRequest<CDConnectorStatusInfoReq> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String result = ok(commonRequest, "/notification_stationStatus", authSecretTokenOut);
|
||||
|
||||
System.out.println("=======result========"+result);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,67 @@
|
||||
package com.xhpc.evcs.cdjgpc.notification;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationStatslnfo;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 推送充电站用能统计信息 ---推送失败
|
||||
* @author yuyang
|
||||
* @date 2023-10-07 11:00
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CDSuperviseNotificationOperationStatusInfoTask extends CoreDispatcher {
|
||||
|
||||
@Resource
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Resource
|
||||
PowerPileService powerPileService;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(CDSuperviseNotificationOperationStatusInfoTask.class);
|
||||
//@Scheduled(cron = "0 0 0 * * ? ")
|
||||
//@Scheduled(fixedRate = 1000 * 45)
|
||||
protected void run() throws IOException {
|
||||
String replace = UUID.randomUUID().toString().replace("-", "");
|
||||
|
||||
R r = powerPileService.getSuperviseNotificationOperationStatusInfo(replace);
|
||||
if(r.getCode() !=200){
|
||||
logger.info("========推送充电站用能统计信息失败,时间:"+ DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd"));
|
||||
}
|
||||
String key ="cdjgpc:station:"+replace+".getSuperviseNotificationOperationStatusInfo";
|
||||
List<CDStationStatslnfo> stationStatsInfoList =REDIS.getCacheObject(key);
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
Map<String, Object> map =new HashMap<>();
|
||||
map.put("StationStatsInfos",stationStatsInfoList);
|
||||
String data = JSONUtil.toJSONString(map);
|
||||
CommonRequest<CDStationStatslnfo> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String ok = ok(commonRequest, "/supervise_notification_operation_status_info", authSecretTokenOut);
|
||||
System.out.println("=====ok======"+ok);
|
||||
logger.info("========推送充电站用能统计信息成功,时间:========="+DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd"));
|
||||
REDIS.deleteObject(key);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,69 @@
|
||||
package com.xhpc.evcs.cdjgpc.notification;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationStatslnfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDSupStationPowerInfo;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 推送充电站实时功率
|
||||
* @author yuyang
|
||||
* @date 2023-10-07 11:04
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CDSuperviseNotificationRealtimePowerInfoTask extends CoreDispatcher {
|
||||
|
||||
@Resource
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Resource
|
||||
PowerPileService powerPileService;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(CDSuperviseNotificationOperationStatusInfoTask.class);
|
||||
//@Scheduled(cron = "0 0 0 * * ? ")
|
||||
//@Scheduled(fixedRate = 1000 * 45)
|
||||
protected void run() throws IOException {
|
||||
String replace = UUID.randomUUID().toString().replace("-", "");
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
|
||||
R r = powerPileService.getSuperviseNotificationRealtimePowerInfo(authSecretTokenOut.getOperatorId3irdpty(),replace);
|
||||
if(r.getCode() !=200){
|
||||
logger.info("========推送充电站实时功率失败,时间:"+ DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd"));
|
||||
}
|
||||
String key ="cdjgpc:station:"+replace+".getSuperviseNotificationRealtimePowerInfo";
|
||||
List<CDSupStationPowerInfo> supStationPowerInfos =REDIS.getCacheObject(key);
|
||||
|
||||
Map<String, Object> map =new HashMap<>();
|
||||
map.put("SupStationPowerInfos",supStationPowerInfos);
|
||||
String data = JSONUtil.toJSONString(map);
|
||||
CommonRequest<CDSupStationPowerInfo> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String ok = ok(commonRequest, "/supervise_notification_realtime_power_info", authSecretTokenOut);
|
||||
System.out.println("=====ok======"+ok);
|
||||
logger.info("========推送充电站实时功率成功,时间:========="+DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd"));
|
||||
REDIS.deleteObject(key);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,17 @@
|
||||
package com.xhpc.evcs.cdjgpc.notification;
|
||||
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
/**
|
||||
* 查询充电事故
|
||||
* @author yuyang
|
||||
* @date 2023-10-07 11:05
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CDSuperviseQueryAccidentInfoTask extends CoreDispatcher {
|
||||
|
||||
//"/supervise_query_accident_info"
|
||||
}
|
||||
@ -48,7 +48,7 @@ import java.util.Scanner;
|
||||
//@Component //spring boot way, see https://www.surasint.com/spring-boot-webfilter-instead-of-component/
|
||||
//@Order(1) not supported, see https://github.com/spring-projects/spring-boot/issues/8276
|
||||
//成都市监管平台v10 恒大v20 新电途 v30 快电 v40 小桔v50
|
||||
@WebFilter(urlPatterns = {"/v1/*", "/v2/*", "/v10/*"}, filterName = "v1n2filter") //multiple filters execute by filterName order
|
||||
@WebFilter(urlPatterns = {"/v1/*", "/v2/*", "/v10/*"}, filterName = "v1n10filter") //multiple filters execute by filterName order
|
||||
public class EvcsFilter extends OncePerRequestFilter {
|
||||
|
||||
@Resource
|
||||
@ -64,7 +64,7 @@ public class EvcsFilter extends OncePerRequestFilter {
|
||||
return;
|
||||
}
|
||||
ServletRequest requestWrapper = new HttpServletRequestRepeatReadWrapper(request);
|
||||
final String encin = request.getHeader("enc.in");
|
||||
// final String encin = request.getHeader("enc.in");
|
||||
// if (encin != null && encin.equals("false")) { //todo comment out in prd env
|
||||
// chain.doFilter(requestWrapper, response);
|
||||
// return;
|
||||
|
||||
@ -134,6 +134,7 @@ public class CoreDispatcher {
|
||||
assert body != null;
|
||||
// if (body==null) request = req.get().build();
|
||||
// else
|
||||
logger.info("==============body================="+body.toString());
|
||||
request = req.post(body).build();
|
||||
OkHttpClient client = builder.build();
|
||||
return fwdToInfra(request, client);
|
||||
@ -167,4 +168,98 @@ public class CoreDispatcher {
|
||||
AuthSecretToken.SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
}
|
||||
|
||||
public String ceshiOk(Object object, String url, AuthSecretToken authSecretTokenOut) {
|
||||
|
||||
return ceshiOk(object, url, authSecretTokenOut, null);
|
||||
}
|
||||
|
||||
@Transactional
|
||||
public String ceshiOk(Object object, String url, AuthSecretToken authSecretTokenOut, String stationOperatorId) {
|
||||
if (authSecretTokenOut == null) {
|
||||
log.error("authSecretTokenOut is null");
|
||||
throw new RuntimeException();
|
||||
}
|
||||
okhttp3.RequestBody body = null;
|
||||
OkHttpClient.Builder builder = new OkHttpClient.Builder();
|
||||
if (oklog2) {
|
||||
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
|
||||
logging.setLevel(HttpLoggingInterceptor.Level.BODY);
|
||||
builder.addInterceptor(logging);
|
||||
}
|
||||
builder.connectTimeout(10, TimeUnit.SECONDS)
|
||||
.readTimeout(10, TimeUnit.SECONDS)
|
||||
.writeTimeout(10, TimeUnit.SECONDS);
|
||||
Calendar cal = Calendar.getInstance();
|
||||
String bearerToken = null;
|
||||
try {
|
||||
if (object.getClass().getSimpleName().equals("CommonRequest")) {
|
||||
CommonRequest commonRequest = (CommonRequest) object;
|
||||
if (stationOperatorId != null) {
|
||||
commonRequest.setOperatorId(stationOperatorId);
|
||||
} else {
|
||||
commonRequest.setOperatorId(authSecretTokenOut.getOperatorId());
|
||||
}
|
||||
Date tokenExpiry = authSecretTokenOut.getTokenExpiry();
|
||||
String originalData = commonRequest.getData();
|
||||
String tData;
|
||||
if (tokenExpiry == null || tokenExpiry.before(cal.getTime())) {
|
||||
log.debug("query notify token opid3rdpt [{}]", authSecretTokenOut.getOperatorId3irdpty());
|
||||
TokenRequest tokenRequest = new TokenRequest();
|
||||
tokenRequest.setOperatorId(authSecretTokenOut.getOperatorId());
|
||||
tokenRequest.setOperatorSecret(authSecretTokenOut.getOperatorSecret());
|
||||
commonRequest.setData(JSONUtil.toJSONString(tokenRequest));
|
||||
tData = JSONUtil.toJSONString(commonRequest);
|
||||
if (authSecretTokenOut.isEncrypt()) {
|
||||
tData = encryptReqOut(authSecretTokenOut.getDataSecret(), authSecretTokenOut.getDataSecretIV(),
|
||||
authSecretTokenOut.getSigSecret(), commonRequest);
|
||||
}
|
||||
Request request = new Request.Builder()
|
||||
.url(authSecretTokenOut.getUrlPrefix() + "/query_token")
|
||||
.post(okhttp3.RequestBody.create(JSON, tData))
|
||||
.build();
|
||||
OkHttpClient client = builder.build();
|
||||
String tokenResponse = fwdToInfra(request, client);
|
||||
TokenResponse tr = DTOJsonHelper.parseResponseData(tokenResponse, TokenResponse.class, authSecretTokenOut);
|
||||
if (tr != null) {
|
||||
String token = tr.getAccessToken();
|
||||
Integer tokenAvailableTime = tr.getTokenAvailableTime();
|
||||
authSecretTokenOut.setToken(token);
|
||||
authSecretTokenOut.setTokenExpiry(DateUtil.date(Calendar.getInstance().getTimeInMillis() + (tokenAvailableTime) * 1000L - 300));
|
||||
authSecretTokenRepository.save(authSecretTokenOut);
|
||||
}
|
||||
}
|
||||
bearerToken = authSecretTokenOut.getToken();
|
||||
commonRequest.setData(originalData);
|
||||
tData = JSONUtil.toJSONString(commonRequest);
|
||||
log.debug("to [{}] {} out plain data:\n{}", authSecretTokenOut.getOperatorId3irdpty(), url, tData);
|
||||
if (authSecretTokenOut.isEncrypt()) {
|
||||
tData = encryptReqOut(authSecretTokenOut.getDataSecret(), authSecretTokenOut.getDataSecretIV(),
|
||||
authSecretTokenOut.getSigSecret(), commonRequest);
|
||||
// log.debug("notify out encrypt data:\n{}", tData);
|
||||
}
|
||||
body = okhttp3.RequestBody.create(JSON, tData);
|
||||
// logger.info("==============平台推送值================="+tData);
|
||||
}
|
||||
|
||||
} catch (JsonProcessingException | BadPaddingException | InvalidAlgorithmParameterException | NoSuchAlgorithmException | IllegalBlockSizeException | NoSuchPaddingException | InvalidKeyException e) {
|
||||
String msg = e.getMessage();
|
||||
log.error(msg);
|
||||
throw new ServerInternalException(msg);
|
||||
}
|
||||
|
||||
final Request.Builder req = new Request.Builder()
|
||||
.url(authSecretTokenOut.getUrlPrefix() + url)
|
||||
.header("Authorization", "Bearer " + bearerToken);
|
||||
Request request;
|
||||
assert body != null;
|
||||
// if (body==null) request = req.get().build();
|
||||
// else
|
||||
logger.info("==============body================="+body.toString());
|
||||
request = req.post(body).build();
|
||||
OkHttpClient client = builder.build();
|
||||
return fwdToInfra(request, client);
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -39,7 +39,7 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
|
||||
//@Scheduled(fixedRate = 1000 * 15)
|
||||
//111@Scheduled(fixedRate = 1000 * 15)
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
Collection<String> orderKeys = REDIS.keys("order:*");
|
||||
@ -62,6 +62,10 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
List<XhpcHistoryOrder> xhpcHistoryOrderList =
|
||||
xhpcHistoryOrderRepository.findByConfirmResultNotAndSource(0, 1);
|
||||
for (XhpcHistoryOrder horder : xhpcHistoryOrderList) {
|
||||
|
||||
if("765367656".equals(horder.getInternetSerialNumber().substring(0, 9))){
|
||||
continue;
|
||||
}
|
||||
for (AuthSecretToken authSecretToken : authSecretTokenList) {
|
||||
String operatorId3rdptyEvcs = horder.getOperatorId3rdptyEvcs();
|
||||
if (operatorId3rdptyEvcs == null) {
|
||||
|
||||
@ -48,7 +48,7 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
* 推送充电状态
|
||||
* @throws IOException
|
||||
*/
|
||||
//@Scheduled(fixedRate = 1000 * 50)
|
||||
//111@Scheduled(fixedRate = 1000 * 50)
|
||||
public void run() throws IOException {
|
||||
|
||||
List<AuthSecretToken> authSecretTokenOutList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT);
|
||||
@ -211,10 +211,14 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
|
||||
public void notify(EquipChargeStatus equipChargeStatus, AuthSecretToken authSecretTokenOut) throws IOException {
|
||||
|
||||
String data = JSONUtil.toJSONString(equipChargeStatus);
|
||||
CommonRequest<CDChargeOrderInfo4BonusReq> commonRequest = new CommonRequest<>();
|
||||
final String operatorId = authSecretTokenOut.getOperatorId3irdpty().equals("765367656") ?
|
||||
authSecretTokenOut.getOperatorId() : "MA6DFCTD5";
|
||||
if(operatorId.equals("765367656")){
|
||||
equipChargeStatus.setChargeModel(null);
|
||||
}
|
||||
String data = JSONUtil.toJSONString(equipChargeStatus);
|
||||
CommonRequest<CDChargeOrderInfo4BonusReq> commonRequest = new CommonRequest<>();
|
||||
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_equip_charge_status", authSecretTokenOut);
|
||||
EquipChargeStatusRes equipChargeStatusRes = DTOJsonHelper.parseResponseData(responseBody,
|
||||
@ -224,11 +228,4 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
DateTime dt = DateTime.now();
|
||||
System.out.println((double) Math.round(100111 / 100D) / 100D);
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -33,7 +33,7 @@ public class NotificationStartChargeResultTask extends CoreDispatcher {
|
||||
/**
|
||||
* Judging the 3rd whether it has got the start charging task.
|
||||
*/
|
||||
//@Scheduled(fixedRate = 1000 * 3)
|
||||
//111@Scheduled(fixedRate = 1000 * 3)
|
||||
public void run() throws IOException {
|
||||
|
||||
//Getting the charge orders which from 3rd.
|
||||
@ -54,6 +54,12 @@ public class NotificationStartChargeResultTask extends CoreDispatcher {
|
||||
notificationStartChargeResultRequestData.setStartTime((String) pushOrder.get("startTime"));
|
||||
notificationStartChargeResultRequestData.setStartChargeSeq(startChargeSeq);
|
||||
notificationStartChargeResultRequestData.setConnectorId((String) pushOrder.get("connectorID"));
|
||||
if("765367656".equals(operatorId)){
|
||||
Integer startChargeSeqStat = (Integer) pushOrder.get("startChargeSeqStat");
|
||||
if(startChargeSeqStat !=1){
|
||||
notificationStartChargeResultRequestData.setFailReasonMsg("平台停止");
|
||||
}
|
||||
}
|
||||
notificationStartChargeResultRequestData.setStartChargeSeqStat((Integer) pushOrder.get(
|
||||
"startChargeSeqStat"));
|
||||
notify(notificationStartChargeResultRequestData, authSecretToken.get(), pushOrderKey.substring(10));
|
||||
|
||||
@ -49,7 +49,7 @@ public class NotificationStationStatusTask extends CoreDispatcher {
|
||||
@Resource
|
||||
private XhpcTerminalRepository terminalRepository;
|
||||
|
||||
//@Scheduled(fixedRate = 1000 * 45)
|
||||
//111@Scheduled(fixedRate = 1000 * 45)
|
||||
protected void run() throws IOException {
|
||||
|
||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||
|
||||
@ -26,7 +26,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
|
||||
//@Scheduled(fixedRate = 1000 * 3)
|
||||
//111@Scheduled(fixedRate = 1000 * 3)
|
||||
public void run() throws Exception {
|
||||
|
||||
notifyService();
|
||||
|
||||
48
sql/v2.2.sql
48
sql/v2.2.sql
@ -21,12 +21,24 @@ ALTER TABLE `xhpc_charging_station`
|
||||
ADD COLUMN `station_status` INT(4) NULL DEFAULT NULL COMMENT '场站建设状态' AFTER `construction_time`,
|
||||
ADD COLUMN `open_all_day` INT(4) NULL DEFAULT NULL COMMENT '是否全天开放(0 否 1是,为零时营业时间必填)' AFTER `station_status`,
|
||||
ADD COLUMN `busine_hours` VARCHAR(100) NULL DEFAULT NULL COMMENT '推荐格 式:周一 至周日 00:00-24:00' AFTER `open_all_day`,
|
||||
ADD COLUMN `service_fee` VARCHAR(100) NULL DEFAULT NULL COMMENT '服务费率' AFTER `busine_hours`,
|
||||
ADD COLUMN `electricity_fee` VARCHAR(100) NULL DEFAULT NULL COMMENT '充电费描述' AFTER `busine_hours`,
|
||||
ADD COLUMN `service_fee` VARCHAR(100) NULL DEFAULT NULL COMMENT '服务费率' AFTER `electricity_fee`,
|
||||
ADD COLUMN `park_free` INT(4) NULL DEFAULT NULL COMMENT '是否免费停车(0 否 1是)' AFTER `service_fee`,
|
||||
ADD COLUMN `park_fee` VARCHAR(100) NULL DEFAULT NULL COMMENT '停车费描述' AFTER `park_free`,
|
||||
ADD COLUMN `payment` VARCHAR(100) NULL DEFAULT NULL COMMENT '支付方式:刷卡、线上、现金 电子钱包:微信/支付宝 ' AFTER `park_fee`;
|
||||
|
||||
|
||||
ADD COLUMN `equipment_type` VARCHAR(100) NULL DEFAULT 1 COMMENT '设备类型:1:直流设备 2:交流设备 3:交直流一体设备' AFTER `payment`;
|
||||
ADD COLUMN `area_code_countryside` VARCHAR(10) NULL DEFAULT NULL COMMENT '充电站省市辖区编码' AFTER `equipment_type`,
|
||||
ADD COLUMN `swap_match_cars_name` VARCHAR(100) NULL DEFAULT NULL COMMENT '服务车型描述' AFTER `area_code_countryside`,
|
||||
ADD COLUMN `station_classification` INT(4) NULL DEFAULT NULL COMMENT '站点分类' AFTER `swap_match_cars`,
|
||||
ADD COLUMN `general_application_type` INT(4) NULL DEFAULT NULL COMMENT '通用类型' AFTER `station_classification`,
|
||||
ADD COLUMN `round_the_clock` INT(4) NULL DEFAULT NULL COMMENT '7*24小时营业' AFTER `general_application_type`,
|
||||
ADD COLUMN `park_type` INT(4) NULL DEFAULT NULL COMMENT '停车费类型' AFTER `round_the_clock`,
|
||||
ADD COLUMN `electncity_type` INT(4) NULL DEFAULT NULL COMMENT '电费类型' AFTER `park_type`,
|
||||
ADD COLUMN `business_expand_type` INT(4) NULL DEFAULT NULL COMMENT '报装类型' AFTER `electncity_type`,
|
||||
ADD COLUMN `rated_power` DOUBLE(10,4) NULL DEFAULT NULL COMMENT '站点额定总功率' AFTER `business_expand_type`,
|
||||
ADD COLUMN `period_fee` INT(4) NULL DEFAULT NULL COMMENT '峰谷分时' AFTER `rated_power`,
|
||||
ADD COLUMN `official_run_time` VARCHAR(50) NULL DEFAULT NULL COMMENT '正式投运时间' AFTER `period_fee`,
|
||||
ADD COLUMN `video_monitor` INT(4) NULL DEFAULT NULL COMMENT '视频监控配套情况' AFTER `official_run_time`;
|
||||
|
||||
|
||||
ALTER TABLE `xhpc_charging_pile`
|
||||
@ -39,7 +51,37 @@ ALTER TABLE `xhpc_charging_pile`
|
||||
ADD COLUMN `manufacturer_id` VARCHAR(50) NULL DEFAULT NULL COMMENT '设备生产商组织机构代码' AFTER `equipment_purpose`;
|
||||
|
||||
|
||||
ALTER TABLE `xhpc_charge_order`
|
||||
ADD COLUMN `station_total_warning_num` INT(4) NULL DEFAULT NULL COMMENT '充电站累计告警数量' AFTER `vin_normal`;
|
||||
|
||||
|
||||
UPDATE `rycloud`.`xhpc_area` SET `code`='510156' WHERE `code`=510186;
|
||||
|
||||
INSERT INTO `rycloud`.`xhpc_area` (`code`, `pcode`, `name`, `short_name`, `merger_name`, `province`, `city`, `level`, `lng`, `lat`, `letter`, `pinyin`, `first_char`, `status`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `is_deleted`, `tenant_id`)
|
||||
VALUES ('510102', '510100', '高新区', '高新区', '四川省/成都市/高新区', '四川省', '成都市', '3', '104.08347', '30.65614', 'JXQ', 'gaoxingqu', 'C', '0', NULL, NULL, '2019-12-19 11:44:50', NULL, '2019-12-19 11:44:50', '0', '000000');
|
||||
|
||||
CREATE TABLE `xhpc_equipment_accident` (
|
||||
`equipment_accident_id` bigint(20) NOT NULL AUTO_INCREMENT,
|
||||
`area_code` varchar(6) DEFAULT NULL COMMENT '区域代码',
|
||||
`address` varchar(255) DEFAULT NULL COMMENT '事故地点',
|
||||
`accident_entity` int(4) DEFAULT NULL COMMENT '事故主题 1.运营商 2车企 3.设备制造商',
|
||||
`type` int(4) DEFAULT NULL COMMENT '事故类型 1.充电设备质量问题 2.电动车电池问题 3.电网故障 4.充电站管路 99.其他',
|
||||
`accident_reason` text COMMENT '事故原因',
|
||||
`level` int(4) DEFAULT NULL COMMENT '事故分级 1.造成经济损失且有人员伤亡 2.造成人员伤亡 3.造成经济损失但未造成人员伤亡 4.未造成经济损失且无人员伤亡',
|
||||
`accident_time` datetime DEFAULT NULL COMMENT '发生时间',
|
||||
`description` text COMMENT '事故文字描述',
|
||||
`pictures` text COMMENT '现场图片',
|
||||
`analysis_report` text COMMENT '事故分析报告',
|
||||
`del_flag` int(2) DEFAULT '0' COMMENT '删除标志(0代表存在 2代表删除)',
|
||||
`create_time` datetime DEFAULT NULL COMMENT '创建时间',
|
||||
`create_by` varchar(30) CHARACTER SET utf8 DEFAULT '' COMMENT '创建者',
|
||||
`update_time` datetime DEFAULT NULL ON UPDATE CURRENT_TIMESTAMP COMMENT '更新时间',
|
||||
`update_by` varchar(30) CHARACTER SET utf8 DEFAULT NULL COMMENT '更新者',
|
||||
`remark` varchar(255) CHARACTER SET utf8 DEFAULT NULL COMMENT '备注',
|
||||
`tenant_id` varchar(12) DEFAULT '000000' COMMENT '租户id',
|
||||
PRIMARY KEY (`equipment_accident_id`)
|
||||
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb4 COMMENT='充电事故信息';
|
||||
|
||||
|
||||
ALTER TABLE `xhpc_charging_station_power`
|
||||
ADD COLUMN `type` int(4) NULL DEFAULT '0' COMMENT '是否推送 0 未推送 1已推送' AFTER `installed_total_power`;
|
||||
|
||||
@ -27,7 +27,7 @@ public class AutoProcessOrderTask {
|
||||
@Resource
|
||||
PowerPileService powerPileService;
|
||||
|
||||
@Scheduled(fixedRate = 60000)
|
||||
//111@Scheduled(fixedRate = 60000)
|
||||
protected void run() {
|
||||
|
||||
List<XhpcWorkOrderDomain> orderList = workOrderMapper.selectByAutoRun();
|
||||
|
||||
@ -76,7 +76,7 @@
|
||||
|
||||
<select id="getListPage" resultType="map">
|
||||
select
|
||||
ho.history_order_id as historyOrderId,
|
||||
xho.history_order_id as historyOrderId,
|
||||
co.charge_order_id as chargeOrderId,
|
||||
ho.serial_number as serialNumber,
|
||||
ct.name as chargingStationName,
|
||||
@ -123,6 +123,7 @@
|
||||
ho.stop_reason_evcs_name as stopReasonEvcsName
|
||||
from xhpc_work_history_order as ho
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
|
||||
LEFT JOIN xhpc_history_order xho on ho.charge_order_id =xho.charge_order_id
|
||||
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
||||
left join xhpc_charge_order co on co.charge_order_id = ho.charge_order_id
|
||||
left join xhpc_terminal as ter on ter.terminal_id = ho.terminal_id
|
||||
|
||||
@ -222,11 +222,10 @@ public class XhpcChargingStationController extends BaseController {
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取场站信息
|
||||
* 组合场站信息(成都市平台)
|
||||
*/
|
||||
|
||||
@GetMapping("/getChargingStationServiceById")
|
||||
public R getChargingStationServiceById(Long stationId){
|
||||
return xhpcChargingStationService.getChargingStationServiceById(stationId);
|
||||
@GetMapping("/getNotificationStationInfo")
|
||||
public R getNotificationStationInfo(Long stationId){
|
||||
return xhpcChargingStationService.getNotificationStationInfo(stationId);
|
||||
}
|
||||
}
|
||||
|
||||
@ -254,6 +254,6 @@ public interface IXhpcChargingStationService {
|
||||
|
||||
Map<String,Object> activityDiscountTime(Long userId, Date startTime, Integer source, Long chargingStationId, String tenantId);
|
||||
|
||||
R getChargingStationServiceById(Long stationId);
|
||||
R getNotificationStationInfo(Long stationId);
|
||||
|
||||
}
|
||||
|
||||
@ -687,8 +687,15 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
||||
//数据回滚-手动回滚
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error("添加费率入缓存失败,请稍后在试");
|
||||
}else{
|
||||
//费率发生改变,缓存到redis
|
||||
powerPileService.getNotificationStationFee(chargingStationId);
|
||||
//生成场站推送数据信息
|
||||
powerPileService.addNotificationStationInfo(chargingStationId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
//修改桩和终端的模板id
|
||||
xhpcChargingStationMapper.updateXhpcChargingPile(chargingStationId,rateModelId);
|
||||
xhpcChargingStationMapper.updateXhpcTerminal(chargingStationId,rateModelId);
|
||||
@ -1068,6 +1075,10 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
||||
XhpcChargingStation xhpc = xhpcChargingStationMapper.selectXhpcChargingStationById(xhpcChargingStation.getChargingStationId());
|
||||
xhpcChargingStation.setRateModelId(xhpc.getRateModelId());
|
||||
xhpcChargingStationMapper.updateXhpcChargingStation(xhpcChargingStation);
|
||||
|
||||
//生成场站推送数据信息
|
||||
powerPileService.addNotificationStationInfo(xhpcChargingStation.getChargingStationId());
|
||||
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@ -1343,6 +1354,8 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return AjaxResult.error("添加费率入缓存失败,请稍后在试");
|
||||
}
|
||||
//费率发生改变,缓存到redis
|
||||
powerPileService.getNotificationStationFee(chargingStationId);
|
||||
//修改桩和终端的模板id
|
||||
xhpcChargingStationMapper.updateXhpcChargingPile(chargingStationId,rateModelId);
|
||||
xhpcChargingStationMapper.updateXhpcTerminal(chargingStationId,rateModelId);
|
||||
@ -1569,9 +1582,14 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getChargingStationServiceById(Long stationId) {
|
||||
Map<String, Object> map = xhpcChargingStationMapper.getXhpcChargingStationMessage(stationId);
|
||||
return R.ok(map,"获取场站基本信息成功");
|
||||
public R getNotificationStationInfo(Long stationId) {
|
||||
R r = powerPileService.getNotificationStationInfo(stationId);
|
||||
if (r.getCode() != 200) {
|
||||
logger.info("组合场站信息(成都市平台)失败,请稍后在试:"+r.getMsg());
|
||||
//数据回滚-手动回滚
|
||||
return R.fail("组合场站信息(成都市平台)失败,请稍后在试");
|
||||
}
|
||||
return R.ok(null,"组合场站信息(成都市平台)成功");
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -563,6 +563,8 @@ public class XhpcTimingChargingModelServiceImpl extends BaseService implements I
|
||||
xhpcTimingChargingModel.setStatus(1);
|
||||
xhpcTimingChargingModel.setErrorReason(r.getMsg());
|
||||
xhpcTimingChargingModelMapper.updateXhpcTimingChargingModel(xhpcTimingChargingModel);
|
||||
//费率发生改变,缓存到redis
|
||||
powerPileService.getNotificationStationFee(chargingStationId);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -275,7 +275,7 @@
|
||||
ct.parking_lock_flag as parkingLockFlag,
|
||||
ct.is_demand_response as isDemandResponse,
|
||||
ct.is_support_orderly_charging as isSupportOrderlyCharging,
|
||||
ct.is_energystorage as isEnergystorage,
|
||||
ct.is_energy_storage as isEnergyStorage,
|
||||
ct.station_type as stationType,
|
||||
ct.longitude as longitude,
|
||||
ct.latitude as latitude,
|
||||
|
||||
@ -17,7 +17,7 @@ import java.util.Map;
|
||||
* @date 2021/11/5 10:05
|
||||
* @since version-1.0
|
||||
*/
|
||||
@FeignClient(contextId = "ChargingStationPushStatusService", value = ServiceNameConstants.XHPC_EVCS, fallbackFactory = ChargingStationPushStatusFallbackFactory.class)
|
||||
@FeignClient(contextId = "ChargingStationPushStatusService", value = ServiceNameConstants.XHPC_CHARGING_STATION, fallbackFactory = ChargingStationPushStatusFallbackFactory.class)
|
||||
public interface ChargingStationPushStatusService {
|
||||
|
||||
@PostMapping("/station/editStationStatus")
|
||||
|
||||
@ -0,0 +1,21 @@
|
||||
package com.xhpc.common.api;
|
||||
|
||||
import com.xhpc.common.api.factory.EvcsServiceFallbackFactory;
|
||||
import com.xhpc.common.core.constant.ServiceNameConstants;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import org.springframework.cloud.openfeign.FeignClient;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author yuyang
|
||||
* @date 2023-09-16 19:08
|
||||
*/
|
||||
@FeignClient(contextId = "EvcsService", value = ServiceNameConstants.XHPC_EVCS, fallbackFactory = EvcsServiceFallbackFactory.class)
|
||||
public interface EvcsService {
|
||||
|
||||
//市平台---设备充电中状态变化推送
|
||||
@GetMapping("/v10/getNotificationConnectorChargeStatus")
|
||||
R getNotificationConnectorChargeStatus(@RequestParam("serialNumber") String serialNumber);
|
||||
}
|
||||
@ -51,6 +51,48 @@ public interface PowerPileService {
|
||||
@PostMapping("/pile/{pileNo}/reboot")
|
||||
R pileReboot(@PathVariable("pileNo") String pileNo);
|
||||
|
||||
@GetMapping("/station/getNotificationStationInfo/{stationId}")
|
||||
R getNotificationStationInfo(@Param("stationId") Long stationId);
|
||||
//整合场站数据
|
||||
@GetMapping("/station/getNotificationStationInfo")
|
||||
R getNotificationStationInfo(@RequestParam("stationId") Long stationId);
|
||||
|
||||
//生成场站推送数据信息
|
||||
@GetMapping("/station/addNotificationStationInfo")
|
||||
R addNotificationStationInfo(@RequestParam("stationId") Long stationId);
|
||||
|
||||
|
||||
//查询统计信息(成都市平台调用我们平台)
|
||||
@GetMapping("/station/queryStationStats")
|
||||
R queryStationStats(@RequestParam("stationId") Long stationId,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime);
|
||||
|
||||
//查询充电设备运行统计计信息
|
||||
@GetMapping("/station/querySupEquipmentStatsInfo")
|
||||
R querySupEquipmentStatsInfo(@RequestParam("stationId") Long stationId,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime);
|
||||
|
||||
//查询充电设备接口运行统计计信息
|
||||
@GetMapping("/station/queryConnectorStatsInfo")
|
||||
R queryConnectorStatsInfo(@RequestParam("stationId") Long stationId,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime);
|
||||
|
||||
//查询费率变化
|
||||
@GetMapping("/station/getNotificationStationFee")
|
||||
R getNotificationStationFee(@RequestParam("stationId") Long stationId);
|
||||
|
||||
//查询充电站功率统信息
|
||||
@GetMapping("/station/getSuperviseQueryStationPowerInfo")
|
||||
R getSuperviseQueryStationPowerInfo(@RequestParam("stationIDs") String [] stationIDs,@RequestParam("dataTime") String dataTime,@RequestParam("replace") String replace);
|
||||
|
||||
//查询充电设备功率统计信息
|
||||
@GetMapping("/station/getSuperviseQueryEquipmentPowerInfo")
|
||||
R getSuperviseQueryEquipmentPowerInfo(@RequestParam("stationID") String stationID,@RequestParam("dataTime") String dataTime,@RequestParam("replace") String replace);
|
||||
|
||||
//查充电事故
|
||||
@GetMapping("/station/getSuperviseQueryAccidentInfo")
|
||||
R getSuperviseQueryAccidentInfo(@RequestParam("lastQueryTime") String lastQueryTime,@RequestParam("replace") String replace);
|
||||
|
||||
//推送充电站用能统计信息
|
||||
@GetMapping("/station/getSuperviseNotificationOperationStatusInfo")
|
||||
R getSuperviseNotificationOperationStatusInfo(@RequestParam("replace") String replace);
|
||||
|
||||
//推送充电站实时功率
|
||||
@GetMapping("/station/getSuperviseNotificationRealtimePowerInfo")
|
||||
R getSuperviseNotificationRealtimePowerInfo(@RequestParam("operatorIdEvcs")String operatorIdEvcs,@RequestParam("replace")String replace);
|
||||
}
|
||||
|
||||
@ -0,0 +1,39 @@
|
||||
package com.xhpc.common.api.factory;
|
||||
|
||||
import com.xhpc.common.api.EvcsService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.cloud.openfeign.FallbackFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.HashMap;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @date 2023-09-16 19:10
|
||||
*/
|
||||
@Component
|
||||
public class EvcsServiceFallbackFactory implements FallbackFactory<EvcsService> {
|
||||
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(EvcsServiceFallbackFactory.class);
|
||||
/**
|
||||
* Returns an instance of the fallback appropriate for the given cause.
|
||||
*
|
||||
* @param cause cause of an exception.
|
||||
* @return fallback
|
||||
*/
|
||||
@Override
|
||||
public EvcsService create(Throwable cause) {
|
||||
logger.error("Evcs服务调用失败:{}//fallback", cause.getMessage());
|
||||
return new EvcsService() {
|
||||
@Override
|
||||
public R getNotificationConnectorChargeStatus(String serialNumber) {
|
||||
return R.fail(500,"Evcs服务--》设备充电中状态变化推送接口失败:" + serialNumber);
|
||||
}
|
||||
|
||||
};
|
||||
}
|
||||
}
|
||||
@ -80,6 +80,56 @@ public class PowerPileFallbackFactory implements FallbackFactory<PowerPileServic
|
||||
public R getNotificationStationInfo(Long stationId) {
|
||||
return R.fail(500,"组装场站信息失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R addNotificationStationInfo(Long stationId) {
|
||||
return R.fail(500,"生成场站推送数据信息失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R queryStationStats(Long stationId, String startTime, String endTime) {
|
||||
return R.fail(500,"统计场站信息失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R querySupEquipmentStatsInfo(Long stationId, String startTime, String endTime) {
|
||||
return R.fail(500,"查询充电设备运行统计信息失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R queryConnectorStatsInfo(Long stationId, String startTime, String endTime) {
|
||||
return R.fail(500,"查询充电设备接口运行统计计信息失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getNotificationStationFee(Long stationId) {
|
||||
return R.fail(500,"获取场站费率失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getSuperviseQueryStationPowerInfo(String[] stationIDs, String dataTime,String replace) {
|
||||
return R.fail(500,"查询充电站功率统信息失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getSuperviseQueryEquipmentPowerInfo(String stationID, String dataTime,String replace) {
|
||||
return R.fail(500,"查询充电设备功率统计信息失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getSuperviseQueryAccidentInfo(String lastQueryTime,String replace) {
|
||||
return R.fail(500,"查充电事故信息失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getSuperviseNotificationOperationStatusInfo(String replace) {
|
||||
return R.fail(500,"推送充电站用能统计信息失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R getSuperviseNotificationRealtimePowerInfo(String operatorIdEvcs, String replace) {
|
||||
return R.fail(500,"推送充电站实时功率失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -4,6 +4,7 @@ import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUnit;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.alibaba.fastjson.JSONObject;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.api.UserTypeService;
|
||||
import com.xhpc.common.api.WebSocketService;
|
||||
import com.xhpc.common.api.WorkOrderYuService;
|
||||
@ -27,10 +28,8 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static cn.hutool.core.date.DateUnit.*;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
@ -59,6 +58,9 @@ public class XhpcPileOrderController extends BaseController {
|
||||
@Autowired
|
||||
private WorkOrderYuService workOrderYuService;
|
||||
|
||||
@Autowired
|
||||
private PowerPileService powerPileService;
|
||||
|
||||
private static final Logger logger = LoggerFactory.getLogger(XhpcPileOrderController.class);
|
||||
|
||||
/**
|
||||
@ -238,6 +240,7 @@ public class XhpcPileOrderController extends BaseController {
|
||||
CacheRealtimeData cacheRealtimeData = redisService.getCacheObject("order:" + orderNo + ".lord");
|
||||
|
||||
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderService.getSerialNumberMessage(orderNo);
|
||||
|
||||
if(xhpcChargeOrder==null|| xhpcChargeOrder.getUserId()==null){
|
||||
logger.info("桩实时数据回调接口--无效订单号>>>>>orderNo:" + orderNo);
|
||||
return R.fail(500,"无效订单号");
|
||||
@ -259,6 +262,94 @@ public class XhpcPileOrderController extends BaseController {
|
||||
return R.fail(500,"无效订单号");
|
||||
}
|
||||
}
|
||||
|
||||
String key = "pile:"+orderNo.substring(0,14);
|
||||
Map<String, Object> cachePile = REDIS.getCacheMap(key);
|
||||
if(cachePile !=null && cachePile.get("equipmentType") !=null && "1".equals(cachePile.get("equipmentType").toString()) && cacheRealtimeData.getWorkingCurrent()>=300){
|
||||
|
||||
String keys = "RealtimeOrder:"+orderNo;
|
||||
Map<String, Object> keysMap = new HashMap<>();
|
||||
Map<String, Object> keysMapOrder = redisService.getCacheMap(keys);
|
||||
int number =1;
|
||||
if(keysMapOrder !=null && keysMapOrder.get("number") !=null){
|
||||
number =(Integer)keysMapOrder.get("number");
|
||||
if(number<8){
|
||||
keysMapOrder.put("identical","0");
|
||||
}else{
|
||||
if(keysMapOrder.get("identical") ==null || "".equals(keysMapOrder.get("identical").toString())){
|
||||
keysMapOrder.put("identical","0");
|
||||
}
|
||||
}
|
||||
Integer soc = cacheRealtimeData.getSoc();
|
||||
if(number>=8 && soc<90){
|
||||
String chargingDegree ="";
|
||||
String amountCharged ="";
|
||||
if(number%3==1){
|
||||
chargingDegree =keysMapOrder.get("chargingDegree1").toString();
|
||||
amountCharged =keysMapOrder.get("amountCharged1").toString();
|
||||
}else if(number%3==2){
|
||||
chargingDegree =keysMapOrder.get("chargingDegree2").toString();
|
||||
amountCharged =keysMapOrder.get("amountCharged2").toString();
|
||||
}else{
|
||||
chargingDegree =keysMapOrder.get("chargingDegree3").toString();
|
||||
amountCharged =keysMapOrder.get("amountCharged3").toString();
|
||||
}
|
||||
String identical =keysMapOrder.get("identical").toString();
|
||||
String substring = orderNo.substring(0, 14);
|
||||
if(chargingDegree.equals(cacheRealtimeData.getChargingDegree().toString()) || amountCharged.equals(cacheRealtimeData.getAmountCharged().toString())){
|
||||
if("0".equals(identical)){
|
||||
keysMap.put("identical","1");
|
||||
}else if("1".equals(identical)){
|
||||
keysMap.put("identical","2");
|
||||
}else{
|
||||
//停止充电
|
||||
xhpcChargeOrder.setRemark("充电桩校验故障");
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
powerPileService.stopCharging(orderNo, substring,orderNo.substring(0, 16), "0A");
|
||||
return R.fail(500,"充电桩校验故障");
|
||||
}
|
||||
}
|
||||
}else{
|
||||
keysMap.put("identical","0");
|
||||
}
|
||||
number++;
|
||||
}
|
||||
|
||||
keysMap.put("orderNo",cacheRealtimeData.getOrderNo());
|
||||
keysMap.put("number",number);
|
||||
keysMap.put("createTime",cacheRealtimeData.getCreateTime());
|
||||
if(cacheRealtimeData.getWorkingVoltage() !=null){
|
||||
keysMap.put("workingVoltage",cacheRealtimeData.getWorkingVoltage());
|
||||
}
|
||||
if(cacheRealtimeData.getWorkingVoltage() !=null){
|
||||
keysMap.put("workingCurrent",cacheRealtimeData.getWorkingCurrent());
|
||||
}
|
||||
if(number%3==1){
|
||||
if(cacheRealtimeData.getWorkingVoltage() !=null){
|
||||
keysMap.put("amountCharged1",cacheRealtimeData.getAmountCharged());
|
||||
}
|
||||
if(cacheRealtimeData.getWorkingVoltage() !=null){
|
||||
keysMap.put("chargingDegree1",cacheRealtimeData.getChargingDegree());
|
||||
}
|
||||
}else if(number%3==2){
|
||||
if(cacheRealtimeData.getWorkingVoltage() !=null){
|
||||
keysMap.put("amountCharged2",cacheRealtimeData.getAmountCharged());
|
||||
}
|
||||
if(cacheRealtimeData.getWorkingVoltage() !=null){
|
||||
keysMap.put("chargingDegree2",cacheRealtimeData.getChargingDegree());
|
||||
}
|
||||
}else{
|
||||
if(cacheRealtimeData.getWorkingVoltage() !=null){
|
||||
keysMap.put("amountCharged3",cacheRealtimeData.getAmountCharged());
|
||||
}
|
||||
if(cacheRealtimeData.getWorkingVoltage() !=null){
|
||||
keysMap.put("chargingDegree3",cacheRealtimeData.getChargingDegree());
|
||||
}
|
||||
}
|
||||
redisService.setCacheMap(keys,keysMap);
|
||||
}
|
||||
|
||||
|
||||
Long userId = xhpcChargeOrder.getUserId();
|
||||
Integer source = xhpcChargeOrder.getSource();
|
||||
String tenantId = xhpcChargeOrder.getTenantId();
|
||||
@ -381,16 +472,17 @@ public class XhpcPileOrderController extends BaseController {
|
||||
}
|
||||
BigDecimal bigDecimal = new BigDecimal(10000);
|
||||
BigDecimal totalPowerQuantity = new BigDecimal(cacheOrderData.getTotalPowerQuantity()).divide(bigDecimal,4,BigDecimal.ROUND_HALF_UP);
|
||||
if(totalPowerQuantity.compareTo(new BigDecimal(250)) > -1){
|
||||
logger.info("结算电量大于250度>>"+totalPowerQuantity+">>>orderNo:" + orderNo);
|
||||
if(totalPowerQuantity.compareTo(new BigDecimal(400)) > -1){
|
||||
logger.info("结算电量大于400度>>"+totalPowerQuantity+">>>orderNo:" + orderNo);
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
xhpcChargeOrder.setChargingDegree(totalPowerQuantity);
|
||||
xhpcChargeOrder.setUpdateTime(new Date());
|
||||
xhpcChargeOrder.setErroRemark("结算电量大于250度");
|
||||
xhpcChargeOrder.setErroRemark("结算电量大于400度");
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
BigDecimal money = new BigDecimal(cacheOrderData.getCost()).divide(bigDecimal,2,BigDecimal.ROUND_HALF_UP);
|
||||
|
||||
if(cacheOrderData.getTotalPowerQuantity()==0 || totalPowerQuantity.compareTo(new BigDecimal(0.1))<1 || money.compareTo(new BigDecimal(0.1))<1){
|
||||
xhpcChargeOrder.setStatus(3);
|
||||
xhpcChargeOrder.setUpdateTime(new Date());
|
||||
@ -586,7 +678,11 @@ public class XhpcPileOrderController extends BaseController {
|
||||
xhpcChargeOrder.setChargingDegree(divide);
|
||||
xhpcChargeOrder.setAmountCharged(money);
|
||||
String stopReason = cacheOrderData.getStopReason();
|
||||
xhpcChargeOrder.setRemark(stopReason);
|
||||
if("充电桩校验故障".equals(xhpcChargeOrder.getRemark())){
|
||||
|
||||
}else{
|
||||
xhpcChargeOrder.setRemark(stopReason);
|
||||
}
|
||||
xhpcChargeOrder.setUpdateTime(date);
|
||||
xhpcChargeOrder.setStatus(status);
|
||||
XhpcHistoryOrder xhpcHistoryOrder = new XhpcHistoryOrder();
|
||||
@ -673,6 +769,9 @@ public class XhpcPileOrderController extends BaseController {
|
||||
logger.info("添加订单回调失败>>>>>orderNo:"+orderNo);
|
||||
return R.fail(500,"添加订单回调失败");
|
||||
}
|
||||
String keys = "RealtimeOrder:"+orderNo;
|
||||
redisService.deleteObject(keys);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@ -817,25 +916,20 @@ public R pileStartUpBy3rd(@RequestParam(value = "internetSerialNumber") String i
|
||||
|
||||
logger.info("桩实时数据BMS回调接口>>>>>orderNo:" + orderNo);
|
||||
//获取实时订单
|
||||
|
||||
xhpcRealTimeOrderService.addRealTimeOrderBms(orderNo);
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
String startTime1="2023-07-11 11:55:34";
|
||||
String endTime1="2023-07-11 12:52:27";
|
||||
Date startTime = DateUtil.parse(startTime1);
|
||||
Date endTime = DateUtil.parse(endTime1);
|
||||
System.out.println("=========="+DateUtil.formatDateTime(startTime));
|
||||
System.out.println("=========="+DateUtil.formatDateTime(endTime));
|
||||
DateTime parse = DateUtil.parse(DateUtil.format(startTime, "yyyy-MM-dd"), "yyyy-MM-dd");
|
||||
DateTime parse1 = DateUtil.parse(DateUtil.format(endTime, "yyyy-MM-dd"), "yyyy-MM-dd");
|
||||
long betweenDay = DateUtil.between(parse,parse1, DateUnit.DAY);
|
||||
System.out.println("=========="+betweenDay);
|
||||
|
||||
@GetMapping("/chargeOrder/realtimeOrderDedis")
|
||||
public R realtimeOrderDedis() {
|
||||
logger.info("清除缓存>>>>>RealtimeOrder:");
|
||||
//获取实时订单
|
||||
Collection<String> realtimeOrder = REDIS.keys("RealtimeOrder:*");
|
||||
for (String okey : realtimeOrder) {
|
||||
redisService.deleteObject(okey);
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@ -32,7 +32,7 @@ public class XhpcChargingStationPowerController extends BaseController {
|
||||
private IXhpcChargingStationPowerService xhpcChargingStationPowerService;
|
||||
|
||||
@GetMapping("/test1")
|
||||
@Scheduled(cron = "0 0/30 0/1 * * ? ")
|
||||
@Scheduled(cron = "0 0/5 0/1 * * ? ")
|
||||
public void test1(){
|
||||
xhpcChargingStationPowerService.addChargingStationPower();
|
||||
}
|
||||
|
||||
@ -1006,6 +1006,15 @@ public class XhpcHistoryOrderController extends BaseController {
|
||||
xhpcSt.setEndTimeEvcs(DateUtil.format(xhpc.getEndTime(), "yyyy-MM-dd HH:mm:ss"));
|
||||
xhpcSt.setCreateTime(xhpc.getEndTime());
|
||||
}
|
||||
Map<String, Object> xhpcRateTimeFee = xhpcHistoryOrderService.getXhpcRateTimeFee(xhpc.getRateModelId());
|
||||
if(xhpcRateTimeFee !=null){
|
||||
if(xhpcRateTimeFee.get("powerFee") !=null){
|
||||
xhpcSt.setElecPriceEvcs(new BigDecimal(xhpcRateTimeFee.get("powerFee").toString()));
|
||||
}
|
||||
if(xhpcRateTimeFee.get("serviceFee") !=null){
|
||||
xhpcSt.setServicePrice(new BigDecimal(xhpcRateTimeFee.get("serviceFee").toString()));
|
||||
}
|
||||
}
|
||||
xhpcStatisticsService.addStatisticsTime(xhpcSt);
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
@ -444,4 +444,27 @@ public class XhpcStatisticsController extends BaseController {
|
||||
public AjaxResult getWorkOrderNumber(){
|
||||
return AjaxResult.success(xhpcStatisticsService.getWorkOrderNumber());
|
||||
}
|
||||
|
||||
@GetMapping("/getChargeOrderFaultPage")
|
||||
public TableDataInfo getChargeOrderFaultPage(HttpServletRequest request,Long chargingStationId,String serialNumber,String startTime, String endTime)
|
||||
{
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcStatisticsService.getChargeOrderFaultPage(request,chargingStationId,serialNumber,startTime,endTime);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@PostMapping("/getChargeOrderFaultPage/export")
|
||||
public void getChargeOrderFaultPageExport(HttpServletRequest request,HttpServletResponse response,Long chargingStationId,String serialNumber,String startTime, String endTime)throws IOException
|
||||
{
|
||||
xhpcStatisticsService.getChargeOrderFaultPageExport(request,response,chargingStationId,serialNumber,startTime,endTime);
|
||||
}
|
||||
|
||||
/**
|
||||
* 工单类型统计
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/getHistoryOrderMassage")
|
||||
public AjaxResult getHistoryOrderMassage(Long chargeOrderId){
|
||||
return AjaxResult.success(xhpcStatisticsService.getHistoryOrderMassage(chargeOrderId));
|
||||
}
|
||||
}
|
||||
|
||||
@ -151,4 +151,6 @@ public interface XhpcHistoryOrderMapper {
|
||||
int updateOrderInternetPush(Long historyOrderId);
|
||||
|
||||
int updateChengDuPush(Long historyOrderId);
|
||||
|
||||
Map<String, Object> getXhpcRateTimeFee(@Param("date") String date, @Param("rateModelId") Long rateModelId);
|
||||
}
|
||||
|
||||
@ -5,6 +5,7 @@ import com.xhpc.order.domain.XhpcStatisticsTimeInterval;
|
||||
import org.apache.ibatis.annotations.Mapper;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@ -229,4 +230,10 @@ public interface XhpcStatisticsServiceMapper {
|
||||
Map<String, Object> getChargeOrderStatusNumber(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);
|
||||
|
||||
Map<String, Object> getRefundOderStatusNumber(@Param("status") Integer status,@Param("logOperatorId")Long logOperatorId,@Param("tenantId")String tenantId);
|
||||
|
||||
List<Map<String, Object>> getChargeOrderFaultPage(@Param("chargingStationId") Long chargingStationId,@Param("serialNumber") String serialNumber,@Param("startTime") String startTime,@Param("endTime") String endTime,@Param("type") Integer type,@Param("userId")Long userId,@Param("tenantId")String tenantId);
|
||||
|
||||
Map<String, Object> getHistoryOrderMassage(@Param("chargeOrderId")Long chargeOrderId);
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -145,4 +145,6 @@ public interface IXhpcHistoryOrderService {
|
||||
AjaxResult updateOrderInternetPush(Long historyOrderId);
|
||||
|
||||
AjaxResult updateChengDuPush(Long historyOrderId);
|
||||
|
||||
Map<String, Object> getXhpcRateTimeFee(Long rateModelId);
|
||||
}
|
||||
|
||||
@ -317,4 +317,12 @@ public interface IXhpcStatisticsService {
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, Object>> getWorkOrderNumber();
|
||||
|
||||
|
||||
List<Map<String, Object>> getChargeOrderFaultPage(HttpServletRequest request,Long chargingStationId,String serialNumber,String startTime, String endTime);
|
||||
|
||||
|
||||
void getChargeOrderFaultPageExport(HttpServletRequest request,HttpServletResponse response,Long chargingStationId,String serialNumber,String startTime, String endTime) throws IOException ;
|
||||
|
||||
Map<String, Object> getHistoryOrderMassage(Long chargeOrderId);
|
||||
}
|
||||
|
||||
@ -33,10 +33,9 @@ public class XhpcChargingStationPowerServiceImpl extends BaseService implements
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
|
||||
|
||||
private final String [] enumeration ={"zero","one","two","three","four","five", "six","seven","eight","nine","ten","eleven","twelve","thirteen","fourteen","fifteen","sixteen","seventeen", "eighteen","nineteen","twenty","twenty-one","twenty-two","twenty-three","twenty-four",
|
||||
"twenty-five","twenty-six","twenty-seven", "twenty-eight","twenty-nine","thirty","thirty-one","thirty-two","thirty-three","thirty-four","thirty-five","thirty-six","thirty-seven","thirty-eight","thirty-nine","forty","forty-one","forty-two","forty-three","forty-four","forty-five","forty-six","forty-seven"};
|
||||
|
||||
|
||||
|
||||
"twenty-five","twenty-six","twenty-seven", "twenty-eight","twenty-nine","thirty","thirty-one","thirty-two","thirty-three","thirty-four","thirty-five","thirty-six","thirty-seven","thirty-eight","thirty-nine","forty","forty-one","forty-two","forty-three","forty-four","forty-five","forty-six","forty-seven",
|
||||
"forty-eight","forty-nine","fifty","fifty-one","fifty-two","fifty-three","fifty-four","fifty-five","fifty-six","fifty-seven","fifty-eight","fifty-nine","sixty","sixty-one","sixty-two","sixty-three","sixty-four","sixty-five","sixty-six","sixty-seven","sixty-eight","sixty-nine","seventy","seventy-one","seventy-two","seventy-three","seventy-four",
|
||||
"seventy-five","seventy-six","seventy-seven","seventy-eight","seventy-nine","eighty","eighty-one","eighty-two","eighty-three","eighty-four","eighty-five","eighty-six","eighty-seven","eighty-eight","eighty-nine","ninety","ninety-one","ninety-two","ninety-three","ninety-four","ninety-five"};
|
||||
|
||||
@Override
|
||||
public void addChargingStationPower() {
|
||||
@ -54,14 +53,22 @@ public class XhpcChargingStationPowerServiceImpl extends BaseService implements
|
||||
String sterTime = "";
|
||||
String endTime = "";
|
||||
String substr = now.substring(0,13);
|
||||
if(mm>=30){
|
||||
numbrt = hh*2+1;
|
||||
sterTime = substr+":29:25";
|
||||
endTime = substr+":30:08";
|
||||
}else{
|
||||
numbrt = hh*2;
|
||||
if(mm<15){
|
||||
numbrt = hh*4;
|
||||
sterTime = substr+":00:00";
|
||||
endTime = substr+":00:16";
|
||||
endTime = substr+":14:59";
|
||||
}else if(mm<30){
|
||||
numbrt = hh*4+1;
|
||||
sterTime = substr+":15:00";
|
||||
endTime = substr+":29:59";
|
||||
}else if(mm<45){
|
||||
numbrt = hh*4+2;
|
||||
sterTime = substr+":30:00";
|
||||
endTime = substr+":44:59";
|
||||
}else{
|
||||
numbrt = hh*4+3;
|
||||
sterTime = substr+":45:00";
|
||||
endTime = substr+":59:59";
|
||||
}
|
||||
for (int i = 0; i <chargingStationS.size() ; i++) {
|
||||
Map<String, Object> objectMap = chargingStationS.get(i);
|
||||
@ -79,19 +86,19 @@ public class XhpcChargingStationPowerServiceImpl extends BaseService implements
|
||||
int determine = xhpcChargingStationPowerMapper.duplicateStatistics(chargingStationId, terminalId,numbrt, subTime);
|
||||
if(determine==0){
|
||||
List<Map<String, Object>> xhpcRealTimeOrderList = xhpcChargingStationPowerMapper.getXhpcRealTimeOrderList(chargingStationId,terminalId, sterTime, endTime, numbrt,subTime);
|
||||
int finalNumbrt = numbrt;
|
||||
executorService.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if(xhpcRealTimeOrderList !=null && xhpcRealTimeOrderList.size()>0){
|
||||
for (int j = 0; j < xhpcRealTimeOrderList.size(); j++) {
|
||||
Map<String, Object> map = xhpcRealTimeOrderList.get(j);
|
||||
map.put("number", finalNumbrt);
|
||||
addXhpcChargingStationPower(map);
|
||||
}
|
||||
if(xhpcRealTimeOrderList !=null && xhpcRealTimeOrderList.size()>0){
|
||||
int finalNumbrt = numbrt;
|
||||
executorService.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
for (int j = 0; j < xhpcRealTimeOrderList.size(); j++) {
|
||||
Map<String, Object> map = xhpcRealTimeOrderList.get(j);
|
||||
map.put("number", finalNumbrt);
|
||||
addXhpcChargingStationPower(map);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -130,17 +137,13 @@ public class XhpcChargingStationPowerServiceImpl extends BaseService implements
|
||||
}
|
||||
if(list !=null && list.size()>0){
|
||||
for (int i = 0; i <list.size() ; i++) {
|
||||
String[] shuzu ={"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47"};
|
||||
String[] shuzu ={"0","1","2","3","4","5","6","7","8","9","10","11","12","13","14","15","16","17","18","19","20","21","22","23","24","25","26","27","28","29","30","31","32","33","34","35","36","37","38","39","40","41","42","43","44","45","46","47",
|
||||
"48","49","50","51","52","53","54","55","56","57","58","59","60","61","62","63","64","65","66","67","68","69","70","71","72","73","74","75","76","77","78","79","80","81","82","83","84","85","86","87","88","89","90","91","92","93","94","95"};
|
||||
Map<String, Object> map = list.get(i);
|
||||
String status = map.get("status").toString();
|
||||
String[] split = status.split(",");
|
||||
String power = map.get("power").toString();
|
||||
String[] powerSplit = power.split(",");
|
||||
System.out.println("====i==="+i);
|
||||
System.out.println("====split.length==="+split.length);
|
||||
System.out.println("====chargingStationName==="+map.get("chargingStationName").toString());
|
||||
System.out.println("====time==="+map.get("time").toString());
|
||||
System.out.println("====powerSplit.length==="+powerSplit.length);
|
||||
for (int j = 0; j <split.length ; j++) {
|
||||
int time = Integer.parseInt(split[j]);
|
||||
if(map.get(enumeration[time]) !=null){
|
||||
@ -232,11 +235,8 @@ public class XhpcChargingStationPowerServiceImpl extends BaseService implements
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
String time ="2023-10-10 19:00:07";
|
||||
System.out.println("===="+time.substring(0,10));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -446,7 +446,10 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
||||
if(byId.get("stopReasonRvcsName") !=null){
|
||||
byId.put("stopReasonRvcsName",translate(byId.get("stopReasonRvcsName").toString()));
|
||||
}
|
||||
byId.putAll(getRateTime(byId.get("serialNumber").toString(), byId.get("totalPrice").toString(),byId.get("totalPower").toString()));
|
||||
Map<String, Object> rateTime = getRateTime(byId.get("serialNumber").toString(), byId.get("totalPrice").toString(), byId.get("totalPower").toString());
|
||||
if(rateTime !=null){
|
||||
byId.putAll(rateTime);
|
||||
}
|
||||
}
|
||||
return AjaxResult.success(byId);
|
||||
} catch (Exception e) {
|
||||
@ -646,6 +649,13 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
||||
}
|
||||
return AjaxResult.error("修改推送订单失败请联系管理员");
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getXhpcRateTimeFee(Long rateModelId) {
|
||||
String tiem = DateUtil.formatTime(new Date());
|
||||
return xhpcHistoryOrderMapper.getXhpcRateTimeFee(tiem,rateModelId);
|
||||
}
|
||||
|
||||
/**
|
||||
* 历史信息费率时段
|
||||
*/
|
||||
@ -676,6 +686,10 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
||||
DateTime tomorrow = DateUtil.offsetDay(startTime2, 1);
|
||||
Date startTime3 = DateUtil.beginOfDay(tomorrow);
|
||||
Map<String, Object> twentyFour = xhpcHistoryOrderMapper.getXhpcRealTimeOrderTwentyFour(chargeOrder.getChargeOrderId(), format);
|
||||
if(twentyFour==null){
|
||||
return getBigDecimal(totalPrice, powerPriceTotal, servicePriceTotal, chargeOrder, rateModelId, startTime2, updateTime2, chargingDegree, list);
|
||||
}
|
||||
|
||||
if(twentyFour !=null && twentyFour.get("chargingDegree")!=null){
|
||||
BigDecimal chargingDegree1 = new BigDecimal(twentyFour.get("chargingDegree").toString());
|
||||
BigDecimal decimal = divide.subtract(chargingDegree1);
|
||||
@ -710,7 +724,6 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
||||
}
|
||||
}
|
||||
return null;
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -935,4 +948,8 @@ public class XhpcHistoryOrderServiceImpl extends BaseService implements IXhpcHis
|
||||
// }
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -722,82 +722,6 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
xhpcHistoryOrder.setChargingMode(xhpcChargeOrder.getUserId()+"");
|
||||
xhpcHistoryOrder.setInternetSerialNumber(xhpcChargeOrder.getInternetSerialNumber());
|
||||
Double totalPower = xhpcHistoryOrder.getTotalPower();
|
||||
|
||||
// Map<String, Object> judgeActivity= getRateOrActivityFormul(xhpcChargeOrder.getSerialNumber(), internetUserId, startTime, endTime, chargingStationId, tenantId, xhpcChargeOrder.getRateModelId());
|
||||
//
|
||||
// Map<String, Double> params1 =new HashMap<>();
|
||||
// if("1".equals(judgeActivity.get("status").toString())){
|
||||
// judge =true;
|
||||
// logger.info("<<<<<<<<<<<<<<<价格、时间、公式都相同>>>>>>>>>>>>>>>>>");
|
||||
// params1.put("T",money.doubleValue());
|
||||
// params1.put("P",powerPrice.doubleValue());
|
||||
// params1.put("S",servicePrice.doubleValue());
|
||||
// params1.put("E",totalPower);
|
||||
// String computeFormula = judgeActivity.get("computeFormula").toString();
|
||||
// computeType = (int)judgeActivity.get("computeType");
|
||||
// BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params1)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
// //活动总服务费
|
||||
// activityServicePriceTotal = servicePrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
// //活动总电费
|
||||
// activityPowerPriceTotal = powerPrice.setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
// //活动总金额
|
||||
// activityTotalPriceTotal = money;
|
||||
// if(computeType==1){
|
||||
// BigDecimal decimal1 = eval.multiply(new BigDecimal(0.5)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
// internetCommission = internetCommission.add(eval);
|
||||
// activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal.subtract(decimal1));
|
||||
// activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(decimal1));
|
||||
// }else if(computeType==2){
|
||||
// internetSvcCommission = internetSvcCommission.add(eval);
|
||||
// activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
|
||||
// activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
|
||||
// }else{
|
||||
// //电量抽成
|
||||
// internetDegreeCommission = internetDegreeCommission.add(eval);
|
||||
// //减服务费
|
||||
// activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
|
||||
// activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
|
||||
// }
|
||||
// promotionDiscount = money.subtract(activityTotalPriceTotal);
|
||||
// xhpcHistoryOrder.setActivityId(judgeActivity.get("activityId").toString());
|
||||
// }else if("2".equals(judgeActivity.get("status").toString())){
|
||||
// judge =true;
|
||||
// logger.info("<<<<<<<<<<<<<<<价格、时间都相同>>>>>>>>>>>>>>>>>");
|
||||
// String computeFormula = judgeActivity.get("computeFormula").toString();
|
||||
// BigDecimal powerPrice1 = new BigDecimal(judgeActivity.get("powerPrice").toString());
|
||||
// BigDecimal servicePrice1 = new BigDecimal(judgeActivity.get("servicePrice").toString());
|
||||
// //活动总服务费
|
||||
// activityServicePriceTotal = servicePrice1.multiply(new BigDecimal(totalPower)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
// //活动总电费
|
||||
// activityPowerPriceTotal = powerPrice1.multiply(new BigDecimal(totalPower)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
// //活动总金额
|
||||
// activityTotalPriceTotal = activityServicePriceTotal.add(activityPowerPriceTotal);
|
||||
// params1.put("T",activityTotalPriceTotal.doubleValue());
|
||||
// params1.put("P",activityPowerPriceTotal.doubleValue());
|
||||
// params1.put("S",activityServicePriceTotal.doubleValue());
|
||||
// params1.put("E",totalPower);
|
||||
//
|
||||
// computeType = (int)judgeActivity.get("computeType");
|
||||
// BigDecimal eval = new BigDecimal(Calc.eval(computeFormula, params1)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
// if(computeType==1){
|
||||
// BigDecimal decimal1 = eval.multiply(new BigDecimal(0.5)).setScale(2, BigDecimal.ROUND_HALF_UP);
|
||||
// internetCommission = internetCommission.add(eval);
|
||||
// activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal.subtract(decimal1));
|
||||
// activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(decimal1));
|
||||
// }else if(computeType==2){
|
||||
// internetSvcCommission = internetSvcCommission.add(eval);
|
||||
// activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
|
||||
// activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
|
||||
// }else{
|
||||
// //电量抽成
|
||||
// internetDegreeCommission = internetDegreeCommission.add(eval);
|
||||
// //减服务费
|
||||
// activityServicePrice =activityServicePrice.add(activityServicePriceTotal.subtract(eval));
|
||||
// activityPowerPrice =activityPowerPrice.add(activityPowerPriceTotal);
|
||||
// }
|
||||
// promotionDiscount = money.subtract(activityTotalPriceTotal);
|
||||
// xhpcHistoryOrder.setActivityId(judgeActivity.get("activityId").toString());
|
||||
// }else{
|
||||
boolean activityInternet =false;
|
||||
//yyyy-mm-dd(当前时间)
|
||||
String parse2 = DateUtil.formatDate(startTime);
|
||||
@ -1136,11 +1060,12 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
if(operatorMessage.get("operatorIdEvcs")!=null){
|
||||
if(operatorMessage.get("operatorIdEvcs") !=null && !"".equals(operatorMessage.get("operatorIdEvcs").toString())){
|
||||
String stw = operatorMessage.get("operatorIdEvcs").toString();
|
||||
if(stw.length()>9){
|
||||
xhpcHistoryOrder.setOperatorIdEvcs(stw.substring(8, stw.length() - 1));
|
||||
if(stw.length()==9){
|
||||
// xhpcHistoryOrder.setOperatorIdEvcs(stw);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(operatorMessage.get("maintenanceCommissionRate") !=null && operatorMessage.get("commissionType") !=null && operatorMessage.get("platformCommissionRate") !=null){
|
||||
Integer commissionType = (Integer) operatorMessage.get("commissionType");
|
||||
//运维提成
|
||||
@ -1719,8 +1644,8 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
if(operatorMessage.get("operatorIdEvcs")!=null){
|
||||
if(operatorMessage.get("operatorIdEvcs") !=null && !"".equals(operatorMessage.get("operatorIdEvcs").toString())){
|
||||
String stw = operatorMessage.get("operatorIdEvcs").toString();
|
||||
if(stw.length()>9){
|
||||
xhpcHistoryOrder.setOperatorIdEvcs(stw.substring(8, stw.length() - 1));
|
||||
if(stw.length()==9){
|
||||
// xhpcHistoryOrder.setOperatorIdEvcs(stw);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -2031,8 +1956,8 @@ public class XhpcRealTimeOrderServiceImpl extends BaseService implements IXhpcRe
|
||||
System.out.println("json :"+json);
|
||||
String result = HttpUtils.post(url, json);
|
||||
JSONObject jsonObject =JSON.parseObject(result);
|
||||
System.out.println("jsonObject :"+jsonObject);
|
||||
System.out.println("========101010===========sessionKey:============1010===============");
|
||||
//System.out.println("jsonObject :"+jsonObject);
|
||||
// System.out.println("========101010===========sessionKey:============1010===============");
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
@ -1488,6 +1488,91 @@ public class XhpcStatisticsServiceImpl extends BaseService implements IXhpcStati
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getChargeOrderFaultPage(HttpServletRequest request, Long chargingStationId, String serialNumber, String startTime, String endTime) {
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
Long sysUserId = sysUser.getUserId();
|
||||
String tenantId = sysUser.getTenantId();
|
||||
//获取登陆用户
|
||||
List<Map<String, Object>> list =new ArrayList<>();
|
||||
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
|
||||
startPage();
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
//运营商看自己的场站
|
||||
list = xhpcStatisticsServiceMapper.getChargeOrderFaultPage(chargingStationId,serialNumber,startTime, endTime, 1,logOperatorId,tenantId);
|
||||
}else{
|
||||
//查询赋值的场站
|
||||
list = xhpcStatisticsServiceMapper.getChargeOrderFaultPage(chargingStationId,serialNumber,startTime,endTime, 2,sysUserId,tenantId);
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list =xhpcStatisticsServiceMapper.getChargeOrderFaultPage(chargingStationId,serialNumber,startTime,endTime,0,sysUserId,tenantId);
|
||||
}
|
||||
|
||||
return list;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getChargeOrderFaultPageExport(HttpServletRequest request, HttpServletResponse response, Long chargingStationId, String serialNumber, String startTime, String endTime) throws IOException {
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
Long sysUserId = sysUser.getUserId();
|
||||
String tenantId = sysUser.getTenantId();
|
||||
//获取登陆用户
|
||||
List<Map<String, Object>> list =new ArrayList<>();
|
||||
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
|
||||
startPage();
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
//运营商看自己的场站
|
||||
list = xhpcStatisticsServiceMapper.getChargeOrderFaultPage(chargingStationId,serialNumber,startTime, endTime, 1,logOperatorId,tenantId);
|
||||
}else{
|
||||
//查询赋值的场站
|
||||
list = xhpcStatisticsServiceMapper.getChargeOrderFaultPage(chargingStationId,serialNumber,startTime,endTime, 2,sysUserId,tenantId);
|
||||
}
|
||||
}else{
|
||||
startPage();
|
||||
list =xhpcStatisticsServiceMapper.getChargeOrderFaultPage(chargingStationId,serialNumber,startTime,endTime,0,sysUserId,tenantId);
|
||||
}
|
||||
|
||||
// 通过工具类创建writer,默认创建xls格式
|
||||
BigExcelWriter writer = ExcelUtil.getBigWriter("temp_" + System.currentTimeMillis() + ".xlsx");
|
||||
writer.addHeaderAlias("stationName", "场站名称");
|
||||
writer.addHeaderAlias("pileName", "桩名称");
|
||||
writer.addHeaderAlias("serialNumber", "订单号");
|
||||
writer.addHeaderAlias("remark", "故障原因");
|
||||
writer.addHeaderAlias("createTime", "时间");
|
||||
|
||||
|
||||
// 默认的,未添加alias的属性也会写出,如果想只写出加了别名的字段,可以调用此方法排除之
|
||||
writer.setOnlyAlias(true);
|
||||
// 一次性写出内容,使用默认样式,强制输出标题
|
||||
writer.write(list, true);
|
||||
//out为OutputStream,需要写出到的目标流
|
||||
|
||||
response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
|
||||
response.setCharacterEncoding("utf-8");
|
||||
|
||||
ServletOutputStream out = response.getOutputStream();
|
||||
|
||||
writer.flush(out, true);
|
||||
// 关闭writer,释放内存
|
||||
writer.close();
|
||||
//此处记得关闭输出Servlet流
|
||||
IoUtil.close(out);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getHistoryOrderMassage(Long chargeOrderId) {
|
||||
|
||||
|
||||
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
private Map<String, Object> averageOrder(Integer status,Integer type,Long logOperatorId,Long operatorId, Long chargingStationId, Long chargingPileId, String tenantId,String conditionBeginOfDay,String conditionEndOfDay) {
|
||||
List<Map<String, Object>> dateOrder = xhpcStatisticsServiceMapper.getDateOrderCount(type,status,logOperatorId,operatorId,chargingStationId,chargingPileId,tenantId,conditionBeginOfDay,conditionEndOfDay);
|
||||
|
||||
@ -428,6 +428,7 @@
|
||||
operator_id as operatorId,
|
||||
commission_type as commissionType,
|
||||
operator_id_evcs as operatorIdEvcs,
|
||||
duty_paragraph as dutyParagraph,
|
||||
soc as soc,
|
||||
platform_commission_rate as platformCommissionRate,
|
||||
(select name from xhpc_charging_station where charging_station_id=#{chargingStationId}) chargingStationName,
|
||||
|
||||
@ -39,15 +39,14 @@
|
||||
xt.charging_pile_id as chargingPileId,
|
||||
xt.tenant_id as tenantId,
|
||||
xt.terminal_id as terminalId,
|
||||
(xcp.max_voltage * xcp.max_electric_current) installedTotalPower
|
||||
xcp.power as installedTotalPower
|
||||
FROM
|
||||
xhpc_real_time_order AS xrto
|
||||
LEFT JOIN xhpc_charge_order AS xco ON xrto.charging_order_id =xco.charge_order_id
|
||||
LEFT JOIN xhpc_terminal as xt on xt.terminal_id = xco.terminal_id
|
||||
LEFT JOIN xhpc_charging_pile as xcp on xcp.charging_pile_id = xt.charging_pile_id
|
||||
where xrto.voltage is not null and xrto.electric_current is not null
|
||||
where xrto.voltage is not null and xrto.electric_current >0 and xrto.voltage >0
|
||||
and xrto.create_time >= #{sterTime} and xrto.create_time <=#{endTime}
|
||||
and xrto.create_time like concat(#{subTime}, '%')
|
||||
and xrto.charging_station_id = #{chargingStationId}
|
||||
and xco.terminal_id =#{terminalId}
|
||||
limit 1
|
||||
@ -106,6 +105,9 @@
|
||||
<if test="null != tenantId ">
|
||||
tenant_id,
|
||||
</if>
|
||||
<if test="null != installedTotalPower ">
|
||||
installed_total_power,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != chargeOrderId ">
|
||||
@ -150,6 +152,9 @@
|
||||
<if test="null != tenantId ">
|
||||
#{tenantId},
|
||||
</if>
|
||||
<if test="null != installedTotalPower ">
|
||||
#{installedTotalPower},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
<select id="getListPage" resultType="map">
|
||||
|
||||
@ -1705,4 +1705,22 @@
|
||||
<update id="updateChengDuPush">
|
||||
UPDATE et_auth_sec_token set last_push_order =#{historyOrderId} where id=2
|
||||
</update>
|
||||
|
||||
<select id="getXhpcRateTimeFee" resultType="map">
|
||||
select xrt.rate_time_id as rateTimeId,
|
||||
xrt.rate_id as rateId,
|
||||
xrt.start_time as startTime,
|
||||
xrt.end_time as endTime,
|
||||
xr.power_fee as powerFee,
|
||||
xr.service_fee as serviceFee
|
||||
from xhpc_rate_time xrt
|
||||
left join xhpc_rate xr on xr.rate_id = xrt.rate_id
|
||||
where xrt.rate_model_id = #{rateModelId}
|
||||
and xrt.start_time <= #{date}
|
||||
and replace(xrt.end_time, '00:00:00', '24:00:00') >= #{date}
|
||||
and xrt.status = 0
|
||||
and xrt.del_flag = 0
|
||||
limit 1
|
||||
</select>
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -704,9 +704,6 @@
|
||||
where co.charge_order_id=#{chargeOrderId}
|
||||
</select>
|
||||
|
||||
|
||||
|
||||
|
||||
<select id="timeList" resultType="map">
|
||||
select
|
||||
create_time as createTime,
|
||||
@ -719,6 +716,7 @@
|
||||
charging_time as chargingTime,
|
||||
remaining_time as remainingTime,
|
||||
vehicle_gun_status as vehicleGunStatus,
|
||||
amount_charged as amountCharged,
|
||||
status
|
||||
from xhpc_real_time_order
|
||||
where charging_order_id=#{chargingOrderId}
|
||||
|
||||
@ -127,27 +127,27 @@
|
||||
|
||||
<select id="getDateIntervalPage" resultType="map">
|
||||
select
|
||||
format(ifnull(sum(charging_degree),0), 4) chargingDegree,
|
||||
ifnull(sum(charging_degree),0) chargingDegree,
|
||||
format(ifnull(sum(charging_time),0), 2) chargingTime,
|
||||
ifnull(sum(charging_number),0) chargingNumber,
|
||||
format(ifnull(sum(power_price),0), 2) powerPrice,
|
||||
format(ifnull(sum(service_price),0), 2) servicePrice,
|
||||
format(ifnull(sum(total_price),0), 2) totalPrice,
|
||||
format(ifnull(sum(activity_power_price_total),0), 2) activityPowerPriceTotal,
|
||||
format(ifnull(sum(activity_service_price_total),0), 2) activityServicePriceTotal,
|
||||
format(ifnull(sum(activity_total_price),0), 2) activityTotalPrice,
|
||||
format(ifnull(sum(act_price),0), 2) actPrice,
|
||||
format(ifnull(sum(act_power_price),0), 2) actPowerPrice,
|
||||
format(ifnull(sum(act_service_price),0), 2) actServicePrice,
|
||||
format(ifnull(sum(promotion_discount),0), 2) promotionDiscount,
|
||||
format(ifnull(sum(internet_commission),0), 2) internetCommission,
|
||||
format(ifnull(sum(internet_svc_commission),0), 2) internetSvcCommission,
|
||||
format(ifnull(sum(internet_degree_commission),0), 2) internetDegreeCommission,
|
||||
format(ifnull(sum(platform_commission),0), 2) platformCommission,
|
||||
format(ifnull(sum(platform_svc_commisssion),0), 2) platformSvcCommisssion,
|
||||
format(ifnull(sum(operation_commission),0), 2) operationCommission,
|
||||
format(ifnull(sum(operation_svc_commission),0), 2) operationSvcCommission,
|
||||
format(ifnull(sum(act_power_price + act_service_price),0), 2) actTotalPrice,
|
||||
ifnull(sum(power_price),0) powerPrice,
|
||||
ifnull(sum(service_price),0) servicePrice,
|
||||
ifnull(sum(total_price),0) totalPrice,
|
||||
ifnull(sum(activity_power_price_total),0) activityPowerPriceTotal,
|
||||
ifnull(sum(activity_service_price_total),0) activityServicePriceTotal,
|
||||
ifnull(sum(activity_total_price),0) activityTotalPrice,
|
||||
ifnull(sum(act_price),0) actPrice,
|
||||
ifnull(sum(act_power_price),0) actPowerPrice,
|
||||
ifnull(sum(act_service_price),0) actServicePrice,
|
||||
ifnull(sum(promotion_discount),0) promotionDiscount,
|
||||
ifnull(sum(internet_commission),0) internetCommission,
|
||||
ifnull(sum(internet_svc_commission),0) internetSvcCommission,
|
||||
ifnull(sum(internet_degree_commission),0) internetDegreeCommission,
|
||||
ifnull(sum(platform_commission),0) platformCommission,
|
||||
ifnull(sum(platform_svc_commisssion),0) platformSvcCommisssion,
|
||||
ifnull(sum(operation_commission),0) operationCommission,
|
||||
ifnull(sum(operation_svc_commission),0) operationSvcCommission,
|
||||
ifnull(sum(act_power_price + act_service_price),0) actTotalPrice,
|
||||
DATE_FORMAT(create_time,'%Y-%m-%d') createTime
|
||||
from xhpc_statistics_station
|
||||
where del_flag=0 and type=1 and total_price >=0
|
||||
@ -1723,4 +1723,42 @@
|
||||
and tenant_id=#{tenantId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<select id="getChargeOrderFaultPage" resultType="map">
|
||||
select
|
||||
xho.history_order_id historyOrderId,
|
||||
xcs.name stationName,
|
||||
xt.name pileName,
|
||||
xco.serial_number serialNumber,
|
||||
xco.create_time createTime,
|
||||
xco.remark remark
|
||||
from xhpc_charge_order xco
|
||||
left join xhpc_charging_station xcs on xcs.charging_station_id = xco.charging_station_id
|
||||
left join xhpc_terminal xt on xt.terminal_id = xco.terminal_id
|
||||
left join xhpc_history_order xho on xho.charge_order_id = xco.charge_order_id
|
||||
where xco.remark LIKE concat('%充电桩校验故障%') and xco.create_time >='2023-09-21 00:00:00'
|
||||
<if test="startTime !=null and startTime !=''">
|
||||
and xco.create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime !=null and endTime !=''">
|
||||
and xco.create_time <= #{endTime}
|
||||
</if>
|
||||
<if test="serialNumber !=null and serialNumber !=''">
|
||||
and xco.serial_number LIKE concat('%',#{serialNumber}, '%')
|
||||
</if>
|
||||
<if test="chargingStationId !=null">
|
||||
and xco.charging_station_id=#{chargingStationId}
|
||||
</if>
|
||||
<if test="type==1">
|
||||
and xco.charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
|
||||
</if>
|
||||
<if test="type==2">
|
||||
and xco.charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
|
||||
</if>
|
||||
order by xco.create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getHistoryOrderMassage" resultType="map">
|
||||
select history_order_id historyOrderId from xhpc_history_order where charge_order_id=#{chargeOrderId} limit 1
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -230,7 +230,7 @@ public class AlipayPaymentController {
|
||||
}
|
||||
}
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(500);
|
||||
return "failure";
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
||||
@ -309,6 +309,11 @@ public class WxPaymentController {
|
||||
" <trade_type>" + trade_type + "</trade_type>\n" +
|
||||
" <sign>" + sign + "</sign>\n" +
|
||||
"</xml> ";
|
||||
|
||||
System.out.println("============weixin==xmlString================");
|
||||
System.out.println("============weixin==xmlString================"+xmlString);
|
||||
System.out.println("============weixin==xmlString================");
|
||||
|
||||
return xmlString;
|
||||
}
|
||||
|
||||
@ -452,6 +457,7 @@ public class WxPaymentController {
|
||||
@RequestMapping("/paymentCallback")
|
||||
public Object payNotify(HttpServletRequest request, HttpServletResponse response) {
|
||||
try{
|
||||
System.out.println("============weixin==回调Api======开始==========");
|
||||
readWriteLock.writeLock().lock();//取
|
||||
try {
|
||||
ServletInputStream in = null;
|
||||
@ -506,7 +512,7 @@ public class WxPaymentController {
|
||||
} catch (IOException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(500);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
|
||||
@ -95,7 +95,7 @@ public class XhpcRechargeOrderController extends BaseController {
|
||||
/**
|
||||
* 每隔30分钟,清理一次未支付的订单
|
||||
*/
|
||||
@Scheduled(cron = "0 0/30 * * * ?")
|
||||
//@Scheduled(cron = "0 0/30 * * * ?")
|
||||
@GetMapping("/test1")
|
||||
public void test1(){
|
||||
iXhpcRechargeOrderService.updateRechargeOrderStatus();
|
||||
|
||||
@ -28,6 +28,7 @@ import io.swagger.annotations.ApiOperation;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.interceptor.TransactionAspectSupport;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
@ -43,6 +44,7 @@ import java.io.PrintWriter;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
@ -75,14 +77,14 @@ public class XhpcRefundOriginalOrderController extends BaseController {
|
||||
|
||||
@NoRepeatSubmit(lockTime = 3)
|
||||
@GetMapping("/refundOrder")
|
||||
@ApiOperation(value = "支付宝支付")
|
||||
@ApiOperation(value = "支付宝退款")
|
||||
public R refundOrder(Long refundOrderId) throws Exception {
|
||||
return xhpcRefundOriginalOrderService.zhbRefundOriginalOrder(refundOrderId);
|
||||
}
|
||||
|
||||
@NoRepeatSubmit(lockTime = 3)
|
||||
@GetMapping("/refundWxOrder")
|
||||
@ApiOperation(value = "微信支付")
|
||||
@ApiOperation(value = "微信退款")
|
||||
public R refundWxOrder(Long refundOrderId) throws Exception {
|
||||
return xhpcRefundOriginalOrderService.wxRefundOriginalOrder(refundOrderId);
|
||||
}
|
||||
@ -167,7 +169,7 @@ public class XhpcRefundOriginalOrderController extends BaseController {
|
||||
if(xhpcRefundAudit.getStatus()==2){
|
||||
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,2,3);
|
||||
xhpcRefundOrder.setRemark("订单已取消审核");
|
||||
return R.ok("订单已取消审核");
|
||||
return R.ok(null,"订单已取消审核");
|
||||
}
|
||||
if (!StatusConstants.REFUND_ORDER_STATUS_WAIT.equals(xhpcRefundOrder.getStatus())) {
|
||||
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,2,2);
|
||||
@ -184,7 +186,7 @@ public class XhpcRefundOriginalOrderController extends BaseController {
|
||||
int refundApplication = xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
|
||||
if (refundApplication == 0) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return R.fail("修改用户信息失败");
|
||||
return R.fail(HttpStatus.ERROR_STATUS,"修改用户信息失败");
|
||||
}
|
||||
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(userId);
|
||||
BigDecimal amount = new BigDecimal(appUserInfo.get("balance").toString());
|
||||
@ -192,13 +194,13 @@ public class XhpcRefundOriginalOrderController extends BaseController {
|
||||
xhpcRefundOrder.setStatus(2);
|
||||
xhpcRefundOrder.setRemark("订单金额出错");
|
||||
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,4,2);
|
||||
return R.fail("订单金额出错");
|
||||
return R.fail(HttpStatus.ERROR_STATUS,"订单金额出错");
|
||||
}
|
||||
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
|
||||
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(userId, null, 0);
|
||||
if (i == 0) {
|
||||
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
|
||||
return R.fail("获取社区用户失败");
|
||||
return R.fail(HttpStatus.ERROR_STATUS,"获取社区用户失败");
|
||||
}
|
||||
Map<String, Object> communityPersonnel = iXhpcRefundAuditService.getCommunityPersonnelById(userId, xhpcRefundOrder.getTenantId());
|
||||
BigDecimal amount = new BigDecimal(communityPersonnel.get("balance").toString());
|
||||
@ -206,7 +208,7 @@ public class XhpcRefundOriginalOrderController extends BaseController {
|
||||
xhpcRefundOrder.setStatus(2);
|
||||
xhpcRefundOrder.setRemark("订单金额出错");
|
||||
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,4,2);
|
||||
return R.fail("订单金额出错");
|
||||
return R.fail(HttpStatus.ERROR_STATUS,"订单金额出错");
|
||||
}
|
||||
}else{
|
||||
AjaxResult.error(HttpStatus.DATA_ERROR, "该用户不能退款");
|
||||
@ -222,7 +224,7 @@ public class XhpcRefundOriginalOrderController extends BaseController {
|
||||
xhpcRefundOrder.setStatus(2);
|
||||
xhpcRefundOrder.setRemark("订单金额出错");
|
||||
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,4,2);
|
||||
return R.fail(r.getMsg());
|
||||
return R.fail(HttpStatus.ERROR_STATUS,r.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -237,7 +239,7 @@ public class XhpcRefundOriginalOrderController extends BaseController {
|
||||
xhpcRefundOrder.setStatus(2);
|
||||
xhpcRefundOrder.setRemark("订单金额出错");
|
||||
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,4,2);
|
||||
return R.fail(r.getMsg());
|
||||
return R.fail(HttpStatus.ERROR_STATUS,r.getMsg());
|
||||
}
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
@ -356,6 +358,39 @@ public class XhpcRefundOriginalOrderController extends BaseController {
|
||||
return R.ok(null,"申请退款成功");
|
||||
}
|
||||
|
||||
//@Scheduled(cron = "0/30 * * * * ? ")
|
||||
@GetMapping("/moneyPage")
|
||||
public void moneyPage(){
|
||||
logger.info("++++++++++++每30秒,扫描一次,退款订单金额小于200,自动审核通过++++++++++++++++");
|
||||
try {
|
||||
List<Long> list = iXhpcRefundOrderService.moneyPage(1);
|
||||
logger.info("++++++++++++有自动退款订单+++++list+++++++++++"+list.size());
|
||||
if(list !=null && list.size()>0){
|
||||
for (int i = 0; i <list.size() ; i++) {
|
||||
Long aLong = list.get(i);
|
||||
XhpcRefundAudit xhpcRefundAudit =new XhpcRefundAudit();
|
||||
xhpcRefundAudit.setRefundOrderId(aLong);
|
||||
xhpcRefundAudit.setStatus(1);
|
||||
xhpcRefundAudit.setRemark("自动审核通过");
|
||||
info(xhpcRefundAudit);
|
||||
Thread.sleep(500);
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("++++++++++++自动审核异常++++++++++++++++");
|
||||
e.printStackTrace();
|
||||
//后期可以增加短信通知
|
||||
}
|
||||
}
|
||||
|
||||
@GetMapping("/getRefundOriginalOrderList")
|
||||
@ApiOperation(value = "退款页面")
|
||||
public R getRefundOriginalOrderList(Long refundOrderId){
|
||||
return xhpcRefundOriginalOrderService.getRefundOriginalOrderList(refundOrderId);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@GetMapping("/getTestSms")
|
||||
@ApiOperation(value = "短信测试")
|
||||
public void getTestSms(String number){
|
||||
|
||||
@ -37,4 +37,6 @@ public interface XhpcRefundOriginalOrderMapper {
|
||||
|
||||
void updateRechargeOrderRefundStatus(@Param("userId")Long userId,@Param("source")Integer source);
|
||||
|
||||
List<Map<String,Object>> getRefundOriginalOrderList(@Param("refundOrderId")Long refundOrderId);
|
||||
|
||||
}
|
||||
|
||||
@ -28,4 +28,6 @@ public interface IXhpcRefundOriginalOrderService {
|
||||
void addXhpcRefundOrder(XhpcRefundOrder xhpcRefundOrder);
|
||||
|
||||
void getTestSms(String number);
|
||||
|
||||
R getRefundOriginalOrderList(Long refundOrderId);
|
||||
}
|
||||
|
||||
@ -714,7 +714,7 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(500);
|
||||
if (fals) {
|
||||
return R.ok();
|
||||
}
|
||||
@ -913,7 +913,7 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
}
|
||||
|
||||
}
|
||||
Thread.sleep(1000);
|
||||
Thread.sleep(500);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}finally {
|
||||
@ -1444,7 +1444,11 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
|
||||
smsService.sendNotice(paramMap);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public R getRefundOriginalOrderList(Long refundOrderId) {
|
||||
List<Map<String, Object>> refundOriginalOrderList = xhpcRefundOriginalOrderMapper.getRefundOriginalOrderList(refundOrderId);
|
||||
return R.ok(refundOriginalOrderList,"查询成功");
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) throws AlipayApiException {
|
||||
|
||||
@ -553,4 +553,25 @@
|
||||
<update id="updateRechargeOrderRefundStatus">
|
||||
update xhpc_recharge_order set refund_status=2 where user_id=#{userId} and source =#{source} and (refund_status=0 or refund_status =1)
|
||||
</update>
|
||||
|
||||
<select id="getRefundOriginalOrderList" resultType="map">
|
||||
select
|
||||
case when type=1 then "微信"
|
||||
when type=2 then "支付宝"
|
||||
else "平台!"
|
||||
end typeName,
|
||||
case when status=0 then "退款中"
|
||||
when status=1 then "退款成功"
|
||||
else "退款失败"
|
||||
end statusName,
|
||||
out_trade_no outTradeNo,
|
||||
transaction_id transactionId,
|
||||
trade_no tradeNo,
|
||||
cash_refund_fee cashRefundFee,
|
||||
create_time createTime,
|
||||
refund_recv_accout refundRecvAccout
|
||||
from xhpc_refund_original_order where refund_order_id=#{refundOrderId}
|
||||
</select>
|
||||
|
||||
|
||||
</mapper>
|
||||
|
||||
@ -397,43 +397,46 @@ public class ChargingController {
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
Integer F401 = HexUtils.reverseHexInt("F401");
|
||||
Integer F401 = HexUtils.reverseHexInt("8E200100");
|
||||
System.out.println("F401 转化成="+F401);
|
||||
|
||||
Integer D007 = HexUtils.reverseHexInt("D007");
|
||||
System.out.println("D007 转化成="+D007);
|
||||
Integer F402 = HexUtils.reverseHexInt("8E200100");
|
||||
System.out.println("F402 转化成="+F402);
|
||||
|
||||
Integer F620 = HexUtils.reverseHexInt("F620");
|
||||
System.out.println("F620 转化成="+F620);
|
||||
|
||||
Integer F03 = HexUtils.reverseHexInt("03");
|
||||
System.out.println("F03 转化成="+F03);
|
||||
|
||||
Integer D3C0F = HexUtils.reverseHexInt("3C0F");
|
||||
System.out.println("3C0F 转化成="+D3C0F);
|
||||
|
||||
Integer f4C1D = HexUtils.reverseHexInt("4C1D");
|
||||
System.out.println("f4C1D 转化成="+f4C1D);
|
||||
|
||||
Integer DC05 = HexUtils.reverseHexInt("DC05");
|
||||
System.out.println("DC05 转化成="+DC05);
|
||||
|
||||
Integer A00F = HexUtils.reverseHexInt("A00F");
|
||||
System.out.println("A00F 转化成="+A00F);
|
||||
|
||||
Integer FCF3 = HexUtils.reverseHexInt("FCF3");
|
||||
System.out.println("FCF3 转化成="+FCF3);
|
||||
|
||||
|
||||
|
||||
Integer f70C0001 = HexUtils.reverseHexInt("D8B68A0400");
|
||||
System.out.println("f70C0001 转化成="+f70C0001);
|
||||
|
||||
Integer f70C0002 = HexUtils.reverseHexInt("C2E00200");
|
||||
System.out.println("f70C0002 转化成="+f70C0002);
|
||||
|
||||
String s = HexUtils.reverseHex("38C7280A1D0817");
|
||||
System.out.println("s 转化成="+s);
|
||||
// Integer D007 = HexUtils.reverseHexInt("D007");
|
||||
// System.out.println("D007 转化成="+D007);
|
||||
//
|
||||
// Integer F620 = HexUtils.reverseHexInt("F620");
|
||||
// System.out.println("F620 转化成="+F620);
|
||||
//
|
||||
// Integer F03 = HexUtils.reverseHexInt("03");
|
||||
// System.out.println("F03 转化成="+F03);
|
||||
//
|
||||
// Integer D3C0F = HexUtils.reverseHexInt("3C0F");
|
||||
// System.out.println("3C0F 转化成="+D3C0F);
|
||||
//
|
||||
// Integer f4C1D = HexUtils.reverseHexInt("4C1D");
|
||||
// System.out.println("f4C1D 转化成="+f4C1D);
|
||||
//
|
||||
// Integer DC05 = HexUtils.reverseHexInt("DC05");
|
||||
// System.out.println("DC05 转化成="+DC05);
|
||||
//
|
||||
// Integer A00F = HexUtils.reverseHexInt("A00F");
|
||||
// System.out.println("A00F 转化成="+A00F);
|
||||
//
|
||||
// Integer FCF3 = HexUtils.reverseHexInt("FCF3");
|
||||
// System.out.println("FCF3 转化成="+FCF3);
|
||||
//
|
||||
//
|
||||
//
|
||||
// Integer f70C0001 = HexUtils.reverseHexInt("D8B68A0400");
|
||||
// System.out.println("f70C0001 转化成="+f70C0001);
|
||||
//
|
||||
// Integer f70C0002 = HexUtils.reverseHexInt("C2E00200");
|
||||
// System.out.println("f70C0002 转化成="+f70C0002);
|
||||
//
|
||||
// String s = HexUtils.reverseHex("38C7280A1D0817");
|
||||
// System.out.println("s 转化成="+s);
|
||||
// String s = toHexInt(3532);
|
||||
// System.out.println("3532 转化成BIN码="+s);
|
||||
// byte[] bytes = HexUtils.toBytes("80836000150001022305301518050003");
|
||||
|
||||
@ -5,6 +5,7 @@ import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.HttpUtils;
|
||||
import com.xhpc.common.enums.StationDeviceEnum;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDConnectorInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDEquipmentInfo;
|
||||
import com.xhpc.evcs.domain.XhpcChargingPile;
|
||||
import com.xhpc.evcs.dto.ConnectorInfo;
|
||||
@ -444,19 +445,20 @@ public class PileController {
|
||||
cdEquipmentInfo.setNewNationalStandard(xhpcChargingPile.getNewNationalStandard());
|
||||
cdEquipmentInfo.setVinFlag(xhpcChargingPile.getVinFlag());
|
||||
cdEquipmentInfo.setConnectorInfos(getConnectorInfos(serialNumber,xhpcChargingPile));
|
||||
cdEquipmentInfo.setEquipmentClassificatlon(xhpcChargingPile.getEquipmentClassificatlon());
|
||||
REDIS.setCacheObject(skey, cdEquipmentInfo);
|
||||
|
||||
}
|
||||
|
||||
private List<ConnectorInfo> getConnectorInfos(String pileNo,XhpcChargingPile xhpcChargingPile) {
|
||||
private List<CDConnectorInfo> getConnectorInfos(String pileNo, XhpcChargingPile xhpcChargingPile) {
|
||||
final Map<String, Object> cachePile = REDIS.getCacheMap("pile:".concat(pileNo));
|
||||
List<ConnectorInfo> connectorInfoList = new ArrayList<>();
|
||||
List<CDConnectorInfo> connectorInfoList = new ArrayList<>();
|
||||
Integer gunNumCache = (Integer) cachePile.get("gunNum");
|
||||
gunNumCache = gunNumCache == null ? 2 : gunNumCache;
|
||||
for (int i = 1; i <= gunNumCache; i++) {
|
||||
String gunId = pileNo.concat(String.format("%02d", i));
|
||||
|
||||
ConnectorInfo connectorInfo = new ConnectorInfo();
|
||||
CDConnectorInfo connectorInfo = new CDConnectorInfo();
|
||||
connectorInfo.setConnectorID(gunId);
|
||||
String connectorName = REDIS.getCacheMapValue("gun:".concat(gunId), "terminalName"); //todo set them in redis!
|
||||
connectorInfo.setConnectorName(connectorName == null ?
|
||||
@ -474,6 +476,9 @@ public class PileController {
|
||||
connectorInfo.setPower(power == null ? 120.0 : power);
|
||||
Integer nationalStandard = (Integer) cachePile.get("nationalStandard");
|
||||
connectorInfo.setNationalStandard(nationalStandard == null ? 2 : nationalStandard);
|
||||
connectorInfo.setEquipmentClassification(xhpcChargingPile.getEquipmentClassificatlon());
|
||||
connectorInfo.setOpreateStatus(50);
|
||||
connectorInfo.setAuxPower(xhpcChargingPile.getAuxPower());
|
||||
connectorInfoList.add(connectorInfo);
|
||||
}
|
||||
return connectorInfoList;
|
||||
|
||||
@ -1,20 +1,18 @@
|
||||
package com.xhpc.pp.controller;
|
||||
|
||||
import com.xhpc.common.api.ChargingStationService;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDEquipmentInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.*;
|
||||
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
|
||||
@ -34,30 +32,35 @@ public class StationController {
|
||||
REDIS.setCacheObject(skey, cacheStation);
|
||||
String rkey = "rateModel:".concat(rateModelId.toString());
|
||||
REDIS.setCacheObject(rkey, rateModel);
|
||||
addNotificationStationInfo(stationId);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
//组装场站信息
|
||||
public void addNotificationStationInfo(Long stationId){
|
||||
//生成场站推送数据信息
|
||||
@GetMapping("station/addNotificationStationInfo")
|
||||
public void addNotificationStationInfo(@RequestParam("stationId")Long stationId){
|
||||
CDStationInfo xhpcChargingStation = deviceMessageMapper.getXhpcChargingStation(stationId);
|
||||
if(xhpcChargingStation !=null){
|
||||
//场站信息入缓存
|
||||
String skey = "cdjgpc:station:".concat(stationId.toString())+".notification";
|
||||
REDIS.deleteObject(skey);
|
||||
|
||||
if(xhpcChargingStation.getSwapMatchCarsName() !=null){
|
||||
String[] split = xhpcChargingStation.getSwapMatchCarsName().split(",");
|
||||
xhpcChargingStation.setSwapMatchCars(split);
|
||||
}
|
||||
xhpcChargingStation.setEquipmentInfos(new ArrayList<>());
|
||||
REDIS.setCacheObject(skey, xhpcChargingStation);
|
||||
}
|
||||
}
|
||||
|
||||
//组合场站数据
|
||||
@GetMapping("station/getNotificationStationInfo/{stationId}")
|
||||
public R getNotificationStationInfo(Long chargingStationId){
|
||||
String key = "cdjgpc:station:".concat(chargingStationId.toString())+".notification";
|
||||
@GetMapping("station/getNotificationStationInfo")
|
||||
public R getNotificationStationInfo(@RequestParam("stationId") Long stationId){
|
||||
String key = "cdjgpc:station:".concat(stationId.toString())+".notification";
|
||||
CDStationInfo cdStationInfo = REDIS.getCacheObject(key);
|
||||
cdStationInfo.setEquipmentInfos(new ArrayList<>());
|
||||
//查询场站是桩是否对应上
|
||||
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+chargingStationId);
|
||||
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+stationId);
|
||||
Set<String> pks = stationDto.getPiles();
|
||||
if (pks != null) {
|
||||
List<CDEquipmentInfo> cdEquipmentInfos = new ArrayList<>();
|
||||
@ -77,7 +80,257 @@ public class StationController {
|
||||
return R.fail("场站未查询到充电桩信息");
|
||||
}
|
||||
|
||||
//查询站点统计信息
|
||||
@GetMapping("station/queryStationStats")
|
||||
public R queryStationStats(@RequestParam("stationId") Long stationId,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime){
|
||||
//获取场站
|
||||
CDStationStatslnfo stationStatsInfo = deviceMessageMapper.getStationEquipmentElectricity(stationId, startTime, endTime);
|
||||
stationStatsInfo.setStartTime(startTime);
|
||||
stationStatsInfo.setEndTime(endTime);
|
||||
//获取桩
|
||||
List<Long> chargingPileIds = deviceMessageMapper.getchargingPileId(stationId);
|
||||
List<CDSuqEquipmentStatslnfo> equipmentStatsInfos =new ArrayList<>();
|
||||
for (int i = 0; i < chargingPileIds.size(); i++) {
|
||||
Long chargingPileId = chargingPileIds.get(i);
|
||||
CDSuqEquipmentStatslnfo equipmentStatsInfo = deviceMessageMapper.getSupEquipmentStatsInfo(stationId, chargingPileId, startTime, endTime);
|
||||
List<CDSupConnectorStatslnfo> supConnectorStatslnfo = deviceMessageMapper.getSupConnectorStatslnfo(stationId, null, startTime, endTime);
|
||||
equipmentStatsInfo.setConnectorStatsInfos(supConnectorStatslnfo);
|
||||
equipmentStatsInfos.add(equipmentStatsInfo);
|
||||
}
|
||||
stationStatsInfo.setEquipmentStatsInfo(equipmentStatsInfos);
|
||||
|
||||
String key ="cdjgpc:station:"+stationId+".queryStationStats";
|
||||
REDIS.setCacheObject(key, stationStatsInfo,30L, TimeUnit.MINUTES);
|
||||
return R.ok(stationStatsInfo);
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("station/getNotificationStationFee")
|
||||
public R getNotificationStationFee(@RequestParam("stationId") Long stationId){
|
||||
List<CDChargeFeeDetail> notificationStationFee = deviceMessageMapper.getNotificationStationFee(stationId);
|
||||
String skey = "cdjgpc:stationFee:".concat(stationId.toString());
|
||||
CDStationFee cdStationFeeRequest =new CDStationFee();
|
||||
cdStationFeeRequest.setOperatorID("MA6DFCTD5");
|
||||
cdStationFeeRequest.setStationID(stationId.toString());
|
||||
cdStationFeeRequest.setChargeFeeDetails(notificationStationFee);
|
||||
REDIS.setCacheObject(skey, cdStationFeeRequest);
|
||||
String ske = "cdjgpc:stationFeeRequest:".concat(stationId.toString());
|
||||
REDIS.deleteObject(ske);
|
||||
REDIS.setCacheObject(ske, cdStationFeeRequest,30L, TimeUnit.MINUTES);
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
|
||||
//查询充电设备运行统计信息
|
||||
@GetMapping("station/querySupEquipmentStatsInfo")
|
||||
public R querySupEquipmentStatsInfo(@RequestParam("stationId") Long stationId,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime){
|
||||
//获取场站
|
||||
List<CDSuqEquipmentStatslnfo> cdSuqEquipmentStatslnfos =new ArrayList<>();
|
||||
List<Long> chargingPileIds = deviceMessageMapper.getchargingPileId(stationId);
|
||||
for (int i = 0; i < chargingPileIds.size(); i++) {
|
||||
CDSuqEquipmentStatslnfo supEquipmentStatsInfo = deviceMessageMapper.getSupEquipmentStatsInfo(stationId,chargingPileIds.get(i), startTime, endTime);
|
||||
//获取枪信息
|
||||
List<CDSupConnectorStatslnfo> supConnectorStatslnfo = deviceMessageMapper.getSupConnectorStatslnfo(stationId, chargingPileIds.get(i), startTime, endTime);
|
||||
supEquipmentStatsInfo.setConnectorStatsInfos(supConnectorStatslnfo);
|
||||
|
||||
cdSuqEquipmentStatslnfos.add(supEquipmentStatsInfo);
|
||||
}
|
||||
String key ="cdjgpc:station:"+stationId+".querySupEquipmentStatsInfo";
|
||||
REDIS.setCacheObject(key, cdSuqEquipmentStatslnfos,30L, TimeUnit.MINUTES);
|
||||
return R.ok(cdSuqEquipmentStatslnfos);
|
||||
}
|
||||
|
||||
//查询充电设备运行统计信息
|
||||
@GetMapping("station/queryConnectorStatsInfo")
|
||||
public R queryConnectorStatsInfo(@RequestParam("stationId") Long stationId,@RequestParam("startTime") String startTime,@RequestParam("endTime") String endTime){
|
||||
//获取枪信息
|
||||
List<CDSupConnectorStatslnfo> supConnectorStatslnfo = deviceMessageMapper.getSupConnectorStatslnfo(stationId, null, startTime, endTime);
|
||||
String key ="cdjgpc:station:"+stationId+".queryConnectorStatsInfo";
|
||||
REDIS.setCacheObject(key, supConnectorStatslnfo,30L, TimeUnit.MINUTES);
|
||||
return R.ok(supConnectorStatslnfo);
|
||||
}
|
||||
|
||||
//查询充电站功率统信息
|
||||
@GetMapping("station/getSuperviseQueryStationPowerInfo")
|
||||
public R getSuperviseQueryStationPowerInfo(@RequestParam("stationIDs") String [] stationIDs,@RequestParam("dataTime") String dataTime,@RequestParam("replace")String replace){
|
||||
System.out.println("stationIDs===="+stationIDs.toString());
|
||||
List<String> list = Arrays.asList(stationIDs);
|
||||
List<Long> longList =new ArrayList<>();
|
||||
for (int i = 0; i <list.size() ; i++) {
|
||||
longList.add(Long.valueOf(list.get(i)));
|
||||
}
|
||||
//获取时间
|
||||
String now = DateUtil.now();
|
||||
int hh = Integer.parseInt(now.substring(11,13));
|
||||
int mm = Integer.parseInt(now.substring(14,16));
|
||||
int dd = Integer.parseInt(now.substring(17,19));
|
||||
int numbrt =0;
|
||||
if(mm<15){
|
||||
numbrt = hh*4;
|
||||
}else if(mm<30){
|
||||
numbrt = hh*4+1;
|
||||
}else if(mm<45){
|
||||
numbrt = hh*4+2;
|
||||
}else{
|
||||
numbrt = hh*4+3;
|
||||
}
|
||||
List<CDSupStationPowerInfo> superviseQueryStationPowerInfoList = deviceMessageMapper.getSuperviseQueryStationPowerInfo(longList, dataTime, numbrt);
|
||||
|
||||
for (int i = 0; i < superviseQueryStationPowerInfoList.size(); i++) {
|
||||
//获取充电桩实时功率
|
||||
CDSupStationPowerInfo cdSupStationPowerInfo = superviseQueryStationPowerInfoList.get(i);
|
||||
|
||||
List<CDSupEquipmentPowerInfo> pileSuperviseQueryStationPowerInfoList = deviceMessageMapper.getPileSuperviseQueryStationPowerInfo(Long.valueOf(cdSupStationPowerInfo.getStationID()), dataTime, numbrt);
|
||||
for (int j = 0; j <pileSuperviseQueryStationPowerInfoList.size() ; j++) {
|
||||
CDSupEquipmentPowerInfo cdSupEquipmentPowerlnfo = pileSuperviseQueryStationPowerInfoList.get(j);
|
||||
//获取枪实时功率
|
||||
List<CDSupConnectorPowerInfo> terminalSuperviseQueryStationPowerInfo = deviceMessageMapper.getTerminalSuperviseQueryStationPowerInfo(Long.valueOf(cdSupEquipmentPowerlnfo.getPileID()), dataTime, numbrt);
|
||||
cdSupEquipmentPowerlnfo.setConnectorPowerInfos(terminalSuperviseQueryStationPowerInfo);
|
||||
}
|
||||
cdSupStationPowerInfo.setEquipmentPowerInfos(pileSuperviseQueryStationPowerInfoList);
|
||||
}
|
||||
String key ="cdjgpc:station:"+replace+".getSuperviseQueryStationPowerInfo";
|
||||
REDIS.setCacheObject(key, superviseQueryStationPowerInfoList,30L, TimeUnit.MINUTES);
|
||||
|
||||
return R.ok(superviseQueryStationPowerInfoList);
|
||||
}
|
||||
|
||||
//查询充电站功率统信息
|
||||
@GetMapping("station/getSuperviseQueryEquipmentPowerInfo")
|
||||
public R getSuperviseQueryEquipmentPowerInfo(@RequestParam("stationID") String stationID,@RequestParam("dataTime") String dataTime,@RequestParam("replace")String replace){
|
||||
//获取时间
|
||||
String now = DateUtil.now();
|
||||
int hh = Integer.parseInt(now.substring(11,13));
|
||||
int mm = Integer.parseInt(now.substring(14,16));
|
||||
int dd = Integer.parseInt(now.substring(17,19));
|
||||
int numbrt =0;
|
||||
if(mm<15){
|
||||
numbrt = hh*4;
|
||||
}else if(mm<30){
|
||||
numbrt = hh*4+1;
|
||||
}else if(mm<45){
|
||||
numbrt = hh*4+2;
|
||||
}else{
|
||||
numbrt = hh*4+3;
|
||||
}
|
||||
|
||||
List<CDSupEquipmentPowerInfo> pileSuperviseQueryStationPowerInfoList = deviceMessageMapper.getPileSuperviseQueryStationPowerInfo(Long.valueOf(stationID), dataTime, numbrt);
|
||||
for (int j = 0; j <pileSuperviseQueryStationPowerInfoList.size() ; j++) {
|
||||
CDSupEquipmentPowerInfo cdSupEquipmentPowerlnfo = pileSuperviseQueryStationPowerInfoList.get(j);
|
||||
//获取枪实时功率
|
||||
List<CDSupConnectorPowerInfo> terminalSuperviseQueryStationPowerInfo = deviceMessageMapper.getTerminalSuperviseQueryStationPowerInfo(Long.valueOf(cdSupEquipmentPowerlnfo.getPileID()), dataTime, numbrt);
|
||||
cdSupEquipmentPowerlnfo.setConnectorPowerInfos(terminalSuperviseQueryStationPowerInfo);
|
||||
}
|
||||
String key ="cdjgpc:station:"+replace+".getSuperviseQueryEquipmentPowerInfo";
|
||||
REDIS.setCacheObject(key, pileSuperviseQueryStationPowerInfoList,30L, TimeUnit.MINUTES);
|
||||
return R.ok(pileSuperviseQueryStationPowerInfoList);
|
||||
}
|
||||
|
||||
|
||||
//查充电事故
|
||||
@GetMapping("station/getSuperviseQueryAccidentInfo")
|
||||
public R getSuperviseQueryAccidentInfo(@RequestParam("lastQueryTime") String lastQueryTime,@RequestParam("replace") String replace){
|
||||
List<CDSupEquipmentAccidentInfo> list = deviceMessageMapper.getSuperviseQueryAccidentInfo();
|
||||
|
||||
for (int i = 0; i <list.size() ; i++) {
|
||||
CDSupEquipmentAccidentInfo cdSupEquipmentAccidentInfo = list.get(i);
|
||||
if(!"".equals(cdSupEquipmentAccidentInfo.getPicturesName())){
|
||||
String[] split = cdSupEquipmentAccidentInfo.getPicturesName().split(",");
|
||||
String[] pictures =new String[split.length];
|
||||
for (int j = 0; j <split.length ; j++) {
|
||||
String s = split[j];
|
||||
pictures[j] = "https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/"+s;
|
||||
}
|
||||
}
|
||||
if(!"".equals(cdSupEquipmentAccidentInfo.getAnalysisReportName())){
|
||||
String[] split = cdSupEquipmentAccidentInfo.getAnalysisReportName().split(",");
|
||||
String[] analysisReport =new String[split.length];
|
||||
for (int j = 0; j <split.length ; j++) {
|
||||
String s = split[j];
|
||||
analysisReport[j] = "https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/"+s;
|
||||
}
|
||||
}
|
||||
}
|
||||
String key ="cdjgpc:station:"+replace+".getSuperviseQueryAccidentInfo";
|
||||
REDIS.setCacheObject(key, list,30L, TimeUnit.MINUTES);
|
||||
return R.ok(list);
|
||||
}
|
||||
|
||||
|
||||
//推送充电站用能统计信息
|
||||
@GetMapping("station/getSuperviseNotificationOperationStatusInfo")
|
||||
public R getSuperviseNotificationOperationStatusInfo(@RequestParam("replace")String replace){
|
||||
|
||||
//获取昨天日期
|
||||
DateTime yesterday = DateUtil.yesterday();
|
||||
String format = DateUtil.format(yesterday, "yyyy-MM-dd");
|
||||
String startTime =format+" 00:00:00";
|
||||
String endTime =format+" 23:59:59";
|
||||
|
||||
List<CDStationStatslnfo> stationStatsInfoList = deviceMessageMapper.getCDStationStatslnfoList(startTime, endTime);
|
||||
|
||||
for (int k = 0; k <stationStatsInfoList.size() ; k++) {
|
||||
CDStationStatslnfo cdStationStatslnfo = stationStatsInfoList.get(k);
|
||||
Long stationId = Long.valueOf(cdStationStatslnfo.getStationID());
|
||||
//获取桩
|
||||
List<Long> chargingPileIds = deviceMessageMapper.getchargingPileId(stationId);
|
||||
List<CDSuqEquipmentStatslnfo> equipmentStatsInfos =new ArrayList<>();
|
||||
for (int i = 0; i < chargingPileIds.size(); i++) {
|
||||
Long chargingPileId = chargingPileIds.get(i);
|
||||
CDSuqEquipmentStatslnfo equipmentStatsInfo = deviceMessageMapper.getSupEquipmentStatsInfo(stationId, chargingPileId, startTime, endTime);
|
||||
List<CDSupConnectorStatslnfo> supConnectorStatslnfo = deviceMessageMapper.getSupConnectorStatslnfo(stationId, null, startTime, endTime);
|
||||
equipmentStatsInfo.setConnectorStatsInfos(supConnectorStatslnfo);
|
||||
equipmentStatsInfos.add(equipmentStatsInfo);
|
||||
}
|
||||
cdStationStatslnfo.setEquipmentStatsInfo(equipmentStatsInfos);
|
||||
}
|
||||
|
||||
String key ="cdjgpc:station:"+replace+".getSuperviseNotificationOperationStatusInfo";
|
||||
REDIS.setCacheObject(key, stationStatsInfoList,30L, TimeUnit.MINUTES);
|
||||
return R.ok(stationStatsInfoList);
|
||||
}
|
||||
|
||||
|
||||
//推送充电站实时功率
|
||||
@GetMapping("station/getSuperviseNotificationRealtimePowerInfo")
|
||||
public R getSuperviseNotificationRealtimePowerInfo(@RequestParam("operatorIdEvcs")String operatorIdEvcs,@RequestParam("replace")String replace){
|
||||
|
||||
List<Long> stationId = deviceMessageMapper.getStationId();
|
||||
//获取时间
|
||||
String now = DateUtil.now();
|
||||
String dataTime = now.substring(0,10);
|
||||
int hh = Integer.parseInt(now.substring(11,13));
|
||||
int mm = Integer.parseInt(now.substring(14,16));
|
||||
int numbrt =0;
|
||||
if(mm<15){
|
||||
numbrt = hh*4;
|
||||
}else if(mm<30){
|
||||
numbrt = hh*4+1;
|
||||
}else if(mm<45){
|
||||
numbrt = hh*4+2;
|
||||
}else{
|
||||
numbrt = hh*4+3;
|
||||
}
|
||||
List<CDSupStationPowerInfo> superviseQueryStationPowerInfoList = deviceMessageMapper.getSuperviseQueryStationPowerInfo(stationId, dataTime, numbrt);
|
||||
for (int i = 0; i < superviseQueryStationPowerInfoList.size(); i++) {
|
||||
//获取充电桩实时功率
|
||||
CDSupStationPowerInfo cdSupStationPowerInfo = superviseQueryStationPowerInfoList.get(i);
|
||||
|
||||
List<CDSupEquipmentPowerInfo> pileSuperviseQueryStationPowerInfoList = deviceMessageMapper.getPileSuperviseQueryStationPowerInfo(Long.valueOf(cdSupStationPowerInfo.getStationID()), dataTime, numbrt);
|
||||
for (int j = 0; j <pileSuperviseQueryStationPowerInfoList.size() ; j++) {
|
||||
CDSupEquipmentPowerInfo cdSupEquipmentPowerlnfo = pileSuperviseQueryStationPowerInfoList.get(j);
|
||||
//获取枪实时功率
|
||||
List<CDSupConnectorPowerInfo> terminalSuperviseQueryStationPowerInfo = deviceMessageMapper.getTerminalSuperviseQueryStationPowerInfo(Long.valueOf(cdSupEquipmentPowerlnfo.getPileID()), dataTime, numbrt);
|
||||
cdSupEquipmentPowerlnfo.setConnectorPowerInfos(terminalSuperviseQueryStationPowerInfo);
|
||||
}
|
||||
cdSupStationPowerInfo.setEquipmentPowerInfos(pileSuperviseQueryStationPowerInfoList);
|
||||
}
|
||||
String key ="cdjgpc:station:"+replace+".getSuperviseNotificationRealtimePowerInfo";
|
||||
REDIS.setCacheObject(key, superviseQueryStationPowerInfoList,30L, TimeUnit.MINUTES);
|
||||
|
||||
return R.ok(superviseQueryStationPowerInfoList);
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -25,10 +25,10 @@ public class BmsChargingCompletedDataLogic implements ServiceLogic {
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
log.error("====0X19======getServiceName================"+sp.getServiceName());
|
||||
log.error("====0X19======getPileNo================"+sp.getPileNo());
|
||||
log.error("====0X19======getParameters================"+sp.getParameters());
|
||||
log.error("====0X19======getVersion================"+sp.getVersion());
|
||||
// log.error("====0X19======getServiceName================"+sp.getServiceName());
|
||||
// log.error("====0X19======getPileNo================"+sp.getPileNo());
|
||||
// log.error("====0X19======getParameters================"+sp.getParameters());
|
||||
// log.error("====0X19======getVersion================"+sp.getVersion());
|
||||
String remark = "充电桩与 BMS 充电结束阶段报文";
|
||||
Map<String, Object> req = sp.getParameters();
|
||||
|
||||
|
||||
@ -3,6 +3,7 @@ package com.xhpc.pp.logic;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONUtil;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.xhpc.common.api.EvcsService;
|
||||
import com.xhpc.common.api.PileOrderService;
|
||||
import com.xhpc.common.api.SmsService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
@ -31,6 +32,8 @@ import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
@ -52,6 +55,8 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
private ChargingController chargingController;
|
||||
@Resource
|
||||
XhpcDeviceMessageMapper deviceMessageMapper;
|
||||
@Resource
|
||||
EvcsService evcsService;
|
||||
|
||||
private static final Logger log = LoggerFactory.getLogger(RealtimeDataLogic.class);
|
||||
|
||||
@ -60,6 +65,7 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
private static final String[] hftable = {"急停按钮动作故障", "无可用整流模块", "出风口温度过高", "交流防雷故障", "交直流模块DC20通信中断", "绝缘检测模块FC08通信中断",
|
||||
"电度表通信中断", "读卡器通信中断", "RC10通信中断", "风扇调速板故障", "直流熔断器故障", "高压接触器故障", "门打开"};
|
||||
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(40);
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
@ -281,6 +287,12 @@ public class RealtimeDataLogic implements ServiceLogic {
|
||||
deviceMessage.setContent((String) req.get("hex"));
|
||||
deviceMessage.setChargeOrderNo((String) req.get("orderNo"));
|
||||
deviceMessageMapper.insertByDomain(deviceMessage);
|
||||
// executorService.execute(new Runnable() {
|
||||
// @Override
|
||||
// public void run() {
|
||||
// evcsService.getNotificationConnectorChargeStatus(orderNo);
|
||||
// }
|
||||
// });
|
||||
return new ServiceResult(false);
|
||||
}
|
||||
|
||||
|
||||
@ -29,10 +29,10 @@ public class RemoteStopReplyDataLogic implements ServiceLogic {
|
||||
|
||||
@Override
|
||||
public ServiceResult service(ServiceParameter sp) throws Exception {
|
||||
log.error("=====0X35=====getServiceName================"+sp.getServiceName());
|
||||
log.error("=====0X35=====getPileNo================"+sp.getPileNo());
|
||||
log.error("=====0X35=====getParameters================"+sp.getParameters());
|
||||
log.error("=====0X35=====getVersion================"+sp.getVersion());
|
||||
// log.error("=====0X35=====getServiceName================"+sp.getServiceName());
|
||||
// log.error("=====0X35=====getPileNo================"+sp.getPileNo());
|
||||
// log.error("=====0X35=====getParameters================"+sp.getParameters());
|
||||
// log.error("=====0X35=====getVersion================"+sp.getVersion());
|
||||
Map<String, Object> req = sp.getParameters();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
RemoteStopReplyData remoteStopReplyData = objectMapper.convertValue(req, RemoteStopReplyData.class);
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user