diff --git a/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/web/domain/BaseEntity.java b/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/web/domain/BaseEntity.java index a519fd36..5af7eeda 100644 --- a/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/web/domain/BaseEntity.java +++ b/ruoyi-common/ruoyi-common-core/src/main/java/com/xhpc/common/core/web/domain/BaseEntity.java @@ -3,6 +3,8 @@ package com.xhpc.common.core.web.domain; import com.fasterxml.jackson.annotation.JsonFormat; import org.springframework.format.annotation.DateTimeFormat; +import javax.persistence.MappedSuperclass; +import javax.persistence.Transient; import java.io.Serializable; import java.util.Date; import java.util.HashMap; @@ -13,6 +15,7 @@ import java.util.Map; * * @author ruoyi */ +@MappedSuperclass public class BaseEntity implements Serializable { private static final long serialVersionUID = 1L; @@ -40,6 +43,7 @@ public class BaseEntity implements Serializable private String remark; /** 请求参数 */ + @Transient private Map params; public String getSearchValue() diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/evcs/domain/XhpcStatisticsTimeInterval.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/evcs/domain/XhpcStatisticsTimeInterval.java new file mode 100644 index 00000000..bd992eeb --- /dev/null +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/evcs/domain/XhpcStatisticsTimeInterval.java @@ -0,0 +1,131 @@ +package com.xhpc.evcs.domain; + +import javax.persistence.Column; +import javax.persistence.Entity; +import javax.persistence.Id; +import javax.persistence.Table; +import java.math.BigDecimal; + +@Table(name = "xhpc_statistics_time_interval") +@Entity +public class XhpcStatisticsTimeInterval { + + @Id + @Column(name = "statistics_time_interval_id", nullable = false) + private Long id; + + @Column(name = "history_order_id", nullable = false) + private Long historyOrderId; + + @Column(name = "charging_degree", precision = 10, scale = 2) + private BigDecimal chargingDegree; + + @Column(name = "power_price", precision = 10, scale = 2) + private BigDecimal powerPrice; + + @Column(name = "service_price", precision = 10, scale = 2) + private BigDecimal servicePrice; + + @Column(name = "start_time_evcs", length = 50) + private String startTimeEvcs; + + @Column(name = "end_time_evcs", length = 50) + private String endTimeEvcs; + + @Column(name = "elec_price_evcs", precision = 10, scale = 2) + private BigDecimal elecPriceEvcs; + + @Column(name = "service_price_evcs", precision = 10, scale = 2) + private BigDecimal servicePriceEvcs; + + public Long getHistoryOrderId() { + + return historyOrderId; + } + + public void setHistoryOrderId(Long historyOrderId) { + + this.historyOrderId = historyOrderId; + } + + public BigDecimal getServicePriceEvcs() { + + return servicePriceEvcs; + } + + public void setServicePriceEvcs(BigDecimal servicePriceEvcs) { + + this.servicePriceEvcs = servicePriceEvcs; + } + + public BigDecimal getElecPriceEvcs() { + + return elecPriceEvcs; + } + + public void setElecPriceEvcs(BigDecimal elecPriceEvcs) { + + this.elecPriceEvcs = elecPriceEvcs; + } + + public String getEndTimeEvcs() { + + return endTimeEvcs; + } + + public void setEndTimeEvcs(String endTimeEvcs) { + + this.endTimeEvcs = endTimeEvcs; + } + + public String getStartTimeEvcs() { + + return startTimeEvcs; + } + + public void setStartTimeEvcs(String startTimeEvcs) { + + this.startTimeEvcs = startTimeEvcs; + } + + public BigDecimal getServicePrice() { + + return servicePrice; + } + + public void setServicePrice(BigDecimal servicePrice) { + + this.servicePrice = servicePrice; + } + + public BigDecimal getPowerPrice() { + + return powerPrice; + } + + public void setPowerPrice(BigDecimal powerPrice) { + + this.powerPrice = powerPrice; + } + + public BigDecimal getChargingDegree() { + + return chargingDegree; + } + + public void setChargingDegree(BigDecimal chargingDegree) { + + this.chargingDegree = chargingDegree; + } + + public Long getId() { + + return id; + } + + public void setId(Long id) { + + this.id = id; + } + +} diff --git a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/order/domain/XhpcHistoryOrder.java b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/order/domain/XhpcHistoryOrder.java index 9e686ec5..e88ee7f8 100644 --- a/xhpc-modules/xhpc-common/src/main/java/com/xhpc/order/domain/XhpcHistoryOrder.java +++ b/xhpc-modules/xhpc-common/src/main/java/com/xhpc/order/domain/XhpcHistoryOrder.java @@ -1,19 +1,22 @@ package com.xhpc.order.domain; import com.xhpc.common.core.web.domain.BaseEntity; -import lombok.Data; +import com.xhpc.evcs.domain.XhpcStatisticsTimeInterval; import javax.persistence.Entity; import javax.persistence.Id; import javax.persistence.Table; +import javax.persistence.Transient; import java.math.BigDecimal; +import java.util.ArrayList; +import java.util.Date; +import java.util.List; /** * @author * @description 历史订单 xhpc_history_order * @date 2021-07-22 */ -@Data @Entity @Table(name = "xhpc_history_order") public class XhpcHistoryOrder extends BaseEntity { @@ -163,4 +166,479 @@ public class XhpcHistoryOrder extends BaseEntity { * VIN 码 */ private String vinNormal; + + /** + * 充电电量 + */ + private Double totalPower; + + private String gunId; + + private Date startTime; + + /** + * 0:用户手动停止充电 + * 1:客户归属地运营商平台停止充电 + * 2:BMS 停止充电; + * 3:充电机设备故障; + * 4:连接器断开 + * 5-99 自定义 + */ + private Integer stopReasonEvcs = 0; + + /** + * 运营商/场站OperatorID + */ + private String operatorIdEvcs; + + /** + * 流量方OperatorID + */ + private String operatorId3rdptyEvcs; + + /** + * 终端客户开启充电方式 + * 0:未知 + * 1:市/省级平台无卡启动 + * 2:有卡启动 + * 3:其他无卡启动 + */ + private int chargeModelEvcs; + + /** + * 实际充电的客户在运营商侧的名称,<=20字符 + */ + private String userNameEvcs; + + /** + * 接口额定功率 + * 单位:kW, 小数点后 1 位 + */ + private Double connectorPowerEvcs; + + /** + * 电表总起值 + * 单位:度, 小数点后2位 + */ + private Double meterValueStartEvcs; + + /** + * 电表总结束值 + * 单位:度, 小数点后2位 + */ + private Double meterValueEndEvcs; + + public Double getMeterValueEndEvcs() { + + return meterValueEndEvcs; + } + + public void setMeterValueEndEvcs(Double meterValueEndEvcs) { + + this.meterValueEndEvcs = meterValueEndEvcs; + } + + public String getUserNameEvcs() { + + return userNameEvcs; + } + + public void setUserNameEvcs(String userNameEvcs) { + + this.userNameEvcs = userNameEvcs; + } + + @Transient + private List xhpcStatisticsTimeIntervalList; + + public List getXhpcStatisticsTimeIntervalList() { + + return xhpcStatisticsTimeIntervalList == null ? new ArrayList<>() : xhpcStatisticsTimeIntervalList; + } + + public void setXhpcStatisticsTimeIntervalList(List xhpcStatisticsTimeIntervalList) { + + this.xhpcStatisticsTimeIntervalList = xhpcStatisticsTimeIntervalList; + } + + public Long getHistoryOrderId() { + + return historyOrderId; + } + + public void setHistoryOrderId(Long historyOrderId) { + + this.historyOrderId = historyOrderId; + } + + public Long getChargingStationId() { + + return chargingStationId == null ? 0 : chargingStationId; + } + + public void setChargingStationId(Long chargingStationId) { + + this.chargingStationId = chargingStationId; + } + + public Long getChargeOrderId() { + + return chargeOrderId; + } + + public void setChargeOrderId(Long chargeOrderId) { + + this.chargeOrderId = chargeOrderId; + } + + public Long getUserId() { + + return userId; + } + + public void setUserId(Long userId) { + + this.userId = userId; + } + + public Long getTerminalId() { + + return terminalId; + } + + public void setTerminalId(Long terminalId) { + + this.terminalId = terminalId; + } + + public String getSerialNumber() { + + return serialNumber; + } + + public void setSerialNumber(String serialNumber) { + + this.serialNumber = serialNumber; + } + + public String getInternetSerialNumber() { + + return internetSerialNumber; + } + + public void setInternetSerialNumber(String internetSerialNumber) { + + this.internetSerialNumber = internetSerialNumber; + } + + public BigDecimal getTotalPrice() { + + return totalPrice == null ? BigDecimal.ZERO : totalPrice; + } + + public void setTotalPrice(BigDecimal totalPrice) { + + this.totalPrice = totalPrice; + } + + public BigDecimal getPromotionDiscount() { + + return promotionDiscount; + } + + public void setPromotionDiscount(BigDecimal promotionDiscount) { + + this.promotionDiscount = promotionDiscount; + } + + public BigDecimal getActPrice() { + + return actPrice; + } + + public void setActPrice(BigDecimal actPrice) { + + this.actPrice = actPrice; + } + + public BigDecimal getActPowerPrice() { + + return actPowerPrice; + } + + public void setActPowerPrice(BigDecimal actPowerPrice) { + + this.actPowerPrice = actPowerPrice; + } + + public BigDecimal getActServicePrice() { + + return actServicePrice; + } + + public void setActServicePrice(BigDecimal actServicePrice) { + + this.actServicePrice = actServicePrice; + } + + public BigDecimal getInternetCommission() { + + return internetCommission; + } + + public void setInternetCommission(BigDecimal internetCommission) { + + this.internetCommission = internetCommission; + } + + public BigDecimal getInternetSvcCommission() { + + return internetSvcCommission; + } + + public void setInternetSvcCommission(BigDecimal internetSvcCommission) { + + this.internetSvcCommission = internetSvcCommission; + } + + public BigDecimal getPlatformCommission() { + + return platformCommission; + } + + public void setPlatformCommission(BigDecimal platformCommission) { + + this.platformCommission = platformCommission; + } + + public BigDecimal getPlatformSvcCommisssion() { + + return platformSvcCommisssion; + } + + public void setPlatformSvcCommisssion(BigDecimal platformSvcCommisssion) { + + this.platformSvcCommisssion = platformSvcCommisssion; + } + + public BigDecimal getOperationCommission() { + + return operationCommission; + } + + public void setOperationCommission(BigDecimal operationCommission) { + + this.operationCommission = operationCommission; + } + + public BigDecimal getOperationSvcCommission() { + + return operationSvcCommission; + } + + public void setOperationSvcCommission(BigDecimal operationSvcCommission) { + + this.operationSvcCommission = operationSvcCommission; + } + + public String getStartSoc() { + + return startSoc; + } + + public void setStartSoc(String startSoc) { + + this.startSoc = startSoc; + } + + public String getEndSoc() { + + return endSoc; + } + + public void setEndSoc(String endSoc) { + + this.endSoc = endSoc; + } + + public Integer getReconciliationStatus() { + + return reconciliationStatus; + } + + public void setReconciliationStatus(Integer reconciliationStatus) { + + this.reconciliationStatus = reconciliationStatus; + } + + public Integer getSortingStatus() { + + return sortingStatus; + } + + public void setSortingStatus(Integer sortingStatus) { + + this.sortingStatus = sortingStatus; + } + + public Integer getType() { + + return type; + } + + public void setType(Integer type) { + + this.type = type; + } + + public Integer getStatus() { + + return status; + } + + public void setStatus(Integer status) { + + this.status = status; + } + + public Integer getDelFlag() { + + return delFlag; + } + + public void setDelFlag(Integer delFlag) { + + this.delFlag = delFlag; + } + + public BigDecimal getPowerPriceTotal() { + + return powerPriceTotal; + } + + public void setPowerPriceTotal(BigDecimal powerPriceTotal) { + + this.powerPriceTotal = powerPriceTotal; + } + + public BigDecimal getServicePriceTotal() { + + return servicePriceTotal == null ? BigDecimal.ZERO : servicePriceTotal; + } + + public void setServicePriceTotal(BigDecimal servicePriceTotal) { + + this.servicePriceTotal = servicePriceTotal; + } + + public Integer getState() { + + return state; + } + + public void setState(Integer state) { + + this.state = state; + } + + public String getVinNormal() { + + return vinNormal; + } + + public void setVinNormal(String vinNormal) { + + this.vinNormal = vinNormal; + } + + public Double getTotalPower() { + + return totalPower; + } + + public void setTotalPower(Double totalPower) { + + this.totalPower = totalPower; + } + + public String getGunId() { + + return gunId; + } + + public void setGunId(String gunId) { + + this.gunId = gunId; + } + + public Date getStartTime() { + + return startTime; + } + + public void setStartTime(Date startTime) { + + this.startTime = startTime; + } + + public Integer getStopReasonEvcs() { + + return stopReasonEvcs; + } + + public void setStopReasonEvcs(Integer stopReasonEvcs) { + + this.stopReasonEvcs = stopReasonEvcs; + } + + public String getOperatorIdEvcs() { + + return operatorIdEvcs; + } + + public void setOperatorIdEvcs(String operatorIdEvcs) { + + this.operatorIdEvcs = operatorIdEvcs; + } + + public String getOperatorId3rdptyEvcs() { + + return operatorId3rdptyEvcs; + } + + public void setOperatorId3rdptyEvcs(String operatorId3rdptyEvcs) { + + this.operatorId3rdptyEvcs = operatorId3rdptyEvcs; + } + + public int getChargeModelEvcs() { + + return chargeModelEvcs; + } + + public void setChargeModelEvcs(int chargeModelEvcs) { + + this.chargeModelEvcs = chargeModelEvcs; + } + + public Double getConnectorPowerEvcs() { + + return connectorPowerEvcs; + } + + public void setConnectorPowerEvcs(Double connectorPowerEvcs) { + + this.connectorPowerEvcs = connectorPowerEvcs; + } + + public Double getMeterValueStartEvcs() { + + return meterValueStartEvcs; + } + + public void setMeterValueStartEvcs(Double meterValueStartEvcs) { + + this.meterValueStartEvcs = meterValueStartEvcs; + } + } diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcChargeOrder.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcChargeOrder.java index dfd31a21..7b5389d1 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcChargeOrder.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/domain/XhpcChargeOrder.java @@ -93,15 +93,114 @@ public class XhpcChargeOrder extends BaseEntity { /** 0桩停止充电 1 远程停止充电 */ private Integer type; - /** 异常备注 */ + /** + * 异常备注 + */ private String erroRemark; - /** 总金额 */ + /** + * 总金额 + */ private BigDecimal amountCharged; - /** 功率 */ + /** + * 功率 + */ private String power; + private String gunId; + + /** + * 运营商/场站OperatorID + */ + private String operatorIdEvcs; + + /** + * 流量方OperatorID + */ + private String operatorId3rdptyEvcs; + + /** + * 终端客户开启充电方式 + * 0:未知 + * 1:市/省级平台无卡启动 + * 2:有卡启动 + * 3:其他无卡启动 + */ + private Integer chargeModelEvcs = 3; + + private Double totalPower; + + /** + * 0:用户手动停止充电 + * 1:客户归属地运营商平台停止充电 + * 2:BMS 停止充电; + * 3:充电机设备故障; + * 4:连接器断开 + * 5-99 自定义 + */ + private Integer stopReasonEvcs = 0; + + public Integer getStopReasonEvcs() { + + return stopReasonEvcs; + } + + public void setStopReasonEvcs(Integer stopReasonEvcs) { + + this.stopReasonEvcs = stopReasonEvcs; + } + + public Integer getChargeModelEvcs() { + + return chargeModelEvcs; + } + + public void setChargeModelEvcs(Integer chargeModelEvcs) { + + this.chargeModelEvcs = chargeModelEvcs; + } + + public Double getTotalPower() { + + return totalPower; + } + + public void setTotalPower(Double totalPower) { + + this.totalPower = totalPower; + } + + public String getOperatorIdEvcs() { + + return operatorIdEvcs; + } + + public void setOperatorIdEvcs(String operatorIdEvcs) { + + this.operatorIdEvcs = operatorIdEvcs; + } + + public String getOperatorId3rdptyEvcs() { + + return operatorId3rdptyEvcs; + } + + public void setOperatorId3rdptyEvcs(String operatorId3rdptyEvcs) { + + this.operatorId3rdptyEvcs = operatorId3rdptyEvcs; + } + + public String getGunId() { + + return gunId; + } + + public void setGunId(String gunId) { + + this.gunId = gunId; + } + public Long getChargeOrderId() { return chargeOrderId; diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java index 6decca72..47465226 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcChargeOrderServiceImpl.java @@ -13,7 +13,6 @@ import com.xhpc.order.domain.XhpcChargeOrder; import com.xhpc.order.domain.XhpcOrderRedisRecord; import com.xhpc.order.mapper.XhpcChargeOrderMapper; import com.xhpc.order.service.IXhpcChargeOrderService; -import org.checkerframework.checker.units.qual.C; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; @@ -206,6 +205,7 @@ public class XhpcChargeOrderServiceImpl implements IXhpcChargeOrderService { xhpcChargeOrder.setChargingStationId(xhpcTerminal.getChargingStationId()); xhpcChargeOrder.setUserId(userId); xhpcChargeOrder.setTerminalId(xhpcTerminal.getTerminalId()); + xhpcChargeOrder.setGunId(xhpcTerminal.getSerialNumber()); xhpcChargeOrder.setSerialNumber(orderNo); xhpcChargeOrder.setSource(0); xhpcChargeOrder.setStatus(-1); diff --git a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java index 4cd5c1f4..2a91c1d3 100644 --- a/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java +++ b/xhpc-modules/xhpc-order/src/main/java/com/xhpc/order/service/impl/XhpcRealTimeOrderServiceImpl.java @@ -318,6 +318,10 @@ public class XhpcRealTimeOrderServiceImpl implements IXhpcRealTimeOrderService { xhpcHistoryOrder.setChargingStationId(xhpcChargeOrder.getChargingStationId()); xhpcHistoryOrder.setUserId(userId); xhpcHistoryOrder.setTerminalId(xhpcChargeOrder.getTerminalId()); + xhpcHistoryOrder.setGunId(xhpcChargeOrder.getGunId()); + xhpcHistoryOrder.setStartTime(xhpcChargeOrder.getStartTime()); + xhpcHistoryOrder.setStopReasonEvcs(xhpcChargeOrder.getStopReasonEvcs());//todo 从头开始设置所有evcs字段 + xhpcHistoryOrder.setChargeModelEvcs(xhpcChargeOrder.getChargeModelEvcs()); xhpcHistoryOrder.setSerialNumber(xhpcChargeOrder.getSerialNumber()); xhpcHistoryOrder.setStartSoc(xhpcChargeOrder.getStartSoc()); xhpcHistoryOrder.setReconciliationStatus(0); diff --git a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileServer.java b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileServer.java index 60bb2654..b4bc8ab1 100644 --- a/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileServer.java +++ b/xhpc-modules/xhpc-power-pile/src/main/java/com/xhpc/pp/server/ChargingPileServer.java @@ -88,13 +88,14 @@ public class ChargingPileServer { private static void putemDisconn(String pileNo, Map cachePile) { String stationTermStatusKey = "stationTerminalStatus:".concat(cachePile.get("stationId").toString()); for (int i = 1; i <= (int) cachePile.get("gunNum"); i++) { - String gunkey = "gun:".concat(pileNo).concat(String.format("%02d", i)); + String gunId = pileNo.concat(String.format("%02d", i)); + String gunkey = "gun:".concat(gunId); Map cacheGun = REDIS.getCacheMap(gunkey); if (!cacheGun.isEmpty()) { cacheGun.put("status", DISCONNECTED); REDIS.setCacheMap(gunkey, cacheGun); Map cacheTerminalStatusMap = REDIS.getCacheMap(stationTermStatusKey); - cacheTerminalStatusMap.put(gunkey, DISCONNECTED); + cacheTerminalStatusMap.put(gunId, DISCONNECTED); REDIS.setCacheMap(stationTermStatusKey, cacheTerminalStatusMap); String orderkey = (String) cacheGun.get("orderkey"); if (orderkey != null) {