一键启动、一键关停
This commit is contained in:
parent
c884e6821a
commit
bf2b8452df
@ -0,0 +1,115 @@
|
||||
package com.xhpc.evcs.cdjgpc.domain;
|
||||
|
||||
import com.xhpc.common.core.web.domain.BaseEntity;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.*;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
|
||||
/**
|
||||
* 充电订单
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2024-08-16 14:07
|
||||
*/
|
||||
@Table(name = "xhpc_charge_order")
|
||||
@Entity
|
||||
@Data
|
||||
public class XhpcChargeOrder extends BaseEntity {
|
||||
@Id
|
||||
@GeneratedValue(strategy = GenerationType.IDENTITY)
|
||||
@Column(name = "charge_order_id", nullable = false)
|
||||
private Long id;
|
||||
|
||||
@Column(name = "charging_station_id")
|
||||
private Long chargingStationId;
|
||||
|
||||
@Column(name = "user_id")
|
||||
private Long userId;
|
||||
|
||||
@Column(name = "terminal_id")
|
||||
private Long terminalId;
|
||||
|
||||
@Column(name = "internet_serial_number", length = 50)
|
||||
private String internetSerialNumber;
|
||||
|
||||
@Column(name = "serial_number", length = 50)
|
||||
private String serialNumber;
|
||||
|
||||
@Column(name = "start_soc", length = 50)
|
||||
private String startSoc;
|
||||
|
||||
@Column(name = "end_soc", length = 50)
|
||||
private String endSoc;
|
||||
|
||||
@Column(name = "source")
|
||||
private Integer source;
|
||||
|
||||
@Column(name = "status")
|
||||
private Integer status;
|
||||
|
||||
@Column(name = "del_flag")
|
||||
private Integer delFlag;
|
||||
|
||||
@Column(name = "rate_model_id")
|
||||
private Long rateModelId;
|
||||
|
||||
@Column(name = "charging_mode", length = 50)
|
||||
private String chargingMode;
|
||||
|
||||
@Column(name = "start_time")
|
||||
private Date startTime;
|
||||
|
||||
@Column(name = "end_time")
|
||||
private Date endTime;
|
||||
|
||||
@Column(name = "charging_time", length = 50)
|
||||
private String chargingTime;
|
||||
|
||||
@Column(name = "charging_degree")
|
||||
private BigDecimal chargingDegree;
|
||||
|
||||
@Column(name = "type", length = 50)
|
||||
private String type;
|
||||
|
||||
@Column(name = "erro_remark", length = 50)
|
||||
private String erroRemark;
|
||||
|
||||
@Column(name = "amount_charged")
|
||||
private BigDecimal amountCharged;
|
||||
|
||||
@Column(name = "power", length = 50)
|
||||
private String power;
|
||||
|
||||
@Column(name = "charging_time_number")
|
||||
private Long chargingTimeNumber;
|
||||
|
||||
@Column(name = "driver_id", length = 50)
|
||||
private String driverId;
|
||||
|
||||
@Column(name = "charging_amt")
|
||||
private Long chargingAmt;
|
||||
|
||||
@Column(name = "Plate_num", length = 50)
|
||||
private String plateNum;
|
||||
|
||||
@Column(name = "evcs_order_no", length = 50)
|
||||
private String evcsOrderNo;
|
||||
|
||||
@Column(name = "tenant_id", length = 50)
|
||||
private String tenantId;
|
||||
|
||||
@Column(name = "vin_normal", length = 50)
|
||||
private String vinNormal;
|
||||
|
||||
@Column(name = "station_total_warning_num")
|
||||
private Integer stationTotalWarningNum;
|
||||
|
||||
@Column(name = "charging_capacity")
|
||||
private Integer chargingCapacity;
|
||||
|
||||
@Column(name = "suncha_status")
|
||||
private Integer sunchaStatus;
|
||||
|
||||
}
|
||||
@ -54,8 +54,26 @@ public class CDConnectorInfo {
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
@JsonProperty("Power")
|
||||
public Double power;
|
||||
|
||||
// @Column(columnDefinition = "Decimal(10,1)")
|
||||
// @JsonProperty("ConstantVoltageUpperLimits")
|
||||
// public Double constantVoltageUpperLimits;
|
||||
//
|
||||
// @Column(columnDefinition = "Decimal(10,1)")
|
||||
// @JsonProperty("ConstantVoltageLowerLimits")
|
||||
// public Double constantVoltageLowerLimits;
|
||||
//
|
||||
// @Column(columnDefinition = "Decimal(10,1)")
|
||||
// @JsonProperty("ConstantCurrentUpperLimits")
|
||||
// public Double constantCurrentUpperLimits;
|
||||
//
|
||||
// @Column(columnDefinition = "Decimal(10,1)")
|
||||
// @JsonProperty("ConstantCurrentLowerLimits")
|
||||
// public Double constantCurrentLowerLimits;
|
||||
|
||||
// @JsonProperty("ParkNo")
|
||||
// public String ParkNo;
|
||||
|
||||
@JsonProperty("NationalStandard")
|
||||
public Integer nationalStandard;
|
||||
/**
|
||||
@ -77,5 +95,6 @@ public class CDConnectorInfo {
|
||||
@JsonProperty("OpreateStatus")
|
||||
public Integer opreateStatus;
|
||||
|
||||
|
||||
// @JsonProperty("OperateHours")
|
||||
// public String operateHours;
|
||||
}
|
||||
|
||||
@ -60,8 +60,22 @@ public class CDConnectorStatusInfo {
|
||||
*/
|
||||
@JsonProperty("Status")
|
||||
public Integer status;
|
||||
|
||||
|
||||
|
||||
|
||||
//
|
||||
// /**
|
||||
// * 接口状态描述
|
||||
// */
|
||||
// @JsonProperty("StatusDesc")
|
||||
// public String statusDesc;
|
||||
//
|
||||
// /**
|
||||
// * 车位状态
|
||||
// */
|
||||
// @JsonProperty("ParkStatus")
|
||||
// public Integer parkStatus;
|
||||
//
|
||||
// /**
|
||||
// * 地锁状态
|
||||
// */
|
||||
// @JsonProperty("LockStatus")
|
||||
// public Integer lockStatus;
|
||||
}
|
||||
|
||||
@ -6,6 +6,7 @@ import com.xhpc.evcs.dto.EquipmentInfo;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Transient;
|
||||
import java.util.List;
|
||||
|
||||
@ -103,6 +104,7 @@ public class CDEquipmentInfo {
|
||||
* 额定功率
|
||||
*/
|
||||
@JsonProperty("EquipmentPower")
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
public Double equipmentPower;
|
||||
/**
|
||||
* 新国标
|
||||
@ -134,4 +136,10 @@ public class CDEquipmentInfo {
|
||||
*/
|
||||
@JsonProperty("EquipmentClassificatlon")
|
||||
public Integer equipmentClassificatlon;
|
||||
// /**
|
||||
// * 是否支持 V2G
|
||||
// */
|
||||
// @JsonProperty("V2GSupport")
|
||||
// public Integer v2GSupport;
|
||||
|
||||
}
|
||||
|
||||
@ -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 lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
/**
|
||||
* V2G 实时负荷(1min 时点负荷值)
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"StationID",
|
||||
"OperatorID",
|
||||
"EquipmentOwnerID",
|
||||
"EquipmentID",
|
||||
"ChargeStatus",
|
||||
"TsMin",
|
||||
"TsHour",
|
||||
"TsDay",
|
||||
"TsMonth",
|
||||
"AnalysisReport"
|
||||
})
|
||||
@Data
|
||||
public class CDEquipmentV2GPowerInfo {
|
||||
/**
|
||||
* 充电桩ID
|
||||
*/
|
||||
@JsonProperty("StationID")
|
||||
public String stationID;
|
||||
/**
|
||||
* 运营平台 ID
|
||||
*/
|
||||
@JsonProperty("OperatorID")
|
||||
public String operatorID;
|
||||
/**
|
||||
* 产权所属单位 ID
|
||||
*/
|
||||
@JsonProperty("EquipmentOwnerID")
|
||||
public String equipmentOwnerID;
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
@JsonProperty("EquipmentID")
|
||||
public String equipmentID;
|
||||
/**
|
||||
* 充放电状态(1.充电 2放电)
|
||||
*/
|
||||
@JsonProperty("ChargeStatus")
|
||||
public Integer chargeStatus;
|
||||
/**
|
||||
* 设备实时负荷值
|
||||
*/
|
||||
@JsonProperty("Power")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double power;
|
||||
/**
|
||||
* 时间点 1 分钟一个刻度 yyyymmddhhmm
|
||||
*/
|
||||
@JsonProperty("TsMin")
|
||||
public String tsMin;
|
||||
/**
|
||||
* 时 yyyymmddhh
|
||||
*/
|
||||
@JsonProperty("TsHour")
|
||||
public String tsHour;
|
||||
/**
|
||||
* 日 yyyymmdd
|
||||
*/
|
||||
@JsonProperty("TsDay")
|
||||
public String tsDay;
|
||||
/**
|
||||
* 月 yyyymm
|
||||
*/
|
||||
@JsonProperty("TsMonth")
|
||||
public String tsMonth;
|
||||
/**
|
||||
* 年 yyyy
|
||||
*/
|
||||
@JsonProperty("TsYear")
|
||||
public String tsYear;
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -121,6 +121,35 @@ public class CDOrderInfo {
|
||||
@JsonProperty("Elect")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double elect;
|
||||
|
||||
// /**
|
||||
// * 尖阶段电量
|
||||
// */
|
||||
// @JsonProperty("CuspElect")
|
||||
// @Column(columnDefinition = "Decimal(10,4)")
|
||||
// public Double cuspElect;
|
||||
//
|
||||
// /**
|
||||
// * 峰阶段电量
|
||||
// */
|
||||
// @JsonProperty("PeakElect")
|
||||
// @Column(columnDefinition = "Decimal(10,4)")
|
||||
// public Double peakElect;
|
||||
//
|
||||
// /**
|
||||
// * 平阶段电量
|
||||
// */
|
||||
// @JsonProperty("FlatElect")
|
||||
// @Column(columnDefinition = "Decimal(10,4)")
|
||||
// public Double flatElect;
|
||||
//
|
||||
// /**
|
||||
// * 谷阶段电量
|
||||
// */
|
||||
// @JsonProperty("ValleyElect")
|
||||
// @Column(columnDefinition = "Decimal(10,4)")
|
||||
// public Double valleyElect;
|
||||
|
||||
/**
|
||||
* 本次充电开始时间
|
||||
*/
|
||||
|
||||
@ -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.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调控需求(RequirementInfo)
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"Name",
|
||||
"Area",
|
||||
"Code",
|
||||
"list",
|
||||
"requireDate",
|
||||
"releaseTime",
|
||||
"releaseTime"
|
||||
})
|
||||
@Data
|
||||
public class CDRequirementInfo {
|
||||
/**
|
||||
* 需求名称
|
||||
*/
|
||||
@JsonProperty("Name")
|
||||
public String name;
|
||||
/**
|
||||
* 需求地区
|
||||
*/
|
||||
@JsonProperty("Area")
|
||||
public String area;
|
||||
/**
|
||||
* 需求编号
|
||||
*/
|
||||
@JsonProperty("Code")
|
||||
public String code;
|
||||
/**
|
||||
* 时段责任量 List
|
||||
*/
|
||||
@JsonProperty("list")
|
||||
public List<CDRequirementInfoList> list;
|
||||
/**
|
||||
* 需求日期
|
||||
*/
|
||||
@JsonProperty("RequireDate")
|
||||
public String requireDate;
|
||||
/**
|
||||
* 发布时间
|
||||
*/
|
||||
@JsonProperty("ReleaseTime")
|
||||
public String releaseTime;
|
||||
/**
|
||||
* 下发时间
|
||||
*/
|
||||
@JsonProperty("DeliveryTime")
|
||||
public String deliveryTime;
|
||||
|
||||
}
|
||||
@ -0,0 +1,33 @@
|
||||
package com.xhpc.evcs.cdjgpc.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 调控需求
|
||||
* @author yuyang
|
||||
* @Date 2024-08-20 10:14
|
||||
*/
|
||||
@Data
|
||||
public class CDRequirementInfoList {
|
||||
|
||||
/**
|
||||
* 开始时段
|
||||
*/
|
||||
@JsonProperty("StartTime")
|
||||
public String startTime;
|
||||
|
||||
/**
|
||||
* 结束时段
|
||||
*/
|
||||
@JsonProperty("EndTime")
|
||||
public String endTime;
|
||||
|
||||
/**
|
||||
* 需求时段响
|
||||
* 应量
|
||||
*/
|
||||
@JsonProperty("Res")
|
||||
public String res;
|
||||
|
||||
}
|
||||
@ -405,4 +405,56 @@ public class CDStationInfo extends CommonStationInfo {
|
||||
@Transient
|
||||
@JsonProperty("SwapEquipmentlnfos")
|
||||
public List<CDSwapEquipmentlnfos> swapEquipmentlnfos = null;
|
||||
|
||||
// /**
|
||||
// * 是否支持远程调控
|
||||
// */
|
||||
// @Transient
|
||||
// @JsonProperty("SupportOrder2")
|
||||
// public Integer supportOrder2;
|
||||
//
|
||||
// /**
|
||||
// * 变压器装机容量
|
||||
// */
|
||||
// @Transient
|
||||
// @JsonProperty("InstalledCapacity")
|
||||
// @Column(columnDefinition = "Decimal(10,1)")
|
||||
// public Double installedCapacity;
|
||||
//
|
||||
// /**
|
||||
// * 备用容量
|
||||
// */
|
||||
// @Transient
|
||||
// @JsonProperty("ReserveCapacity")
|
||||
// @Column(columnDefinition = "Decimal(10,1)")
|
||||
// public Double reserveCapacity;
|
||||
//
|
||||
// /**
|
||||
// * 可响应时段
|
||||
// */
|
||||
// @Transient
|
||||
// @JsonProperty("ResponsablePeriod")
|
||||
// public String responsablePeriod;
|
||||
//
|
||||
// /**
|
||||
// * 响应速率(min)
|
||||
// */
|
||||
// @Transient
|
||||
// @JsonProperty("ResponseRate")
|
||||
// public String responseRate;
|
||||
//
|
||||
// /**
|
||||
// * 当年最大可调能力
|
||||
// */
|
||||
// @Transient
|
||||
// @Column(columnDefinition = "Decimal(10,1)")
|
||||
// public String maxAdjustableCapacity;
|
||||
//
|
||||
// /**
|
||||
// * 可调节时长
|
||||
// */
|
||||
// @Transient
|
||||
// @JsonProperty("AdjustTime")
|
||||
// public Integer adjustTime;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,85 @@
|
||||
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;
|
||||
|
||||
/**
|
||||
* 充电站实时负荷(1min 时点负荷值)
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"StationID",
|
||||
"OperatorID",
|
||||
"EquipmentOwnerID",
|
||||
"EleNo",
|
||||
"Power",
|
||||
"TsMin",
|
||||
"TsHour",
|
||||
"TsDay",
|
||||
"TsMonth",
|
||||
"AnalysisReport"
|
||||
})
|
||||
@Data
|
||||
public class CDStationPowerlnfo {
|
||||
|
||||
/**
|
||||
* 充电桩ID
|
||||
*/
|
||||
@JsonProperty("StationID")
|
||||
public String stationID;
|
||||
/**
|
||||
* 运营平台 ID
|
||||
*/
|
||||
@JsonProperty("OperatorID")
|
||||
public String operatorID;
|
||||
/**
|
||||
* 产权所属单位 ID
|
||||
*/
|
||||
@JsonProperty("EquipmentOwnerID")
|
||||
public String equipmentOwnerID;
|
||||
/**
|
||||
* 户号编号
|
||||
*/
|
||||
@JsonProperty("EleNo")
|
||||
//@Column(columnDefinition = "Decimal(10,2)")
|
||||
public String eleNo;
|
||||
/**
|
||||
* 站点实时负荷值
|
||||
*/
|
||||
@JsonProperty("Power")
|
||||
@Column(columnDefinition = "Decimal(10,2)")
|
||||
public Double power;
|
||||
/**
|
||||
* 时间点 1 分钟一个刻度 yyyymmddhhmm
|
||||
*/
|
||||
@JsonProperty("TsMin")
|
||||
public String tsMin;
|
||||
/**
|
||||
* 时 yyyymmddhh
|
||||
*/
|
||||
@JsonProperty("TsHour")
|
||||
public String tsHour;
|
||||
/**
|
||||
* 日 yyyymmdd
|
||||
*/
|
||||
@JsonProperty("TsDay")
|
||||
public String tsDay;
|
||||
/**
|
||||
* 月 yyyymm
|
||||
*/
|
||||
@JsonProperty("TsMonth")
|
||||
public String tsMonth;
|
||||
/**
|
||||
* 年 yyyy
|
||||
*/
|
||||
@JsonProperty("TsYear")
|
||||
public String tsYear;
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
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.cdjgpc.dto.CDRequirementInfoList;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调控任务
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2024-08-16 10:59
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"TaskName",
|
||||
"TaskCode",
|
||||
"DemandDate",
|
||||
"StationID",
|
||||
"OperatorID",
|
||||
"EquipmentOwnerID",
|
||||
"EleNo",
|
||||
"List",
|
||||
"DeliveryTime"
|
||||
})
|
||||
@Data
|
||||
public class CDTaskInfo {
|
||||
/**
|
||||
* 任务名称
|
||||
*/
|
||||
@JsonProperty("TaskName")
|
||||
public String taskName;
|
||||
/**
|
||||
* 任务编码
|
||||
*/
|
||||
@JsonProperty("TaskCode")
|
||||
public String taskCode;
|
||||
/**
|
||||
* 响应日期 yyyy-MM-dd
|
||||
*/
|
||||
@JsonProperty("DemandDate")
|
||||
public String demandDate;
|
||||
|
||||
/**
|
||||
* 充电桩ID
|
||||
*/
|
||||
@JsonProperty("StationID")
|
||||
public String stationID;
|
||||
/**
|
||||
* 运营平台 ID
|
||||
*/
|
||||
@JsonProperty("OperatorID")
|
||||
public String operatorID;
|
||||
/**
|
||||
* 产权所属单位 ID
|
||||
*/
|
||||
@JsonProperty("EquipmentOwnerID")
|
||||
public String equipmentOwnerID;
|
||||
/**
|
||||
* 所属户号
|
||||
*/
|
||||
@JsonProperty("EleNo")
|
||||
public String eleNo;
|
||||
/**
|
||||
* 时段责任量 List
|
||||
*/
|
||||
@JsonProperty("List")
|
||||
public List<CDRequirementInfoList> list;
|
||||
/**
|
||||
* 下发时间
|
||||
*/
|
||||
@JsonProperty("DeliveryTime")
|
||||
public String deliveryTime;
|
||||
|
||||
}
|
||||
@ -43,6 +43,8 @@ public class AuthSecretToken {
|
||||
|
||||
private Long lastPushOrder;
|
||||
|
||||
private Integer status;
|
||||
|
||||
public AuthSecretToken() {
|
||||
|
||||
}
|
||||
@ -63,6 +65,14 @@ public class AuthSecretToken {
|
||||
this.lastPushOrder = lastPushOrder;
|
||||
}
|
||||
|
||||
public Integer getStatus() {
|
||||
return status;
|
||||
}
|
||||
|
||||
public void setStatus(Integer status) {
|
||||
this.status = status;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "AuthSecretToken{" +
|
||||
@ -79,6 +89,7 @@ public class AuthSecretToken {
|
||||
", tokenExpiry=" + tokenExpiry +
|
||||
", encrypt=" + encrypt +
|
||||
", lastPushOrder=" + lastPushOrder +
|
||||
", status=" + status +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ public class QueryTokenController {
|
||||
if (xhpcInternetUser != null) {
|
||||
String operatorSecret = tokenRequest.getOperatorSecret();
|
||||
AuthSecretToken authSecretTokenIn =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(
|
||||
authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(1,
|
||||
operatorID, AuthSecretToken.SECRET_TOKEN_TYPE_IN, operatorSecret).orElse(null);
|
||||
if (authSecretTokenIn == null) {
|
||||
resp.setRet("4003");
|
||||
@ -139,7 +139,7 @@ public class QueryTokenController {
|
||||
if (xhpcInternetUser != null) {
|
||||
String operatorSecret = tokenRequest.getOperatorSecret();
|
||||
AuthSecretToken authSecretTokenIn =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(
|
||||
authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(2,
|
||||
operatorID, AuthSecretToken.SECRET_TOKEN_TYPE_IN, operatorSecret).orElse(null);
|
||||
if (authSecretTokenIn == null) {
|
||||
resp.setRet("4003");
|
||||
@ -195,7 +195,7 @@ public class QueryTokenController {
|
||||
if (xhpcInternetUser != null) {
|
||||
String operatorSecret = tokenRequest.getOperatorSecret();
|
||||
AuthSecretToken authSecretTokenIn =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(
|
||||
authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(3,
|
||||
operatorID, AuthSecretToken.SECRET_TOKEN_TYPE_IN, operatorSecret).orElse(null);
|
||||
if (authSecretTokenIn == null) {
|
||||
resp.setRet("4003");
|
||||
@ -227,4 +227,5 @@ public class QueryTokenController {
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -9,38 +9,31 @@ 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.cyc.dto.CYCNotificationStartChargeResultRequestData;
|
||||
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.Aes128Cbc;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.http.ForbiddenException;
|
||||
import com.xhpc.evcs.http.ServerInternalException;
|
||||
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.cdjgpc.dto.CDRequirementInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDTaskInfo;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import okhttp3.OkHttpClient;
|
||||
import okhttp3.Request;
|
||||
import okhttp3.Response;
|
||||
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.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
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;
|
||||
|
||||
@ -81,6 +74,48 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
||||
cdStationInfo.setEquipmentInfos(new ArrayList<>());
|
||||
//查询场站是桩是否对应上
|
||||
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+chargingStationId);
|
||||
|
||||
CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + stationDto.getRateModelId());
|
||||
|
||||
StringBuilder price = new StringBuilder();
|
||||
StringBuilder svcPrice = new StringBuilder();
|
||||
|
||||
Integer t1Price = cacheRateModel.getT1Price();
|
||||
Integer t1SvcPrice = cacheRateModel.getT1SvcPrice();
|
||||
Integer t2Price = cacheRateModel.getT2Price();
|
||||
Integer t2SvcPrice = cacheRateModel.getT2SvcPrice();
|
||||
Integer t3Price = cacheRateModel.getT3Price();
|
||||
Integer t3SvcPrice = cacheRateModel.getT3SvcPrice();
|
||||
Integer t4Price = cacheRateModel.getT4Price();
|
||||
Integer t4SvcPrice = cacheRateModel.getT4SvcPrice();
|
||||
|
||||
if(cacheRateModel.getTfPricesSeq() !=null && cacheRateModel.getTfPricesSeq().length>0){
|
||||
price.append("{");
|
||||
svcPrice.append("{");
|
||||
for (int i = 0; i < cacheRateModel.getTfPricesSeq().length; i++) {
|
||||
String time = getTime(i);
|
||||
String s = cacheRateModel.getTfPricesSeq()[i];
|
||||
|
||||
if("00".equals(s)){
|
||||
price.append(time).append(t1Price.toString()).append(",");
|
||||
svcPrice.append(time).append(t1SvcPrice.toString()).append(",");
|
||||
}else if("01".equals(s)){
|
||||
price.append(time).append(t2Price.toString()).append(",");
|
||||
svcPrice.append(time).append(t2SvcPrice.toString()).append(",");
|
||||
}else if("02".equals(s)){
|
||||
price.append(time).append(t3Price.toString()).append(",");
|
||||
svcPrice.append(time).append(t3SvcPrice.toString()).append(",");
|
||||
}else{
|
||||
price.append(time).append(t4Price.toString()).append(",");
|
||||
svcPrice.append(time).append(t4SvcPrice.toString()).append(",");
|
||||
}
|
||||
}
|
||||
price.deleteCharAt(price.length()-1).append("}");
|
||||
svcPrice.deleteCharAt(price.length()-1).append("}");
|
||||
}
|
||||
cdStationInfo.setElectricityFee(price.toString());
|
||||
cdStationInfo.setServiceFee(svcPrice.toString());
|
||||
|
||||
Set<String> pks = stationDto.getPiles();
|
||||
if (pks != null) {
|
||||
List<CDEquipmentInfo> cdEquipmentInfos = new ArrayList<>();
|
||||
@ -730,6 +765,64 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 需求通知推送
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v30/notification_requirement")
|
||||
public CommonResponse notificationRequirement(@RequestBody(required = false) CommonRequest<PageRequest> commonRequest)throws Exception {
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
CDRequirementInfo cdRequirementInfo = JSONUtil.readParams(commonRequest.getData(), CDRequirementInfo.class);
|
||||
if (cdRequirementInfo == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
resp.setRet("4002");
|
||||
} else {
|
||||
R r = powerPileService.addRequirementInfo(cdRequirementInfo.getName(), cdRequirementInfo.getArea(), cdRequirementInfo.getCode(), cdRequirementInfo.getList().toString(), cdRequirementInfo.getRequireDate(), cdRequirementInfo.getReleaseTime(), cdRequirementInfo.getDeliveryTime());
|
||||
if(r.getCode()==200){
|
||||
resp.setMsg("已接收数据");
|
||||
resp.setRet("0");
|
||||
}else{
|
||||
resp.setRet("-1");
|
||||
resp.setMsg("系统繁忙,此时请求方稍后重试");
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 需求通知推送
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v30/notification_task")
|
||||
public CommonResponse notificationTask(@RequestBody(required = false) CommonRequest<PageRequest> commonRequest)throws Exception {
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
CDTaskInfo cdTaskInfo = JSONUtil.readParams(commonRequest.getData(), CDTaskInfo.class);
|
||||
if (cdTaskInfo == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
resp.setRet("4002");
|
||||
} else {
|
||||
R r = powerPileService.addNotificationTask(cdTaskInfo.getTaskName(), cdTaskInfo.getTaskCode(), cdTaskInfo.getDemandDate(), cdTaskInfo.getStationID(), cdTaskInfo.getOperatorID(), cdTaskInfo.getEquipmentOwnerID(), cdTaskInfo.getEleNo(),cdTaskInfo.getList().toString(),cdTaskInfo.getDeliveryTime());
|
||||
if(r.getCode()==200){
|
||||
resp.setMsg("已接收数据");
|
||||
resp.setRet("0");
|
||||
}else{
|
||||
resp.setRet("-1");
|
||||
resp.setMsg("系统繁忙,此时请求方稍后重试");
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//数据加密处理
|
||||
@PostMapping("/v10/getEncrytReqout")
|
||||
public R getEncrytReqout(){
|
||||
@ -802,5 +895,105 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
||||
return R.fail();
|
||||
}
|
||||
|
||||
|
||||
private String getTime(Integer number){
|
||||
String time ="";
|
||||
if(number ==0){
|
||||
time ="00:00:00-00:30:00:";
|
||||
}else if(number ==1) {
|
||||
time = "00:30:00-01:00:00:";
|
||||
}else if(number ==2) {
|
||||
time = "01:00:00-01:30:00:";
|
||||
}else if(number ==3) {
|
||||
time = "01:30:00-02:00:00:";
|
||||
}else if(number ==4) {
|
||||
time = "02:00:00-02:30:00:";
|
||||
}else if(number ==5) {
|
||||
time = "02:30:00-03:00:00:";
|
||||
}else if(number ==6) {
|
||||
time = "03:00:00-03:30:00:";
|
||||
}else if(number ==7) {
|
||||
time = "03:30:00-04:00:00:";
|
||||
}else if(number ==8) {
|
||||
time = "04:00:00-04:30:00:";
|
||||
}else if(number ==9) {
|
||||
time = "04:30:00-05:00:00:";
|
||||
}else if(number ==10) {
|
||||
time = "05:00:00-05:30:00:";
|
||||
}else if(number ==11) {
|
||||
time = "05:30:00-06:00:00:";
|
||||
}else if(number ==12) {
|
||||
time = "06:00:00-06:30:00:";
|
||||
}else if(number ==13) {
|
||||
time = "06:30:00-07:00:00:";
|
||||
}else if(number ==14) {
|
||||
time = "07:00:00-07:30:00:";
|
||||
}else if(number ==15) {
|
||||
time = "07:30:00-08:00:00:";
|
||||
}else if(number ==16) {
|
||||
time = "08:00:00-08:30:00:";
|
||||
}else if(number ==17) {
|
||||
time = "08:30:00-09:00:00:";
|
||||
}else if(number ==18) {
|
||||
time = "09:00:00-09:30:00:";
|
||||
}else if(number ==19) {
|
||||
time = "09:30:00-10:00:00:";
|
||||
}else if(number ==20) {
|
||||
time = "10:00:00-10:30:00:";
|
||||
}else if(number ==21) {
|
||||
time = "10:30:00-11:00:00:";
|
||||
}else if(number ==22) {
|
||||
time = "11:00:00-11:30:00:";
|
||||
}else if(number ==23) {
|
||||
time = "11:30:00-12:00:00:";
|
||||
}else if(number ==24) {
|
||||
time = "12:00:00-12:30:00:";
|
||||
}else if(number ==25) {
|
||||
time = "12:30:00-13:00:00:";
|
||||
}else if(number ==26) {
|
||||
time = "13:00:00-13:30:00:";
|
||||
}else if(number ==27) {
|
||||
time = "13:30:00-14:00:00:";
|
||||
}else if(number ==28) {
|
||||
time = "14:00:00-14:30:00:";
|
||||
}else if(number ==29) {
|
||||
time = "14:30:00-15:00:00:";
|
||||
}else if(number ==30){
|
||||
time ="15:00:00-15:30:00:";
|
||||
}else if(number ==31) {
|
||||
time = "15:30:00-16:00:00:";
|
||||
}else if(number ==32) {
|
||||
time = "16:00:00-16:30:00:";
|
||||
}else if(number ==33) {
|
||||
time = "16:30:00-17:00:00:";
|
||||
}else if(number ==34) {
|
||||
time = "17:00:00-17:30:00:";
|
||||
}else if(number ==35) {
|
||||
time = "17:30:00-18:00:00:";
|
||||
}else if(number ==36) {
|
||||
time = "18:00:00-18:30:00:";
|
||||
}else if(number ==37) {
|
||||
time = "18:30:00-19:00:00:";
|
||||
}else if(number ==38) {
|
||||
time = "19:00:00-19:30:00:";
|
||||
}else if(number ==39) {
|
||||
time = "19:30:00-20:00:00:";
|
||||
}else if(number ==40){
|
||||
time ="20:00:00-20:30:00:";
|
||||
}else if(number ==41) {
|
||||
time = "20:30:00-21:00:00:";
|
||||
}else if(number ==42) {
|
||||
time = "21:00:00-21:30:00:";
|
||||
}else if(number ==43) {
|
||||
time = "21:30:00-22:00:00";
|
||||
}else if(number ==44) {
|
||||
time = "22:00:00-22:30:00:";
|
||||
}else if(number ==45) {
|
||||
time = "22:30:00-23:00:00:";
|
||||
}else if(number ==46) {
|
||||
time = "23:00:00-23:30:00";
|
||||
}else if(number ==47) {
|
||||
time = "23:30:00-24:00:00:";
|
||||
}
|
||||
return time;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,25 @@
|
||||
package com.xhpc.evcs.cdjgpc.jpa;
|
||||
|
||||
import com.xhpc.evcs.cdjgpc.domain.XhpcChargeOrder;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.repository.query.QueryByExampleExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 充电站实时负荷
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2024-08-16 14:04
|
||||
*/
|
||||
@Repository
|
||||
public interface XhpcChargeOrderRepository extends JpaRepository<XhpcChargeOrder, String>,
|
||||
QueryByExampleExecutor<XhpcChargeOrder>, JpaSpecificationExecutor<XhpcChargeOrder> {
|
||||
|
||||
|
||||
//查询充电中的数据
|
||||
List<XhpcChargeOrder> findByStatusAndDelFlagAndChargingStationIdOrderByChargingStationId(Integer status,Integer delflag,Long chargingStationId);
|
||||
|
||||
}
|
||||
@ -0,0 +1,107 @@
|
||||
package com.xhpc.evcs.cdjgpc.notification;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.cdjgpc.domain.XhpcChargeOrder;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDEquipmentV2GPowerInfo;
|
||||
import com.xhpc.evcs.cdjgpc.jpa.XhpcChargeOrderRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* V2G 实时负荷信息推送
|
||||
* @author yuyang
|
||||
* @Date 2024-08-20 9:19
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CDNotificationEquipmentV2GPowerInfoTask extends CoreDispatcher {
|
||||
|
||||
@Resource
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Resource
|
||||
XhpcChargeOrderRepository xhpcChargeOrderRepository;
|
||||
@Resource
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(CDNotificationEquipmentV2GPowerInfoTask.class);
|
||||
|
||||
//测试环境放开定时任务
|
||||
//@Scheduled(cron = "0 0/1 * * * ? ")
|
||||
public void run() throws IOException {
|
||||
//不参与合作的电站
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist =xhpcStationInternetBlacklistRepo.findByInternetUserId(6L);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
|
||||
for (String stationKey : stationKeys) {
|
||||
//查询不合作的电桩
|
||||
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
|
||||
if (!stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
|
||||
// maybe对接第三方
|
||||
if (authSecretTokenOut != null) {
|
||||
String stationId = xhpcStationInternetBlack.getChargingStationId().toString();
|
||||
//获取所有该场站充电中订单
|
||||
List<XhpcChargeOrder> xhpcChargeOrderList = xhpcChargeOrderRepository.findByStatusAndDelFlagAndChargingStationIdOrderByChargingStationId(0, 0,xhpcStationInternetBlack.getChargingStationId());
|
||||
//获取订单bms数据
|
||||
for (int i = 0; i < xhpcChargeOrderList.size(); i++) {
|
||||
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderList.get(i);
|
||||
String key = "order:".concat(xhpcChargeOrder.getSerialNumber())+".bms";
|
||||
CacheBmsReqChargerOutputData bms = REDIS.getCacheObject(key);
|
||||
BigDecimal bigDecimal = new BigDecimal(bms.getPileVoltageOutput()).multiply(new BigDecimal(bms.getPileCurrentOutput())).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_CEILING);
|
||||
//获取场站信息
|
||||
String keys = "cdjgpc:station:".concat(stationId)+".notification";
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(keys);
|
||||
|
||||
CDEquipmentV2GPowerInfo cdEquipmentV2GPowerInfo = new CDEquipmentV2GPowerInfo();
|
||||
cdEquipmentV2GPowerInfo.setStationID(stationId);
|
||||
cdEquipmentV2GPowerInfo.setOperatorID(cdStationInfo.getOperatorId());
|
||||
cdEquipmentV2GPowerInfo.setEquipmentOwnerID(cdStationInfo.getEquipmentOwnerId());
|
||||
cdEquipmentV2GPowerInfo.setEquipmentID(xhpcChargeOrder.getSerialNumber().substring(0,14));
|
||||
cdEquipmentV2GPowerInfo.setChargeStatus(1);
|
||||
cdEquipmentV2GPowerInfo.setPower(bigDecimal.doubleValue());
|
||||
|
||||
String format = DateUtil.format(new Date(), "yyyymmddhhmm");
|
||||
cdEquipmentV2GPowerInfo.setTsMin(format);
|
||||
cdEquipmentV2GPowerInfo.setTsHour(format.substring(0,10));
|
||||
cdEquipmentV2GPowerInfo.setTsDay(format.substring(0,8));
|
||||
cdEquipmentV2GPowerInfo.setTsMonth(format.substring(0,6));
|
||||
cdEquipmentV2GPowerInfo.setTsYear(format.substring(0,4));
|
||||
|
||||
CommonRequest<CDEquipmentV2GPowerInfo> commonRequest = new CommonRequest<>();
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("EquipmentV2GPowerInfo",cdEquipmentV2GPowerInfo);
|
||||
String data = JSONUtil.toJSONString(mapStationInfo);
|
||||
System.out.println("=======data========"+data);
|
||||
commonRequest.setData(data);
|
||||
String result =ok(commonRequest,"/notification_equipmentV2GPowerInfo",authSecretTokenOut);
|
||||
System.out.println("=====V2G 实时负荷信息推送==result========"+result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xhpc.evcs.cdjgpc.notification;
|
||||
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
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.domain.AuthSecretToken;
|
||||
@ -53,6 +54,46 @@ public class CDNotificationStationInfoTask extends CoreDispatcher {
|
||||
cdStationInfo.setEquipmentInfos(new ArrayList<>());
|
||||
//查询场站是桩是否对应上
|
||||
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+chargingStationId);
|
||||
CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + stationDto.getRateModelId());
|
||||
|
||||
StringBuilder price = new StringBuilder();
|
||||
StringBuilder svcPrice = new StringBuilder();
|
||||
|
||||
Integer t1Price = cacheRateModel.getT1Price();
|
||||
Integer t1SvcPrice = cacheRateModel.getT1SvcPrice();
|
||||
Integer t2Price = cacheRateModel.getT2Price();
|
||||
Integer t2SvcPrice = cacheRateModel.getT2SvcPrice();
|
||||
Integer t3Price = cacheRateModel.getT3Price();
|
||||
Integer t3SvcPrice = cacheRateModel.getT3SvcPrice();
|
||||
Integer t4Price = cacheRateModel.getT4Price();
|
||||
Integer t4SvcPrice = cacheRateModel.getT4SvcPrice();
|
||||
|
||||
if(cacheRateModel.getTfPricesSeq() !=null && cacheRateModel.getTfPricesSeq().length>0){
|
||||
price.append("{");
|
||||
svcPrice.append("{");
|
||||
for (int i = 0; i < cacheRateModel.getTfPricesSeq().length; i++) {
|
||||
String time = getTime(i);
|
||||
String s = cacheRateModel.getTfPricesSeq()[i];
|
||||
|
||||
if("00".equals(s)){
|
||||
price.append(time).append(t1Price.toString()).append(",");
|
||||
svcPrice.append(time).append(t1SvcPrice.toString()).append(",");
|
||||
}else if("01".equals(s)){
|
||||
price.append(time).append(t2Price.toString()).append(",");
|
||||
svcPrice.append(time).append(t2SvcPrice.toString()).append(",");
|
||||
}else if("02".equals(s)){
|
||||
price.append(time).append(t3Price.toString()).append(",");
|
||||
svcPrice.append(time).append(t3SvcPrice.toString()).append(",");
|
||||
}else{
|
||||
price.append(time).append(t4Price.toString()).append(",");
|
||||
svcPrice.append(time).append(t4SvcPrice.toString()).append(",");
|
||||
}
|
||||
}
|
||||
price.deleteCharAt(price.length()-1).append("}");
|
||||
svcPrice.deleteCharAt(price.length()-1).append("}");
|
||||
}
|
||||
cdStationInfo.setElectricityFee(price.toString());
|
||||
cdStationInfo.setServiceFee(svcPrice.toString());
|
||||
Set<String> pks = stationDto.getPiles();
|
||||
if (pks != null) {
|
||||
List<CDEquipmentInfo> cdEquipmentInfos = new ArrayList<>();
|
||||
@ -86,4 +127,106 @@ public class CDNotificationStationInfoTask extends CoreDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
private String getTime(Integer number){
|
||||
String time ="";
|
||||
if(number ==0){
|
||||
time ="00:00:00-00:30:00:";
|
||||
}else if(number ==1) {
|
||||
time = "00:30:00-01:00:00:";
|
||||
}else if(number ==2) {
|
||||
time = "01:00:00-01:30:00:";
|
||||
}else if(number ==3) {
|
||||
time = "01:30:00-02:00:00:";
|
||||
}else if(number ==4) {
|
||||
time = "02:00:00-02:30:00:";
|
||||
}else if(number ==5) {
|
||||
time = "02:30:00-03:00:00:";
|
||||
}else if(number ==6) {
|
||||
time = "03:00:00-03:30:00:";
|
||||
}else if(number ==7) {
|
||||
time = "03:30:00-04:00:00:";
|
||||
}else if(number ==8) {
|
||||
time = "04:00:00-04:30:00:";
|
||||
}else if(number ==9) {
|
||||
time = "04:30:00-05:00:00:";
|
||||
}else if(number ==10) {
|
||||
time = "05:00:00-05:30:00:";
|
||||
}else if(number ==11) {
|
||||
time = "05:30:00-06:00:00:";
|
||||
}else if(number ==12) {
|
||||
time = "06:00:00-06:30:00:";
|
||||
}else if(number ==13) {
|
||||
time = "06:30:00-07:00:00:";
|
||||
}else if(number ==14) {
|
||||
time = "07:00:00-07:30:00:";
|
||||
}else if(number ==15) {
|
||||
time = "07:30:00-08:00:00:";
|
||||
}else if(number ==16) {
|
||||
time = "08:00:00-08:30:00:";
|
||||
}else if(number ==17) {
|
||||
time = "08:30:00-09:00:00:";
|
||||
}else if(number ==18) {
|
||||
time = "09:00:00-09:30:00:";
|
||||
}else if(number ==19) {
|
||||
time = "09:30:00-10:00:00:";
|
||||
}else if(number ==20) {
|
||||
time = "10:00:00-10:30:00:";
|
||||
}else if(number ==21) {
|
||||
time = "10:30:00-11:00:00:";
|
||||
}else if(number ==22) {
|
||||
time = "11:00:00-11:30:00:";
|
||||
}else if(number ==23) {
|
||||
time = "11:30:00-12:00:00:";
|
||||
}else if(number ==24) {
|
||||
time = "12:00:00-12:30:00:";
|
||||
}else if(number ==25) {
|
||||
time = "12:30:00-13:00:00:";
|
||||
}else if(number ==26) {
|
||||
time = "13:00:00-13:30:00:";
|
||||
}else if(number ==27) {
|
||||
time = "13:30:00-14:00:00:";
|
||||
}else if(number ==28) {
|
||||
time = "14:00:00-14:30:00:";
|
||||
}else if(number ==29) {
|
||||
time = "14:30:00-15:00:00:";
|
||||
}else if(number ==30){
|
||||
time ="15:00:00-15:30:00:";
|
||||
}else if(number ==31) {
|
||||
time = "15:30:00-16:00:00:";
|
||||
}else if(number ==32) {
|
||||
time = "16:00:00-16:30:00:";
|
||||
}else if(number ==33) {
|
||||
time = "16:30:00-17:00:00:";
|
||||
}else if(number ==34) {
|
||||
time = "17:00:00-17:30:00:";
|
||||
}else if(number ==35) {
|
||||
time = "17:30:00-18:00:00:";
|
||||
}else if(number ==36) {
|
||||
time = "18:00:00-18:30:00:";
|
||||
}else if(number ==37) {
|
||||
time = "18:30:00-19:00:00:";
|
||||
}else if(number ==38) {
|
||||
time = "19:00:00-19:30:00:";
|
||||
}else if(number ==39) {
|
||||
time = "19:30:00-20:00:00:";
|
||||
}else if(number ==40){
|
||||
time ="20:00:00-20:30:00:";
|
||||
}else if(number ==41) {
|
||||
time = "20:30:00-21:00:00:";
|
||||
}else if(number ==42) {
|
||||
time = "21:00:00-21:30:00:";
|
||||
}else if(number ==43) {
|
||||
time = "21:30:00-22:00:00";
|
||||
}else if(number ==44) {
|
||||
time = "22:00:00-22:30:00:";
|
||||
}else if(number ==45) {
|
||||
time = "22:30:00-23:00:00:";
|
||||
}else if(number ==46) {
|
||||
time = "23:00:00-23:30:00";
|
||||
}else if(number ==47) {
|
||||
time = "23:30:00-24:00:00:";
|
||||
}
|
||||
return time;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,109 @@
|
||||
package com.xhpc.evcs.cdjgpc.notification;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.cdjgpc.domain.XhpcChargeOrder;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationPowerlnfo;
|
||||
import com.xhpc.evcs.cdjgpc.jpa.XhpcChargeOrderRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.*;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 充电站实时负荷信息推送
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2024-08-16 13:57
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CDNotificationStationPowerInfoTask extends CoreDispatcher {
|
||||
@Resource
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Resource
|
||||
XhpcChargeOrderRepository xhpcChargeOrderRepository;
|
||||
@Resource
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(CDNotificationStationPowerInfoTask.class);
|
||||
|
||||
//测试环境放开定时任务
|
||||
//@Scheduled(cron = "0 0/1 * * * ? ")
|
||||
public void run() throws IOException {
|
||||
//不参与合作的电站
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist =xhpcStationInternetBlacklistRepo.findByInternetUserId(6L);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
|
||||
for (String stationKey : stationKeys) {
|
||||
//查询不合作的电桩
|
||||
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
|
||||
if (!stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
|
||||
// maybe对接第三方
|
||||
if (authSecretTokenOut != null) {
|
||||
String stationId = xhpcStationInternetBlack.getChargingStationId().toString();
|
||||
//获取所有该场站充电中订单
|
||||
List<XhpcChargeOrder> xhpcChargeOrderList = xhpcChargeOrderRepository.findByStatusAndDelFlagAndChargingStationIdOrderByChargingStationId(0, 0,xhpcStationInternetBlack.getChargingStationId());
|
||||
//获取订单bms数据
|
||||
BigDecimal bigDecimal1 = new BigDecimal(0);
|
||||
for (int i = 0; i < xhpcChargeOrderList.size(); i++) {
|
||||
XhpcChargeOrder xhpcChargeOrder = xhpcChargeOrderList.get(i);
|
||||
String key = "order:".concat(xhpcChargeOrder.getSerialNumber())+".bms";
|
||||
CacheBmsReqChargerOutputData bms = REDIS.getCacheObject(key);
|
||||
BigDecimal bigDecimal = new BigDecimal(bms.getPileVoltageOutput()).multiply(new BigDecimal(bms.getPileCurrentOutput())).divide(new BigDecimal(1000)).setScale(2, BigDecimal.ROUND_CEILING);
|
||||
bigDecimal1 = bigDecimal1.add(bigDecimal);
|
||||
}
|
||||
|
||||
//获取场站信息
|
||||
String key = "cdjgpc:station:".concat(stationId)+".notification";
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
|
||||
|
||||
CDStationPowerlnfo cdStationPowerlnfo = new CDStationPowerlnfo();
|
||||
cdStationPowerlnfo.setStationID(stationId);
|
||||
cdStationPowerlnfo.setOperatorID(cdStationInfo.getOperatorId());
|
||||
cdStationPowerlnfo.setEquipmentOwnerID(cdStationInfo.getEquipmentOwnerId());
|
||||
cdStationPowerlnfo.setEleNo(cdStationInfo.getAccountNumber());
|
||||
cdStationPowerlnfo.setPower(bigDecimal1.doubleValue());
|
||||
|
||||
String format = DateUtil.format(new Date(), "yyyymmddhhmm");
|
||||
cdStationPowerlnfo.setTsMin(format);
|
||||
cdStationPowerlnfo.setTsHour(format.substring(0,10));
|
||||
cdStationPowerlnfo.setTsDay(format.substring(0,8));
|
||||
cdStationPowerlnfo.setTsMonth(format.substring(0,6));
|
||||
cdStationPowerlnfo.setTsYear(format.substring(0,4));
|
||||
|
||||
|
||||
CommonRequest<CDStationPowerlnfo> commonRequest = new CommonRequest<>();
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("StationPowerInfo",cdStationPowerlnfo);
|
||||
String data = JSONUtil.toJSONString(mapStationInfo);
|
||||
System.out.println("=======data========"+data);
|
||||
commonRequest.setData(data);
|
||||
String result =ok(commonRequest,"/notification_stationPowerInfo",authSecretTokenOut);
|
||||
System.out.println("=====充电站实时负荷信息推送==result========"+result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -47,8 +47,8 @@ import java.util.Scanner;
|
||||
@Slf4j
|
||||
//@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/*", "/v20/*"}, filterName = "v1n10filter") //multiple filters execute by filterName order
|
||||
//成都市监管平台(蓉成充)v10 v20 川逸充 v30
|
||||
@WebFilter(urlPatterns = {"/v1/*", "/v2/*", "/v10/*", "/v20/*", "/v30/*"}, filterName = "v1n10filter") //multiple filters execute by filterName order
|
||||
public class EvcsFilter extends OncePerRequestFilter {
|
||||
|
||||
@Resource
|
||||
@ -99,28 +99,41 @@ public class EvcsFilter extends OncePerRequestFilter {
|
||||
|
||||
if (servletPath.endsWith("/v1/query_token")) {
|
||||
log.info("================老接口过滤 token========operatorId=========="+operatorId);
|
||||
authSecretTokenIn = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId,
|
||||
authSecretTokenIn = authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenType(1,operatorId,
|
||||
AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null);
|
||||
handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest,
|
||||
responseWrapper, authSecretTokenIn);
|
||||
}else if (servletPath.endsWith("/v10/query_token")) {
|
||||
log.info("================新接口过滤 token========operatorId=========="+operatorId);
|
||||
authSecretTokenIn = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId,
|
||||
log.info("================新监管平台(蓉城充) token========operatorId=========="+operatorId);
|
||||
authSecretTokenIn = authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenType(2,operatorId,
|
||||
AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null);
|
||||
handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest,
|
||||
responseWrapper, authSecretTokenIn);
|
||||
}else if (servletPath.endsWith("/v20/query_token")) {
|
||||
log.info("================新接口过滤 token========operatorId=========="+operatorId);
|
||||
authSecretTokenIn = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId,
|
||||
log.info("================川逸充 token========operatorId=========="+operatorId);
|
||||
authSecretTokenIn = authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenType(3,operatorId,
|
||||
AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null);
|
||||
handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest,
|
||||
responseWrapper, authSecretTokenIn);
|
||||
} else {
|
||||
if (authorization != null && authorization.startsWith("Bearer ")) {
|
||||
String token = authorization.replace("Bearer ", "");
|
||||
authSecretTokenIn =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(
|
||||
operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN, now).orElse(null);
|
||||
|
||||
if(servletPath.endsWith("/v1/")){
|
||||
authSecretTokenIn =
|
||||
authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(1,
|
||||
operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN, now).orElse(null);
|
||||
}else if(servletPath.endsWith("/v10/")){
|
||||
authSecretTokenIn =
|
||||
authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(2,
|
||||
operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN, now).orElse(null);
|
||||
}else if(servletPath.endsWith("/v20/")){
|
||||
authSecretTokenIn =
|
||||
authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(3,
|
||||
operatorId, AuthSecretToken.SECRET_TOKEN_TYPE_IN, now).orElse(null);
|
||||
}
|
||||
|
||||
|
||||
if (authSecretTokenIn == null) {
|
||||
resp.setRet("4002");
|
||||
resp.setMsg("Invalid token(db)");
|
||||
|
||||
@ -20,16 +20,37 @@ public interface AuthSecretTokenRepository extends JpaRepository<AuthSecretToken
|
||||
Optional<AuthSecretToken> findByOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(String operatorId,
|
||||
String secretTokenType,
|
||||
Date time);
|
||||
|
||||
Optional<AuthSecretToken> findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndTokenExpiryGreaterThan(Integer status,
|
||||
String operatorId,
|
||||
String secretTokenType,
|
||||
Date time);
|
||||
|
||||
|
||||
Optional<AuthSecretToken> findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(String operatorId3irdpty,
|
||||
String operatorID,
|
||||
String secretTokenTypeIn);
|
||||
|
||||
|
||||
Optional<AuthSecretToken> findByStatusAndOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
Integer status,
|
||||
String operatorId3irdpty,
|
||||
String operatorID,
|
||||
String secretTokenTypeIn);
|
||||
|
||||
Optional<AuthSecretToken> findByOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(String operatorID3irdpty,
|
||||
String secretTokenType,
|
||||
String operatorSecret);
|
||||
|
||||
Optional<AuthSecretToken> findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(
|
||||
Integer status,
|
||||
String operatorID3irdpty,
|
||||
String secretTokenType,
|
||||
String operatorSecret);
|
||||
|
||||
Optional<AuthSecretToken> findByOperatorId3irdptyAndSecretTokenType(String operatorId, String secretTokenType);
|
||||
|
||||
Optional<AuthSecretToken> findByStatusAndOperatorId3irdptyAndSecretTokenType(Integer status,String operatorId, String secretTokenType);
|
||||
List<AuthSecretToken> findBySecretTokenType(String secretTokenType);
|
||||
|
||||
|
||||
|
||||
@ -31,7 +31,7 @@ public class NotificationCancelOrderTask extends CoreDispatcher {
|
||||
//private Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
|
||||
//推送不开放(evcs 放开)
|
||||
@Scheduled(fixedRate = 1000 * 15)
|
||||
//@Scheduled(fixedRate = 1000 * 15)
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
//Getting the orders, which need to be notified.
|
||||
|
||||
@ -39,7 +39,7 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
//推送不开放(evcs 放开)
|
||||
@Scheduled(fixedRate = 1000 * 15)
|
||||
//@Scheduled(fixedRate = 1000 * 15)
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
Collection<String> orderKeys = REDIS.keys("order:*");
|
||||
|
||||
@ -49,7 +49,7 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
* @throws IOException
|
||||
*/
|
||||
//推送不开放
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
//@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws IOException {
|
||||
|
||||
List<AuthSecretToken> authSecretTokenOutList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT);
|
||||
|
||||
@ -34,7 +34,7 @@ public class NotificationStartChargeResultTask extends CoreDispatcher {
|
||||
* Judging the 3rd whether it has got the start charging task.
|
||||
*/
|
||||
//推送不开放(evcs 放开)
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
//@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws IOException {
|
||||
|
||||
//Getting the charge orders which from 3rd.
|
||||
|
||||
@ -50,7 +50,7 @@ public class NotificationStationStatusTask extends CoreDispatcher {
|
||||
private XhpcTerminalRepository terminalRepository;
|
||||
|
||||
//推送不开放(evcs 放开)
|
||||
@Scheduled(fixedRate = 1000 * 45)
|
||||
//@Scheduled(fixedRate = 1000 * 45)
|
||||
protected void run() throws IOException {
|
||||
|
||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||
|
||||
@ -27,7 +27,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
|
||||
//(evcs 放开)
|
||||
@Scheduled(fixedRate = 1000 * 3)
|
||||
//@Scheduled(fixedRate = 1000 * 3)
|
||||
public void run() throws Exception {
|
||||
|
||||
notifyService();
|
||||
|
||||
@ -10,7 +10,7 @@ import java.util.Map;
|
||||
@Mapper
|
||||
public interface XhpcDeviceMessageMapper {
|
||||
|
||||
List<Map<String, Object>> selectListByTypeAndSerialNumber(@Param("type") String type,
|
||||
List<Map<String, Object>> selectListByTypeAndSerialNumber(
|
||||
@Param("serialNumber")String serialNumber,
|
||||
@Param("startTime") String startTime,
|
||||
@Param("endTime") String endTime);
|
||||
|
||||
@ -74,7 +74,7 @@ public class PileLogServiceImpl extends BaseService implements PileLogService {
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getPileRunLogPage(String pileId, String startTime, String endTime){
|
||||
return deviceMessageMapper.selectListByTypeAndSerialNumber(StationDeviceEnum.PILE.getCode(), pileId, startTime, endTime);
|
||||
return deviceMessageMapper.selectListByTypeAndSerialNumber( pileId, startTime, endTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@ -76,7 +76,6 @@
|
||||
ifnull(ho.act_price, 0) as 'act_price',
|
||||
ifnull(ho.act_power_price, 0) as 'act_power_price',
|
||||
ifnull(ho.act_service_price, 0) as 'act_service_price',
|
||||
ifnull(ho.act_service_price+ho.act_power_price, 0) as 'actTotalPrice',
|
||||
ifnull(ho.internet_commission, 0) as 'internet_commission',
|
||||
ifnull( ho.internet_svc_commission, 0) as 'internet_svc_commission',
|
||||
ifnull(ho.platform_commission, 0) as 'platform_commission',
|
||||
@ -87,7 +86,7 @@
|
||||
ho.create_time, ho.create_by, ho.update_time, ho.update_by, ho.remark, ho.`state`, ho.vin_normal, ho.search_value,
|
||||
ho.operator_id_evcs, ho.charge_model_evcs, ho.connector_power_evcs, ho.meter_value_end_evcs,
|
||||
ho.meter_value_start_evcs, ho.operator_id3rdpty_evcs, ho.start_time, ho.end_time, ho.stop_reason_evcs,
|
||||
ho.total_power as totalPower, ho.user_name_evcs, ho.phone, ho.evcs_order_no, ho.confirm_Result, ho.rate_model_id,
|
||||
ho.total_power, ho.user_name_evcs, ho.phone, ho.evcs_order_no, ho.confirm_Result, ho.rate_model_id,
|
||||
ho.charging_mode,
|
||||
ifnull(ho.internet_degree_commission, 0) as 'internet_degree_commission',
|
||||
ho.`source`, ho.tenant_id, ho.operator_id, ho.operator_name,
|
||||
@ -162,9 +161,7 @@
|
||||
when ho.charging_mode="4" then '小桔'
|
||||
when ho.charging_mode="微信" then '微信'
|
||||
when ho.charging_mode="支付宝" then '支付宝'
|
||||
when ho.charging_mode="App" then 'App'
|
||||
when ho.charging_mode="刷卡" then '刷卡'
|
||||
else 'vin码'
|
||||
else '刷卡'
|
||||
end as 'chargingModeName'
|
||||
from xhpc_clearing_history_order ho
|
||||
left join xhpc_charging_station ct on ct.charging_station_id = ho.charging_station_id
|
||||
@ -250,8 +247,6 @@
|
||||
when ho.charging_mode="4" then "小桔"
|
||||
else "--"
|
||||
end as 'charging_mode_name'
|
||||
|
||||
|
||||
from xhpc_clearing_history_order as ho
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
|
||||
left join xhpc_operator as op on op.operator_id = ct.operator_id
|
||||
@ -590,9 +585,7 @@
|
||||
when ho.charging_mode="4" then "小桔"
|
||||
when ho.charging_mode="微信" then "微信"
|
||||
when ho.charging_mode="支付宝" then "支付宝"
|
||||
when ho.charging_mode="App" then "App"
|
||||
when ho.charging_mode="刷卡" then "刷卡"
|
||||
else "vin码"
|
||||
else "刷卡"
|
||||
end chargingModeName
|
||||
from xhpc_clearing_history_order as ho
|
||||
left join xhpc_charging_station as ct on ct.charging_station_id = ho.charging_station_id
|
||||
|
||||
@ -23,12 +23,12 @@
|
||||
update_time as 'updateTime',
|
||||
update_by as 'updateBy'
|
||||
from xhpc_device_message
|
||||
where type=#{type} and serial_number=#{serialNumber}
|
||||
where serial_number=#{serialNumber}
|
||||
<if test="startTime !=null and startTime!=''">
|
||||
and create_time <![CDATA[ >= ]]> #{startTime}
|
||||
and create_time >= #{startTime}
|
||||
</if>
|
||||
<if test="endTime !=null and endTime!=''">
|
||||
and create_time <![CDATA[ <= ]]> #{endTime}
|
||||
and create_time <= #{endTime}
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
@ -119,7 +119,28 @@ public class XhpcTerminalController extends BaseController {
|
||||
// }
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 停用
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "终端-停用", businessType = BusinessType.UPDATE)
|
||||
@PostMapping(value = "/updateStatusAll")
|
||||
public AjaxResult updateStatusAll(@RequestBody XhpcTerminal xhpcTerminal) {
|
||||
if(null==xhpcTerminal.getChargingStationId()){
|
||||
return AjaxResult.error("场站数据为空");
|
||||
}
|
||||
if(null==xhpcTerminal.getStatus()){
|
||||
return AjaxResult.error("桩数据状态为空");
|
||||
}
|
||||
if(xhpcTerminal.getStatus()==1){
|
||||
if(null==xhpcTerminal.getPrompt() || xhpcTerminal.getPrompt().length()>50){
|
||||
return AjaxResult.error("桩提示语为空且50字之内");
|
||||
}
|
||||
//停该场站所有桩
|
||||
}
|
||||
return xhpcTerminalService.updateStatusAll(xhpcTerminal.getChargingStationId(), xhpcTerminal.getStatus(),xhpcTerminal.getPrompt());
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -54,6 +54,8 @@ public interface XhpcTerminalMapper {
|
||||
*/
|
||||
int updateXhpcTerminal(@Param("name") String name,@Param("serialNumber") String serialNumber,@Param("connectorType") Integer connectorType,@Param("status") Integer status,@Param("terminalId") Long terminalId,@Param("prompt")String prompt);
|
||||
|
||||
int updateXhpcTerminalAll(@Param("name") String name,@Param("serialNumber") String serialNumber,@Param("connectorType") Integer connectorType,@Param("status") Integer status,@Param("chargingStationId") Long chargingStationId,@Param("prompt")String prompt);
|
||||
|
||||
/**
|
||||
* 添加终端
|
||||
*
|
||||
|
||||
@ -33,6 +33,7 @@ public interface IXhpcTerminalService {
|
||||
*/
|
||||
AjaxResult updateStatus(Long terminalId,Integer status,String prompt);
|
||||
|
||||
AjaxResult updateStatusAll(Long chargingStationId,Integer status,String prompt);
|
||||
/**
|
||||
* 查询
|
||||
*/
|
||||
|
||||
@ -74,6 +74,15 @@ public class XhpcTerminalServiceImpl extends BaseService implements IXhpcTermina
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult updateStatusAll(Long chargingStationId, Integer status,String prompt) {
|
||||
|
||||
System.out.println(">>>>>>>>>>chargingStationId>>>>>>>>>"+chargingStationId);
|
||||
System.out.println(">>>>>>>>>>status>>>>>>>>>"+status);
|
||||
xhpcTerminalMapper.updateXhpcTerminalAll(null,null,null,status,chargingStationId,prompt);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
|
||||
@Override
|
||||
public AjaxResult selectXhpcTerminalMessage(Long terminalId) {
|
||||
|
||||
|
||||
@ -140,6 +140,29 @@
|
||||
where terminal_id = #{terminalId}
|
||||
</update>
|
||||
|
||||
<update id="updateXhpcTerminalAll">
|
||||
update xhpc_terminal
|
||||
<set>
|
||||
<if test="name != null and name !=''">
|
||||
name = #{name},
|
||||
</if>
|
||||
<if test="serialNumber != null and serialNumber !=''">
|
||||
serial_number = #{serialNumber},
|
||||
</if>
|
||||
<if test="status != null">
|
||||
status = #{status},
|
||||
</if>
|
||||
<if test="connectorType != null">
|
||||
connector_type = #{connectorType},
|
||||
</if>
|
||||
<if test="prompt != null and prompt !=''">
|
||||
prompt = #{prompt},
|
||||
</if>
|
||||
</set>
|
||||
where charging_station_id = #{chargingStationId} and del_flag =0
|
||||
</update>
|
||||
|
||||
|
||||
<insert id="insertXhpcTerminal" parameterType="com.xhpc.common.domain.XhpcTerminal" useGeneratedKeys="true"
|
||||
keyProperty="terminalId">
|
||||
insert into xhpc_terminal
|
||||
|
||||
@ -104,4 +104,12 @@ public interface PowerPileService {
|
||||
//充电桩工作参数设置
|
||||
@PostMapping("/pile/{pileNo}/{powerNumber}/configSettings")
|
||||
R pileConfigSettings(@PathVariable("pileNo") @Param("pileNo")String pileNo,@PathVariable("powerNumber") @Param("powerNumber")String powerNumber);
|
||||
|
||||
|
||||
//需求通知推送(监管平台向我们发送消息)
|
||||
@PostMapping("/station/addRequirementInfo")
|
||||
R addRequirementInfo(@RequestParam("name") String name,@RequestParam("area") String area,@RequestParam("code") String code,@RequestParam("list") String list,@RequestParam("requireDate") String requireDate,@RequestParam("releaseTime") String releaseTime,@RequestParam("deliveryTime") String deliveryTime);
|
||||
|
||||
@PostMapping("/station/addNotificationTask")
|
||||
R addNotificationTask(@RequestParam("taskName") String taskName,@RequestParam("taskCode") String taskCode,@RequestParam("demandDate") String demandDate,@RequestParam("stationID") String stationID,@RequestParam("operatorID") String operatorID,@RequestParam("equipmentOwnerID") String equipmentOwnerID,@RequestParam("eleNo") String eleNo,@RequestParam("list") String list,@RequestParam("deliveryTime") String deliveryTime);
|
||||
}
|
||||
|
||||
@ -140,6 +140,16 @@ public class PowerPileFallbackFactory implements FallbackFactory<PowerPileServic
|
||||
public R pileConfigSettings(String pileNo, String powerNumber) {
|
||||
return R.fail(500,"推送充电桩工作参数设置失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R addRequirementInfo(String name, String area, String code, String list, String requireDate, String releaseTime, String deliveryTime) {
|
||||
return R.fail(500,"监管平台推送调控需求失败:" + cause.getMessage());
|
||||
}
|
||||
|
||||
@Override
|
||||
public R addNotificationTask(String taskName, String taskCode, String demandDate, String stationID, String operatorID, String equipmentOwnerID, String eleNo, String list, String deliveryTime) {
|
||||
return R.fail(500,"监管平台推送调控任务失败:" + cause.getMessage());
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@ -0,0 +1,44 @@
|
||||
package com.xhpc.common.data.down;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 调控需求
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2024-08-20 11:16
|
||||
*/
|
||||
@Data
|
||||
public class RequirementInfoDto {
|
||||
/**
|
||||
* 需求名称
|
||||
*/
|
||||
public String name;
|
||||
/**
|
||||
* 需求地区
|
||||
*/
|
||||
public String area;
|
||||
/**
|
||||
* 需求编号
|
||||
*/
|
||||
public String code;
|
||||
/**
|
||||
* 时段责任量 List
|
||||
*/
|
||||
public String list;
|
||||
/**
|
||||
* 需求日期
|
||||
*/
|
||||
public String requireDate;
|
||||
/**
|
||||
* 发布时间
|
||||
*/
|
||||
public String releaseTime;
|
||||
/**
|
||||
* 下发时间
|
||||
*/
|
||||
public String deliveryTime;
|
||||
}
|
||||
@ -0,0 +1,20 @@
|
||||
package com.xhpc.common.data.down;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 时段责任量
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2024-08-20 11:23
|
||||
*/
|
||||
@Data
|
||||
public class RequirementInfoListDto {
|
||||
|
||||
public String startTime;
|
||||
|
||||
public String endTime;
|
||||
|
||||
public String res;
|
||||
}
|
||||
@ -526,33 +526,71 @@ public class XhpcPileOrderController extends BaseController {
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
DateTime startTime = DateUtil.parse(cacheOrderData.getStartTime());
|
||||
DateTime endTime = DateUtil.parse(cacheOrderData.getEndTime());
|
||||
xhpcChargeOrder.setStartTime(startTime);
|
||||
xhpcChargeOrder.setEndTime(endTime);
|
||||
//开始时间不能小于今天2天 结束时间不能大于今天两天
|
||||
Date dateUtil = DateUtil.date();
|
||||
long betweenStart = DateUtil.between(startTime, dateUtil, DateUnit.DAY);
|
||||
if(betweenStart>2){
|
||||
logger.info("开始时间大于本地时间2天>>>>>orderNo:" + orderNo);
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
xhpcChargeOrder.setUpdateTime(new Date());
|
||||
xhpcChargeOrder.setErroRemark("开始时间大于本地时间2天,需要进行时间效验");
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
extracted();
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
if(endTime.getTime()-dateUtil.getTime()>120000){
|
||||
logger.info("结束时间大于本地时间2分钟,需要进行时间效验>>>>>orderNo:" + orderNo);
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
xhpcChargeOrder.setUpdateTime(new Date());
|
||||
xhpcChargeOrder.setErroRemark("结束时间大于本地时间2分钟,需要进行时间效验");
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
extracted();
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
//结束时间小于开始时间
|
||||
if(startTime.getTime()-endTime.getTime()>0){
|
||||
logger.info("开始时间大于结束时间>>>>>orderNo:" + orderNo);
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
xhpcChargeOrder.setUpdateTime(new Date());
|
||||
xhpcChargeOrder.setErroRemark("开始时间大于结束时间,需要进行时间效验");
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
|
||||
//1.订单结束时上报的开始时间小于订单创建时间3分钟 2.订单结束时上报的开始时间大于订单创建时间5分钟
|
||||
long createTimeLong = xhpcChargeOrder.getCreateTime().getTime();
|
||||
|
||||
if(cacheOrderData.getStartTime() !=null || "".equals(cacheOrderData.getStartTime())){
|
||||
long startTimeLong = DateUtil.parse(cacheOrderData.getStartTime()).getTime();
|
||||
if(createTimeLong-startTimeLong>60000){
|
||||
// xhpcChargeOrder.setStatus(2);
|
||||
// xhpcChargeOrder.setChargingDegree(totalPowerQuantity);
|
||||
// xhpcChargeOrder.setUpdateTime(new Date());
|
||||
// xhpcChargeOrder.setErroRemark("结算订单开始充电时间小于订单创建时间1分钟");
|
||||
// xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
// return R.fail(500,"无效订单号:"+orderNo);
|
||||
|
||||
xhpcChargeOrder.setStartTime(xhpcChargeOrder.getCreateTime());
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
if(createTimeLong-startTimeLong>120000){
|
||||
if("15".equals(xhpcChargeOrder.getChargingStationId().toString())){
|
||||
xhpcChargeOrder.setStartTime(xhpcChargeOrder.getCreateTime());
|
||||
xhpcChargeOrder.setErroRemark("结算订单开始充电时间小于订单创建时间2分钟");
|
||||
}else{
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
xhpcChargeOrder.setChargingDegree(totalPowerQuantity);
|
||||
xhpcChargeOrder.setUpdateTime(new Date());
|
||||
xhpcChargeOrder.setErroRemark("结算订单开始充电时间小于订单创建时间2分钟");
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
}
|
||||
if(startTimeLong-createTimeLong>180000){
|
||||
// xhpcChargeOrder.setStatus(2);
|
||||
// xhpcChargeOrder.setChargingDegree(totalPowerQuantity);
|
||||
// xhpcChargeOrder.setUpdateTime(new Date());
|
||||
// xhpcChargeOrder.setErroRemark("结算订单开始充电时间大于订单创建时间3分钟");
|
||||
// xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
// return R.fail(500,"无效订单号:"+orderNo);
|
||||
|
||||
xhpcChargeOrder.setStartTime(xhpcChargeOrder.getCreateTime());
|
||||
if("15".equals(xhpcChargeOrder.getChargingStationId().toString())){
|
||||
xhpcChargeOrder.setStartTime(xhpcChargeOrder.getCreateTime());
|
||||
xhpcChargeOrder.setErroRemark("结算订单开始充电时间大于订单创建时间3分钟");
|
||||
}else{
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
xhpcChargeOrder.setChargingDegree(totalPowerQuantity);
|
||||
xhpcChargeOrder.setUpdateTime(new Date());
|
||||
xhpcChargeOrder.setErroRemark("结算订单开始充电时间大于订单创建时间3分钟");
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
}
|
||||
}else{
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
@ -759,40 +797,6 @@ public class XhpcPileOrderController extends BaseController {
|
||||
int status = cacheOrderData.getStatus();
|
||||
xhpcChargeOrder.setStatus(status);
|
||||
|
||||
DateTime startTime = DateUtil.parse(cacheOrderData.getStartTime());
|
||||
DateTime endTime = DateUtil.parse(cacheOrderData.getEndTime());
|
||||
xhpcChargeOrder.setStartTime(startTime);
|
||||
xhpcChargeOrder.setEndTime(endTime);
|
||||
//开始时间不能小于今天2天 结束时间不能大于今天两天
|
||||
Date dateUtil = DateUtil.date();
|
||||
long betweenStart = DateUtil.between(startTime, dateUtil, DateUnit.DAY);
|
||||
if(betweenStart>2){
|
||||
logger.info("开始时间大于本地时间2天>>>>>orderNo:" + orderNo);
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
xhpcChargeOrder.setUpdateTime(new Date());
|
||||
xhpcChargeOrder.setErroRemark("开始时间大于本地时间2天,需要进行时间效验");
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
extracted();
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
if(endTime.getTime()-dateUtil.getTime()>120000){
|
||||
logger.info("结束时间大于本地时间2分钟,需要进行时间效验>>>>>orderNo:" + orderNo);
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
xhpcChargeOrder.setUpdateTime(new Date());
|
||||
xhpcChargeOrder.setErroRemark("结束时间大于本地时间2分钟,需要进行时间效验");
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
extracted();
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
//结束时间小于开始时间
|
||||
if(startTime.getTime()-endTime.getTime()>0){
|
||||
logger.info("开始时间大于结束时间>>>>>orderNo:" + orderNo);
|
||||
xhpcChargeOrder.setStatus(2);
|
||||
xhpcChargeOrder.setUpdateTime(new Date());
|
||||
xhpcChargeOrder.setErroRemark("开始时间大于结束时间,需要进行时间效验");
|
||||
xhpcChargeOrderService.updateXhpcChargeOrder(xhpcChargeOrder);
|
||||
return R.fail(500,"无效订单号:"+orderNo);
|
||||
}
|
||||
|
||||
|
||||
//充电时长
|
||||
|
||||
@ -2,18 +2,25 @@ package com.xhpc.order.controller;
|
||||
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.SecurityUtils;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.domain.AjaxResult;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.order.service.IXhpcChargeOrderService;
|
||||
import com.xhpc.order.service.IXhpcStopChargingOrderService;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RequestParam;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
|
||||
@ -38,6 +45,9 @@ public class XhpcStopChargingOrderController extends BaseController {
|
||||
@Autowired
|
||||
private IXhpcChargeOrderService xhpcChargeOrderService;
|
||||
|
||||
@Autowired
|
||||
private TokenService tokenService;
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(Long userId, Long chargingStationId, Long terminalId){
|
||||
startPage();
|
||||
@ -54,7 +64,6 @@ public class XhpcStopChargingOrderController extends BaseController {
|
||||
//查询缓存是否该终端在充电
|
||||
Map<String, Object> cacheMap = redisService.getCacheMap("gun:" + serialNumber);
|
||||
|
||||
|
||||
Map<String, Object> serialNumberOrder = xhpcChargeOrderService.getSerialNumberOrder(serialNumber);
|
||||
if(cacheMap !=null && serialNumberOrder!=null && serialNumberOrder.get("serialNumber") !=null){
|
||||
if(cacheMap.get("orderkey") !=null){
|
||||
@ -79,4 +88,52 @@ public class XhpcStopChargingOrderController extends BaseController {
|
||||
}
|
||||
return AjaxResult.success("无车辆充电");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 停止充电
|
||||
* @return
|
||||
*/
|
||||
@GetMapping("/stopUpAll")
|
||||
public void stopUpAll(Long chargingStationId,Long chargingPileId){
|
||||
if(chargingStationId!=null || chargingPileId !=null ){
|
||||
List<Map<String,Object>> xhpcTerminalList =new ArrayList<>();
|
||||
LoginUser loginUser = tokenService.getLoginUser();
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
Long sysUserId = sysUser.getUserId();
|
||||
//桩的统计、该时段金额
|
||||
if(!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())){
|
||||
startPage();
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
//运营商看自己的场站
|
||||
xhpcTerminalList= xhpcChargeOrderService.getXhpcTerminalList(chargingStationId, chargingPileId,1,logOperatorId);
|
||||
}else{
|
||||
//查询赋值的场站
|
||||
xhpcTerminalList= xhpcChargeOrderService.getXhpcTerminalList(chargingStationId, chargingPileId,2,sysUserId);
|
||||
}
|
||||
}else{
|
||||
xhpcTerminalList= xhpcChargeOrderService.getXhpcTerminalList(chargingStationId, chargingPileId,0,sysUserId);
|
||||
}
|
||||
|
||||
for (int i = 0; i < xhpcTerminalList.size(); i++) {
|
||||
Map<String,Object> map = xhpcTerminalList.get(i);
|
||||
String serialNumber = map.get("serialNumber").toString();
|
||||
//查询缓存是否该终端在充电
|
||||
Map<String, Object> cacheMap = redisService.getCacheMap("gun:" + serialNumber);
|
||||
|
||||
Map<String, Object> serialNumberOrder = xhpcChargeOrderService.getSerialNumberOrder(serialNumber);
|
||||
if(cacheMap !=null && serialNumberOrder!=null && serialNumberOrder.get("serialNumber") !=null){
|
||||
if(cacheMap.get("orderkey") !=null){
|
||||
String serialNumberOrderMap = serialNumberOrder.get("serialNumber").toString();
|
||||
String version ="0A";
|
||||
if(cacheMap.get("version") !=null){
|
||||
version =cacheMap.get("version").toString();
|
||||
}
|
||||
powerPileService.stopCharging(serialNumberOrderMap, serialNumberOrderMap.substring(0,14), serialNumberOrderMap.substring(0,16), version);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -289,5 +289,5 @@ public interface XhpcChargeOrderMapper {
|
||||
//查询是否可以充电
|
||||
int getBlacklistUser(@Param("phone")String phone,@Param("vin")String vin,@Param("plateNnum")String plateNnum,@Param("chargingStationId")Long chargingStationId,@Param("time")String time);
|
||||
|
||||
|
||||
List<Map<String,Object>> getXhpcTerminalList(@Param("chargingStationId")Long chargingStationId,@Param("chargingPileId")Long chargingPileId,@Param("type")Integer type,@Param("userId")Long userId);
|
||||
}
|
||||
|
||||
@ -237,4 +237,10 @@ public interface IXhpcChargeOrderService {
|
||||
String countXhpcRealTimeOrder(Long userId,Integer source,String tenantId);
|
||||
|
||||
int getBlacklistUser(String phone,String vin,String plateNnum,Long chargingStationId,String time);
|
||||
|
||||
/**
|
||||
* 获取终端信息
|
||||
* @return
|
||||
*/
|
||||
List<Map<String,Object>> getXhpcTerminalList(Long chargingStationId,Long chargingPileId,Integer type,Long userId);
|
||||
}
|
||||
|
||||
@ -1916,6 +1916,11 @@ public class XhpcChargeOrderServiceImpl extends BaseService implements IXhpcChar
|
||||
return xhpcChargeOrderMapper.getBlacklistUser(phone, vin, plateNnum, chargingStationId, time);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String,Object>> getXhpcTerminalList(Long chargingStationId, Long chargingPileId,Integer type,Long userId) {
|
||||
return xhpcChargeOrderMapper.getXhpcTerminalList(chargingStationId,chargingPileId,type,userId);
|
||||
}
|
||||
|
||||
//判断双枪启规则
|
||||
private AjaxResult startUpSuncha(Map<String, Object> userMessage,XhpcChargeOrder xhpcChargeOrder,XhpcTerminal xhpcTerminal,String tenantId,Integer source,String terminalSerialNumber,Integer type){
|
||||
|
||||
|
||||
@ -918,4 +918,22 @@
|
||||
and blacklist_id in (select mechanism_id from xhpc_mechanism where source =2 and del_flag =0 and charging_station_id =#{chargingStationId} )
|
||||
and start_time <= #{time} and end_time >= #{time}
|
||||
</select>
|
||||
|
||||
<select id="getXhpcTerminalList" resultType="map">
|
||||
select serial_number as serialNumber
|
||||
from xhpc_terminal
|
||||
where del_flag = 0
|
||||
<if test="'' !=chargingStationId and chargingStationId !=null">
|
||||
and charging_station_id =#{chargingStationId}
|
||||
</if>
|
||||
<if test="''!=chargingPileId and chargingPileId !=null">
|
||||
and charging_pile_id =#{chargingPileId}
|
||||
</if>
|
||||
<if test="type==1">
|
||||
and charging_station_id in (select charging_station_id from xhpc_charging_station where operator_id=#{userId})
|
||||
</if>
|
||||
<if test="type==2">
|
||||
and charging_station_id in (select charging_station_id from xhpc_user_privilege where user_id=#{userId})
|
||||
</if>
|
||||
</select>
|
||||
</mapper>
|
||||
|
||||
@ -334,4 +334,20 @@ public class StationController {
|
||||
}
|
||||
|
||||
|
||||
@PostMapping("/station/addRequirementInfo")
|
||||
public R addRequirementInfo(@RequestParam("name") String name,@RequestParam("area") String area,@RequestParam("code") String code,@RequestParam("list") String list,@RequestParam("requireDate") String requireDate,@RequestParam("releaseTime") String releaseTime,@RequestParam("deliveryTime") String deliveryTime){
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/station/addNotificationTask")
|
||||
public R addNotificationTask(@RequestParam("taskName") String taskName,@RequestParam("taskCode") String taskCode,@RequestParam("demandDate") String demandDate,@RequestParam("stationID") String stationID,@RequestParam("operatorID") String operatorID,@RequestParam("equipmentOwnerID") String equipmentOwnerID,@RequestParam("eleNo") String eleNo,@RequestParam("list") String list,@RequestParam("deliveryTime") String deliveryTime){
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -258,11 +258,11 @@ public class XhpcAppUserController extends BaseController {
|
||||
String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + mapConfig.get("wxAppId").toString() + "&secret=" + mapConfig.get("wxAppSecret").toString() + "&js_code=" + jsCode + "&grant_type=authorization_code";
|
||||
String result = HttpUtils.get(url);
|
||||
JSONObject json = JSON.parseObject(result);
|
||||
//logger.info("========222===========sessionKey:============222===============");
|
||||
logger.info("========222===========sessionKey:============222==============="+json.toString());
|
||||
if (null != json) {
|
||||
String openid = json.getString("openid");
|
||||
String sessionKey = json.getString("session_key");
|
||||
//logger.info("========333===========sessionKey:============333===============");
|
||||
logger.info("========333===========sessionKey:============333===============");
|
||||
if (StringUtils.isEmpty(openid)) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
|
||||
}
|
||||
@ -280,7 +280,7 @@ public class XhpcAppUserController extends BaseController {
|
||||
if(phoneCode1 !=null &&!phoneCode1.equals("")){
|
||||
map.put("phone", phoneCode1);
|
||||
}
|
||||
logger.info("1111phone:"+ phoneCode1);
|
||||
logger.info("======111==4444===========sessionKey:=======111=====444==============="+phoneCode1);
|
||||
}
|
||||
// JSONObject jsonObject = new JSONObject();
|
||||
// if ((!"".equals(encryptedData) && encryptedData != null) && (!"".equals(iv) && iv != null)) {
|
||||
@ -309,18 +309,18 @@ public class XhpcAppUserController extends BaseController {
|
||||
}
|
||||
R r = settingConfigService.settingConfig(1, tenantId);
|
||||
if (r != null && r.getCode() == 200) {
|
||||
// System.out.println("========444===========sessionKey:============444===============");
|
||||
System.out.println("========444===========sessionKey:============444===============");
|
||||
Map<String, Object> mapConfig = (Map<String, Object>) r.getData();
|
||||
String url = "https://api.weixin.qq.com/sns/jscode2session?appid=" + mapConfig.get("wxAppId").toString() + "&secret=" + mapConfig.get("wxAppSecret").toString() + "&js_code=" + jsCode + "&grant_type=authorization_code";
|
||||
String result = HttpUtils.get(url);
|
||||
JSONObject json = JSON.parseObject(result);
|
||||
//logger.info("========555===========sessionKey:============5555===============");
|
||||
logger.info("========555===========sessionKey:============5555==============="+json.toString());
|
||||
if (null != json) {
|
||||
String openid = json.getString("openid");
|
||||
redisService.setCacheObject("WXToken:" + openid, openid, 115L, TimeUnit.MINUTES);
|
||||
String sessionKey = json.getString("session_key");
|
||||
//logger.info("========666===========sessionKey:============666==============="+sessionKey);
|
||||
//logger.info("========666===========sessionKey:============666===============");
|
||||
logger.info("========666===========sessionKey:============666==============="+sessionKey);
|
||||
logger.info("========666===========sessionKey:============666===============");
|
||||
if (StringUtils.isEmpty(openid)) {
|
||||
return R.fail(HttpStatus.ERROR_STATUS, "openid获取失败");
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user