修改占位费、监管平台推送调控、修改vin码充电
This commit is contained in:
parent
f547f03e3f
commit
7fa9660450
@ -28,6 +28,6 @@ public class CDRequirementInfoList {
|
||||
* 应量
|
||||
*/
|
||||
@JsonProperty("Res")
|
||||
public String res;
|
||||
public Double res;
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,80 @@
|
||||
package com.xhpc.evcs.cwj.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 15:35
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"StartChargeSeq",
|
||||
"StartChargeSeqStat",
|
||||
"ConnectorID",
|
||||
"ConnectorStatus",
|
||||
"CurrentA",
|
||||
"CurrentB",
|
||||
"CurrentC",
|
||||
"VoltageA",
|
||||
"VoltageB",
|
||||
"VoltageC",
|
||||
"Soc",
|
||||
"StartTime",
|
||||
"EndTime",
|
||||
"TotalPower",
|
||||
"ElecMoney",
|
||||
"SeviceMoney",
|
||||
"TotalMoney",
|
||||
"SumPeriod",
|
||||
"ChargeDetails",
|
||||
"LeftTime"
|
||||
})
|
||||
public class CEJEquipChargeStatus {
|
||||
@JsonProperty("StartChargeSeq")
|
||||
private String startChargeSeq;
|
||||
@JsonProperty("StartChargeSeqStat")
|
||||
private Integer startChargeSeqStat = 4;
|
||||
@JsonProperty("ConnectorID")
|
||||
private String connectorID;
|
||||
@JsonProperty("ConnectorStatus")
|
||||
private Integer connectorStatus = 1;
|
||||
@JsonProperty("CurrentA")
|
||||
private Double currentA = 0.0;
|
||||
@JsonProperty("CurrentB")
|
||||
private Double currentB = 0.0;
|
||||
@JsonProperty("CurrentC")
|
||||
private Double currentC = 0.0;
|
||||
@JsonProperty("VoltageA")
|
||||
private Double voltageA = 0.0;
|
||||
@JsonProperty("VoltageB")
|
||||
private Double voltageB = 0.0;
|
||||
@JsonProperty("VoltageC")
|
||||
private Double voltageC = 0.0;
|
||||
@JsonProperty("Soc")
|
||||
private Double soc = 0.0;
|
||||
@JsonProperty("StartTime")
|
||||
private String startTime;
|
||||
@JsonProperty("EndTime")
|
||||
private String endTime;
|
||||
@JsonProperty("TotalPower")
|
||||
private Double totalPower = 0.0;
|
||||
@JsonProperty("ElecMoney")
|
||||
private Double elecMoney = 0.0;
|
||||
@JsonProperty("SeviceMoney")
|
||||
private Double seviceMoney = 0.0;
|
||||
@JsonProperty("TotalMoney")
|
||||
private Double totalMoney = 0.0;
|
||||
@JsonProperty("SumPeriod")
|
||||
private Integer sumPeriod = 0;
|
||||
@JsonProperty("ChargeDetails")
|
||||
private com.xhpc.evcs.dto.ChargeDetails[] chargeDetails;
|
||||
@JsonProperty("LeftTime")
|
||||
private Integer leftTime ;
|
||||
|
||||
}
|
||||
@ -0,0 +1,78 @@
|
||||
package com.xhpc.evcs.cwj.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Transient;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 10:12
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"ConnectorID",
|
||||
"ConnectorName",
|
||||
"ConnectorType",
|
||||
"VoltageUpperLimits",
|
||||
"VoltageLowerLimits",
|
||||
"Current",
|
||||
"Power",
|
||||
"NationalStandard"
|
||||
})
|
||||
@Data
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class CWJConnectorInfo {
|
||||
@JsonProperty("ConnectorID")
|
||||
public String connectorID;
|
||||
@JsonProperty("ConnectorName")
|
||||
public String connectorName;
|
||||
// 1:家用插座(模式 2)
|
||||
// 2:交流接口插座(模式 3, 连接方式 B )
|
||||
// 3:交流接口插头(带枪线, 模式 3,连接方式 C)
|
||||
// 4:直流接口枪头(带枪线, 模式 4)
|
||||
// 5:无线充电座
|
||||
// 6:其他
|
||||
@JsonProperty("ConnectorType")
|
||||
public Integer connectorType;
|
||||
@JsonProperty("VoltageUpperLimits")
|
||||
public Integer voltageUpperLimits;
|
||||
@JsonProperty("VoltageLowerLimits")
|
||||
public Integer voltageLowerLimits;
|
||||
@JsonProperty("Current")
|
||||
public Integer current;
|
||||
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
@JsonProperty("Power")
|
||||
public Double power;
|
||||
|
||||
// @JsonProperty("ParkNo")
|
||||
// public String ParkNo;
|
||||
|
||||
@JsonProperty("NationalStandard")
|
||||
public Integer nationalStandard;
|
||||
// /**
|
||||
// * 是否有地锁
|
||||
// */
|
||||
// @Transient
|
||||
// @JsonProperty("ParkingLockFlag")
|
||||
// public Integer parkingLockFlag;
|
||||
// /**
|
||||
// * 充电设备接口二维码
|
||||
// */
|
||||
// @Transient
|
||||
// @JsonProperty("QRCode")
|
||||
// public Integer qRCode;
|
||||
// /**
|
||||
// * 枪编码
|
||||
// */
|
||||
// @Transient
|
||||
// @JsonProperty("Stubld")
|
||||
// public String stubld;
|
||||
|
||||
}
|
||||
@ -0,0 +1,41 @@
|
||||
package com.xhpc.evcs.cwj.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 10:21
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"ConnectorID",
|
||||
"Status"
|
||||
})
|
||||
@Data
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class CWJConnectorStatusInfo {
|
||||
|
||||
@JsonProperty("ConnectorID")
|
||||
public String connectorID;
|
||||
/**
|
||||
* 充电设备接口状态
|
||||
*/
|
||||
@JsonProperty("Status")
|
||||
public Integer status;
|
||||
// /**
|
||||
// * 车位状态
|
||||
// */
|
||||
// @JsonProperty("ParkStatus")
|
||||
// public Integer parkStatus;
|
||||
//
|
||||
// /**
|
||||
// * 地锁状态
|
||||
// */
|
||||
// @JsonProperty("LockStatus")
|
||||
// public Integer lockStatus;
|
||||
}
|
||||
@ -0,0 +1,47 @@
|
||||
package com.xhpc.evcs.cwj.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDConnectorStatusInfo;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 11:18
|
||||
*/
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class CWJConnectorStatusInfoReq {
|
||||
|
||||
|
||||
@JsonProperty("ConnectorStatusInfo")
|
||||
private CWJConnectorStatusInfo connectorStatusInfo;
|
||||
|
||||
@JsonIgnore
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
|
||||
@JsonProperty("ConnectorStatusInfo")
|
||||
public CWJConnectorStatusInfo getConnectorStatusInfo() {
|
||||
|
||||
return connectorStatusInfo;
|
||||
}
|
||||
|
||||
@JsonProperty("ConnectorStatusInfo")
|
||||
public void setConnectorStatusInfo(CWJConnectorStatusInfo connectorStatusInfo) {
|
||||
|
||||
this.connectorStatusInfo = connectorStatusInfo;
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
public Map<String, Object> getAdditionalProperties() {
|
||||
|
||||
return this.additionalProperties;
|
||||
}
|
||||
|
||||
@JsonAnySetter
|
||||
public void setAdditionalProperty(String name, Object value) {
|
||||
|
||||
this.additionalProperties.put(name, value);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,92 @@
|
||||
package com.xhpc.evcs.cwj.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Transient;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 10:04
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"EquipmentID",
|
||||
"EquipmentName",
|
||||
"ManufacturerID",
|
||||
"ManufacturerName",
|
||||
"EquipmentModel",
|
||||
"ProductionDate",
|
||||
"EquipmentType",
|
||||
"Power",
|
||||
"ConnectorInfos"
|
||||
})
|
||||
@Data
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
|
||||
public class CWJEquipmentInfo {
|
||||
/**
|
||||
* 设备编码
|
||||
*/
|
||||
@JsonProperty("EquipmentID")
|
||||
public String equipmentID;
|
||||
/**
|
||||
* 充电设备名称
|
||||
*/
|
||||
@JsonProperty("EquipmentName")
|
||||
public String equipmentName;
|
||||
/**
|
||||
* 设备生产商组织机构代码
|
||||
*/
|
||||
@JsonProperty("ManufacturerID")
|
||||
public String manufacturerID;
|
||||
/**
|
||||
* 设备生产商名称
|
||||
*/
|
||||
@JsonProperty("ManufacturerName")
|
||||
public String manufacturerName;
|
||||
/**
|
||||
* 设备型号
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("EquipmentModel")
|
||||
public String equipmentModel;
|
||||
/**
|
||||
* 设备生产日期
|
||||
*/
|
||||
@JsonProperty("ProductionDate")
|
||||
public String productionDate;
|
||||
/**
|
||||
* 设备类型
|
||||
*/
|
||||
@JsonProperty("EquipmentType")
|
||||
public Integer equipmentType;
|
||||
/**
|
||||
* 充 电 设 备 经度
|
||||
*/
|
||||
// @JsonProperty("EquipmentLng")
|
||||
// public Double equipmentLng;
|
||||
/**
|
||||
* 充电设备 纬度
|
||||
*/
|
||||
// @JsonProperty("EquipmentLat")
|
||||
// public Double equipmentLat;
|
||||
/**
|
||||
* 充电设备总功率
|
||||
*/
|
||||
@Column(columnDefinition = "Decimal(10,1)")
|
||||
@JsonProperty("Power")
|
||||
public Double power;
|
||||
/**
|
||||
* 充电设备 接口列表
|
||||
*/
|
||||
@JsonProperty("ConnectorInfos")
|
||||
public List<CWJConnectorInfo> connectorInfos;
|
||||
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.xhpc.evcs.cwj.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-22 14:41
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
@Getter
|
||||
@Setter
|
||||
public class CWJPageRequest {
|
||||
|
||||
@JsonProperty(value = "PageNo", defaultValue = "1") //CAUTION: PageNo must not wrote as PageNon or anything else
|
||||
Integer pageNo = 1;
|
||||
@JsonProperty(value = "PageSize", defaultValue = "10")
|
||||
Integer pageSize = 10;
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.xhpc.evcs.cwj.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 10:35
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
|
||||
public class CWJPageStationsInfoResponse {
|
||||
@JsonProperty("PageCount")
|
||||
Integer PageCount;
|
||||
@JsonProperty("ItemSize")
|
||||
Integer ItemSize;
|
||||
@JsonProperty(value = "PageNo", defaultValue = "1") //CAUTION: PageNo must not wrote as PageNon or anything else
|
||||
Integer PageNo = 1;
|
||||
@JsonProperty("StationInfos")
|
||||
List<CWJStationInfo> stationInfos = new ArrayList<>();
|
||||
}
|
||||
@ -0,0 +1,43 @@
|
||||
package com.xhpc.evcs.cwj.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 15:04
|
||||
*/
|
||||
|
||||
@Data
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class CWJStartChargeRequest {
|
||||
|
||||
@JsonProperty("StartChargeSeq")
|
||||
String startChargeSeq;
|
||||
|
||||
@JsonProperty("ConnectorID")
|
||||
String connectorId;
|
||||
|
||||
@JsonProperty("QRCode")
|
||||
String qRCode;
|
||||
|
||||
@JsonProperty("FeeLimit")
|
||||
Double feeLimit;
|
||||
|
||||
@JsonProperty("PowerLimit")
|
||||
Double powerLimit;
|
||||
|
||||
@JsonProperty("LimitSoc")
|
||||
Integer limitSoc;
|
||||
|
||||
@JsonProperty("CarPlateNo")
|
||||
String carPlateNo;
|
||||
|
||||
@JsonProperty("UserID")
|
||||
String userId;
|
||||
|
||||
}
|
||||
@ -0,0 +1,209 @@
|
||||
package com.xhpc.evcs.cwj.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.xhpc.evcs.dto.CommonStationInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 车为家
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 9:55
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"StationID",
|
||||
"OperatorID",
|
||||
"EquipmentOwnerID",
|
||||
"StationName",
|
||||
"CountryCode",
|
||||
"AreaCode",
|
||||
"Address",
|
||||
"StationTel",
|
||||
"ServiceTel",
|
||||
"StationType",
|
||||
"StationStatus",
|
||||
"ParkNums",
|
||||
"StationLng",
|
||||
"StationLat",
|
||||
"Construction",
|
||||
"BusineHours",
|
||||
"ElectricityFee",
|
||||
"ServiceFee",
|
||||
"ParkFee",
|
||||
"Payment",
|
||||
"EquipmentInfos",
|
||||
"ParkingDiscountType"
|
||||
})
|
||||
@Data
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
|
||||
public class CWJStationInfo extends CommonStationInfo {
|
||||
|
||||
/**
|
||||
* 充电站国家代码
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("CountryCode")
|
||||
public String countryCcode;
|
||||
/**
|
||||
* 充电站省市辖区编码
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("AreaCode")
|
||||
public String areaCode;
|
||||
/**
|
||||
* 详情地址
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("Address")
|
||||
public String address;
|
||||
/**
|
||||
* 站点电话
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("StationTel")
|
||||
public String stationTel;
|
||||
/**
|
||||
* 服务电话
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("ServiceTel")
|
||||
public String serviceTel;
|
||||
/**
|
||||
* 站点类型
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("StationType")
|
||||
public Integer stationType;
|
||||
/**
|
||||
* 站点状态
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("StationStatus")
|
||||
public Integer stationStatus;
|
||||
/**
|
||||
* 车位数量
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("ParkNums")
|
||||
public Integer parkNums;
|
||||
/**
|
||||
* 经度
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("StationLng")
|
||||
public Double stationLng;
|
||||
/**
|
||||
* 纬度
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("StationLat")
|
||||
public Double stationLat;
|
||||
/**
|
||||
* 站点引导
|
||||
*/
|
||||
// @Transient
|
||||
// @JsonProperty("SiteGuide")
|
||||
// public String siteGuide;
|
||||
/**
|
||||
* 建设场所
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("Construction")
|
||||
public Integer construction;
|
||||
/**
|
||||
* 站点照片
|
||||
*/
|
||||
// @Transient
|
||||
// @JsonProperty("Pictures")
|
||||
// public String[] pictures;
|
||||
/**
|
||||
* 使用车型描述
|
||||
*/
|
||||
// @Transient
|
||||
// @JsonProperty("MatchCars")
|
||||
// public String matchCars;
|
||||
/**
|
||||
* 车位楼层及数量描述
|
||||
*/
|
||||
// @Transient
|
||||
// @JsonProperty("ParkInfo")
|
||||
// public String parkInfo;
|
||||
/**
|
||||
* 营业时间
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("BusineHours")
|
||||
public String busineHours;
|
||||
/**
|
||||
* 充 电 电 费 率
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("ElectricityFee")
|
||||
public String electricityFee;
|
||||
/**
|
||||
* 服务费率
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("ServiceFee")
|
||||
public String serviceFee;
|
||||
/**
|
||||
* 停车费
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("ParkFee")
|
||||
public String parkFee;
|
||||
/**
|
||||
* 支付方式
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("Payment")
|
||||
public String payment;
|
||||
/**
|
||||
* 是否支持预约
|
||||
*/
|
||||
// @Transient
|
||||
// @JsonProperty("SupportOrder")
|
||||
// public Integer supportOrder;
|
||||
/**
|
||||
* 备注
|
||||
*/
|
||||
// @Transient
|
||||
// @JsonProperty("Remark")
|
||||
// public String remark;
|
||||
|
||||
/**
|
||||
* 充电设备信息列表
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("EquipmentInfos")
|
||||
public List<CWJEquipmentInfo> equipmentInfos = null;
|
||||
/**
|
||||
* 停车收费类型
|
||||
*/
|
||||
@Transient
|
||||
@JsonProperty("ParkingDiscountType")
|
||||
public Integer parkingDiscountType;
|
||||
/**
|
||||
* 标签
|
||||
*/
|
||||
// @Transient
|
||||
// @JsonProperty("Tags")
|
||||
// public String[] Tags;
|
||||
/**
|
||||
* 路书
|
||||
*/
|
||||
// @Transient
|
||||
// @JsonProperty("RoadInfo")
|
||||
// public String[] roadInfo;
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,35 @@
|
||||
package com.xhpc.evcs.cwj.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 10:23
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"OperatorID",
|
||||
"ConnectorStatusInfos"
|
||||
})
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
@Data
|
||||
public class CWJStationStatusInfo {
|
||||
/**
|
||||
* 充电设ID
|
||||
*/
|
||||
@JsonProperty("StationID")
|
||||
public String stationID;
|
||||
|
||||
/**
|
||||
* 充电设备接口状态列表
|
||||
*/
|
||||
@JsonProperty("ConnectorStatusInfos")
|
||||
public List<CWJConnectorStatusInfo> connectorStatusInfos;
|
||||
}
|
||||
@ -0,0 +1,73 @@
|
||||
package com.xhpc.evcs.cwj.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import org.apache.commons.lang3.builder.ToStringBuilder;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 11:26
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"Total",
|
||||
"StationStatusInfos"
|
||||
})
|
||||
public class CWJStationStatusInfoWrapper {
|
||||
|
||||
|
||||
@JsonProperty("Total")
|
||||
private Integer total;
|
||||
@JsonProperty("StationStatusInfos")
|
||||
private List<CWJStationStatusInfo> stationStatusInfos = null;
|
||||
@JsonIgnore
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
|
||||
@JsonProperty("Total")
|
||||
public Integer getTotal() {
|
||||
|
||||
return total;
|
||||
}
|
||||
|
||||
@JsonProperty("Total")
|
||||
public void setTotal(Integer total) {
|
||||
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
@JsonProperty("StationStatusInfos")
|
||||
public List<CWJStationStatusInfo> getStationStatusInfos() {
|
||||
|
||||
return stationStatusInfos;
|
||||
}
|
||||
|
||||
@JsonProperty("StationStatusInfos")
|
||||
public void setStationStatusInfos(List<CWJStationStatusInfo> stationStatusInfos) {
|
||||
|
||||
this.stationStatusInfos = stationStatusInfos;
|
||||
}
|
||||
|
||||
@JsonAnyGetter
|
||||
public Map<String, Object> getAdditionalProperties() {
|
||||
|
||||
return this.additionalProperties;
|
||||
}
|
||||
|
||||
@JsonAnySetter
|
||||
public void setAdditionalProperty(String name, Object value) {
|
||||
|
||||
this.additionalProperties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
|
||||
return new ToStringBuilder(this).append("total", total).append("stationStatusInfos", stationStatusInfos).append(
|
||||
"additionalProperties", additionalProperties).toString();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -54,13 +54,13 @@ public class NotificationStartChargeResultRequestData {
|
||||
this.startTime = startTime;
|
||||
}
|
||||
|
||||
@JsonProperty("EndTime")
|
||||
@JsonProperty("StartChargeSeqStat")
|
||||
public Integer getStartChargeSeqStat() {
|
||||
|
||||
return startChargeSeqStat;
|
||||
}
|
||||
|
||||
@JsonProperty("EndTime")
|
||||
@JsonProperty("StartChargeSeqStat")
|
||||
public void setStartChargeSeqStat(Integer startChargeSeqStat) {
|
||||
|
||||
this.startChargeSeqStat = startChargeSeqStat;
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* 快电占位费
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-07-09 14:56
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
"DetailStartTime",
|
||||
"DetailEndTime",
|
||||
"DetailMoney",
|
||||
"OvertimePrice"
|
||||
})
|
||||
@Setter
|
||||
@Getter
|
||||
public class OvertimeDetail {
|
||||
@JsonProperty("DetailStartTime")
|
||||
private String detailStartTime;
|
||||
@JsonProperty("DetailEndTime")
|
||||
private String detailEndTime;
|
||||
@JsonProperty("DetailMoney")
|
||||
private BigDecimal detailMoney;
|
||||
@JsonProperty("OvertimePrice")
|
||||
private BigDecimal overtimePrice;
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-08-01 11:53
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
"OvertimeBillCode",
|
||||
"ConnectorID",
|
||||
"ConfirmResult"
|
||||
})
|
||||
@Data
|
||||
public class OvertimeOrderInfo {
|
||||
@JsonProperty("OvertimeBillCode")
|
||||
private String overtimeBillCode;
|
||||
|
||||
@JsonProperty("SuccStat")
|
||||
private Integer succStat;
|
||||
|
||||
@JsonProperty("FailReason")
|
||||
private Integer failReason;
|
||||
}
|
||||
@ -0,0 +1,28 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-08-05 10:08
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class PageStationsInfoResponseKuaiDian {
|
||||
@JsonProperty("PageCount")
|
||||
Integer PageCount;
|
||||
@JsonProperty("ItemSize")
|
||||
Integer ItemSize;
|
||||
@JsonProperty(value = "PageNo", defaultValue = "1") //CAUTION: PageNo must not wrote as PageNon or anything else
|
||||
Integer PageNo = 1;
|
||||
@JsonProperty("StationInfos")
|
||||
List<StationInfoKuaiDian> stationInfos = new ArrayList<>();
|
||||
}
|
||||
@ -0,0 +1,29 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonAutoDetect;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-08-06 10:31
|
||||
*/
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
|
||||
public class PageStationsInfoResponseXinDianTu {
|
||||
@JsonProperty("PageCount")
|
||||
Integer PageCount;
|
||||
@JsonProperty("ItemSize")
|
||||
Integer ItemSize;
|
||||
@JsonProperty(value = "PageNo", defaultValue = "1") //CAUTION: PageNo must not wrote as PageNon or anything else
|
||||
Integer PageNo = 1;
|
||||
@JsonProperty("StationInfos")
|
||||
List<StationInfoXinDianTu> stationInfos = new ArrayList<>();
|
||||
}
|
||||
@ -0,0 +1,39 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonFormat;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
import org.springframework.format.annotation.DateTimeFormat;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-08-04 15:44
|
||||
*/
|
||||
@Data
|
||||
public class PlaceHolder {
|
||||
@Transient
|
||||
@JsonProperty("FreeTime")
|
||||
public Integer freeTime;
|
||||
@Transient
|
||||
@JsonProperty("MaxFee")
|
||||
public BigDecimal maxFee;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Transient
|
||||
@JsonProperty("EffectStartTime")
|
||||
public Date effectStartTime;
|
||||
@JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
|
||||
@Transient
|
||||
@JsonProperty("EffectEndTime")
|
||||
public Date effectEndTime;
|
||||
@Transient
|
||||
@JsonProperty("PlaceHolderPrices")
|
||||
public List<PlaceHolderPrice> placeHolderPrices;
|
||||
|
||||
}
|
||||
@ -0,0 +1,24 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import java.math.BigDecimal;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-08-04 15:47
|
||||
*/
|
||||
@Data
|
||||
public class PlaceHolderPrice {
|
||||
@Transient
|
||||
@JsonProperty("StartTime")
|
||||
public String startTime;
|
||||
@Transient
|
||||
@JsonProperty("EndTime")
|
||||
public String endTime;
|
||||
@Transient
|
||||
@JsonProperty("Price")
|
||||
public BigDecimal price;
|
||||
}
|
||||
@ -0,0 +1,48 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Column;
|
||||
import javax.persistence.Id;
|
||||
|
||||
/**
|
||||
* 占位费
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-07-08 16:49
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
"PlaceholderOrderID",
|
||||
"StarChargeSeq",
|
||||
"TimeStart",
|
||||
"TimeEnd",
|
||||
"HoldTime",
|
||||
"ActuallyPay",
|
||||
"BillEquipment",
|
||||
"Status"
|
||||
})
|
||||
@Setter
|
||||
@Getter
|
||||
public class PlaceholderOrderInfo {
|
||||
@Id
|
||||
@JsonProperty("PlaceholderOrderID")
|
||||
private String placeholderOrderID;
|
||||
@JsonProperty("StarChargeSeq")
|
||||
private String starChargeSeq;
|
||||
@JsonProperty("TimeStart")
|
||||
private String timeStart;
|
||||
@JsonProperty("TimeEnd")
|
||||
private String timeEnd;
|
||||
@JsonProperty("HoldTime")
|
||||
private Integer holdTime;
|
||||
@JsonProperty("ActuallyPay")
|
||||
private Double actuallyPay;
|
||||
@JsonProperty("BillEquipment")
|
||||
private Integer billEquipment;
|
||||
@JsonProperty("Status")
|
||||
private Integer status;
|
||||
}
|
||||
@ -0,0 +1,60 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Id;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 快电推送
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-07-09 14:19
|
||||
*/
|
||||
@JsonPropertyOrder({
|
||||
"OvertimeBillCode",
|
||||
"StartChargeSeq",
|
||||
"OvertimeBillStatus",
|
||||
"ConnectorId",
|
||||
"BillEquipment",
|
||||
"StartTime",
|
||||
"EndTime",
|
||||
"TotalTimeSpan",
|
||||
"OvertimePrice",
|
||||
"TotalMoney",
|
||||
"OvertimeDetails"
|
||||
|
||||
|
||||
})
|
||||
@Setter
|
||||
@Getter
|
||||
public class PlaceholderOrderInfoKuaiDian {
|
||||
|
||||
@Id
|
||||
@JsonProperty("OvertimeBillCode")
|
||||
private String overtimeBillCode;
|
||||
@JsonProperty("StartChargeSeq")
|
||||
private String startChargeSeq;
|
||||
@JsonProperty("OvertimeBillStatus")
|
||||
private Integer overtimeBillStatus;
|
||||
@JsonProperty("ConnectorId")
|
||||
private String connectorId;
|
||||
@JsonProperty("BillEquipment")
|
||||
private Integer billEquipment;
|
||||
@JsonProperty("StartTime")
|
||||
private String startTime;
|
||||
@JsonProperty("EndTime")
|
||||
private String endTime;
|
||||
@JsonProperty("TotalTimeSpan")
|
||||
private Integer totalTimeSpan;
|
||||
@JsonProperty("OvertimePrice")
|
||||
private BigDecimal overtimePrice;
|
||||
@JsonProperty("TotalMoney")
|
||||
private BigDecimal totalMoney;
|
||||
@JsonProperty("OvertimeDetails")
|
||||
private List<OvertimeDetail> overtimeDetails;
|
||||
}
|
||||
@ -0,0 +1,42 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
|
||||
import com.xhpc.evcs.domain.PriceInfo;
|
||||
import lombok.Data;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-08-06 11:00
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"StationID",
|
||||
"EffectStartTime",
|
||||
"ConnectorStatus",
|
||||
"EffectEndTime",
|
||||
"Status",
|
||||
"FreeTime",
|
||||
"MaxFee",
|
||||
"PriceInfos"
|
||||
})
|
||||
@Data
|
||||
public class PlaceholderRulesXinDianTu {
|
||||
@JsonProperty("StationID")
|
||||
String stationID;
|
||||
@JsonProperty("EffectStartTime")
|
||||
String effectStartTime;
|
||||
@JsonProperty("EffectEndTime")
|
||||
String effectEndTime;
|
||||
@JsonProperty("Status")
|
||||
Integer status;
|
||||
@JsonProperty("FreeTime")
|
||||
Integer freeTime;
|
||||
@JsonProperty("MaxFee")
|
||||
Double maxFee;
|
||||
@JsonProperty("PriceInfos")
|
||||
List<PriceInfo> priceInfos;
|
||||
}
|
||||
@ -1,6 +1,7 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 占位费规则查询
|
||||
@ -8,6 +9,7 @@ import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
* @author yuyang
|
||||
* @Date 2025-06-20 15:18
|
||||
*/
|
||||
@Data
|
||||
public class QeryPlaceholderRequest {
|
||||
|
||||
@JsonProperty("StationIDs")
|
||||
|
||||
@ -0,0 +1,143 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-08-05 10:02
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"StationID",
|
||||
"OperatorID",
|
||||
"EquipmentOwnerID",
|
||||
"StationName",
|
||||
"CountryCode",
|
||||
"AreaCode",
|
||||
"Address",
|
||||
"ServiceTel",
|
||||
"StationType",
|
||||
"StationStatus",
|
||||
"ParkNums",
|
||||
"StationLng",
|
||||
"StationLat",
|
||||
"Construction",
|
||||
"BusineHours",
|
||||
"ElectricityFee",
|
||||
"ServiceFee",
|
||||
"ParkFee",
|
||||
"Payment",
|
||||
"SupportOrder",
|
||||
"PlaceHolder",
|
||||
"OvertimeFee",
|
||||
"EquipmentInfos"
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
public class StationInfoKuaiDian extends CommonStationInfo {
|
||||
|
||||
|
||||
@Transient
|
||||
@JsonProperty("AreaCode")
|
||||
public String areaCode;
|
||||
@Transient
|
||||
@JsonProperty("Address")
|
||||
public String address;
|
||||
@Transient
|
||||
@JsonProperty("ServiceTel")
|
||||
public String serviceTel;
|
||||
@Transient
|
||||
@JsonProperty("StationType")
|
||||
public Integer stationType;
|
||||
@Transient
|
||||
@JsonProperty("StationStatus")
|
||||
public Integer stationStatus;
|
||||
@Transient
|
||||
@JsonProperty("ParkNums")
|
||||
public Integer parkNums;
|
||||
@Transient
|
||||
@JsonProperty("StationLng")
|
||||
public Double stationLng;
|
||||
@Transient
|
||||
@JsonProperty("StationLat")
|
||||
public Double stationLat;
|
||||
@Transient
|
||||
@JsonProperty("Construction")
|
||||
public Long construction;
|
||||
@Transient
|
||||
@JsonProperty("BusineHours")
|
||||
public String busineHours;
|
||||
@Transient
|
||||
@JsonProperty("ElectricityFee")
|
||||
public String electricityFee;
|
||||
@Transient
|
||||
@JsonProperty("ServiceFee")
|
||||
public String serviceFee;
|
||||
@Transient
|
||||
@JsonProperty("ParkFee")
|
||||
public String parkFee;
|
||||
@Transient
|
||||
@JsonProperty("Payment")
|
||||
public String payment;
|
||||
@Transient
|
||||
@JsonProperty("SupportOrder")
|
||||
public Long supportOrder;
|
||||
@Transient
|
||||
@JsonProperty("PlaceHolder")
|
||||
public PlaceHolder placeHolder;
|
||||
@Transient
|
||||
@JsonProperty("OvertimeFee")
|
||||
public String overtimeFee;
|
||||
@Transient
|
||||
@JsonProperty("EquipmentInfos")
|
||||
public List<EquipmentInfo> equipmentInfos = null;
|
||||
@Transient
|
||||
@JsonIgnore
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
|
||||
@JsonAnyGetter
|
||||
public Map<String, Object> getAdditionalProperties() {
|
||||
|
||||
return this.additionalProperties;
|
||||
}
|
||||
|
||||
@JsonAnySetter
|
||||
public void setAdditionalProperty(String name, Object value) {
|
||||
|
||||
this.additionalProperties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StationInfoKuaiDian{" +
|
||||
"areaCode='" + areaCode + '\'' +
|
||||
", address='" + address + '\'' +
|
||||
", serviceTel='" + serviceTel + '\'' +
|
||||
", stationType=" + stationType +
|
||||
", stationStatus=" + stationStatus +
|
||||
", parkNums=" + parkNums +
|
||||
", stationLng=" + stationLng +
|
||||
", stationLat=" + stationLat +
|
||||
", construction=" + construction +
|
||||
", busineHours='" + busineHours + '\'' +
|
||||
", electricityFee='" + electricityFee + '\'' +
|
||||
", serviceFee='" + serviceFee + '\'' +
|
||||
", parkFee='" + parkFee + '\'' +
|
||||
", payment='" + payment + '\'' +
|
||||
", supportOrder=" + supportOrder +
|
||||
", placeHolder=" + placeHolder +
|
||||
", overtimeFee='" + overtimeFee + '\'' +
|
||||
", equipmentInfos=" + equipmentInfos +
|
||||
", additionalProperties=" + additionalProperties +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,137 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.*;
|
||||
import lombok.Getter;
|
||||
import lombok.Setter;
|
||||
|
||||
import javax.persistence.Transient;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-08-06 10:28
|
||||
*/
|
||||
@JsonInclude(JsonInclude.Include.NON_NULL)
|
||||
@JsonPropertyOrder({
|
||||
"StationID",
|
||||
"OperatorID",
|
||||
"EquipmentOwnerID",
|
||||
"StationName",
|
||||
"CountryCode",
|
||||
"AreaCode",
|
||||
"Address",
|
||||
"ServiceTel",
|
||||
"StationType",
|
||||
"StationStatus",
|
||||
"ParkNums",
|
||||
"StationLng",
|
||||
"StationLat",
|
||||
"Construction",
|
||||
"BusineHours",
|
||||
"ElectricityFee",
|
||||
"ServiceFee",
|
||||
"ParkFee",
|
||||
"Payment",
|
||||
"SupportOrder",
|
||||
"OvertimeFee",
|
||||
"EquipmentInfos"
|
||||
})
|
||||
@Getter
|
||||
@Setter
|
||||
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
|
||||
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
|
||||
|
||||
public class StationInfoXinDianTu extends CommonStationInfo{
|
||||
@Transient
|
||||
@JsonProperty("AreaCode")
|
||||
public String areaCode;
|
||||
@Transient
|
||||
@JsonProperty("Address")
|
||||
public String address;
|
||||
@Transient
|
||||
@JsonProperty("ServiceTel")
|
||||
public String serviceTel;
|
||||
@Transient
|
||||
@JsonProperty("StationType")
|
||||
public Integer stationType;
|
||||
@Transient
|
||||
@JsonProperty("StationStatus")
|
||||
public Integer stationStatus;
|
||||
@Transient
|
||||
@JsonProperty("ParkNums")
|
||||
public Integer parkNums;
|
||||
@Transient
|
||||
@JsonProperty("StationLng")
|
||||
public Double stationLng;
|
||||
@Transient
|
||||
@JsonProperty("StationLat")
|
||||
public Double stationLat;
|
||||
@Transient
|
||||
@JsonProperty("Construction")
|
||||
public Long construction;
|
||||
@Transient
|
||||
@JsonProperty("BusineHours")
|
||||
public String busineHours;
|
||||
@Transient
|
||||
@JsonProperty("ElectricityFee")
|
||||
public String electricityFee;
|
||||
@Transient
|
||||
@JsonProperty("ServiceFee")
|
||||
public String serviceFee;
|
||||
@Transient
|
||||
@JsonProperty("ParkFee")
|
||||
public String parkFee;
|
||||
@Transient
|
||||
@JsonProperty("Payment")
|
||||
public String payment;
|
||||
@Transient
|
||||
@JsonProperty("SupportOrder")
|
||||
public Long supportOrder;
|
||||
@Transient
|
||||
@JsonProperty("IncrementExplain")
|
||||
public String incrementExplain;
|
||||
@Transient
|
||||
@JsonProperty("EquipmentInfos")
|
||||
public List<EquipmentInfo> equipmentInfos = null;
|
||||
@Transient
|
||||
@JsonIgnore
|
||||
private Map<String, Object> additionalProperties = new HashMap<String, Object>();
|
||||
|
||||
@JsonAnyGetter
|
||||
public Map<String, Object> getAdditionalProperties() {
|
||||
|
||||
return this.additionalProperties;
|
||||
}
|
||||
|
||||
@JsonAnySetter
|
||||
public void setAdditionalProperty(String name, Object value) {
|
||||
|
||||
this.additionalProperties.put(name, value);
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StationInfoXinDianTu{" +
|
||||
"areaCode='" + areaCode + '\'' +
|
||||
", address='" + address + '\'' +
|
||||
", serviceTel='" + serviceTel + '\'' +
|
||||
", stationType=" + stationType +
|
||||
", stationStatus=" + stationStatus +
|
||||
", parkNums=" + parkNums +
|
||||
", stationLng=" + stationLng +
|
||||
", stationLat=" + stationLat +
|
||||
", construction=" + construction +
|
||||
", busineHours='" + busineHours + '\'' +
|
||||
", electricityFee='" + electricityFee + '\'' +
|
||||
", serviceFee='" + serviceFee + '\'' +
|
||||
", parkFee='" + parkFee + '\'' +
|
||||
", payment='" + payment + '\'' +
|
||||
", supportOrder=" + supportOrder +
|
||||
", incrementExplain='" + incrementExplain + '\'' +
|
||||
", equipmentInfos=" + equipmentInfos +
|
||||
", additionalProperties=" + additionalProperties +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,26 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 占位订单支付通知
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-07-08 17:22
|
||||
*/
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
public class XDTPlaceHolderOrderStatus {
|
||||
|
||||
@JsonProperty("PlaceholderOrderID")
|
||||
String placeholderOrderID;
|
||||
|
||||
@JsonProperty("Status")
|
||||
Integer status;
|
||||
|
||||
@JsonProperty("RefundMoney")
|
||||
Double refundMoney;
|
||||
|
||||
}
|
||||
@ -0,0 +1,18 @@
|
||||
package com.xhpc.evcs.dto;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonInclude;
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.Data;
|
||||
|
||||
/**
|
||||
* 占位费规则查询
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-07-07 11:21
|
||||
*/
|
||||
@Data
|
||||
@JsonInclude(JsonInclude.Include.NON_EMPTY)
|
||||
public class XDTPlaceholderRules {
|
||||
@JsonProperty("StationIDs")
|
||||
String [] stationIDs;
|
||||
}
|
||||
@ -68,17 +68,15 @@ public class Aes128Cbc {
|
||||
public static void main(String[] args) throws BadPaddingException, InvalidAlgorithmParameterException,
|
||||
NoSuchAlgorithmException, IllegalBlockSizeException, UnsupportedEncodingException, NoSuchPaddingException,
|
||||
InvalidKeyException {
|
||||
|
||||
System.out.println(decryptString("8LpncubmWiPCzY3V","8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6"
|
||||
));
|
||||
//ujNoGsWRo5MyPKYOxeofKwgPEng3xF+yhM8DDjwtwHo=
|
||||
System.out.println(encrypt("{\"StationIDs\":[\"1\"]}", "8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6"));
|
||||
System.out.println(encrypt("{\"OperatorID\":\"MA5FNJXW9\", \"OperatorSecret\":\"Ut5UFdqDthiJyncU\"}",
|
||||
"8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6"));
|
||||
|
||||
//{"Ret":0,"Msg":"","Data":"pCA3UNQO1CqxRS6KvcNDpw==","Sig":"FCCCA9489FAD972722FB00E4E207F581"}
|
||||
String responseBody = "{\"Ret\":0,\"Msg\":\"\",\"Data\":\"pCA3UNQO1CqxRS6KvcNDpw==\",\"Sig\":\"FCCCA9489FAD972722FB00E4E207F581\"}";
|
||||
|
||||
try{
|
||||
String date="XvsjHvtpkhS6dBDn/N1gkCPlUOmBIFhxyrYrd+E1nuEmk+jkHbLEYmiKSPpLzxmtvz+ZRXY/N6072RqMlxH9bHX9T6JtbMjmFNP8RvwDFiwK2jW638CIJ2gp+agr7gYKZ6J5fsxCqj8+TGQTYuTdTGhUTy1X9Y7yuv/ptWR2nfh2uPuZYoDyO03umvMSwDS3";
|
||||
String dataSecret="EOAVn9uGuUuLzfCq";
|
||||
String dataSecretIV="ruExy9reF1W1YVMj";
|
||||
String s = decryptString(date, dataSecret, dataSecretIV);
|
||||
System.out.println("=======ss======="+s);
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
@ -78,6 +78,13 @@ public class JSONUtil {
|
||||
}
|
||||
JsonNode gfid = rootNode.path("gf").path("id");
|
||||
System.out.println("gf id: " + gfid.asInt());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@ -4,8 +4,16 @@ import cn.hutool.core.date.DatePattern;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.common.domain.Requirement;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDEquipAuthRequest;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDRequirementInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDRequirementInfoList;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDTaskInfo;
|
||||
import com.xhpc.evcs.cwj.dto.CWJPageRequest;
|
||||
import com.xhpc.evcs.cwj.dto.CWJStartChargeRequest;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.Aes128Cbc;
|
||||
import com.xhpc.evcs.encryption.CryptoMngr;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.encryption.HMAC;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
@ -13,16 +21,14 @@ import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.crypto.BadPaddingException;
|
||||
import javax.crypto.IllegalBlockSizeException;
|
||||
import javax.crypto.NoSuchPaddingException;
|
||||
import javax.crypto.*;
|
||||
import javax.crypto.spec.SecretKeySpec;
|
||||
import java.io.IOException;
|
||||
import java.nio.charset.StandardCharsets;
|
||||
import java.security.InvalidAlgorithmParameterException;
|
||||
import java.security.InvalidKeyException;
|
||||
import java.security.NoSuchAlgorithmException;
|
||||
import java.util.Calendar;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
@RestController()
|
||||
public class CheckChargeOrderController {
|
||||
@ -57,18 +63,62 @@ public class CheckChargeOrderController {
|
||||
public static void main(String[] args) {
|
||||
|
||||
try {
|
||||
CommonRequest<StationStatusRequest> commonRequest = new CommonRequest<>();
|
||||
StationStatusRequest stationStatusRequest =new StationStatusRequest();
|
||||
String[] strings = new String[]{"4"};
|
||||
stationStatusRequest.setStationIds(strings);
|
||||
String data = JSONUtil.toJSONString(stationStatusRequest);
|
||||
// CommonRequest<CDRequirementInfo> commonRequest = new CommonRequest<>();
|
||||
// CDTaskInfo requirementInfo = new CDTaskInfo();
|
||||
// requirementInfo.setTaskName("任务名称");
|
||||
// requirementInfo.setTaskCode("任务编码");
|
||||
// requirementInfo.setDemandDate("2025-07-28");
|
||||
// requirementInfo.setStationID("充电站ID");
|
||||
// requirementInfo.setOperatorID("MA6DFCTD5");
|
||||
// requirementInfo.setEquipmentOwnerID("MA7D6FPW6");
|
||||
// requirementInfo.setEleNo("所属户号");
|
||||
// requirementInfo.setDeliveryTime("2025-07-29 00:00:00");
|
||||
// List<CDRequirementInfoList> list =new ArrayList<>();
|
||||
// CDRequirementInfoList cdRequirementInfoList = new CDRequirementInfoList();
|
||||
// cdRequirementInfoList.setRes(100.0);
|
||||
// cdRequirementInfoList.setStartTime("2025-07-29 00:00:00");
|
||||
// cdRequirementInfoList.setEndTime("2025-07-29 02:00:00");
|
||||
// list.add(cdRequirementInfoList);
|
||||
// requirementInfo.setList(list);
|
||||
// String dataYu = JSONUtil.toJSONString(requirementInfo);
|
||||
// commonRequest.setData(dataYu);
|
||||
// commonRequest.setOperatorId("MA7D6FPW6");
|
||||
|
||||
|
||||
|
||||
|
||||
// String[] st =new String[1];
|
||||
// st[0] = "33";
|
||||
// CommonRequest<XDTPlaceholderRules> commonRequest = new CommonRequest<>();
|
||||
// XDTPlaceholderRules xdtPlaceholderRules = new XDTPlaceholderRules();
|
||||
// xdtPlaceholderRules.setStationIDs(st);
|
||||
CommonRequest<XDTPlaceHolderOrderStatus> commonRequest = new CommonRequest<>();
|
||||
|
||||
XDTPlaceHolderOrderStatus xdtPlaceHolderOrderStatus = new XDTPlaceHolderOrderStatus();
|
||||
xdtPlaceHolderOrderStatus.setPlaceholderOrderID("8083600080000101250806101922");
|
||||
xdtPlaceHolderOrderStatus.setStatus(2);
|
||||
xdtPlaceHolderOrderStatus.setRefundMoney(10.0);
|
||||
String data = JSONUtil.toJSONString(xdtPlaceHolderOrderStatus);
|
||||
commonRequest.setData(data);
|
||||
commonRequest.setOperatorId("MA005DBW1");
|
||||
String s = encryptReqOut("8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6", "wAeYIVQUwd0iGZsV", commonRequest);
|
||||
commonRequest.setOperatorId("MA25CNM38");
|
||||
String s = encryptReqOut("8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6", "Ut5UFdqDthiJyncU", commonRequest);
|
||||
|
||||
|
||||
// CommonRequest<TokenRequest> commonRequestYu = new CommonRequest<>();
|
||||
// TokenRequest tokenRequest = new TokenRequest();
|
||||
// tokenRequest.setOperatorId("MA6DFCTD5");
|
||||
// tokenRequest.setOperatorSecret("7hUeAsYVBrjw8sup");
|
||||
// String data1 = JSONUtil.toJSONString(tokenRequest);
|
||||
// commonRequestYu.setData(data1);
|
||||
// commonRequestYu.setOperatorId("MA6DFCTD5");
|
||||
//
|
||||
// String s = encryptReqOut("YPFVz1OvAS4nSwLW", "5tLoP60aR9QUB5Mx", "S94xUpTpOIlLJBk8", commonRequestYu);
|
||||
|
||||
System.out.println("==========sss==============="+s);
|
||||
|
||||
|
||||
String date= "NR0oe4La+0SLizVoKCDfRkj37avo59qzZBUm7BFSmU+XA81uaP2614Vjbb7VvhRRumS4LwHu6CR981cKMxNM5xCGT+yjGgDwRG4B6xnEJ9upiW7iathKmMrN3lZBkvzstkKcx502kVSMy4x82RBkHUio1KCXoCPIyj9WxpgkJJKnHXaZKrk1Qd6G3xn3MGHvBimnbKssC/bJyD+F9sEp61r5oVPVym7UGSr1GoK9A5sR+j4hrOHeLtlPxgcdJgAuFSXBT75wP2WF1YRsfYppCHh/ERHhIApQ6ym1iAJOE/El/3wehkHLZQAzEMBfEIvtPnpbt9KUItOv16i/GkRR+lrcdcqgrnArOPfKbexWVuqb1zX6/qlQYlQ4yQANrzJ9Dm3KRKtH/sxZ+Uve8d9pJiTAavKpdI9zJwcdywZPOjedoj5X/5GS3bnP/xVofwVgX2l5Vt6Jf4CICDtTHkLREy5ZbwqN5vNPyf+PeF+wp+zCVCXOqBxi+P3hwPVMf/Odm0hEj8byL4ctNmbQZw5A7JcWTrINDOtoeR/C1OYDT+WDj7ZfznJ9y15JllcBAqTFG5GLScvA7kCh4Sk669r6QMbmQek1HYEftVzg8Uh+y+/ItWM1bPfvMUZ9QyyeGJlzWQr/YbxbXdoMqc6STuYkqiLarFUnP3y7lPvomitrdXHub2r9iciCvCDM+WH0WFTFM7rRWdg23D7LahcpBGgObVQpgxuXmnr0SQCVvHKr0Xj6l1o4N/45AAn7JSWPGjclBUNcVOiz1LqVDJaswb8Ymbfgcxqf99Ho0d7nAUvmon4C6IFN3/mmgFSDamGxvIXUTMUtJ9Arj+HP7YQMPGpHgO4ULszzBmh4dR2EQgL4PMSY2smXSzE4DBWYTQ8odMZChm2b5gU/8SBNC89UZFEXNj9/V/J1QqGYiCC18Sp+UNypjpr52MbAV7VDqRWUaovUXnsbnFa8jPHiHOXX9zfvuRuLI22mWLdre4gvmeYBgJ9zweHFdGMBLw7pfKl57/d9GkYP/8yC0QDbtBljd9e605INsY4Va0UJi0oDc1YMKwsXdIbh5zXnN7F0jhOd5uK6rOuBvY5Xo2cvjp2DIUNUsNavaLhkPT9bwmFPICINx1MQkLH4cDB+FYUut7yxFUltGPkd7Vw15nVmFs3ZtCI/OQ2FqX6KtY2aBjlqMc1FG5oQecjLYclgQcWdMLe3jqMqYvM7hGZF1orC65nbztiekl6XQO+pIMcrpkXfjZ9andFK0mBCHLOdUrgvbQeC0ifRdJY+VIfweB+H5IF2934tSF3nD4D+KvLkeg6aqyBFomtw4OWxROmvPF7T7zQWzWETRCDo0pVrBOWKgfByXpsA3BCc/mN7sjJhZTxVcT9OIIJKdBceufAROGtVTmpiVInlUqNRgseT85w6n6PYSNu62jqjLWXP1bFvCRdxHIXn49RfeQMXs8/lAts6DEmD18fU31vtxcWSxAO2W0UAH9YTJuK96Qt8zman1QLiO2U6PRA=";
|
||||
String s2 = decryptString(date, "8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6");
|
||||
System.out.println("===111=======sss==============="+s2);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
@ -92,4 +142,32 @@ public class CheckChargeOrderController {
|
||||
// log.debug("enc to out:{} ", jsonString);
|
||||
return jsonString;
|
||||
}
|
||||
|
||||
|
||||
public static String decryptString(String encryptedMsg, String dataSecret, String dataSecretIV) throws NoSuchAlgorithmException,
|
||||
IllegalBlockSizeException, InvalidKeyException, BadPaddingException,
|
||||
InvalidAlgorithmParameterException, NoSuchPaddingException {
|
||||
|
||||
if (encryptedMsg == null || encryptedMsg.length() == 0) return "";
|
||||
byte[] decryptedBytes = decryptBytes(encryptedMsg, dataSecret, dataSecretIV);
|
||||
return new String(decryptedBytes);
|
||||
}
|
||||
|
||||
public static byte[] decryptBytes(String encryptedMsg, String dataSecret, String dataSecretIV) throws NoSuchAlgorithmException, IllegalBlockSizeException, InvalidKeyException, BadPaddingException, InvalidAlgorithmParameterException, NoSuchPaddingException {
|
||||
|
||||
if (encryptedMsg.startsWith("{") || encryptedMsg.startsWith("[")) {
|
||||
throw new IllegalArgumentException("不是合法的加密字符串");
|
||||
}
|
||||
KeyGenerator keyGenerator = KeyGenerator.getInstance(CryptoMngr.ALGORITHM);
|
||||
keyGenerator.init(128);
|
||||
byte[] ds = (dataSecret).getBytes(StandardCharsets.UTF_8);
|
||||
ds = Arrays.copyOf(ds, 16);
|
||||
SecretKey key = new SecretKeySpec(ds, "AES");
|
||||
byte[] dsiv = (dataSecretIV).getBytes(StandardCharsets.UTF_8);
|
||||
dsiv = Arrays.copyOf(dsiv, 16);
|
||||
SecretKey IV = new SecretKeySpec(dsiv, "AES");
|
||||
byte[] cipherText = Base64.getDecoder().decode(encryptedMsg.getBytes());
|
||||
byte[] decryptedBytes = CryptoMngr.decrypt(key.getEncoded(), IV.getEncoded(), cipherText);
|
||||
return decryptedBytes;
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,52 +0,0 @@
|
||||
package com.xhpc.evcs.api;
|
||||
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.XhpcInternetUser;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RequestHeader;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Calendar;
|
||||
import java.util.UUID;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
|
||||
/**
|
||||
* 占位费查询
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-06-20 15:15
|
||||
*/
|
||||
public class QueryPlaceholderRules {
|
||||
|
||||
/**
|
||||
* 用于平台之间认证Token的申请
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v1/query_placeholder_rules")
|
||||
public CommonResponse qeryPlaceholderRules(@RequestBody CommonRequest<QeryPlaceholderRequest> commonRequest) throws IOException {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
|
||||
QeryPlaceholderRequest request = JSONUtil.readParams(commonRequest.getData(), QeryPlaceholderRequest.class);
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
if (request == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
}else{
|
||||
//获取占位规则信息
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,152 @@
|
||||
package com.xhpc.evcs.api;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.common.api.PileOrderService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.evcs.domain.PlaceholderRules;
|
||||
import com.xhpc.evcs.domain.PriceInfo;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.PlaceholderIOrderRepository;
|
||||
import com.xhpc.evcs.jpa.PlaceholderIRepository;
|
||||
import com.xhpc.evcs.jpa.PlaceholderITimeRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderITime;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderOrder;
|
||||
import com.xhpc.order.domain.XhpcPlacreholder;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 新电图 占位费规则查询
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-07-07 11:19
|
||||
*/
|
||||
@RestController
|
||||
public class QueryPlaceholderRulesController {
|
||||
@Resource
|
||||
private PileOrderService pileOrderService;
|
||||
|
||||
@Autowired
|
||||
private PlaceholderIOrderRepository placeholderIOrderRepository;
|
||||
@Autowired
|
||||
private PlaceholderIRepository placeholderIRepository;
|
||||
@Autowired
|
||||
private PlaceholderITimeRepository placeholderITimeRepository;
|
||||
/**
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/v1/query_placeholder_rules")
|
||||
public CommonResponse queryPlaceholderRules(@RequestBody CommonRequest<XDTPlaceholderRules> commonRequest) throws Exception {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
|
||||
Map<String,Object> map =new HashMap<>();
|
||||
map.put("SuccStat",1);
|
||||
XDTPlaceholderRules placeholderRules = JSONUtil.readParams(commonRequest.getData(), XDTPlaceholderRules.class);
|
||||
if (placeholderRules == null || placeholderRules.getStationIDs().length==0) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
//获取占位规则信息
|
||||
String[] stationIds = placeholderRules.getStationIDs();
|
||||
map.put("SuccStat",0);
|
||||
|
||||
PlaceholderRulesXinDianTu[] placeholderRulesYu = new PlaceholderRulesXinDianTu[stationIds.length];
|
||||
for (int i = 0; i <stationIds.length ; i++) {
|
||||
String stationId = stationIds[i];
|
||||
XhpcPlacreholder xhpcPlacreholder = placeholderIRepository.findByChargingStationIdAndDelFlag(Long.valueOf(stationId), 0);
|
||||
|
||||
PlaceholderRulesXinDianTu placeholderRulesXinDianTu = new PlaceholderRulesXinDianTu();
|
||||
|
||||
placeholderRulesXinDianTu.setStationID(stationId);
|
||||
String startTime = DateUtil.format(xhpcPlacreholder.getStartTime(), "yyyy-MM-dd HH:mm:ss");
|
||||
String endTime = DateUtil.format(xhpcPlacreholder.getEndTime(), "yyyy-MM-dd HH:mm:ss");
|
||||
placeholderRulesXinDianTu.setEffectStartTime(startTime);
|
||||
placeholderRulesXinDianTu.setEffectEndTime(endTime);
|
||||
placeholderRulesXinDianTu.setStatus(xhpcPlacreholder.getStatus());
|
||||
placeholderRulesXinDianTu.setFreeTime(xhpcPlacreholder.getFreeTime());
|
||||
placeholderRulesXinDianTu.setMaxFee(xhpcPlacreholder.getMaxFee().doubleValue());
|
||||
|
||||
List<PriceInfo> priceInfos =new ArrayList<>();
|
||||
List<XhpcPlaceholderITime> xhpcPlaceholderITimeList = placeholderITimeRepository.findByPlaceholderIdAndDelFlagAndChargingStationId(xhpcPlacreholder.getPlaceholderId(), 0,Long.valueOf(stationId));
|
||||
if(xhpcPlaceholderITimeList !=null && xhpcPlaceholderITimeList.size()>0){
|
||||
for (int j = 0; j < xhpcPlaceholderITimeList.size(); j++) {
|
||||
XhpcPlaceholderITime xhpcPlaceholderTimeOrder = xhpcPlaceholderITimeList.get(j);
|
||||
PriceInfo placeHolderPrice = new PriceInfo();
|
||||
placeHolderPrice.setStartTime(DateUtil.format(xhpcPlaceholderTimeOrder.getStartTime(),"HH:mm:ss"));
|
||||
placeHolderPrice.setPrice(xhpcPlaceholderTimeOrder.getPrice().doubleValue());
|
||||
priceInfos.add(placeHolderPrice);
|
||||
}
|
||||
}
|
||||
placeholderRulesXinDianTu.setPriceInfos(priceInfos);
|
||||
|
||||
placeholderRulesYu[i] = placeholderRulesXinDianTu;
|
||||
}
|
||||
|
||||
map.put("PlaceholderRules",placeholderRulesYu);
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
resp.setData(JSONUtil.toJSONString(map));
|
||||
|
||||
// R r = pileOrderService.getPlaceholderIDs(placeholderRules.getStationIDs());
|
||||
// if(r.getCode()==200){
|
||||
// map.put("SuccStat",0);
|
||||
// List<PlaceholderRules> placeholderIDs = (List<PlaceholderRules>) r.getData();
|
||||
// map.put("PlaceholderRules",placeholderIDs);
|
||||
// resp.setRet(EvcsConst.RET_SUCC);
|
||||
// resp.setData(JSONUtil.toJSONString(map));
|
||||
// }
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
@PostMapping(value = "/v1/notification_placeHolder_order_status")
|
||||
public CommonResponse notificationPlaceHolderOrderStatus(@RequestBody CommonRequest<XDTPlaceHolderOrderStatus> commonRequest) throws Exception {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
|
||||
Map<String,Object> map =new HashMap<>();
|
||||
map.put("SuccStat",1);
|
||||
XDTPlaceHolderOrderStatus placeholderRules = JSONUtil.readParams(commonRequest.getData(), XDTPlaceHolderOrderStatus.class);
|
||||
if (placeholderRules == null ) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
String placeholderOrderID = placeholderRules.getPlaceholderOrderID();
|
||||
|
||||
XhpcPlaceholderOrder xhpcPlaceholderOrder = placeholderIOrderRepository.findByPlaceholderOrderNumber(placeholderOrderID);
|
||||
|
||||
if(xhpcPlaceholderOrder!=null){
|
||||
map.put("SuccStat",0);
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
xhpcPlaceholderOrder.setUserStatus(placeholderRules.getStatus());
|
||||
if(placeholderRules.getStatus()==1){
|
||||
xhpcPlaceholderOrder.setRechargeMoney(new BigDecimal(placeholderRules.getRefundMoney()));
|
||||
}else{
|
||||
xhpcPlaceholderOrder.setRefundMoney(xhpcPlaceholderOrder.getTotalMoney());
|
||||
}
|
||||
placeholderIOrderRepository.save(xhpcPlaceholderOrder);
|
||||
}else{
|
||||
map.put("SuccStat",1);
|
||||
map.put("FailReason","无此订单");
|
||||
}
|
||||
resp.setData(JSONUtil.toJSONString(map));
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -4,31 +4,41 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import com.xhpc.common.api.PileOrderService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.DateUtils;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.domain.XhpcChargingStation;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.dto.StartChargeRequest;
|
||||
import com.xhpc.evcs.dto.StartChargeResponse;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.*;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.notification.NotificationStartChargeResultTask;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.Executor;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.genOrder;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
@RestController
|
||||
public class QueryStartChargeController {
|
||||
public class QueryStartChargeController extends CoreDispatcher {
|
||||
|
||||
@Autowired
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@ -45,6 +55,8 @@ public class QueryStartChargeController {
|
||||
@Autowired
|
||||
private XhpcChargingStationRepository xhpcChargingStationRepository;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(QueryStartChargeController.class);
|
||||
private final ExecutorService asyncExecutor = Executors.newFixedThreadPool(40);
|
||||
/**
|
||||
* 请求启动充电
|
||||
* @param commonRequest
|
||||
@ -56,6 +68,8 @@ public class QueryStartChargeController {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
Map<String, Object> pushOrder = new HashMap<>();
|
||||
String orderNo ="";
|
||||
StartChargeRequest startChargeRequest = JSONUtil.readParams(commonRequest.getData(), StartChargeRequest.class);
|
||||
if (startChargeRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
@ -107,7 +121,7 @@ public class QueryStartChargeController {
|
||||
startChargeResponse.setStartChargeSeqStat(1);
|
||||
startChargeResponse.setSuccStat(0);
|
||||
startChargeResponse.setFailReason(0);
|
||||
Map<String, Object> pushOrder = new HashMap<>();
|
||||
|
||||
pushOrder.put("startChargeSeqStat", 1);
|
||||
pushOrder.put("internetSerialNumber", startChargeRequest.getStartChargeSeq());
|
||||
pushOrder.put("connectorID", connectorId);
|
||||
@ -115,7 +129,7 @@ public class QueryStartChargeController {
|
||||
pushOrder.put("chargeOrderInfoNotificationStat", 0);
|
||||
pushOrder.put("operatorId3rdpty", startChargeSeq.substring(0, 9));
|
||||
pushOrder.put("startTime", etOrderData.get("startTime"));
|
||||
String orderNo = (String) etOrderData.get("orderNo");
|
||||
orderNo = (String) etOrderData.get("orderNo");
|
||||
etOrderMapping.setXhOrderNo(orderNo);
|
||||
REDIS.setCacheMap("pushOrder:".concat(orderNo), pushOrder);
|
||||
} else {
|
||||
@ -127,6 +141,15 @@ public class QueryStartChargeController {
|
||||
resp.setData(JSONUtil.toJSONString(startChargeResponse));
|
||||
}
|
||||
}
|
||||
|
||||
if("0".equals(resp.getRet())){
|
||||
String finalOrderNo = orderNo;
|
||||
CompletableFuture.runAsync(()->{
|
||||
System.out.println(">>> 异步回复 <<<");
|
||||
processRequest(pushOrder,startChargeRequest.getStartChargeSeq(), finalOrderNo);
|
||||
},asyncExecutor);
|
||||
}
|
||||
System.out.println(">>> 回复启动结果 <<<");
|
||||
return resp;
|
||||
}
|
||||
|
||||
@ -161,4 +184,51 @@ public class QueryStartChargeController {
|
||||
}
|
||||
|
||||
|
||||
public void notify(NotificationStartChargeResultRequestData notificationStartChargeResultRequestData,
|
||||
AuthSecretToken authSecretTokenOut, String orderNo, String startChargeSeq) throws IOException {
|
||||
|
||||
String data = JSONUtil.toJSONString(notificationStartChargeResultRequestData);
|
||||
|
||||
CommonRequest<NotificationStartChargeResultRequestData> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_start_charge_result", authSecretTokenOut);
|
||||
logger.info("==========第三方调用启动充电接口=====启动推送结果=====responseBody======================="+responseBody+"=================orderNo================="+orderNo);
|
||||
NotificationStartStopChargeResultResponse notificationStartStopChargeResultResponse =DTOJsonHelper.parseResponseData(responseBody,NotificationStartStopChargeResultResponse.class, authSecretTokenOut);
|
||||
|
||||
if (null != notificationStartStopChargeResultResponse) {
|
||||
//Ensuring that only when startChargeNotificationStat equals 1 won't be notified.
|
||||
if (notificationStartStopChargeResultResponse.getSuccStat() == 0) {
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(orderNo), "startChargeNotificationStat", 1);
|
||||
} else {
|
||||
Integer startChargeNotificationStat = REDIS.getCacheMapValue("pushOrder:".concat(orderNo),
|
||||
"startChargeNotificationStat");
|
||||
if (startChargeNotificationStat == 0) {
|
||||
startChargeNotificationStat = 2;
|
||||
} else {
|
||||
++startChargeNotificationStat;
|
||||
}
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(orderNo), "startChargeNotificationStat",startChargeNotificationStat);
|
||||
throw new RuntimeException(String.format("push CD start charge order status [%s] failed: %s",notificationStartChargeResultRequestData.getStartChargeSeq(), responseBody));
|
||||
}
|
||||
}
|
||||
}
|
||||
@Async
|
||||
public void processRequest(Map<String, Object> pushOrder,String startChargeSeq,String orderNo){
|
||||
System.out.println(">>> 开始执行后续操作 <<<");
|
||||
try{
|
||||
//推送启动成功数据
|
||||
String operatorId = startChargeSeq.substring(0, 9);
|
||||
Optional<AuthSecretToken> authSecretToken =authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId,SECRET_TOKEN_TYPE_OUT);
|
||||
if (authSecretToken.isPresent()) {
|
||||
NotificationStartChargeResultRequestData notificationStartChargeResultRequestData = new NotificationStartChargeResultRequestData();
|
||||
notificationStartChargeResultRequestData.setStartTime((String) pushOrder.get("startTime"));
|
||||
notificationStartChargeResultRequestData.setStartChargeSeq(startChargeSeq);
|
||||
notificationStartChargeResultRequestData.setConnectorId((String) pushOrder.get("connectorID"));
|
||||
notificationStartChargeResultRequestData.setStartChargeSeqStat((Integer) pushOrder.get("startChargeSeqStat"));
|
||||
notify(notificationStartChargeResultRequestData, authSecretToken.get(), orderNo,startChargeSeq);
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("==========第三方调用启动充电接口=====启动推送失败=====responseBody=======================");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@ -1,5 +1,6 @@
|
||||
package com.xhpc.evcs.api;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.evcs.domain.XhpcChargingPile;
|
||||
@ -7,11 +8,12 @@ import com.xhpc.evcs.domain.XhpcChargingStation;
|
||||
import com.xhpc.evcs.domain.XhpcInternetUser;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.jpa.XhpcChargingPileRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcChargingStationRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcInternetUserRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||
import com.xhpc.evcs.jpa.*;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderITime;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderTimeOrder;
|
||||
import com.xhpc.order.domain.XhpcPlacreholder;
|
||||
import io.lettuce.core.ScriptOutputType;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
@ -41,6 +43,11 @@ public class QueryStationsInfoController {
|
||||
private XhpcChargingStationRepository xhpcChargingStationRepository;
|
||||
@Autowired
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Autowired
|
||||
private PlaceholderIRepository placeholderIRepository;
|
||||
@Autowired
|
||||
private PlaceholderITimeRepository placeholderITimeRepository;
|
||||
|
||||
private final String[] GUNNAMES = {"", "A", "B", "C", "D"};
|
||||
|
||||
/**
|
||||
@ -55,15 +62,313 @@ public class QueryStationsInfoController {
|
||||
CommonResponse resp = new CommonResponse();
|
||||
//当前页数
|
||||
PageRequest pageRequest = commonRequest.transformDataType(PageRequest.class);
|
||||
//页码总数
|
||||
String operatorId = commonRequest.getOperatorId();
|
||||
if("MA005DBW1".equals(operatorId)){
|
||||
Integer pageNo = pageRequest.getPageNo();
|
||||
PageStationsInfoResponseKuaiDian response = new PageStationsInfoResponseKuaiDian();
|
||||
response.setPageNo(pageNo);
|
||||
Instant now = Instant.now();
|
||||
XhpcInternetUser xhpcInternetUser =xhpcInternetUserRepository.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(operatorId, now, now);
|
||||
if (xhpcInternetUser == null) {
|
||||
resp.setRet("1");
|
||||
resp.setMsg("Not valid internet user/OperatorID");
|
||||
resp.setData(JSONUtil.toJSONString(response));
|
||||
} else {
|
||||
Long internetUserId = xhpcInternetUser.getInternetUserId();
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist =
|
||||
xhpcStationInternetBlacklistRepo.findByInternetUserId(internetUserId);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
List<String> validStationKeys = new ArrayList<>();
|
||||
for (String stationKey : stationKeys) {
|
||||
boolean isValid = true;
|
||||
//查询不合作的电桩
|
||||
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
|
||||
if (stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationKey);
|
||||
if (chargingStationDto.getPiles() != null) {
|
||||
if (isValid) {
|
||||
validStationKeys.add(stationKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (validStationKeys.size() > 0) {
|
||||
Integer pageSize = pageRequest.getPageSize();
|
||||
int totalPage = validStationKeys.size() % pageSize == 0 ? validStationKeys.size() / pageSize :
|
||||
(validStationKeys.size() / pageSize) + 1;
|
||||
response.setPageCount(totalPage);
|
||||
}
|
||||
//总记录条数
|
||||
response.setItemSize(validStationKeys.size());
|
||||
|
||||
//充电站信息列表
|
||||
List<StationInfoKuaiDian> stationInfos = new ArrayList<>();
|
||||
//计算每页开始索引
|
||||
int startIndex = -1;
|
||||
int endIndex = -1;
|
||||
if (pageNo == 1 && validStationKeys.size() <= 10) {
|
||||
startIndex = 0;
|
||||
endIndex = validStationKeys.size() - 1;
|
||||
} else {
|
||||
Integer pageSize = pageRequest.getPageSize();
|
||||
startIndex = (pageNo - 1) * pageSize;
|
||||
endIndex = startIndex + (pageSize - 1);
|
||||
}
|
||||
for (int i = startIndex; i <= endIndex; i++) {
|
||||
String stationKey = null;
|
||||
try {
|
||||
stationKey = validStationKeys.get(i);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationKey);
|
||||
StationInfoKuaiDian stationInfo = new StationInfoKuaiDian();
|
||||
//站点状态
|
||||
stationInfo.setStationStatus(50);
|
||||
//充电站Id
|
||||
String stationId = stationKey.replace("station:", "");
|
||||
stationInfo.setStationId(stationId);
|
||||
Double lat = chargingStationDto.getLat();
|
||||
if (lat == null) {
|
||||
XhpcChargingStation stationExample = new XhpcChargingStation();
|
||||
stationExample.setId(Long.parseLong(stationId));
|
||||
Example<XhpcChargingStation> example = Example.of(stationExample);
|
||||
XhpcChargingStation xhpcChargingStation =
|
||||
xhpcChargingStationRepository.findOne(example).orElse(null);
|
||||
if (xhpcChargingStation != null) {
|
||||
//纬度
|
||||
chargingStationDto.setLat(new BigDecimal(xhpcChargingStation.getLatitude()).setScale(6,
|
||||
RoundingMode.HALF_UP).doubleValue());
|
||||
//经度
|
||||
chargingStationDto.setLng(new BigDecimal(xhpcChargingStation.getLongitude()).setScale(6,
|
||||
RoundingMode.HALF_UP).doubleValue());
|
||||
//站点类型
|
||||
chargingStationDto.setType(xhpcChargingStation.getType());
|
||||
//运营商id
|
||||
String operatorIdEvcs = xhpcChargingStation.getOperatorIdEvcs();
|
||||
chargingStationDto.setOperatorId(operatorIdEvcs == null ? "MA6DFCTD5"
|
||||
: operatorIdEvcs.length() == 9 ? operatorId : operatorIdEvcs.substring(8, 17));
|
||||
//详细地址
|
||||
chargingStationDto.setAddress(xhpcChargingStation.getAddress());
|
||||
//充电站省直辖区编码
|
||||
chargingStationDto.setAreaCode(xhpcChargingStation.getAreaCode().toString());
|
||||
//充电站名称
|
||||
chargingStationDto.setName(xhpcChargingStation.getName());
|
||||
//服务电话
|
||||
chargingStationDto.setServiceTel(xhpcChargingStation.getServiceTel());
|
||||
//车位数量
|
||||
chargingStationDto.setParkNums(xhpcChargingStation.getParkNums());
|
||||
chargingStationDto.setParkFee(xhpcChargingStation.getParkingInstructions());
|
||||
REDIS.setCacheObject(stationKey, chargingStationDto);
|
||||
}
|
||||
}
|
||||
stationInfo.setOperatorId(chargingStationDto.getOperatorId());
|
||||
stationInfo.setEquipmentOwnerId(chargingStationDto.getOperatorId());
|
||||
stationInfo.setStationName(chargingStationDto.getName());
|
||||
stationInfo.setCountryCode("CN");
|
||||
stationInfo.setAreaCode(chargingStationDto.getAreaCode());
|
||||
stationInfo.setAddress(chargingStationDto.getAddress());
|
||||
stationInfo.setServiceTel(chargingStationDto.getServiceTel());
|
||||
stationInfo.setStationType(chargingStationDto.getType());
|
||||
stationInfo.setParkNums(chargingStationDto.getParkNums());
|
||||
stationInfo.setStationLng(chargingStationDto.getLng());
|
||||
stationInfo.setStationLat(chargingStationDto.getLat());
|
||||
stationInfo.setConstruction(chargingStationDto.getConstruction());
|
||||
stationInfo.setParkFee(chargingStationDto.getParkFee());
|
||||
String[] fees = getFees(chargingStationDto.getRateModelId());
|
||||
if (fees != null) {
|
||||
stationInfo.setElectricityFee(fees[0]);
|
||||
stationInfo.setServiceFee(fees[1]);
|
||||
}
|
||||
//获取该充电站的下的所有充电设备列表
|
||||
Set<String> piles = chargingStationDto.getPiles();
|
||||
List<EquipmentInfo> equipmentInfos = getEquipmentInfos(piles);
|
||||
stationInfo.setEquipmentInfos(equipmentInfos);
|
||||
|
||||
Long chargingStationId =Long.valueOf(stationInfo.getStationId());
|
||||
//获取占位信息
|
||||
XhpcPlacreholder xhpcPlacreholder = placeholderIRepository.findByStatusAndChargingStationIdAndDelFlag(1,chargingStationId, 0);
|
||||
if(xhpcPlacreholder !=null){
|
||||
PlaceHolder placeHolder = new PlaceHolder();
|
||||
placeHolder.setFreeTime(xhpcPlacreholder.getFreeTime());
|
||||
placeHolder.setMaxFee(xhpcPlacreholder.getMaxFee());
|
||||
|
||||
String startTime = DateUtil.format(xhpcPlacreholder.getStartTime(), "yyyy-MM-dd HH:mm:ss");
|
||||
String endTime = DateUtil.format(xhpcPlacreholder.getEndTime(), "yyyy-MM-dd HH:mm:ss");
|
||||
placeHolder.setEffectStartTime(DateUtil.parse(startTime,"yyyy-MM-dd HH:mm:ss"));
|
||||
placeHolder.setEffectEndTime(DateUtil.parse(endTime,"yyyy-MM-dd HH:mm:ss"));
|
||||
|
||||
List<PlaceHolderPrice> placeHolderPrices =new ArrayList<>();
|
||||
List<XhpcPlaceholderITime> xhpcPlaceholderITimeList = placeholderITimeRepository.findByPlaceholderIdAndDelFlagAndChargingStationId(xhpcPlacreholder.getPlaceholderId(), 0,chargingStationId);
|
||||
if(xhpcPlaceholderITimeList !=null && xhpcPlaceholderITimeList.size()>0){
|
||||
for (int j = 0; j < xhpcPlaceholderITimeList.size(); j++) {
|
||||
XhpcPlaceholderITime xhpcPlaceholderTimeOrder = xhpcPlaceholderITimeList.get(j);
|
||||
PlaceHolderPrice placeHolderPrice = new PlaceHolderPrice();
|
||||
placeHolderPrice.setStartTime(DateUtil.format(xhpcPlaceholderTimeOrder.getStartTime(),"HH:mm:ss"));
|
||||
placeHolderPrice.setEndTime(DateUtil.format(xhpcPlaceholderTimeOrder.getEndTime(),"HH:mm:ss"));
|
||||
placeHolderPrice.setPrice(xhpcPlaceholderTimeOrder.getPrice());
|
||||
placeHolderPrices.add(placeHolderPrice);
|
||||
}
|
||||
|
||||
placeHolder.setPlaceHolderPrices(placeHolderPrices);
|
||||
|
||||
stationInfo.setPlaceHolder(placeHolder);
|
||||
stationInfo.setOvertimeFee(xhpcPlacreholder.getContent());
|
||||
}
|
||||
}
|
||||
stationInfos.add(stationInfo);
|
||||
}
|
||||
response.setStationInfos(stationInfos);
|
||||
resp.setRet("0");
|
||||
resp.setMsg("Query station info success");
|
||||
resp.setData(JSONUtil.toJSONString(response));
|
||||
}
|
||||
return resp;
|
||||
}else if("MA25CNM38".equals(operatorId)){
|
||||
Integer pageNo = pageRequest.getPageNo();
|
||||
PageStationsInfoResponseXinDianTu response = new PageStationsInfoResponseXinDianTu();
|
||||
response.setPageNo(pageNo);
|
||||
Instant now = Instant.now();
|
||||
XhpcInternetUser xhpcInternetUser =xhpcInternetUserRepository.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(operatorId, now, now);
|
||||
if (xhpcInternetUser == null) {
|
||||
resp.setRet("1");
|
||||
resp.setMsg("Not valid internet user/OperatorID");
|
||||
resp.setData(JSONUtil.toJSONString(response));
|
||||
} else {
|
||||
Long internetUserId = xhpcInternetUser.getInternetUserId();
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist =
|
||||
xhpcStationInternetBlacklistRepo.findByInternetUserId(internetUserId);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
List<String> validStationKeys = new ArrayList<>();
|
||||
for (String stationKey : stationKeys) {
|
||||
boolean isValid = true;
|
||||
//查询不合作的电桩
|
||||
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
|
||||
if (stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationKey);
|
||||
if (chargingStationDto.getPiles() != null) {
|
||||
if (isValid) {
|
||||
validStationKeys.add(stationKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (validStationKeys.size() > 0) {
|
||||
Integer pageSize = pageRequest.getPageSize();
|
||||
int totalPage = validStationKeys.size() % pageSize == 0 ? validStationKeys.size() / pageSize :
|
||||
(validStationKeys.size() / pageSize) + 1;
|
||||
response.setPageCount(totalPage);
|
||||
}
|
||||
//总记录条数
|
||||
response.setItemSize(validStationKeys.size());
|
||||
|
||||
//充电站信息列表
|
||||
List<StationInfoXinDianTu> stationInfos = new ArrayList<>();
|
||||
//计算每页开始索引
|
||||
int startIndex = -1;
|
||||
int endIndex = -1;
|
||||
if (pageNo == 1 && validStationKeys.size() <= 10) {
|
||||
startIndex = 0;
|
||||
endIndex = validStationKeys.size() - 1;
|
||||
} else {
|
||||
Integer pageSize = pageRequest.getPageSize();
|
||||
startIndex = (pageNo - 1) * pageSize;
|
||||
endIndex = startIndex + (pageSize - 1);
|
||||
}
|
||||
for (int i = startIndex; i <= endIndex; i++) {
|
||||
String stationKey = null;
|
||||
try {
|
||||
stationKey = validStationKeys.get(i);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationKey);
|
||||
StationInfoXinDianTu stationInfo = new StationInfoXinDianTu();
|
||||
//站点状态
|
||||
stationInfo.setStationStatus(50);
|
||||
//充电站Id
|
||||
String stationId = stationKey.replace("station:", "");
|
||||
stationInfo.setStationId(stationId);
|
||||
Double lat = chargingStationDto.getLat();
|
||||
if (lat == null) {
|
||||
XhpcChargingStation stationExample = new XhpcChargingStation();
|
||||
stationExample.setId(Long.parseLong(stationId));
|
||||
Example<XhpcChargingStation> example = Example.of(stationExample);
|
||||
XhpcChargingStation xhpcChargingStation =
|
||||
xhpcChargingStationRepository.findOne(example).orElse(null);
|
||||
if (xhpcChargingStation != null) {
|
||||
//纬度
|
||||
chargingStationDto.setLat(new BigDecimal(xhpcChargingStation.getLatitude()).setScale(6,
|
||||
RoundingMode.HALF_UP).doubleValue());
|
||||
//经度
|
||||
chargingStationDto.setLng(new BigDecimal(xhpcChargingStation.getLongitude()).setScale(6,
|
||||
RoundingMode.HALF_UP).doubleValue());
|
||||
//站点类型
|
||||
chargingStationDto.setType(xhpcChargingStation.getType());
|
||||
//运营商id
|
||||
String operatorIdEvcs = xhpcChargingStation.getOperatorIdEvcs();
|
||||
chargingStationDto.setOperatorId(operatorIdEvcs == null ? "MA6DFCTD5"
|
||||
: operatorIdEvcs.length() == 9 ? operatorId : operatorIdEvcs.substring(8, 17));
|
||||
//详细地址
|
||||
chargingStationDto.setAddress(xhpcChargingStation.getAddress());
|
||||
//充电站省直辖区编码
|
||||
chargingStationDto.setAreaCode(xhpcChargingStation.getAreaCode().toString());
|
||||
//充电站名称
|
||||
chargingStationDto.setName(xhpcChargingStation.getName());
|
||||
//服务电话
|
||||
chargingStationDto.setServiceTel(xhpcChargingStation.getServiceTel());
|
||||
//车位数量
|
||||
chargingStationDto.setParkNums(xhpcChargingStation.getParkNums());
|
||||
chargingStationDto.setParkFee(xhpcChargingStation.getParkingInstructions());
|
||||
REDIS.setCacheObject(stationKey, chargingStationDto);
|
||||
}
|
||||
}
|
||||
stationInfo.setOperatorId(chargingStationDto.getOperatorId());
|
||||
stationInfo.setEquipmentOwnerId(chargingStationDto.getOperatorId());
|
||||
stationInfo.setStationName(chargingStationDto.getName());
|
||||
stationInfo.setCountryCode("CN");
|
||||
stationInfo.setAreaCode(chargingStationDto.getAreaCode());
|
||||
stationInfo.setAddress(chargingStationDto.getAddress());
|
||||
stationInfo.setServiceTel(chargingStationDto.getServiceTel());
|
||||
stationInfo.setStationType(chargingStationDto.getType());
|
||||
stationInfo.setParkNums(chargingStationDto.getParkNums());
|
||||
stationInfo.setStationLng(chargingStationDto.getLng());
|
||||
stationInfo.setStationLat(chargingStationDto.getLat());
|
||||
stationInfo.setConstruction(chargingStationDto.getConstruction());
|
||||
stationInfo.setParkFee(chargingStationDto.getParkFee());
|
||||
String[] fees = getFees(chargingStationDto.getRateModelId());
|
||||
if (fees != null) {
|
||||
stationInfo.setElectricityFee(fees[0]);
|
||||
stationInfo.setServiceFee(fees[1]);
|
||||
}
|
||||
Long chargingStationId =Long.valueOf(stationInfo.getStationId());
|
||||
//获取占位信息
|
||||
XhpcPlacreholder xhpcPlacreholder = placeholderIRepository.findByStatusAndChargingStationIdAndDelFlag(1,chargingStationId, 0);
|
||||
if(xhpcPlacreholder !=null){
|
||||
stationInfo.setIncrementExplain(xhpcPlacreholder.getContent());
|
||||
}
|
||||
//获取该充电站的下的所有充电设备列表
|
||||
Set<String> piles = chargingStationDto.getPiles();
|
||||
List<EquipmentInfo> equipmentInfos = getEquipmentInfos(piles);
|
||||
stationInfo.setEquipmentInfos(equipmentInfos);
|
||||
stationInfos.add(stationInfo);
|
||||
}
|
||||
response.setStationInfos(stationInfos);
|
||||
resp.setRet("0");
|
||||
resp.setMsg("Query station info success");
|
||||
resp.setData(JSONUtil.toJSONString(response));
|
||||
}
|
||||
}else{
|
||||
Integer pageNo = pageRequest.getPageNo();
|
||||
PageStationsInfoResponse response = new PageStationsInfoResponse();
|
||||
response.setPageNo(pageNo);
|
||||
//页码总数
|
||||
String operatorId = commonRequest.getOperatorId();
|
||||
Instant now = Instant.now();
|
||||
XhpcInternetUser xhpcInternetUser =
|
||||
xhpcInternetUserRepository
|
||||
.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(operatorId, now, now);
|
||||
XhpcInternetUser xhpcInternetUser =xhpcInternetUserRepository.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(operatorId, now, now);
|
||||
if (xhpcInternetUser == null) {
|
||||
resp.setRet("1");
|
||||
resp.setMsg("Not valid internet user/OperatorID");
|
||||
@ -188,6 +493,7 @@ public class QueryStationsInfoController {
|
||||
resp.setMsg("Query station info success");
|
||||
resp.setData(JSONUtil.toJSONString(response));
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
@ -231,9 +537,9 @@ public class QueryStationsInfoController {
|
||||
endTf = String.format("%02d", i / 2).concat(":00");
|
||||
}
|
||||
String electfrm =
|
||||
startTf.concat("~").concat(endTf).concat(",").concat(BigDecimal.valueOf(elecPrice).divide(BigDecimal.valueOf(100000L)).setScale(2).toString());
|
||||
startTf.concat("~").concat(endTf).concat(",").concat(BigDecimal.valueOf(elecPrice).divide(BigDecimal.valueOf(100000L)).setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
||||
String svcfrm =
|
||||
startTf.concat("~").concat(endTf).concat(",").concat(BigDecimal.valueOf(svcPrice).divide(BigDecimal.valueOf(100000L)).setScale(2).toString());
|
||||
startTf.concat("~").concat(endTf).concat(",").concat(BigDecimal.valueOf(svcPrice).divide(BigDecimal.valueOf(100000L)).setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
||||
previousTf = tfPricesSeq[i];
|
||||
startTf = endTf;
|
||||
tfrmes.add(electfrm);
|
||||
@ -242,9 +548,9 @@ public class QueryStationsInfoController {
|
||||
if (i == 47 && !endTf.startsWith("24:00")) {
|
||||
endTf = "24:00";
|
||||
String electfrm =
|
||||
startTf.concat("~").concat(endTf).concat(",").concat(BigDecimal.valueOf(elecPrice).divide(BigDecimal.valueOf(100000L)).setScale(2).toString());
|
||||
startTf.concat("~").concat(endTf).concat(",").concat(BigDecimal.valueOf(elecPrice).divide(BigDecimal.valueOf(100000L)).setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
||||
String svcfrm =
|
||||
startTf.concat("~").concat(endTf).concat(",").concat(BigDecimal.valueOf(svcPrice).divide(BigDecimal.valueOf(100000L)).setScale(2).toString());
|
||||
startTf.concat("~").concat(endTf).concat(",").concat(BigDecimal.valueOf(svcPrice).divide(BigDecimal.valueOf(100000L)).setScale(2,BigDecimal.ROUND_HALF_UP).toString());
|
||||
tfrmes.add(electfrm);
|
||||
tfrmss.add(svcfrm);
|
||||
}
|
||||
|
||||
@ -3,30 +3,40 @@ package com.xhpc.evcs.api;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.data.redis.CacheOrderData;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.domain.XhpcChargingPile;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.dto.QueryStopChargeRequest;
|
||||
import com.xhpc.evcs.dto.QueryStopChargeResponse;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.OrderMappingRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcChargingPileRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Async;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.CompletableFuture;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class QueryStopChargeController {
|
||||
public class QueryStopChargeController extends CoreDispatcher {
|
||||
|
||||
|
||||
@Autowired
|
||||
@ -34,10 +44,13 @@ public class QueryStopChargeController {
|
||||
//三方订单与redis内部订单映射表
|
||||
@Autowired
|
||||
private OrderMappingRepository etOrderMappingRepo;
|
||||
|
||||
@Autowired
|
||||
private XhpcChargingPileRepository XhpcChargingPileRepository;
|
||||
@Autowired
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(QueryStopChargeController.class);
|
||||
private final ExecutorService asyncExecutor = Executors.newFixedThreadPool(40);
|
||||
/**
|
||||
* 请求停止充电
|
||||
* @param commonRequest
|
||||
@ -51,7 +64,9 @@ public class QueryStopChargeController {
|
||||
commonResponse.setRet(EvcsConst.RET_FAIL);
|
||||
QueryStopChargeRequest queryStopChargeRequest = JSONUtil.readParams(commonRequest.getData(),
|
||||
QueryStopChargeRequest.class);
|
||||
String orderNo="";
|
||||
if (queryStopChargeRequest == null) {
|
||||
|
||||
commonResponse.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
// evcs电订单号(27位)
|
||||
@ -64,6 +79,7 @@ public class QueryStopChargeController {
|
||||
return failCommonResponse(queryStopChargeResponse, "错误的充电订单号");
|
||||
}
|
||||
String xhOrderNo = etOrderMapping.getXhOrderNo();
|
||||
orderNo = xhOrderNo;
|
||||
String pushOrderkey = "pushOrder:".concat(xhOrderNo);
|
||||
Map<String, Object> pushOrder = REDIS.getCacheMap(pushOrderkey);
|
||||
if (pushOrder == null || (pushOrder.get("isStopNotified") != null && (Boolean) pushOrder.get("isStopNotified"))) {
|
||||
@ -76,7 +92,7 @@ public class QueryStopChargeController {
|
||||
XhpcChargingPile pileInfo = XhpcChargingPileRepository.findBySerialNumber(pileNum).orElse(null);
|
||||
String versionNum = pileInfo.getCommunicationProtocolVersion() != null ?
|
||||
pileInfo.getCommunicationProtocolVersion() :
|
||||
"0A";
|
||||
"0C";
|
||||
//给对应的枪发送停止充电指令
|
||||
|
||||
R r = powerPileService.stopCharging(xhOrderNo, pileNum, connectorId, versionNum);
|
||||
@ -116,14 +132,24 @@ public class QueryStopChargeController {
|
||||
order.replace("status", "已结束");
|
||||
REDIS.setCacheMap("order:".concat(xhOrderNo), order);
|
||||
REDIS.setCacheMap(pushOrderkey, pushOrder);
|
||||
queryStopChargeResponse.setStartChargeSeqStat(3);
|
||||
queryStopChargeResponse.setStartChargeSeqStat(4);
|
||||
queryStopChargeResponse.setSuccStat(0);
|
||||
queryStopChargeResponse.setFailReason(0);
|
||||
String data = JSONUtil.toJSONString(queryStopChargeResponse);
|
||||
System.out.println("=====请求停止充电==query_stop_charge========="+data);
|
||||
commonResponse.setRet("0");
|
||||
commonResponse.setMsg("请求停止充电成功");
|
||||
commonResponse.setData(data);
|
||||
}
|
||||
|
||||
if("0".equals(commonResponse.getRet())){
|
||||
String finalOrderNo = orderNo;
|
||||
CompletableFuture.runAsync(()->{
|
||||
processRequest(finalOrderNo);
|
||||
},asyncExecutor);
|
||||
}
|
||||
System.out.println(">>> 回复停止结果 <<<");
|
||||
|
||||
return commonResponse;
|
||||
}
|
||||
|
||||
@ -140,4 +166,45 @@ public class QueryStopChargeController {
|
||||
return commonResponse;
|
||||
}
|
||||
|
||||
|
||||
@Async
|
||||
public void processRequest(String orderNo){
|
||||
System.out.println(">>> 开始执行后续操作 <<<");
|
||||
try{
|
||||
//推送停止成功数据
|
||||
String pushOrderKey ="pushOrder:"+orderNo;
|
||||
String orderkey = "order:".concat(orderNo);
|
||||
CacheOrderData orderData = REDIS.getCacheMapValue(orderkey, "orderData");
|
||||
Map<String, Object> pushOrder = REDIS.getCacheMap(pushOrderKey);
|
||||
if (orderData != null || (pushOrder != null && pushOrder.get("startChargeSeqStat") != null && (Integer) pushOrder.get("startChargeSeqStat") > 3)) {
|
||||
Boolean isStopNotified = (Boolean) pushOrder.get("isStopNotified");
|
||||
if (isStopNotified == null || !isStopNotified) {
|
||||
String internetSerialNumber = (String) pushOrder.get("internetSerialNumber");
|
||||
if (internetSerialNumber != null) {
|
||||
String operatorId3rdpty = internetSerialNumber.substring(0, 9);
|
||||
AuthSecretToken authSecretTokenOut =authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId3rdpty,SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
CommonRequest<ChargeResultRequest> commonRequest = new CommonRequest<>();
|
||||
ChargeResultRequest chargeResultRequest = new ChargeResultRequest();
|
||||
chargeResultRequest.setStartChargeSeq(internetSerialNumber);
|
||||
//使用指定包装类封装数据
|
||||
chargeResultRequest.setConnectorID(orderkey.substring(0, 16));
|
||||
chargeResultRequest.setStartChargeSeqStat(4);
|
||||
chargeResultRequest.setSuccStat(0);
|
||||
chargeResultRequest.setFailReason(0);
|
||||
//将其转换为json
|
||||
String jsonData = JSONUtil.toJSONString(chargeResultRequest);
|
||||
commonRequest.setData(jsonData);
|
||||
String result = ok(commonRequest, "/notification_stop_charge_result", authSecretTokenOut);
|
||||
System.out.println("===充电结束=停止推送结果=======notification_stop_charge_result========="+result+"============orderNo========"+orderNo);
|
||||
pushOrder.put("isStopNotified", true);
|
||||
REDIS.setCacheMap(pushOrderKey, pushOrder);
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
logger.info("==========第三方调用停止充电接口=====停止推送失败=====responseBody=======================");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
@ -228,4 +228,74 @@ public class QueryTokenController {
|
||||
return resp;
|
||||
}
|
||||
|
||||
/**
|
||||
* 用于平台之间认证Token的申请
|
||||
* @param encout
|
||||
* @param tokenRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v40/query_token")
|
||||
public CommonResponse queryTokenV40(@RequestHeader(value = "enc.out", defaultValue = "true") String encout,
|
||||
@RequestBody TokenRequest tokenRequest) throws IOException {
|
||||
|
||||
log.debug("<<query token request body: " + tokenRequest);
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
String operatorID = tokenRequest.getOperatorId();
|
||||
if (operatorID == null) {
|
||||
String decodedData = (String) tokenRequest.getAdditionalProperties().get("Data");
|
||||
tokenRequest = JSONUtil.readParams(decodedData, TokenRequest.class);
|
||||
}
|
||||
if (tokenRequest == null) {
|
||||
resp.setMsg("Request params validation failed");
|
||||
} else {
|
||||
operatorID = tokenRequest.getOperatorId();
|
||||
TokenResponse tokenResponse = new TokenResponse();
|
||||
//tokenResponse.setOperatorId(REDIS.getCacheObject("global:EVCS_OPID"));
|
||||
tokenResponse.setOperatorId("MA6DFCTD5");
|
||||
tokenResponse.setSuccStat(0);
|
||||
tokenResponse.setFailReason(0);
|
||||
XhpcInternetUser xhpcInternetUser =
|
||||
xhpcInternetUserRepository.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(tokenRequest.getOperatorId(), Instant.now(), Instant.now());
|
||||
if (xhpcInternetUser != null) {
|
||||
String operatorSecret = tokenRequest.getOperatorSecret();
|
||||
AuthSecretToken authSecretTokenIn =
|
||||
authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenTypeAndOperatorSecret(4,
|
||||
operatorID, AuthSecretToken.SECRET_TOKEN_TYPE_IN, operatorSecret).orElse(null);
|
||||
if (authSecretTokenIn == null) {
|
||||
resp.setRet("4003");
|
||||
resp.setMsg("Invalid OperatorID/Secret");
|
||||
tokenResponse.setSuccStat(1);
|
||||
tokenResponse.setFailReason(2);
|
||||
} else {
|
||||
String token;
|
||||
if (authSecretTokenIn.getTokenExpiry() != null && !authSecretTokenIn.getTokenExpiry().before(Calendar.getInstance().getTime())) {
|
||||
token = authSecretTokenIn.getToken();
|
||||
} else {
|
||||
token = UUID.randomUUID().toString().replaceAll("-", "");
|
||||
authSecretTokenIn.setToken(token);
|
||||
authSecretTokenIn.setTokenExpiry(getTokenExpiry(xhpcInternetUser));
|
||||
authSecretTokenRepository.save(authSecretTokenIn);
|
||||
}
|
||||
tokenResponse.setAccessToken(token);
|
||||
Instant te = authSecretTokenIn.getTokenExpiry().toInstant();
|
||||
tokenResponse.setTokenAvailableTime(Long.valueOf(ChronoUnit.SECONDS.between(Instant.now(), te)).intValue());
|
||||
tokenResponse.setSuccStat(0);
|
||||
tokenResponse.setFailReason(0);
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
resp.setMsg("Query token success");
|
||||
resp.setData(JSONUtil.toJSONString(tokenResponse));
|
||||
|
||||
System.out.println("========/v40/query_token==============="+tokenResponse.toString());
|
||||
}
|
||||
} else {
|
||||
resp.setMsg("Cooperation settings or start time are not valid");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
System.out.println("========/v40/query_token==============="+resp.toString());
|
||||
return resp;
|
||||
}
|
||||
}
|
||||
|
||||
@ -2,6 +2,7 @@ package com.xhpc.evcs.cdjgpc.api;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.common.api.ChargingStationService;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
@ -58,6 +59,9 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
||||
@Resource
|
||||
PowerPileService powerPileService;
|
||||
|
||||
@Resource
|
||||
ChargingStationService chargingStationService;
|
||||
|
||||
//充电站信息变化推送(我们平台推送成都市平台) --已推送
|
||||
//自己调用接口
|
||||
@PostMapping("/v10/getNotificationStationInfo")
|
||||
@ -772,8 +776,8 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v30/notification_requirement")
|
||||
public CommonResponse notificationRequirement(@RequestBody(required = false) CommonRequest<PageRequest> commonRequest)throws Exception {
|
||||
@PostMapping("/v10/notification_requirement")
|
||||
public CommonResponse notificationRequirement(@RequestBody(required = false) CommonRequest<CDRequirementInfo> commonRequest)throws Exception {
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
CDRequirementInfo cdRequirementInfo = JSONUtil.readParams(commonRequest.getData(), CDRequirementInfo.class);
|
||||
@ -781,7 +785,43 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
||||
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());
|
||||
List<CDRequirementInfoList> list = cdRequirementInfo.getList();
|
||||
List<Map<String,String>> mapList =new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CDRequirementInfoList cdRequirementInfoList = list.get(i);
|
||||
Map<String,String> map =new HashMap<>();
|
||||
map.put("startTime",cdRequirementInfoList.getStartTime());
|
||||
map.put("endTime",cdRequirementInfoList.getEndTime());
|
||||
map.put("res",cdRequirementInfoList.getRes().toString());
|
||||
mapList.add(map);
|
||||
}
|
||||
String name="";
|
||||
if(!"".equals(cdRequirementInfo.getName()) || cdRequirementInfo.getName() !=null){
|
||||
name =cdRequirementInfo.getName();
|
||||
}
|
||||
String area="";
|
||||
if(!"".equals(cdRequirementInfo.getArea()) || cdRequirementInfo.getArea() !=null){
|
||||
area =cdRequirementInfo.getArea();
|
||||
}
|
||||
String code="";
|
||||
if(!"".equals(cdRequirementInfo.getCode()) || cdRequirementInfo.getCode() !=null){
|
||||
code =cdRequirementInfo.getCode();
|
||||
}
|
||||
String requireDate="";
|
||||
if(!"".equals(cdRequirementInfo.getRequireDate()) || cdRequirementInfo.getRequireDate() !=null){
|
||||
requireDate =cdRequirementInfo.getRequireDate();
|
||||
}
|
||||
String releaseTime="";
|
||||
if(!"".equals(cdRequirementInfo.getReleaseTime()) || cdRequirementInfo.getReleaseTime() !=null){
|
||||
releaseTime =cdRequirementInfo.getReleaseTime();
|
||||
}
|
||||
String deliveryTime="";
|
||||
if(!"".equals(cdRequirementInfo.getDeliveryTime()) || cdRequirementInfo.getDeliveryTime() !=null){
|
||||
deliveryTime =cdRequirementInfo.getDeliveryTime();
|
||||
}
|
||||
String dataYu = JSONUtil.toJSONString(mapList);
|
||||
|
||||
R r = chargingStationService.addRequirementInfo(name, area, code, dataYu, requireDate,releaseTime, deliveryTime);
|
||||
if(r.getCode()==200){
|
||||
resp.setMsg("已接收数据");
|
||||
resp.setRet("0");
|
||||
@ -799,8 +839,8 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v30/notification_task")
|
||||
public CommonResponse notificationTask(@RequestBody(required = false) CommonRequest<PageRequest> commonRequest)throws Exception {
|
||||
@PostMapping("/v10/notification_task")
|
||||
public CommonResponse notificationTask(@RequestBody(required = false) CommonRequest<CDTaskInfo> commonRequest)throws Exception {
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
CDTaskInfo cdTaskInfo = JSONUtil.readParams(commonRequest.getData(), CDTaskInfo.class);
|
||||
@ -808,7 +848,19 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
||||
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());
|
||||
|
||||
List<CDRequirementInfoList> list = cdTaskInfo.getList();
|
||||
List<Map<String,String>> mapList =new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
CDRequirementInfoList cdRequirementInfoList = list.get(i);
|
||||
Map<String,String> map =new HashMap<>();
|
||||
map.put("startTime",cdRequirementInfoList.getStartTime());
|
||||
map.put("endTime",cdRequirementInfoList.getEndTime());
|
||||
map.put("res",cdRequirementInfoList.getRes().toString());
|
||||
mapList.add(map);
|
||||
}
|
||||
String dataYu = JSONUtil.toJSONString(mapList);
|
||||
R r = chargingStationService.addNotificationTask(cdTaskInfo.getTaskName(), cdTaskInfo.getTaskCode(), cdTaskInfo.getDemandDate(), cdTaskInfo.getStationID(), cdTaskInfo.getOperatorID(), cdTaskInfo.getEquipmentOwnerID(), cdTaskInfo.getEleNo(),dataYu,cdTaskInfo.getDeliveryTime());
|
||||
if(r.getCode()==200){
|
||||
resp.setMsg("已接收数据");
|
||||
resp.setRet("0");
|
||||
@ -888,13 +940,12 @@ public class CDNotificationStationInfoController extends CoreDispatcher {
|
||||
// System.out.println("==========result=============="+result);
|
||||
|
||||
|
||||
String rawData = "CS/FmJAWR3rNx+k7rqPQcDDRpRMUkZmC0xiOV8EDpxliyL9t+AzTkRDV1ydr4Tl8fmSbgqhSoDvdO1CVNYbz8ObjD8El0G1nr/S980lxvO0=";
|
||||
String rawData = "NR0oe4La+0SLizVoKCDfRkj37avo59qzZBUm7BFSmU+XA81uaP2614Vjbb7VvhRRumS4LwHu6CR981cKMxNM5xCGT+yjGgDwRG4B6xnEJ9upiW7iathKmMrN3lZBkvzstkKcx502kVSMy4x82RBkHXmS6nTFnfwbX1jI706L3pUvmNTtrYMH2Qvi6IOgG7AX/uhMVsvDOHZAAb5o66c/DfkfZBkWHSVWfmlgkwzuwkdktJQJOwOTM25jXotML7hLi0n7HPfmWPlpmye/cn/KVRBiUjxlvINzTIoz3dXw3SlV0zJC72zVd9I/cD2WBkFM53WmsPIDARGSGlj22rNVRx6fhff1CzmTP/NovUXiaNWb1F9PsVHluOUVZZ2x571jbHbc5+SR1JHu2NT5zNIzlk4HPfx0/eXjSBhtAsutnow9O5fDkSb/pa1gNkB3n6DMnJnyLuqFazUiYcqVPQlyl2J0EsMafQAbkNLeGr3tuNEEsywzWIeP35EceedIC2msRqTWkC02cXStCMlG5pVDyKFQe7pmT7LSXw8OGk348W43TGN0VTAhufvz5SeHAmVsoGgzvL7bCekPVhI3mC778Wa2Bag6tnV6xkEi40dlTwvVRD/0ycZ9XxEuOhlji3NMtOdECoE8YJSyN5FfN4253+xthr1UXCORShasYJLs00MByWL0H9wUFEHG7o/ZLJV8QVibfAF8qGF997UJsdieyGWQHjltFwCRUGp1St+lskZa8LCNI8TlUtf2ti5GfjIXfN5YXTgVK5DFBNe4wrw+n4+v17TBUIESwOmLnXqwE9IePQAY5gASYA5rfQfCvL1qCvvqM6/ccPxg3hFmQzoL4b9Jnx5OGCvy42dn8TXkQMm2ngJBd6av2+F5cNKe4ABw";
|
||||
String dataSecret="8LpncubmWiPCzY3V";
|
||||
|
||||
String dataSecretIV="av6A8QdnRaVRMXu6";
|
||||
String data = Aes128Cbc.encrypt(rawData, dataSecret, dataSecretIV);
|
||||
|
||||
// System.out.println("==========data=============="+data);
|
||||
System.out.println("========解密==data=============="+data);
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
|
||||
@ -41,10 +41,10 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher {
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
/**
|
||||
* 清除3天前数据
|
||||
* 清除5天前数据
|
||||
* 实时数据没40秒
|
||||
*/
|
||||
@Scheduled(fixedDelay = 1000 * 60)
|
||||
//@Scheduled(fixedDelay = 1000 * 60)
|
||||
public void runY() throws Exception{
|
||||
Collection<String> realtimeOrder = REDIS.keys("cdjgpc:realTime:*");
|
||||
for (String okey : realtimeOrder) {
|
||||
@ -56,12 +56,29 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher {
|
||||
}
|
||||
}
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
/**
|
||||
* 清除5天前数据
|
||||
* 实时数据没40秒
|
||||
*/
|
||||
//@Scheduled(fixedDelay = 1000 * 120)
|
||||
public void runYu() throws Exception{
|
||||
Collection<String> realtimeOrder = REDIS.keys("orderOutpu:*");
|
||||
for (String okey : realtimeOrder) {
|
||||
String format = DateUtil.format(DateUtil.offsetDay(new Date(),-5), "yyMMdd");
|
||||
if(Integer.parseInt(format)>Integer.parseInt(okey.substring(28,33))){
|
||||
REDIS.deleteObject(okey);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
/**
|
||||
* 设备充电中状态变化推送(我们平台推送成都市平台) --已推送
|
||||
* 实时数据没40秒
|
||||
*/
|
||||
@Scheduled(fixedDelay = 1000 * 40)
|
||||
//@Scheduled(fixedDelay = 1000 * 40)
|
||||
public void run() throws Exception{
|
||||
|
||||
List<Long> longList =new ArrayList<>();
|
||||
@ -193,11 +210,11 @@ public class CDConnectorChargeStatusInfoTask extends CoreDispatcher {
|
||||
}
|
||||
|
||||
public static void main(String[] args) {
|
||||
String num ="80836000010001022504092251329998";
|
||||
String num =" orderOutpu:80836000030006012409021226448679";
|
||||
String format = DateUtil.format(DateUtil.offsetDay(new Date(),-3), "yyMMdd");
|
||||
System.out.println(format);
|
||||
System.out.println(num.substring(16,22));
|
||||
if(Integer.parseInt(format)>Integer.parseInt(num.substring(16,22))){
|
||||
System.out.println(num.substring(28,33));
|
||||
if(Integer.parseInt(format)>Integer.parseInt(num.substring(27,33))){
|
||||
System.out.println("==============");
|
||||
}else{
|
||||
System.out.println("=======4444=======");
|
||||
|
||||
@ -43,7 +43,7 @@ public class CDNotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
@Scheduled(fixedRate = 1000 * 15)
|
||||
//@Scheduled(fixedRate = 1000 * 15)
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
Collection<String> orderKeys = REDIS.keys("order:*");
|
||||
|
||||
@ -67,7 +67,7 @@ public class CDNotificationOrderInfoTask extends CoreDispatcher {
|
||||
*/
|
||||
//9099开放定时任务 9009不开放
|
||||
@GetMapping("/infoTask")
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
// @Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws IOException {
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
|
||||
@ -31,7 +31,7 @@ public class CDNotificationStationFeeTask extends CoreDispatcher {
|
||||
private final Logger logger = LoggerFactory.getLogger(CDNotificationStationFeeTask.class);
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
@Scheduled(fixedDelay = 1000 * 60)
|
||||
//@Scheduled(fixedDelay = 1000 * 60)
|
||||
public void run() throws IOException {
|
||||
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
|
||||
@ -32,7 +32,7 @@ public class CDNotificationStationInfoTask extends CoreDispatcher {
|
||||
private final Logger logger = LoggerFactory.getLogger(CDNotificationStationInfoTask.class);
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
@Scheduled(cron = "0 0 0 1/15 * ? ")
|
||||
//@Scheduled(cron = "0 20 0 1/1 * ? ")
|
||||
public void run() throws IOException {
|
||||
try{
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist =
|
||||
@ -47,7 +47,7 @@ public class CDNotificationStationInfoTask extends CoreDispatcher {
|
||||
if (!stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
|
||||
// maybe对接第三方
|
||||
if (authSecretTokenOut != null) {
|
||||
String chargingStationId = xhpcStationInternetBlack.getChargingStationId().toString();
|
||||
String chargingStationId = stationKey.substring(8);
|
||||
//获取场站信息
|
||||
String key = "cdjgpc:station:".concat(chargingStationId)+".notification";
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
|
||||
@ -90,7 +90,7 @@ public class CDNotificationStationInfoTask extends CoreDispatcher {
|
||||
}
|
||||
}
|
||||
price.deleteCharAt(price.length()-1).append("}");
|
||||
svcPrice.deleteCharAt(price.length()-1).append("}");
|
||||
svcPrice.deleteCharAt(svcPrice.length()-1).append("}");
|
||||
}
|
||||
cdStationInfo.setElectricityFee(price.toString());
|
||||
cdStationInfo.setServiceFee(svcPrice.toString());
|
||||
|
||||
@ -49,8 +49,10 @@ public class CDNotificationStationStatusTask extends CoreDispatcher {
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Resource
|
||||
private XhpcTerminalRepository terminalRepository;
|
||||
//9099开放定时任务 9009不开放
|
||||
//都开放
|
||||
@Scheduled(fixedRate = 1000 * 180)
|
||||
|
||||
|
||||
protected void run() throws IOException {
|
||||
|
||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||
@ -60,20 +62,16 @@ public class CDNotificationStationStatusTask extends CoreDispatcher {
|
||||
|
||||
Instant now = Instant.now();
|
||||
|
||||
XhpcInternetUser xhpcInternetUser =
|
||||
xhpcInternetUserRepository.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter("MA6CC2LK7", Instant.now(), Instant.now());
|
||||
XhpcInternetUser xhpcInternetUser = xhpcInternetUserRepository.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter("MA6CC2LK7", Instant.now(), Instant.now());
|
||||
|
||||
for (String stationTerminalKey : stationTerminalKeys) {
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationTerminalKey.replace("stationTerminalStatus",
|
||||
"station"));
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationTerminalKey.replace("stationTerminalStatus", "station"));
|
||||
String operatorId = chargingStationDto.getOperatorId();
|
||||
Map<String, String> terminalStatusMap = REDIS.getCacheMap(stationTerminalKey);
|
||||
Set<ConnectorStatusInfo> connectorStatusInfos = translateStatus(operatorId, terminalStatusMap, terminalDBMap);
|
||||
Set<ConnectorStatusInfo> changeStatus = ChangePoleStatus.getChangeStatus(connectorStatusInfos);
|
||||
if (!changeStatus.isEmpty()) {
|
||||
XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
|
||||
xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(Long.valueOf(stationTerminalKey.split(":")[1]),
|
||||
xhpcInternetUser.getInternetUserId()).orElse(null);
|
||||
XhpcStationInternetBlacklist xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(Long.valueOf(stationTerminalKey.split(":")[1]), xhpcInternetUser.getInternetUserId()).orElse(null);
|
||||
if (xhpcStationInternetBlacklist != null) continue;
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType("MA6CC2LK7", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
|
||||
@ -46,8 +46,8 @@ import java.util.*;
|
||||
@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
|
||||
@WebFilter(urlPatterns = {"/v1/*", "/v2/*", "/v10/*", "/v20/*", "/v30/*"}, filterName = "v1n10filter") //multiple filters execute by filterName order
|
||||
//成都市监管平台(蓉成充)v10 v20 川逸充 v30 v40车为家
|
||||
@WebFilter(urlPatterns = {"/v1/*", "/v2/*", "/v10/*", "/v20/*", "/v30/*", "/v40/*"}, filterName = "v1n10filter") //multiple filters execute by filterName order
|
||||
public class EvcsFilter extends OncePerRequestFilter {
|
||||
|
||||
@Resource
|
||||
@ -114,6 +114,9 @@ public class EvcsFilter extends OncePerRequestFilter {
|
||||
AuthSecretToken.SECRET_TOKEN_TYPE_IN).orElse(null);
|
||||
handleQueryToken(request, response, chain, requestWrapper, bodyString, commonRequest,
|
||||
responseWrapper, authSecretTokenIn);
|
||||
}else if (servletPath.endsWith("/v40/query_token")) {
|
||||
authSecretTokenIn = authSecretTokenRepository.findByStatusAndOperatorId3irdptyAndSecretTokenType(4,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 ", "");
|
||||
@ -374,11 +377,15 @@ public class EvcsFilter extends OncePerRequestFilter {
|
||||
try{
|
||||
|
||||
CommonRequest commonRequest = structure();
|
||||
String s = encryptReqOut("8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6",
|
||||
"Ut5UFdqDthiJyncU", commonRequest);
|
||||
String s = encryptReqOut("8LpncubmWiPCzY3V", "av6A8QdnRaVRMXu6","Ut5UFdqDthiJyncU", commonRequest);
|
||||
System.out.println("s================"+s);
|
||||
|
||||
|
||||
String servletPath="/v40/query_token";
|
||||
if(servletPath.endsWith("/query_token")){
|
||||
System.out.println("77777");
|
||||
}else{
|
||||
System.out.println("2222");
|
||||
}
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
@ -0,0 +1,105 @@
|
||||
package com.xhpc.evcs.cwj.api;
|
||||
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDEquipAuthRequest;
|
||||
import com.xhpc.evcs.domain.XhpcInternetUser;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.dto.EquipAuthResponse;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.XhpcInternetUserRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.Instant;
|
||||
import java.util.Map;
|
||||
|
||||
import static cn.hutool.core.util.NumberUtil.isInteger;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 14:42
|
||||
*/
|
||||
@RestController
|
||||
public class CWJQueryEquipAuthController {
|
||||
|
||||
@Autowired
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Autowired
|
||||
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
|
||||
/**
|
||||
* 请求设备认证
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/v40/query_equip_auth")
|
||||
public CommonResponse queryEquipAuth(@RequestBody CommonRequest<CDEquipAuthRequest> commonRequest) throws Exception {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
CDEquipAuthRequest equipAuthRequest = JSONUtil.readParams(commonRequest.getData(), CDEquipAuthRequest.class);
|
||||
if (equipAuthRequest == null) {
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
EquipAuthResponse equipAuthResponse = new EquipAuthResponse();
|
||||
String equipAuthSeq = equipAuthRequest.getEquipAuthSeq();
|
||||
String connectorId = equipAuthRequest.getConnectorId();
|
||||
equipAuthResponse.setEquipAuthSeq(equipAuthSeq);
|
||||
equipAuthResponse.setConnectorId(connectorId);
|
||||
String pileId = connectorId.substring(0, connectorId.length() - 2);
|
||||
Map<String, Object> pileDataModel = REDIS.getCacheMap("pile:" + pileId);
|
||||
Long stationId = Long.parseLong(pileDataModel.get("stationId").toString());
|
||||
Instant now = Instant.now();
|
||||
XhpcInternetUser xhpcInternetUser = xhpcInternetUserRepository
|
||||
.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(commonRequest.getOperatorId(), now, now);
|
||||
if (xhpcInternetUser == null) {
|
||||
equipAuthResponse.setSuccStat(1);
|
||||
equipAuthResponse.setFailReason(2);
|
||||
equipAuthResponse.setFailReasonMsg("身份验证失败");
|
||||
resp.setMsg("auth denied");
|
||||
} else {
|
||||
Long internetUserId = xhpcInternetUser.getInternetUserId();
|
||||
XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
|
||||
xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(stationId, internetUserId).orElse(null);
|
||||
if (null != xhpcStationInternetBlacklist) {
|
||||
equipAuthResponse.setSuccStat(1);
|
||||
equipAuthResponse.setFailReason(2);
|
||||
equipAuthResponse.setFailReasonMsg("身份验证失败");
|
||||
resp.setMsg("auth denied");
|
||||
} else {
|
||||
Map<String, Object> cacheGun = REDIS.getCacheMap("gun:".concat(connectorId));
|
||||
String terminalStatus = (String) cacheGun.get("vehicleGunStatus");
|
||||
String status = (String) cacheGun.get("status");
|
||||
if (!"空闲".equals(status)) {
|
||||
resp.setMsg("终端不在空闲状态:[".concat(status == null ? "未注册" : isInteger(status) ? "充电中" : status).concat(
|
||||
"]"));
|
||||
equipAuthResponse.setSuccStat(1);
|
||||
equipAuthResponse.setFailReason(1);
|
||||
} else if ("否".equals(terminalStatus)) {
|
||||
resp.setMsg("未插枪");
|
||||
equipAuthResponse.setSuccStat(1);
|
||||
equipAuthResponse.setFailReason(1);
|
||||
} else {
|
||||
resp.setRet("0");
|
||||
resp.setMsg("success");
|
||||
equipAuthResponse.setSuccStat(0);
|
||||
equipAuthResponse.setFailReason(0);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
resp.setData(JSONUtil.toJSONString(equipAuthResponse));
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,170 @@
|
||||
package com.xhpc.evcs.cwj.api;
|
||||
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.jpa.XhpcTerminalRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 14:44
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class CWJQueryEquipBusinessPolicyController {
|
||||
@Autowired
|
||||
private XhpcTerminalRepository xhpcTerminalRepository;
|
||||
|
||||
/**
|
||||
* 查询业务策略信息结果
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v40/query_equip_business_policy")
|
||||
public CommonResponse queryEquipBusinessPolicy(@RequestBody CommonRequest<EquipBizRequest> commonRequest) throws IOException {
|
||||
//获取充电设备接口编码(枪编码)
|
||||
EquipBizRequest equipBizRequest = JSONUtil.readParams(commonRequest.getData(), EquipBizRequest.class);
|
||||
CommonResponse commonResponse = new CommonResponse();
|
||||
if (equipBizRequest == null) {
|
||||
commonResponse.setRet("500");
|
||||
commonResponse.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
String connectorId = equipBizRequest.getConnectorId();
|
||||
//获取枪所对应的桩编码
|
||||
String pileSerialNumber = xhpcTerminalRepository.selectBySql(connectorId);
|
||||
Map<String, Object> cachePile = REDIS.getCacheMap("pile:" + pileSerialNumber);
|
||||
if (pileSerialNumber == null || cachePile == null) {
|
||||
commonResponse.setMsg("ConnectorID not found");
|
||||
commonResponse.setRet("500");
|
||||
return commonResponse;
|
||||
}
|
||||
ArrayList<String> modelTypes = new ArrayList<>();
|
||||
//存储时段个数
|
||||
ArrayList<Integer> modelCount = new ArrayList<>();
|
||||
Long rateModelId = (Long) cachePile.get("rateModelId");
|
||||
CacheRateModel rateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
||||
PolicyInfos[] policyInfosArr = new PolicyInfos[0];
|
||||
if (rateModel != null) {
|
||||
String[] tfPricesSeq = rateModel.getTfPricesSeq();
|
||||
//存储时段
|
||||
//建立对应时段的映射Map集合,存放其对应的价格和服务费
|
||||
Map<String, Object> timeMap = new HashMap<>();
|
||||
//个数计数器
|
||||
int count = 0;
|
||||
//最后一个时段的前一个时段的下标索引
|
||||
int index = 0;
|
||||
//遍历获取每一个时段
|
||||
for (int i = 0; i < tfPricesSeq.length - 1; i++) {
|
||||
count++;
|
||||
//如果当前时段与后面的时段不相同,则表示当前时段已经结束,添加当前时段到list中,并将其坐标存放到另一个集合中。
|
||||
if (!tfPricesSeq[i].equals(tfPricesSeq[i + 1])) {
|
||||
//将每段时间的索引,赋值
|
||||
index = i;
|
||||
modelTypes.add(tfPricesSeq[i]);
|
||||
modelCount.add(count);
|
||||
//如果这段时段结束,则重置计数器
|
||||
count = 0;
|
||||
}
|
||||
}
|
||||
//获取最后一个时段的费率值
|
||||
String lastModelType = tfPricesSeq[tfPricesSeq.length - 1];
|
||||
//放入到类型list中
|
||||
modelTypes.add(lastModelType);
|
||||
//获取最后一个时段的费率的个数
|
||||
int lastCount = (tfPricesSeq.length - 1) - index;
|
||||
//放入到个数List中
|
||||
modelCount.add(lastCount);
|
||||
|
||||
//获取各个类型的时段的时间区间,并将其存放至timeList集合中。
|
||||
//定义一个初始时间段
|
||||
String initTime = "000000";
|
||||
//添加临时存储变量
|
||||
int temp = -1;
|
||||
ArrayList<String> timeList = new ArrayList<>();
|
||||
//放入必有初始时间
|
||||
timeList.add(initTime);
|
||||
//根据出现的时段个数确定他们的时间区间,然后存放至List集合中
|
||||
for (int i = 0; i < modelCount.size() - 1; i++) {
|
||||
if (temp != -1) {
|
||||
Integer integer = modelCount.get(i);
|
||||
int hours = integer / 2;
|
||||
temp = temp + hours;
|
||||
String hoursStr = String.format("%02d", temp);
|
||||
String finalTime = hoursStr + "0000";
|
||||
timeList.add(finalTime);
|
||||
} else {
|
||||
Integer integer = modelCount.get(i);
|
||||
int hours = integer / 2;
|
||||
//记录中间时间
|
||||
temp = hours;
|
||||
String hoursStr = String.format("%02d", temp);
|
||||
String finalTime = hoursStr + "0000";
|
||||
timeList.add(finalTime);
|
||||
}
|
||||
}
|
||||
policyInfosArr = new PolicyInfos[timeList.size()];
|
||||
for (int i = 0; i <= timeList.size() - 1; i++) {
|
||||
PolicyInfos policyInfos = new PolicyInfos();
|
||||
policyInfos.setStartTime(timeList.get(i));
|
||||
String modelType = modelTypes.get(i);
|
||||
switch (modelType) {
|
||||
case "00":
|
||||
policyInfos.setServicePrice(BigDecimal.valueOf((long) rateModel.getT1SvcPrice()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
policyInfos.setElecPrice(BigDecimal.valueOf((long) rateModel.getT1Price()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
break;
|
||||
case "01":
|
||||
policyInfos.setServicePrice(BigDecimal.valueOf((long) rateModel.getT2SvcPrice()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
policyInfos.setElecPrice(BigDecimal.valueOf((long) rateModel.getT2Price()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
break;
|
||||
case "02":
|
||||
policyInfos.setServicePrice(BigDecimal.valueOf((long) rateModel.getT3SvcPrice()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
policyInfos.setElecPrice(BigDecimal.valueOf((long) rateModel.getT3Price()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
break;
|
||||
case "03":
|
||||
policyInfos.setServicePrice(BigDecimal.valueOf((long) rateModel.getT4SvcPrice()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
policyInfos.setElecPrice(BigDecimal.valueOf((long) rateModel.getT4Price()).divide(BigDecimal.valueOf(100000L)).setScale(4).doubleValue());
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
policyInfosArr[i] = policyInfos;
|
||||
}
|
||||
}
|
||||
|
||||
//封装数据
|
||||
EquipBizResponse equipBizResponse = new EquipBizResponse();
|
||||
//业务查询流水号
|
||||
equipBizResponse.setEquipBizSeq(equipBizRequest.getEquipBizSeq());
|
||||
//充电设备接口编码
|
||||
equipBizResponse.setConnectorId(connectorId);
|
||||
//操作结果
|
||||
equipBizResponse.setSuccStat(0);
|
||||
//失败原因
|
||||
equipBizResponse.setFailReason(0);
|
||||
//总时段数
|
||||
equipBizResponse.setSumPeriod(modelTypes.size());
|
||||
//计费信息
|
||||
equipBizResponse.setPolicyInfos(policyInfosArr);
|
||||
|
||||
//塞入包装类
|
||||
commonResponse.setMsg("Query equipment business policy success");
|
||||
commonResponse.setRet("0");
|
||||
commonResponse.setData(JSONUtil.toJSONString(equipBizResponse));
|
||||
}
|
||||
return commonResponse;
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,281 @@
|
||||
package com.xhpc.evcs.cwj.api;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData;
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||
import com.xhpc.evcs.cwj.dto.CEJEquipChargeStatus;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.OrderMappingRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
|
||||
import com.xhpc.evcs.utils.DateUtil;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.Date;
|
||||
import java.util.Map;
|
||||
import java.util.Stack;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.notification.NotificationEquipChargeStatusTask.calculateEm;
|
||||
import static com.xhpc.evcs.utils.DateUtil.orderNo2DateStr;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 15:30
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController()
|
||||
public class CWJQueryEquipChargeStatusController {
|
||||
@Autowired
|
||||
XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
@Autowired
|
||||
OrderMappingRepository orderMappingRepository;
|
||||
|
||||
/**
|
||||
* 查询充电状态
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v40/query_equip_charge_status")
|
||||
public CommonResponse queryEquipChargeStatus(@RequestBody CommonRequest<ChargeInfoRequest> commonRequest) throws IOException {
|
||||
//创建数据实体类
|
||||
CEJEquipChargeStatus equipChargeStatus = new CEJEquipChargeStatus();
|
||||
//充电订单号 三方传进来都是27位
|
||||
String data = commonRequest.getData();
|
||||
ChargeInfoRequest chargeInfoRequest = JSONUtil.readParams(data, ChargeInfoRequest.class);
|
||||
CommonResponse response = new CommonResponse();
|
||||
if (chargeInfoRequest == null) {
|
||||
response.setRet(EvcsConst.RET_FAIL);
|
||||
response.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
String startChargeSeq = chargeInfoRequest.getStartChargeSeq();
|
||||
equipChargeStatus.setStartChargeSeq(startChargeSeq);
|
||||
//充电订单状态
|
||||
EtOrderMapping etOrderMapping = orderMappingRepository.findByEvcsOrderNo(startChargeSeq).orElse(null);
|
||||
if (etOrderMapping == null) {
|
||||
response.setRet(EvcsConst.RET_FAIL);
|
||||
response.setMsg("Order not found/started");
|
||||
log.error("3rdpty order[{}] not found", startChargeSeq);
|
||||
return response;
|
||||
}
|
||||
String internalOrderNum = etOrderMapping.getXhOrderNo();
|
||||
Map<String, Object> cacheOrder = REDIS.getCacheMap("order:" + internalOrderNum);
|
||||
if (cacheOrder == null) {
|
||||
response.setRet(EvcsConst.RET_FAIL);
|
||||
response.setMsg("Order cache data not found");
|
||||
} else {
|
||||
String orderStatus = (String) cacheOrder.get("status");
|
||||
int startChargeSeqStat;
|
||||
if (orderStatus == null) {
|
||||
startChargeSeqStat = 5;
|
||||
} else switch (orderStatus) {
|
||||
case "启动中":
|
||||
startChargeSeqStat = 1;
|
||||
break;
|
||||
case "充电中":
|
||||
startChargeSeqStat = 2;
|
||||
break;
|
||||
case "停止中":
|
||||
startChargeSeqStat = 3;
|
||||
break;
|
||||
case "已结束":
|
||||
startChargeSeqStat = 4;
|
||||
break;
|
||||
default:
|
||||
startChargeSeqStat = 5;
|
||||
break;
|
||||
}
|
||||
equipChargeStatus.setStartChargeSeqStat(startChargeSeqStat);
|
||||
//充电设备接口编码
|
||||
String connectorId = internalOrderNum.substring(0, 16);
|
||||
equipChargeStatus.setConnectorID(connectorId);
|
||||
//充电设备接口状态
|
||||
Map<String, Object> cacheGunData = REDIS.getCacheMap("gun:" + connectorId);
|
||||
String gunStatus = (String) cacheGunData.get("status");
|
||||
int connectorStatus = 0;
|
||||
switch (gunStatus) {
|
||||
case "空闲":
|
||||
connectorStatus = 1;
|
||||
break;
|
||||
case "离线":
|
||||
connectorStatus = 2;
|
||||
break;
|
||||
case "故障":
|
||||
connectorStatus = 255;
|
||||
break;
|
||||
default:
|
||||
connectorStatus = 3;
|
||||
break;
|
||||
}
|
||||
equipChargeStatus.setConnectorStatus(connectorStatus);
|
||||
//A相电流
|
||||
Double current = (Double) cacheGunData.get("current");
|
||||
equipChargeStatus.setCurrentA(current);
|
||||
//A相电压
|
||||
Double voltage = (Double) cacheGunData.get("voltage");
|
||||
equipChargeStatus.setVoltageA(voltage);
|
||||
//电池剩余电量
|
||||
Integer endSoc = (Integer) cacheOrder.get("endSoc");
|
||||
Double soc = Double.valueOf(endSoc == null ? 0 : endSoc);
|
||||
equipChargeStatus.setSoc(soc);
|
||||
//开始充电时间
|
||||
String startTime = (String) cacheOrder.get("startTime");
|
||||
if (startTime == null) startTime = orderNo2DateStr(internalOrderNum);
|
||||
equipChargeStatus.setStartTime(startTime);
|
||||
//本次采样时间 直接new一个当前时间的Date就可以了
|
||||
CacheRealtimeData lord = REDIS.getCacheObject("order:" + internalOrderNum + ".lord");
|
||||
if (lord != null) {
|
||||
equipChargeStatus.setEndTime(lord.getCreateTime());
|
||||
equipChargeStatus.setTotalMoney(lord.getAmountCharged() / 10000.0);
|
||||
equipChargeStatus.setTotalPower(lord.getChargingDegree() / 10000.0);
|
||||
} else {
|
||||
equipChargeStatus.setEndTime(equipChargeStatus.getStartTime());
|
||||
equipChargeStatus.setTotalMoney(0.0);
|
||||
equipChargeStatus.setTotalPower(0.0);
|
||||
}
|
||||
final Long rateModelId = REDIS.getCacheMapValue("pile:".concat(connectorId.substring(0, 14)), "rateModelId");
|
||||
final CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
||||
calculateEmYu(equipChargeStatus, cacheRateModel);
|
||||
|
||||
CacheBmsReqChargerOutputData bms = REDIS.getCacheObject("order:"+internalOrderNum+".bms");
|
||||
if(bms==null || bms.getBmsEstRemainingTime()==null){
|
||||
equipChargeStatus.setLeftTime(60);
|
||||
}else{
|
||||
equipChargeStatus.setLeftTime(bms.getBmsEstRemainingTime());
|
||||
}
|
||||
|
||||
response.setRet(EvcsConst.RET_SUCC);
|
||||
response.setData(JSONUtil.toJSONString(equipChargeStatus));
|
||||
response.setMsg("success");
|
||||
}
|
||||
}
|
||||
return response;
|
||||
}
|
||||
|
||||
|
||||
|
||||
public static void calculateEmYu(CEJEquipChargeStatus equipChargeStatus, CacheRateModel cacheRateModel) {
|
||||
|
||||
if (cacheRateModel == null) {
|
||||
equipChargeStatus.setChargeDetails(new ChargeDetails[0]);
|
||||
return;
|
||||
}
|
||||
final Date endTime = DateUtil.yyyyMMDDhhmmss2Date(equipChargeStatus.getEndTime());
|
||||
final Date startTime = DateUtil.yyyyMMDDhhmmss2Date(equipChargeStatus.getStartTime());
|
||||
long totalMilSec = endTime.getTime() - startTime.getTime();
|
||||
BigDecimal hours = new BigDecimal(totalMilSec).divide(new BigDecimal(3600000), 2, RoundingMode.FLOOR);
|
||||
int sumPeriod = hours.setScale(0, RoundingMode.CEILING).intValue() + 1;
|
||||
equipChargeStatus.setSumPeriod(sumPeriod);
|
||||
DateTime firstNDT = DateTime.of(startTime);
|
||||
Stack<ChargeDetails> chargeDetailsStack = new Stack<>();
|
||||
ChargeDetails chargeDetails = null;
|
||||
Double firstNElecMoney = 0.0;
|
||||
Double firstNSeviceMony = 0.0;
|
||||
Double firstNPower = 0.0;
|
||||
String rtfTemp = null;
|
||||
Instant startIst = startTime.toInstant();
|
||||
final Instant endInst = endTime.toInstant();
|
||||
Instant endPeriod;
|
||||
final Double totalPower = equipChargeStatus.getTotalPower();
|
||||
for (int i = 0; i < sumPeriod; i++) {
|
||||
if (!startIst.isBefore(endInst)) break;
|
||||
endPeriod = startIst.truncatedTo(ChronoUnit.HOURS).plusSeconds(3599L);
|
||||
if (!endPeriod.isBefore(endInst)) {
|
||||
endPeriod = endInst;
|
||||
}
|
||||
boolean newCd = false;
|
||||
int firstSTHourOfDay = firstNDT.getField(DateField.HOUR_OF_DAY);
|
||||
int tf = firstSTHourOfDay * 2;
|
||||
final String rtf = cacheRateModel.getTfPricesSeq()[tf];
|
||||
if (chargeDetails == null || !rtf.equals(rtfTemp)) {
|
||||
newCd = true;
|
||||
chargeDetails = new ChargeDetails();
|
||||
}
|
||||
rtfTemp = rtf;
|
||||
Duration durm = Duration.between(startIst, endPeriod);
|
||||
BigDecimal timePeriodRatio = BigDecimal.valueOf(durm.toMillis()).divide(BigDecimal.valueOf(totalMilSec), 2,
|
||||
RoundingMode.HALF_UP);
|
||||
calculateCD(cacheRateModel, rtf, timePeriodRatio, BigDecimal.valueOf(totalPower), chargeDetails);
|
||||
if (i == 0) {
|
||||
chargeDetails.setDetailStartTime(equipChargeStatus.getStartTime());
|
||||
} else if (newCd) {
|
||||
chargeDetails.setDetailStartTime(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault()).format(startIst));
|
||||
}
|
||||
startIst = startIst.truncatedTo(ChronoUnit.HOURS).plusSeconds(3600L);
|
||||
chargeDetails.setDetailEndTime(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault()).format(endPeriod));
|
||||
if (newCd) {
|
||||
chargeDetailsStack.push(chargeDetails);
|
||||
}
|
||||
}
|
||||
ChargeDetails[] cda = new ChargeDetails[chargeDetailsStack.size()];
|
||||
equipChargeStatus.setChargeDetails(chargeDetailsStack.toArray(cda));
|
||||
equipChargeStatus.setSumPeriod(chargeDetailsStack.size());
|
||||
equipChargeStatus.setElecMoney(firstNElecMoney);
|
||||
final Double totalMoney = equipChargeStatus.getTotalMoney();
|
||||
for (ChargeDetails cd : chargeDetailsStack) {
|
||||
firstNElecMoney += cd.getDetailElecMoney();
|
||||
firstNSeviceMony += cd.getDetailSeviceMoney();
|
||||
firstNPower += cd.getDetailPower();
|
||||
}
|
||||
equipChargeStatus.setElecMoney(BigDecimal.valueOf(totalMoney).subtract(BigDecimal.valueOf(firstNSeviceMony)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
equipChargeStatus.setSeviceMoney(BigDecimal.valueOf(firstNSeviceMony).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
final BigDecimal oddm =
|
||||
BigDecimal.valueOf(totalMoney).subtract(BigDecimal.valueOf(firstNElecMoney)).subtract(BigDecimal.valueOf(firstNSeviceMony));
|
||||
final BigDecimal oddp = BigDecimal.valueOf(totalPower).subtract(BigDecimal.valueOf(firstNPower));
|
||||
if (!chargeDetailsStack.isEmpty()) {
|
||||
ChargeDetails peek = chargeDetailsStack.peek();
|
||||
peek.setDetailElecMoney(BigDecimal.valueOf(peek.getDetailElecMoney()).add(oddm).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
peek.setDetailPower(BigDecimal.valueOf(peek.getDetailPower()).add(oddp).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void calculateCD(CacheRateModel cacheRateModel, String rtf,
|
||||
BigDecimal timePeriodRatio, BigDecimal tpPower, ChargeDetails cd) {
|
||||
|
||||
cd.setDetailPower(BigDecimal.valueOf(cd.getDetailPower() + tpPower.multiply(timePeriodRatio).doubleValue()).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
|
||||
Integer powerPrice;
|
||||
Integer svcPrice;
|
||||
if ("00".equals(rtf)) {
|
||||
powerPrice = cacheRateModel.getT1Price();
|
||||
svcPrice = cacheRateModel.getT1SvcPrice();
|
||||
} else if ("01".equals(rtf)) {
|
||||
powerPrice = cacheRateModel.getT2Price();
|
||||
svcPrice = cacheRateModel.getT2SvcPrice();
|
||||
} else if ("02".equals(rtf)) {
|
||||
powerPrice = cacheRateModel.getT3Price();
|
||||
svcPrice = cacheRateModel.getT3SvcPrice();
|
||||
} else{
|
||||
powerPrice = cacheRateModel.getT4Price();
|
||||
svcPrice = cacheRateModel.getT4SvcPrice();
|
||||
}
|
||||
cd.setElecPrice( new BigDecimal(powerPrice).divide(new BigDecimal(100000)).setScale(4,RoundingMode.HALF_UP).doubleValue());
|
||||
cd.setSevicePrice(new BigDecimal(svcPrice).divide(new BigDecimal(100000)).setScale(4,RoundingMode.HALF_UP).doubleValue());
|
||||
final double detailElecMoney = BigDecimal.valueOf(cd.getElecPrice())
|
||||
.multiply(BigDecimal.valueOf(cd.getDetailPower()))
|
||||
.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
cd.setDetailElecMoney(BigDecimal.valueOf(detailElecMoney).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
final double detailSeviceMoney = BigDecimal.valueOf(cd.getSevicePrice())
|
||||
.multiply(BigDecimal.valueOf(cd.getDetailPower()))
|
||||
.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
cd.setDetailSeviceMoney(BigDecimal.valueOf(detailSeviceMoney).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,234 @@
|
||||
package com.xhpc.evcs.cwj.api;
|
||||
|
||||
import com.xhpc.common.api.PileOrderService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.utils.DateUtils;
|
||||
import com.xhpc.evcs.cwj.dto.CWJStartChargeRequest;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.domain.XhpcChargingStation;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.*;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
import java.util.Optional;
|
||||
import java.util.concurrent.ExecutorService;
|
||||
import java.util.concurrent.Executors;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.genOrder;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 14:46
|
||||
*/
|
||||
@RestController
|
||||
public class CWJQueryStartChargeController extends CoreDispatcher {
|
||||
|
||||
@Resource
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Resource
|
||||
private OrderMappingRepository etOrderMappingRepo;
|
||||
@Resource
|
||||
private XhpcHistoryOrderRepository xhpcHistoryOrderRepository;
|
||||
@Resource
|
||||
private XhpcTerminalRepository xhpcTerminalRepository;
|
||||
@Resource
|
||||
private PileOrderService pileOrderService;
|
||||
@Resource
|
||||
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
@Resource
|
||||
private XhpcChargingStationRepository xhpcChargingStationRepository;
|
||||
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
|
||||
/**
|
||||
* 请求启动充电
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping(value = "/v40/query_start_charge")
|
||||
public CommonResponse queryStartCharge(@RequestBody CommonRequest<CWJStartChargeRequest> commonRequest) throws Exception {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
CWJStartChargeRequest startChargeRequest = JSONUtil.readParams(commonRequest.getData(), CWJStartChargeRequest.class);
|
||||
String order ="";
|
||||
if (startChargeRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
String startChargeSeq = startChargeRequest.getStartChargeSeq();
|
||||
EtOrderMapping orderMapping = etOrderMappingRepo.findByEvcsOrderNo(startChargeSeq).orElse(null);
|
||||
if (orderMapping != null) {
|
||||
resp.setMsg("Duplicated StartChargeSeq");
|
||||
} else {
|
||||
StartChargeResponse startChargeResponse = new StartChargeResponse();
|
||||
startChargeResponse.setFailReason(0);
|
||||
startChargeResponse.setSuccStat(1);
|
||||
startChargeResponse.setStartChargeSeqStat(4);
|
||||
String connectorId = startChargeRequest.getConnectorId();
|
||||
Map<String, Object> cacheGun = REDIS.getCacheMap("gun:".concat(connectorId));
|
||||
String terminalStatus = (String) cacheGun.get("vehicleGunStatus");
|
||||
String status = (String) cacheGun.get("status");
|
||||
EtOrderMapping etOrderMapping = new EtOrderMapping();
|
||||
Date now = DateUtils.getNowDate();
|
||||
etOrderMapping.setCreateTime(now);
|
||||
etOrderMapping.setEvcsOrderNo(startChargeSeq);
|
||||
if (!"空闲".equals(status)) {
|
||||
resp.setMsg("终端状态异常:[".concat(status == null ? "未注册" : status).concat("]"));
|
||||
emptyHorder(startChargeSeq, connectorId, etOrderMapping);
|
||||
} else if ("否".equals(terminalStatus)) {
|
||||
resp.setMsg("未插枪");
|
||||
emptyHorder(startChargeSeq, connectorId, etOrderMapping);
|
||||
} else {
|
||||
Integer chargingAmt = (int) Math.round(startChargeRequest.getFeeLimit());
|
||||
R res = pileOrderService.pileStartUpBy3rd(startChargeSeq, "",chargingAmt , "", -1, connectorId);
|
||||
startChargeResponse.setStartChargeSeq(startChargeSeq);
|
||||
startChargeResponse.setConnectorID(connectorId);
|
||||
resp.setMsg(res.getMsg());
|
||||
if (res.getCode() != 200) {
|
||||
if (res.getCode() != 500) {
|
||||
startChargeResponse.setFailReason(res.getCode());
|
||||
} else {
|
||||
startChargeResponse.setFailReason(3);
|
||||
}
|
||||
startChargeResponse.setFailReasonMsg(res.getMsg());
|
||||
startChargeResponse.setSuccStat(1);
|
||||
startChargeResponse.setStartChargeSeqStat(4);
|
||||
emptyHorder(startChargeSeq, connectorId, etOrderMapping);
|
||||
} else {
|
||||
Map<String, Object> etOrderData = (Map<String, Object>) res.getData();
|
||||
if (etOrderData != null) {
|
||||
resp.setRet(EvcsConst.RET_SUCC);
|
||||
startChargeResponse.setStartChargeSeqStat(1);
|
||||
startChargeResponse.setSuccStat(0);
|
||||
startChargeResponse.setFailReason(0);
|
||||
Map<String, Object> pushOrder = new HashMap<>();
|
||||
pushOrder.put("startChargeSeqStat", 1);
|
||||
pushOrder.put("internetSerialNumber", startChargeRequest.getStartChargeSeq());
|
||||
pushOrder.put("connectorID", connectorId);
|
||||
pushOrder.put("startChargeNotificationStat", 0);
|
||||
pushOrder.put("chargeOrderInfoNotificationStat", 0);
|
||||
pushOrder.put("operatorId3rdpty", startChargeSeq.substring(0, 9));
|
||||
pushOrder.put("startTime", etOrderData.get("startTime"));
|
||||
String orderNo = (String) etOrderData.get("orderNo");
|
||||
etOrderMapping.setXhOrderNo(orderNo);
|
||||
REDIS.setCacheMap("pushOrder:".concat(orderNo), pushOrder);
|
||||
order = orderNo;
|
||||
|
||||
|
||||
|
||||
|
||||
} else {
|
||||
emptyHorder(startChargeSeq, connectorId, etOrderMapping);
|
||||
}
|
||||
}
|
||||
}
|
||||
etOrderMappingRepo.save(etOrderMapping);
|
||||
resp.setData(JSONUtil.toJSONString(startChargeResponse));
|
||||
try {
|
||||
notification(order);
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
private void emptyHorder(String startChargeSeq, String connectorId, EtOrderMapping etOrderMapping) {
|
||||
|
||||
final Long stationId = REDIS.getCacheMapValue("pile:".concat(connectorId.substring(0, 14)), "stationId");
|
||||
XhpcChargingStation xhpcChargingStation = xhpcChargingStationRepository.findById(stationId).orElse(null);
|
||||
if (xhpcChargingStation != null) {
|
||||
XhpcHistoryOrder emptyHorder = new XhpcHistoryOrder();
|
||||
emptyHorder.setTenantId(xhpcChargingStation.getTenantId());
|
||||
Date now = DateUtils.getNowDate();
|
||||
emptyHorder.setStartTime(now);
|
||||
emptyHorder.setEndTime(now);
|
||||
emptyHorder.setCreateTime(now);
|
||||
emptyHorder.setUpdateTime(now);
|
||||
emptyHorder.setStopReasonEvcs("平台停止");
|
||||
String sn = genOrder(connectorId);
|
||||
etOrderMapping.setXhOrderNo(sn);
|
||||
emptyHorder.setSerialNumber(sn);
|
||||
emptyHorder.setInternetSerialNumber(startChargeSeq);
|
||||
String operatorId3rdpty = startChargeSeq.substring(0, 9);
|
||||
emptyHorder.setOperatorId3rdptyEvcs(operatorId3rdpty);
|
||||
emptyHorder.setUserId(xhpcInternetUserRepository.queryDbId(operatorId3rdpty));
|
||||
emptyHorder.setType(1);
|
||||
emptyHorder.setSource(1);
|
||||
emptyHorder.setState(-1);
|
||||
emptyHorder.setChargingStationId(stationId);
|
||||
emptyHorder.setTerminalId(xhpcTerminalRepository.queryDbId(connectorId));
|
||||
emptyHorder.setConfirmResult(-1);
|
||||
xhpcHistoryOrderRepository.save(emptyHorder);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void notification(String orderNo) throws IOException {
|
||||
|
||||
String pushOrderKey="pushOrder:"+orderNo;
|
||||
Map<String, Object> pushOrder = REDIS.getCacheMap(pushOrderKey);
|
||||
if (pushOrder.get("startChargeSeqStat") != null && (Integer) pushOrder.get("startChargeSeqStat") > 1) {
|
||||
//logger.info("===============启动推送============================"+pushOrderKey);
|
||||
Integer startChargeNotificationStat = (Integer) pushOrder.get("startChargeNotificationStat");
|
||||
if (null != startChargeNotificationStat && 1 != startChargeNotificationStat && startChargeNotificationStat <= 20) {
|
||||
String startChargeSeq = (String) pushOrder.get("internetSerialNumber");
|
||||
String operatorId = startChargeSeq.substring(0, 9);
|
||||
Optional<AuthSecretToken> authSecretToken =authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId,SECRET_TOKEN_TYPE_OUT);
|
||||
if (authSecretToken.isPresent()) {
|
||||
NotificationStartChargeResultRequestData notificationStartChargeResultRequestData =
|
||||
new NotificationStartChargeResultRequestData();
|
||||
notificationStartChargeResultRequestData.setStartTime((String) pushOrder.get("startTime"));
|
||||
notificationStartChargeResultRequestData.setStartChargeSeq(startChargeSeq);
|
||||
notificationStartChargeResultRequestData.setConnectorId((String) pushOrder.get("connectorID"));
|
||||
notificationStartChargeResultRequestData.setStartChargeSeqStat((Integer) pushOrder.get("startChargeSeqStat"));
|
||||
notify(notificationStartChargeResultRequestData, authSecretToken.get(), pushOrderKey.substring(10));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void notify(NotificationStartChargeResultRequestData notificationStartChargeResultRequestData,
|
||||
AuthSecretToken authSecretTokenOut, String orderNo) throws IOException {
|
||||
String data = JSONUtil.toJSONString(notificationStartChargeResultRequestData);
|
||||
System.out.println("==========车为家=====启动推送数据===========data============="+data);
|
||||
CommonRequest<NotificationStartChargeResultRequestData> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_start_charge_result", authSecretTokenOut);
|
||||
System.out.println("==========车为家=====启动充电结果===========responseBody============="+responseBody);
|
||||
NotificationStartStopChargeResultResponse notificationStartStopChargeResultResponse =DTOJsonHelper.parseResponseData(responseBody,NotificationStartStopChargeResultResponse.class, authSecretTokenOut);
|
||||
if (null != notificationStartStopChargeResultResponse) {
|
||||
//Ensuring that only when startChargeNotificationStat equals 1 won't be notified.
|
||||
System.out.println("==========车为家=====启动充电结果===========notificationStartStopChargeResultResponse============="+notificationStartStopChargeResultResponse.toString());
|
||||
if (notificationStartStopChargeResultResponse.getSuccStat() == 0) {
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(orderNo), "startChargeNotificationStat", 1);
|
||||
} else {
|
||||
Integer startChargeNotificationStat = REDIS.getCacheMapValue("pushOrder:".concat(orderNo),
|
||||
"startChargeNotificationStat");
|
||||
if (startChargeNotificationStat == 0) {
|
||||
startChargeNotificationStat = 2;
|
||||
} else {
|
||||
++startChargeNotificationStat;
|
||||
}
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(orderNo), "startChargeNotificationStat",startChargeNotificationStat);
|
||||
throw new RuntimeException(String.format("push CD start charge order status [%s] failed: %s",notificationStartChargeResultRequestData.getStartChargeSeq(), responseBody));
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,301 @@
|
||||
package com.xhpc.evcs.cwj.api;
|
||||
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.core.utils.bean.BeanUtils;
|
||||
import com.xhpc.common.domain.XhpcTerminal;
|
||||
import com.xhpc.evcs.cdjgpc.dto.*;
|
||||
import com.xhpc.evcs.cwj.dto.*;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.XhpcInternetUser;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcInternetUserRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcTerminalRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static cn.hutool.core.util.NumberUtil.isInteger;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 10:29
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class CWJQueryStationsInfoController extends CoreDispatcher {
|
||||
|
||||
@Resource
|
||||
XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
@Resource
|
||||
XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Resource
|
||||
PowerPileService powerPileService;
|
||||
@Resource
|
||||
AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Resource
|
||||
XhpcTerminalRepository terminalRepository;
|
||||
/**
|
||||
* 车为家查询充电站信息
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v40/query_stations_info")
|
||||
public CommonResponse queryStationsInfo(@RequestBody(required = false) CommonRequest<CWJPageRequest> commonRequest) {
|
||||
|
||||
// System.out.println("================车为家查询充电站信息=======================");
|
||||
CommonResponse resp = new CommonResponse();
|
||||
try{
|
||||
//当前页数
|
||||
CWJPageRequest pageRequest = commonRequest.transformDataType(CWJPageRequest.class);
|
||||
Integer pageNo = pageRequest.getPageNo();
|
||||
CWJPageStationsInfoResponse response = new CWJPageStationsInfoResponse();
|
||||
response.setPageNo(pageNo);
|
||||
//页码总数
|
||||
String operatorId = commonRequest.getOperatorId();
|
||||
Instant now = Instant.now();
|
||||
XhpcInternetUser xhpcInternetUser =
|
||||
xhpcInternetUserRepository
|
||||
.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter(operatorId, now, now);
|
||||
Long internetUserId = xhpcInternetUser.getInternetUserId();
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist =
|
||||
xhpcStationInternetBlacklistRepo.findByInternetUserId(internetUserId);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
List<String> validStationKeys = new ArrayList<>();
|
||||
for (String stationKey : stationKeys) {
|
||||
boolean isValid = true;
|
||||
//查询不合作的电桩
|
||||
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
|
||||
if (stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
|
||||
isValid = false;
|
||||
}
|
||||
}
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationKey);
|
||||
if (chargingStationDto.getPiles() != null) {
|
||||
if (isValid) {
|
||||
validStationKeys.add(stationKey);
|
||||
}
|
||||
}
|
||||
}
|
||||
if (validStationKeys.size() > 0) {
|
||||
Integer pageSize = pageRequest.getPageSize();
|
||||
int totalPage = validStationKeys.size() % pageSize == 0 ? validStationKeys.size() / pageSize :
|
||||
(validStationKeys.size() / pageSize) + 1;
|
||||
response.setPageCount(totalPage);
|
||||
}
|
||||
//总记录条数
|
||||
response.setItemSize(validStationKeys.size());
|
||||
|
||||
//充电站信息列表
|
||||
List<CWJStationInfo> stationInfos = new ArrayList<>();
|
||||
//计算每页开始索引
|
||||
int startIndex = -1;
|
||||
int endIndex = -1;
|
||||
if (pageNo == 1 && validStationKeys.size() <= 10) {
|
||||
startIndex = 0;
|
||||
endIndex = validStationKeys.size() - 1;
|
||||
} else {
|
||||
Integer pageSize = pageRequest.getPageSize();
|
||||
startIndex = (pageNo - 1) * pageSize;
|
||||
endIndex = startIndex + (pageSize - 1);
|
||||
}
|
||||
for (int i = startIndex; i <= endIndex; i++) {
|
||||
String stationKey = null;
|
||||
try {
|
||||
stationKey = validStationKeys.get(i);
|
||||
} catch (Exception e) {
|
||||
continue;
|
||||
}
|
||||
String stationId = stationKey.replace("station:", "");
|
||||
stationInfos.add(getNotificationStationInfo(stationId));
|
||||
}
|
||||
response.setStationInfos(stationInfos);
|
||||
resp.setRet("0");
|
||||
resp.setMsg("Query station info success");
|
||||
|
||||
System.out.println("========/v40/query_stations_info=============="+JSONUtil.toJSONString(response));
|
||||
resp.setData(JSONUtil.toJSONString(response));
|
||||
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return resp;
|
||||
}
|
||||
|
||||
//组合场站数据
|
||||
public CWJStationInfo getNotificationStationInfo(String stationId){
|
||||
CWJStationInfo cwjStationInfo = new CWJStationInfo();
|
||||
|
||||
String key = "cdjgpc:station:".concat(stationId)+".notification";
|
||||
CDStationInfo cdStationInfo = REDIS.getCacheObject(key);
|
||||
|
||||
BeanUtils.copyBeanProp(cwjStationInfo,cdStationInfo);
|
||||
cwjStationInfo.setBusineHours("00:00-24:00");
|
||||
cwjStationInfo.setParkingDiscountType(2);
|
||||
//cwjStationInfo.setAreaCode(cdStationInfo.getAreaCodeCountryside());
|
||||
cwjStationInfo.setEquipmentInfos(new ArrayList<>());
|
||||
//查询场站是桩是否对应上
|
||||
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+stationId);
|
||||
|
||||
List<CWJEquipmentInfo> cwjEquipmentInfos = new ArrayList<>();
|
||||
|
||||
|
||||
Set<String> pks = stationDto.getPiles();
|
||||
if (pks != null) {
|
||||
for (String pileNo : pks) {
|
||||
String pk = "pile:".concat(pileNo);
|
||||
String skey = "cdjgpc:".concat(pk) + ".notification";
|
||||
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
|
||||
CWJEquipmentInfo cwjEquipmentInfo = new CWJEquipmentInfo();
|
||||
BeanUtils.copyBeanProp(cwjEquipmentInfo,cdEquipmentInfo);
|
||||
|
||||
List<CWJConnectorInfo> connectorInfos =new ArrayList<>();
|
||||
List<CDConnectorInfo> connectorInfos1 = cdEquipmentInfo.getConnectorInfos();
|
||||
|
||||
for (int i = 0; i <connectorInfos1.size() ; i++) {
|
||||
CDConnectorInfo cdConnectorInfo = connectorInfos1.get(i);
|
||||
CWJConnectorInfo cwjConnectorInfo = new CWJConnectorInfo();
|
||||
BeanUtils.copyBeanProp(cwjConnectorInfo,cdConnectorInfo);
|
||||
connectorInfos.add(cwjConnectorInfo);
|
||||
}
|
||||
cwjEquipmentInfo.setConnectorInfos(connectorInfos);
|
||||
cwjEquipmentInfo.setPower(cdEquipmentInfo.getEquipmentPower());
|
||||
cwjEquipmentInfos.add(cwjEquipmentInfo);
|
||||
}
|
||||
cwjStationInfo.setEquipmentInfos(cwjEquipmentInfos);
|
||||
REDIS.setCacheObject(key, cdStationInfo);
|
||||
}
|
||||
return cwjStationInfo;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设备接口状态查询(成都市平台调用我们平台) --已调用
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v40/query_station_status")
|
||||
public CommonResponse queryStationsStatus(@RequestBody CommonRequest<StationStatusRequest> commonRequest) throws Exception {
|
||||
|
||||
CommonResponse resp = new CommonResponse();
|
||||
resp.setRet(EvcsConst.RET_FAIL);
|
||||
StationStatusRequest stationStatusRequest = JSONUtil.readParams(commonRequest.getData(), StationStatusRequest.class);
|
||||
if (stationStatusRequest == null) {
|
||||
resp.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
String[] stationIDs = stationStatusRequest.getStationIds();
|
||||
List<CWJStationStatusInfo> cdStationStatusInfos = new ArrayList<>();
|
||||
//Loading data through redis at first.
|
||||
Collection<String> guns = REDIS.keys("gun:*");
|
||||
List<String> gunsNewList = new ArrayList<>();
|
||||
for (String value : guns) {
|
||||
gunsNewList.add(value.substring(4));
|
||||
}
|
||||
List<String> gunsIds = new ArrayList<>();
|
||||
for (String value : gunsNewList) {
|
||||
if (value.length() == 16) {
|
||||
gunsIds.add(value);
|
||||
}
|
||||
}
|
||||
Map<String, Integer> statusMap = new HashMap<>();
|
||||
String[] keys = {"离线", "空闲", "故障"};
|
||||
Integer[] values = {0, 1, 255};
|
||||
for (int i = 0; i < keys.length; i++) {
|
||||
statusMap.put(keys[i], values[i]);
|
||||
}
|
||||
|
||||
List<XhpcTerminal> terminalList = terminalRepository.selectStatusBySql();
|
||||
Map<String,Integer> terminalDBMap = terminalList.stream().collect(Collectors.toMap(XhpcTerminal::getSerialNumber,XhpcTerminal::getStatus));
|
||||
|
||||
for (String stationID : stationIDs) {
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject("station:" + stationID);
|
||||
Set<String> pileIds = new HashSet<>();
|
||||
if (null != chargingStationDto) {
|
||||
pileIds = chargingStationDto.getPiles();
|
||||
}
|
||||
boolean existsGun = false;
|
||||
List<CWJConnectorStatusInfo> connectorStatusInfos = new ArrayList<>();
|
||||
for (String pileId : pileIds) {
|
||||
for (String value : gunsIds) {
|
||||
if (pileId.equals(value.substring(0, 14))) {
|
||||
existsGun = true;
|
||||
CWJConnectorStatusInfo cdConnectorStatusInfo = new CWJConnectorStatusInfo();
|
||||
Integer gunStatus = terminalDBMap.get(value);
|
||||
if (gunStatus == null){
|
||||
existsGun = false;
|
||||
} else {
|
||||
if (gunStatus == 0){
|
||||
Object status = REDIS.getCacheMapValue("gun:" + value, "status");
|
||||
if (isInteger(status.toString())) {
|
||||
cdConnectorStatusInfo.setStatus(3);
|
||||
} else {
|
||||
cdConnectorStatusInfo.setStatus(statusMap.get(status));
|
||||
}
|
||||
} else {
|
||||
cdConnectorStatusInfo.setStatus(0);
|
||||
}
|
||||
cdConnectorStatusInfo.setConnectorID(value);
|
||||
connectorStatusInfos.add(cdConnectorStatusInfo);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (existsGun) {
|
||||
CWJStationStatusInfo cdStationStatusInfo = new CWJStationStatusInfo();
|
||||
cdStationStatusInfo.setStationID(stationID);
|
||||
cdStationStatusInfo.setConnectorStatusInfos(connectorStatusInfos);
|
||||
cdStationStatusInfos.add(cdStationStatusInfo);
|
||||
}
|
||||
}
|
||||
CWJStationStatusInfoWrapper stationStatusInfoWrappers = new CWJStationStatusInfoWrapper();
|
||||
stationStatusInfoWrappers.setTotal(cdStationStatusInfos.size());
|
||||
if (cdStationStatusInfos.size() != 0) {
|
||||
stationStatusInfoWrappers.setStationStatusInfos(cdStationStatusInfos);
|
||||
}
|
||||
resp.setRet("0");
|
||||
resp.setMsg("Query station status success");
|
||||
resp.setData(JSONUtil.toJSONString(stationStatusInfoWrappers));
|
||||
}
|
||||
return resp;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送站点下线
|
||||
* @return
|
||||
* @throws Exception
|
||||
*/
|
||||
@PostMapping("/v40/getNotificationStationFee")
|
||||
public void getNotificationStationFee(String stationID) throws Exception {
|
||||
AuthSecretToken authSecretTokenOut = authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA6CC2LK7", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
// maybe对接第三方
|
||||
if (authSecretTokenOut != null) {
|
||||
Map<String, Object> map =new HashMap<>();
|
||||
map.put("StationID",stationID);
|
||||
String data = JSONUtil.toJSONString(map);
|
||||
CommonRequest<CDStationFee> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
ok(commonRequest, "/notification_stationOfflineStatus", authSecretTokenOut);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,150 @@
|
||||
package com.xhpc.evcs.cwj.api;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.domain.XhpcChargingPile;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.CommonResponse;
|
||||
import com.xhpc.evcs.dto.QueryStopChargeRequest;
|
||||
import com.xhpc.evcs.dto.QueryStopChargeResponse;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.OrderMappingRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestBody;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 17:26
|
||||
*/
|
||||
@Slf4j
|
||||
@RestController
|
||||
public class CWJQueryStopChargeController {
|
||||
@Autowired
|
||||
PowerPileService powerPileService;
|
||||
//三方订单与redis内部订单映射表
|
||||
@Autowired
|
||||
private OrderMappingRepository etOrderMappingRepo;
|
||||
|
||||
@Autowired
|
||||
private com.xhpc.evcs.jpa.XhpcChargingPileRepository XhpcChargingPileRepository;
|
||||
|
||||
/**
|
||||
* 请求停止充电
|
||||
* @param commonRequest
|
||||
* @return
|
||||
* @throws IOException
|
||||
*/
|
||||
@PostMapping("/v40/query_stop_charge")
|
||||
public CommonResponse queryStopCharge(@RequestBody CommonRequest<QueryStopChargeRequest> commonRequest) throws IOException {
|
||||
|
||||
CommonResponse commonResponse = new CommonResponse();
|
||||
commonResponse.setRet(EvcsConst.RET_FAIL);
|
||||
QueryStopChargeRequest queryStopChargeRequest = JSONUtil.readParams(commonRequest.getData(),
|
||||
QueryStopChargeRequest.class);
|
||||
if (queryStopChargeRequest == null) {
|
||||
commonResponse.setMsg("Request or token params validation failed");
|
||||
} else {
|
||||
// evcs电订单号(27位)
|
||||
String startChargeSeq = queryStopChargeRequest.getStartChargeSeq();
|
||||
QueryStopChargeResponse queryStopChargeResponse = new QueryStopChargeResponse();
|
||||
queryStopChargeResponse.setStartChargeSeq(startChargeSeq);
|
||||
//判断三方的订单号是否存在
|
||||
EtOrderMapping etOrderMapping = etOrderMappingRepo.findByEvcsOrderNo(startChargeSeq).orElse(null);
|
||||
if (etOrderMapping == null) {
|
||||
return failCommonResponse(queryStopChargeResponse, "错误的充电订单号");
|
||||
}
|
||||
String xhOrderNo = etOrderMapping.getXhOrderNo();
|
||||
String pushOrderkey = "pushOrder:".concat(xhOrderNo);
|
||||
Map<String, Object> pushOrder = REDIS.getCacheMap(pushOrderkey);
|
||||
if (pushOrder == null || (pushOrder.get("isStopNotified") != null && (Boolean) pushOrder.get("isStopNotified"))) {
|
||||
return failCommonResponse(queryStopChargeResponse, "已下发停止充电指令");
|
||||
}
|
||||
//充电设备接口编码(枪编码)
|
||||
String connectorId = queryStopChargeRequest.getConnectorId();
|
||||
String pileNum = connectorId.substring(0, connectorId.length() - 2);
|
||||
//从数据库中查询对应的桩的版本信息
|
||||
XhpcChargingPile pileInfo = XhpcChargingPileRepository.findBySerialNumber(pileNum).orElse(null);
|
||||
String versionNum = pileInfo.getCommunicationProtocolVersion() != null ?
|
||||
pileInfo.getCommunicationProtocolVersion() :
|
||||
"0A";
|
||||
//给对应的枪发送停止充电指令
|
||||
// System.out.println("=================22========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo);
|
||||
// System.out.println("=================22========给对应的枪发送停止充电指令==================停止 充电=================="+xhOrderNo);
|
||||
|
||||
R r = powerPileService.stopCharging(xhOrderNo, pileNum, connectorId, versionNum);
|
||||
// 判断停止指令发送是否成功
|
||||
if (r.getCode() != 200) {
|
||||
//向redis中放入停止充电指令没有下发成功的标识
|
||||
REDIS.setCacheMap(pushOrderkey, pushOrder);
|
||||
//充电订单状态
|
||||
queryStopChargeResponse.setStartChargeSeqStat(5);
|
||||
//操作结果
|
||||
queryStopChargeResponse.setSuccStat(1);
|
||||
//失败原因
|
||||
String errorMsg = r.getMsg();
|
||||
if (errorMsg.contains("未注册")) {
|
||||
queryStopChargeResponse.setFailReasonMsg("此设备不存在");
|
||||
queryStopChargeResponse.setFailReason(1);
|
||||
}
|
||||
if (errorMsg.contains("离线")) {
|
||||
queryStopChargeResponse.setFailReasonMsg("此设备离线");
|
||||
queryStopChargeResponse.setFailReason(2);
|
||||
}
|
||||
if (errorMsg.contains("订单号")) {
|
||||
//4 means error orderNumber
|
||||
queryStopChargeResponse.setFailReasonMsg("订单号不正确");
|
||||
queryStopChargeResponse.setFailReason(4);
|
||||
}
|
||||
if (errorMsg.contains("端口")) {
|
||||
//5 means port is not charging
|
||||
queryStopChargeResponse.setFailReasonMsg("端口不在充电中");
|
||||
queryStopChargeResponse.setFailReason(5);
|
||||
}
|
||||
queryStopChargeResponse.setStartChargeSeqStat(4);
|
||||
queryStopChargeResponse.setSuccStat(1);
|
||||
String data = JSONUtil.toJSONString(queryStopChargeResponse);
|
||||
commonResponse.setMsg("请求停止充电失败");
|
||||
commonResponse.setData(data);
|
||||
return commonResponse;
|
||||
}
|
||||
//设置该订单已经被停止的标识
|
||||
Map<String, Object> order = REDIS.getCacheMap("order:" + xhOrderNo);
|
||||
order.replace("status", "已结束");
|
||||
REDIS.setCacheMap("order:".concat(xhOrderNo), order);
|
||||
REDIS.setCacheMap(pushOrderkey, pushOrder);
|
||||
queryStopChargeResponse.setStartChargeSeqStat(3);
|
||||
queryStopChargeResponse.setSuccStat(0);
|
||||
queryStopChargeResponse.setFailReason(0);
|
||||
String data = JSONUtil.toJSONString(queryStopChargeResponse);
|
||||
commonResponse.setRet("0");
|
||||
commonResponse.setMsg("请求停止充电成功");
|
||||
commonResponse.setData(data);
|
||||
}
|
||||
return commonResponse;
|
||||
}
|
||||
|
||||
private CommonResponse failCommonResponse(QueryStopChargeResponse queryStopChargeResponse, String msg) throws JsonProcessingException {
|
||||
|
||||
queryStopChargeResponse.setStartChargeSeqStat(5);
|
||||
queryStopChargeResponse.setSuccStat(1);
|
||||
queryStopChargeResponse.setFailReason(0);
|
||||
String data = JSONUtil.toJSONString(queryStopChargeResponse);
|
||||
CommonResponse commonResponse = new CommonResponse();
|
||||
commonResponse.setRet("500");
|
||||
commonResponse.setMsg(msg);
|
||||
commonResponse.setData(data);
|
||||
return commonResponse;
|
||||
}
|
||||
|
||||
}
|
||||
@ -0,0 +1,250 @@
|
||||
package com.xhpc.evcs.cwj.notification;
|
||||
|
||||
import cn.hutool.core.date.DateField;
|
||||
import cn.hutool.core.date.DateTime;
|
||||
import com.xhpc.common.data.redis.CacheBmsReqChargerOutputData;
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.common.data.redis.CacheRealtimeData;
|
||||
import com.xhpc.evcs.cwj.dto.CEJEquipChargeStatus;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.EtOrderMapping;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.encryption.EvcsConst;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.OrderMappingRepository;
|
||||
import com.xhpc.evcs.jpa.StatisticTimeIntervalRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.notification.NotificationEquipChargeStatusTask;
|
||||
import com.xhpc.evcs.utils.DateUtil;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.math.RoundingMode;
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
import java.time.ZoneId;
|
||||
import java.time.format.DateTimeFormatter;
|
||||
import java.time.temporal.ChronoUnit;
|
||||
import java.util.*;
|
||||
|
||||
import static cn.hutool.core.util.NumberUtil.isInteger;
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
import static com.xhpc.evcs.utils.DateUtil.DATE_FORMAT_DATE_TIME;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 17:15
|
||||
*/
|
||||
@Component
|
||||
public class CWJNotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Autowired
|
||||
private StatisticTimeIntervalRepository statisticTimeIntervalRepository;
|
||||
@Autowired
|
||||
private OrderMappingRepository orderMappingRepository;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationEquipChargeStatusTask.class);
|
||||
|
||||
/**
|
||||
* 推送充电状态(evcs 放开)
|
||||
* @throws IOException
|
||||
*/
|
||||
//都开放
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws IOException {
|
||||
|
||||
AuthSecretToken authSecretToken =authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType("MA7D6FPW6", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
final Collection<String> gunkeys = REDIS.keys("gun:*");
|
||||
for (String gunkey : gunkeys) {
|
||||
if (!gunkey.endsWith(".seqdec") && !gunkey.endsWith(".seqhex") && !gunkey.endsWith(".hori")) {
|
||||
final Map<String, Object> cacheGun = REDIS.getCacheMap(gunkey);
|
||||
final String status = (String) cacheGun.get("status");
|
||||
if (status != null) {
|
||||
if(cacheGun.get("cycOrder") !=null){
|
||||
//川逸充订单不走实时充电状态接口
|
||||
continue;
|
||||
}
|
||||
if (isInteger(status)) {
|
||||
String orderkey = (String) cacheGun.get("orderkey");
|
||||
if (orderkey == null) {
|
||||
logger.error("[{}] is charging but no okey in cache..", gunkey);
|
||||
continue;
|
||||
}
|
||||
CEJEquipChargeStatus equipChargeStatus = new CEJEquipChargeStatus();
|
||||
final String internetSerialNumber = REDIS.getCacheMapValue(orderkey.replace("order:", "pushOrder:"),"internetSerialNumber");
|
||||
if (internetSerialNumber == null || !internetSerialNumber.startsWith(authSecretToken.getOperatorId3irdpty())) {
|
||||
continue;
|
||||
}
|
||||
equipChargeStatus.setStartChargeSeq(internetSerialNumber);
|
||||
equipChargeStatus.setStartChargeSeqStat(2);
|
||||
equipChargeStatus.setConnectorID(orderkey.substring(6, 22));
|
||||
equipChargeStatus.setConnectorStatus(3);
|
||||
equipChargeStatus.setCurrentA(REDIS.getCacheMapValue(gunkey, "current"));
|
||||
equipChargeStatus.setVoltageA(REDIS.getCacheMapValue(gunkey, "voltage"));
|
||||
Integer soc = REDIS.getCacheMapValue(orderkey, "endSoc");
|
||||
equipChargeStatus.setSoc(soc == null ? 0.0 : (double) (soc > 100 ? 100 : soc));
|
||||
CacheRealtimeData lord = REDIS.getCacheObject(orderkey.concat(".lord"));
|
||||
String lordTime;
|
||||
if (lord != null) {
|
||||
lordTime = lord.getCreateTime();
|
||||
} else {
|
||||
lordTime = DateUtil.date2String(Calendar.getInstance().getTime(), DATE_FORMAT_DATE_TIME);
|
||||
}
|
||||
equipChargeStatus.setStartTime(REDIS.getCacheMapValue(orderkey, "startTime"));
|
||||
equipChargeStatus.setEndTime(lordTime);
|
||||
equipChargeStatus.setTotalPower(REDIS.getCacheMapValue(orderkey, "totalPower"));
|
||||
equipChargeStatus.setTotalMoney(REDIS.getCacheMapValue(orderkey, "totalMoney"));
|
||||
final Long rateModelId = REDIS.getCacheMapValue(gunkey.replace("gun", "pile").substring(0, 19),
|
||||
"rateModelId");
|
||||
final CacheRateModel cacheRateModel = REDIS.getCacheObject("rateModel:" + rateModelId);
|
||||
calculateEmYu(equipChargeStatus, cacheRateModel);
|
||||
//充电订单状态
|
||||
EtOrderMapping etOrderMapping = orderMappingRepository.findByEvcsOrderNo(internetSerialNumber).orElse(null);
|
||||
if (etOrderMapping != null) {
|
||||
CacheBmsReqChargerOutputData bms = REDIS.getCacheObject("order:"+etOrderMapping.getXhOrderNo()+".bms");
|
||||
if(bms==null || bms.getBmsEstRemainingTime()==null){
|
||||
equipChargeStatus.setLeftTime(60);
|
||||
}else{
|
||||
equipChargeStatus.setLeftTime(bms.getBmsEstRemainingTime());
|
||||
}
|
||||
}
|
||||
|
||||
notify(equipChargeStatus, authSecretToken);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void calculateEmYu(CEJEquipChargeStatus equipChargeStatus, CacheRateModel cacheRateModel) {
|
||||
|
||||
if (cacheRateModel == null) {
|
||||
equipChargeStatus.setChargeDetails(new ChargeDetails[0]);
|
||||
return;
|
||||
}
|
||||
final Date endTime = DateUtil.yyyyMMDDhhmmss2Date(equipChargeStatus.getEndTime());
|
||||
final Date startTime = DateUtil.yyyyMMDDhhmmss2Date(equipChargeStatus.getStartTime());
|
||||
long totalMilSec = endTime.getTime() - startTime.getTime();
|
||||
BigDecimal hours = new BigDecimal(totalMilSec).divide(new BigDecimal(3600000), 2, RoundingMode.FLOOR);
|
||||
int sumPeriod = hours.setScale(0, RoundingMode.CEILING).intValue() + 1;
|
||||
equipChargeStatus.setSumPeriod(sumPeriod);
|
||||
DateTime firstNDT = DateTime.of(startTime);
|
||||
Stack<ChargeDetails> chargeDetailsStack = new Stack<>();
|
||||
ChargeDetails chargeDetails = null;
|
||||
Double firstNElecMoney = 0.0;
|
||||
Double firstNSeviceMony = 0.0;
|
||||
Double firstNPower = 0.0;
|
||||
String rtfTemp = null;
|
||||
Instant startIst = startTime.toInstant();
|
||||
final Instant endInst = endTime.toInstant();
|
||||
Instant endPeriod;
|
||||
final Double totalPower = equipChargeStatus.getTotalPower();
|
||||
for (int i = 0; i < sumPeriod; i++) {
|
||||
if (!startIst.isBefore(endInst)) break;
|
||||
endPeriod = startIst.truncatedTo(ChronoUnit.HOURS).plusSeconds(3599L);
|
||||
if (!endPeriod.isBefore(endInst)) {
|
||||
endPeriod = endInst;
|
||||
}
|
||||
boolean newCd = false;
|
||||
int firstSTHourOfDay = firstNDT.getField(DateField.HOUR_OF_DAY);
|
||||
int tf = firstSTHourOfDay * 2;
|
||||
final String rtf = cacheRateModel.getTfPricesSeq()[tf];
|
||||
if (chargeDetails == null || !rtf.equals(rtfTemp)) {
|
||||
newCd = true;
|
||||
chargeDetails = new ChargeDetails();
|
||||
}
|
||||
rtfTemp = rtf;
|
||||
Duration durm = Duration.between(startIst, endPeriod);
|
||||
BigDecimal timePeriodRatio = BigDecimal.valueOf(durm.toMillis()).divide(BigDecimal.valueOf(totalMilSec), 2,
|
||||
RoundingMode.HALF_UP);
|
||||
calculateCD(cacheRateModel, rtf, timePeriodRatio, BigDecimal.valueOf(totalPower), chargeDetails);
|
||||
if (i == 0) {
|
||||
chargeDetails.setDetailStartTime(equipChargeStatus.getStartTime());
|
||||
} else if (newCd) {
|
||||
chargeDetails.setDetailStartTime(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault()).format(startIst));
|
||||
}
|
||||
startIst = startIst.truncatedTo(ChronoUnit.HOURS).plusSeconds(3600L);
|
||||
chargeDetails.setDetailEndTime(DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss").withZone(ZoneId.systemDefault()).format(endPeriod));
|
||||
if (newCd) {
|
||||
chargeDetailsStack.push(chargeDetails);
|
||||
}
|
||||
}
|
||||
ChargeDetails[] cda = new ChargeDetails[chargeDetailsStack.size()];
|
||||
equipChargeStatus.setChargeDetails(chargeDetailsStack.toArray(cda));
|
||||
equipChargeStatus.setSumPeriod(chargeDetailsStack.size());
|
||||
equipChargeStatus.setElecMoney(firstNElecMoney);
|
||||
final Double totalMoney = equipChargeStatus.getTotalMoney();
|
||||
for (ChargeDetails cd : chargeDetailsStack) {
|
||||
firstNElecMoney += cd.getDetailElecMoney();
|
||||
firstNSeviceMony += cd.getDetailSeviceMoney();
|
||||
firstNPower += cd.getDetailPower();
|
||||
}
|
||||
equipChargeStatus.setElecMoney(BigDecimal.valueOf(totalMoney).subtract(BigDecimal.valueOf(firstNSeviceMony)).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
equipChargeStatus.setSeviceMoney(BigDecimal.valueOf(firstNSeviceMony).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
final BigDecimal oddm =
|
||||
BigDecimal.valueOf(totalMoney).subtract(BigDecimal.valueOf(firstNElecMoney)).subtract(BigDecimal.valueOf(firstNSeviceMony));
|
||||
final BigDecimal oddp = BigDecimal.valueOf(totalPower).subtract(BigDecimal.valueOf(firstNPower));
|
||||
if (!chargeDetailsStack.isEmpty()) {
|
||||
ChargeDetails peek = chargeDetailsStack.peek();
|
||||
peek.setDetailElecMoney(BigDecimal.valueOf(peek.getDetailElecMoney()).add(oddm).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
peek.setDetailPower(BigDecimal.valueOf(peek.getDetailPower()).add(oddp).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private static void calculateCD(CacheRateModel cacheRateModel, String rtf,
|
||||
BigDecimal timePeriodRatio, BigDecimal tpPower, ChargeDetails cd) {
|
||||
|
||||
cd.setDetailPower(BigDecimal.valueOf(cd.getDetailPower() + tpPower.multiply(timePeriodRatio).doubleValue()).setScale(4, RoundingMode.HALF_UP).doubleValue());
|
||||
|
||||
Integer powerPrice;
|
||||
Integer svcPrice;
|
||||
if ("00".equals(rtf)) {
|
||||
powerPrice = cacheRateModel.getT1Price();
|
||||
svcPrice = cacheRateModel.getT1SvcPrice();
|
||||
} else if ("01".equals(rtf)) {
|
||||
powerPrice = cacheRateModel.getT2Price();
|
||||
svcPrice = cacheRateModel.getT2SvcPrice();
|
||||
} else if ("02".equals(rtf)) {
|
||||
powerPrice = cacheRateModel.getT3Price();
|
||||
svcPrice = cacheRateModel.getT3SvcPrice();
|
||||
} else{
|
||||
powerPrice = cacheRateModel.getT4Price();
|
||||
svcPrice = cacheRateModel.getT4SvcPrice();
|
||||
}
|
||||
cd.setElecPrice( new BigDecimal(powerPrice).divide(new BigDecimal(100000)).setScale(4,RoundingMode.HALF_UP).doubleValue());
|
||||
cd.setSevicePrice(new BigDecimal(svcPrice).divide(new BigDecimal(100000)).setScale(4,RoundingMode.HALF_UP).doubleValue());
|
||||
final double detailElecMoney = BigDecimal.valueOf(cd.getElecPrice())
|
||||
.multiply(BigDecimal.valueOf(cd.getDetailPower()))
|
||||
.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
cd.setDetailElecMoney(BigDecimal.valueOf(detailElecMoney).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
final double detailSeviceMoney = BigDecimal.valueOf(cd.getSevicePrice())
|
||||
.multiply(BigDecimal.valueOf(cd.getDetailPower()))
|
||||
.setScale(2, RoundingMode.HALF_UP).doubleValue();
|
||||
cd.setDetailSeviceMoney(BigDecimal.valueOf(detailSeviceMoney).setScale(2, RoundingMode.HALF_UP).doubleValue());
|
||||
}
|
||||
|
||||
public void notify(CEJEquipChargeStatus equipChargeStatus, AuthSecretToken authSecretTokenOut) throws IOException {
|
||||
String data = JSONUtil.toJSONString(equipChargeStatus);
|
||||
CommonRequest<CDChargeOrderInfo4BonusReq> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_equip_charge_status", authSecretTokenOut);
|
||||
|
||||
System.out.println("==========车为家=====充电结束状态推送===========responseBody============="+responseBody);
|
||||
EquipChargeStatusRes equipChargeStatusRes = DTOJsonHelper.parseResponseData(responseBody,
|
||||
EquipChargeStatusRes.class, authSecretTokenOut);
|
||||
if (equipChargeStatusRes != null && equipChargeStatusRes.getSuccStat() != 0) {
|
||||
logger.error("push equipment order status [%s] failed: %s", equipChargeStatus.getStartChargeSeq(), responseBody);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,255 @@
|
||||
package com.xhpc.evcs.cwj.notification;
|
||||
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.core.utils.bean.BeanUtils;
|
||||
import com.xhpc.common.data.redis.CacheRateModel;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDConnectorInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDEquipmentInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||
import com.xhpc.evcs.cdjgpc.notification.CDNotificationStationInfoTask;
|
||||
import com.xhpc.evcs.cwj.dto.CWJConnectorInfo;
|
||||
import com.xhpc.evcs.cwj.dto.CWJEquipmentInfo;
|
||||
import com.xhpc.evcs.cwj.dto.CWJStationInfo;
|
||||
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.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.*;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 11:31
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CWJNotificationStationInfoTask extends CoreDispatcher {
|
||||
@Resource
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Resource
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
private final Logger logger = LoggerFactory.getLogger(CDNotificationStationInfoTask.class);
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
@Scheduled(cron = "0 30 0 1/1 * ? ")
|
||||
public void run() throws IOException {
|
||||
try{
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByInternetUserId(7L);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType("MA7D6FPW6", "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 chargingStationId = stationKey.substring(8);
|
||||
//获取场站信息
|
||||
String key = "cdjgpc:station:".concat(chargingStationId)+".notification";
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
|
||||
CWJStationInfo cwjStationInfo = new CWJStationInfo();
|
||||
BeanUtils.copyBeanProp(cwjStationInfo,cdStationInfo);
|
||||
cwjStationInfo.setBusineHours("00:00-24:00");
|
||||
cwjStationInfo.setParkingDiscountType(2);
|
||||
cwjStationInfo.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(svcPrice.length()-1).append("}");
|
||||
}
|
||||
cwjStationInfo.setElectricityFee(price.toString());
|
||||
cwjStationInfo.setServiceFee(svcPrice.toString());
|
||||
Set<String> pks = stationDto.getPiles();
|
||||
if (pks != null) {
|
||||
List<CWJEquipmentInfo> cwjEquipmentInfos = new ArrayList<>();
|
||||
for (String pileNo : pks) {
|
||||
String pk = "pile:".concat(pileNo);
|
||||
String skey = "cdjgpc:".concat(pk)+".notification";
|
||||
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
|
||||
CWJEquipmentInfo cwjEquipmentInfo = new CWJEquipmentInfo();
|
||||
BeanUtils.copyBeanProp(cwjEquipmentInfo,cdEquipmentInfo);
|
||||
|
||||
List<CWJConnectorInfo> connectorInfos =new ArrayList<>();
|
||||
List<CDConnectorInfo> connectorInfos1 = cdEquipmentInfo.getConnectorInfos();
|
||||
|
||||
for (int i = 0; i <connectorInfos1.size() ; i++) {
|
||||
CDConnectorInfo cdConnectorInfo = connectorInfos1.get(i);
|
||||
CWJConnectorInfo cwjConnectorInfo = new CWJConnectorInfo();
|
||||
BeanUtils.copyBeanProp(cwjConnectorInfo,cdConnectorInfo);
|
||||
connectorInfos.add(cwjConnectorInfo);
|
||||
}
|
||||
cwjEquipmentInfo.setConnectorInfos(connectorInfos);
|
||||
cwjEquipmentInfo.setPower(cdEquipmentInfo.getEquipmentPower());
|
||||
cwjEquipmentInfos.add(cwjEquipmentInfo);
|
||||
}
|
||||
cwjStationInfo.setEquipmentInfos(cwjEquipmentInfos);
|
||||
}
|
||||
CommonRequest<CWJStationInfo> commonRequest = new CommonRequest<>();
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("StationInfo",cwjStationInfo);
|
||||
String data = JSONUtil.toJSONString(mapStationInfo);
|
||||
System.out.println("=======data========"+data);
|
||||
commonRequest.setData(data);
|
||||
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut);
|
||||
System.out.println("=====推送充电站信息==result========"+result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
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,152 @@
|
||||
package com.xhpc.evcs.cwj.notification;
|
||||
|
||||
import com.xhpc.common.api.dto.ChargingStationDto;
|
||||
import com.xhpc.common.domain.XhpcTerminal;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDConnectorStatusInfo;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDConnectorStatusInfoReq;
|
||||
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
|
||||
import com.xhpc.evcs.cwj.dto.CWJConnectorStatusInfo;
|
||||
import com.xhpc.evcs.cwj.dto.CWJConnectorStatusInfoReq;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.XhpcInternetUser;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.ConnectorStatusInfo;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcInternetUserRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcStationInternetBlacklistRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcTerminalRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.ChangePoleStatus;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.time.Instant;
|
||||
import java.util.*;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
import static com.xhpc.evcs.dto.ConnectorStatusInfo.*;
|
||||
import static com.xhpc.evcs.dto.ConnectorStatusInfo.CHARGING;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-16 11:06
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class CWJNotificationStationStatusTask extends CoreDispatcher {
|
||||
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Autowired
|
||||
private XhpcInternetUserRepository xhpcInternetUserRepository;
|
||||
@Autowired
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
@Resource
|
||||
private XhpcTerminalRepository terminalRepository;
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(fixedRate = 1000 * 60)
|
||||
protected void run() throws IOException {
|
||||
|
||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||
|
||||
List<XhpcTerminal> terminalList = terminalRepository.selectStatusBySql();
|
||||
Map<String,Integer> terminalDBMap = terminalList.stream().collect(Collectors.toMap(XhpcTerminal::getSerialNumber,XhpcTerminal::getStatus));
|
||||
|
||||
Instant now = Instant.now();
|
||||
|
||||
XhpcInternetUser xhpcInternetUser =xhpcInternetUserRepository.findByOperatorIdEvcsLikeAndCooperationStartTimeBeforeAndCooperationEndTimeAfter("MA7D6FPW6", Instant.now(), Instant.now());
|
||||
|
||||
for (String stationTerminalKey : stationTerminalKeys) {
|
||||
ChargingStationDto chargingStationDto = REDIS.getCacheObject(stationTerminalKey.replace("stationTerminalStatus",
|
||||
"station"));
|
||||
String operatorId = chargingStationDto.getOperatorId();
|
||||
Map<String, String> terminalStatusMap = REDIS.getCacheMap(stationTerminalKey);
|
||||
Set<ConnectorStatusInfo> connectorStatusInfos = translateStatus(operatorId, terminalStatusMap, terminalDBMap);
|
||||
Set<ConnectorStatusInfo> changeStatus = ChangePoleStatus.getChangeStatus(connectorStatusInfos);
|
||||
if (!changeStatus.isEmpty()) {
|
||||
XhpcStationInternetBlacklist xhpcStationInternetBlacklist =
|
||||
xhpcStationInternetBlacklistRepo.findByChargingStationIdAndInternetUserId(Long.valueOf(stationTerminalKey.split(":")[1]),
|
||||
xhpcInternetUser.getInternetUserId()).orElse(null);
|
||||
if (xhpcStationInternetBlacklist != null) continue;
|
||||
AuthSecretToken authSecretTokenOut =authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType("MA7D6FPW6", SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
log.debug("nss pushing to: {}", "MA7D6FPW6");
|
||||
if (authSecretTokenOut != null) {
|
||||
for (ConnectorStatusInfo statusInfo : changeStatus) {
|
||||
notify(stationTerminalKey,statusInfo, authSecretTokenOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private Set<ConnectorStatusInfo> translateStatus(String operatorId, Map<String, String> terminalStatusMap, Map<String, Integer> terminalDBMap) {
|
||||
|
||||
Set<ConnectorStatusInfo> connectorStatusInfoList = new HashSet<>();
|
||||
final Set<String> connectorIds = terminalStatusMap.keySet();
|
||||
for (String gunId : connectorIds) {
|
||||
ConnectorStatusInfo connectorStatusInfo = new ConnectorStatusInfo();
|
||||
connectorStatusInfo.setConnectorID(gunId);
|
||||
connectorStatusInfo.setOperatorID(operatorId);
|
||||
Integer dbStatus = terminalDBMap.get(gunId);
|
||||
if(dbStatus !=null && dbStatus == 0){
|
||||
connectorStatusInfo.setStatus(translateStatus(terminalStatusMap.get(gunId)));
|
||||
} else {
|
||||
connectorStatusInfo.setStatus(0);
|
||||
}
|
||||
connectorStatusInfoList.add(connectorStatusInfo);
|
||||
}
|
||||
return connectorStatusInfoList;
|
||||
}
|
||||
|
||||
private Integer translateStatus(String statusStr) {
|
||||
|
||||
switch (statusStr) {
|
||||
case "空闲":
|
||||
return FREE;
|
||||
case "离线":
|
||||
return OFF_LINE;
|
||||
case "故障":
|
||||
return ERROR;
|
||||
default:
|
||||
return CHARGING;
|
||||
}
|
||||
}
|
||||
|
||||
public void notify(String stationTerminalKey,ConnectorStatusInfo connectorStatusInfo, AuthSecretToken authSecretTokenOut) throws IOException {
|
||||
|
||||
CWJConnectorStatusInfoReq connectorStatusInfoReq = new CWJConnectorStatusInfoReq();
|
||||
|
||||
//System.out.println("=========stationTerminalKey=========="+stationTerminalKey+"======ConnectorID======="+connectorStatusInfo.getConnectorID());
|
||||
String key =stationTerminalKey.replace("stationTerminalStatus","cdjgpc:station")+".notification";
|
||||
// System.out.println("=========key=========="+key);
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
|
||||
CWJConnectorStatusInfo cdConnectorStatusInfo =new CWJConnectorStatusInfo();
|
||||
|
||||
cdConnectorStatusInfo.setConnectorID(connectorStatusInfo.getConnectorID());
|
||||
cdConnectorStatusInfo.setStatus(connectorStatusInfo.getStatus());
|
||||
|
||||
connectorStatusInfoReq.setConnectorStatusInfo(cdConnectorStatusInfo);
|
||||
String data = JSONUtil.toJSONString(connectorStatusInfoReq);
|
||||
CommonRequest<CDConnectorStatusInfoReq> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String result = ok(commonRequest, "/notification_stationStatus", authSecretTokenOut);
|
||||
|
||||
System.out.println("==车为家=设备状态变化推送====result========"+result);
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
@ -52,6 +52,5 @@ public interface AuthSecretTokenRepository extends JpaRepository<AuthSecretToken
|
||||
|
||||
Optional<AuthSecretToken> findByStatusAndOperatorId3irdptyAndSecretTokenType(Integer status,String operatorId, String secretTokenType);
|
||||
List<AuthSecretToken> findBySecretTokenType(String secretTokenType);
|
||||
|
||||
|
||||
List<AuthSecretToken> findBySecretTokenTypeAndOperatorId3irdptyNot(String secretTokenType,String operatorId3irdpty);
|
||||
}
|
||||
|
||||
@ -0,0 +1,34 @@
|
||||
package com.xhpc.evcs.jpa;
|
||||
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderOrder;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.QueryByExampleExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 占位费
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-07-08 16:13
|
||||
*/
|
||||
@Repository
|
||||
public interface PlaceholderIOrderRepository extends JpaRepository<XhpcPlaceholderOrder, Long>,
|
||||
QueryByExampleExecutor<XhpcPlaceholderOrder>, JpaSpecificationExecutor<XhpcPlaceholderOrder>, PagingAndSortingRepository<XhpcPlaceholderOrder, Long> {
|
||||
|
||||
List<XhpcPlaceholderOrder> findTop100ByPlaceholderOrderIdGreaterThanEqualAndOperatorIdEvcsAndConfirmResultOrderByPlaceholderOrderIdAsc(Long placeholderOrderId,String OperatorIdEvcs,int confirmResult);
|
||||
|
||||
List<XhpcPlaceholderOrder> findTop100ByOperatorIdEvcsAndConfirmResultLessThanOrderByPlaceholderOrderIdAsc(String OperatorIdEvcs,int confirmResult);
|
||||
|
||||
List<XhpcPlaceholderOrder> findTop100ByOperatorIdEvcsAndConfirmResultOrderByPlaceholderOrderIdAsc(String OperatorIdEvcs,int confirmResult);
|
||||
|
||||
List<XhpcPlaceholderOrder> findTop100ByOperatorIdEvcsAndTypeAndConfirmResultOrderByPlaceholderOrderIdAsc(String OperatorIdEvcs,int type,int confirmResult);
|
||||
|
||||
XhpcPlaceholderOrder findByPlaceholderOrderNumber(String placeholderOrderNumber);
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.xhpc.evcs.jpa;
|
||||
|
||||
import com.xhpc.order.domain.XhpcPlaceholderOrder;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderTimeOrder;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.QueryByExampleExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-08-01 17:19
|
||||
*/
|
||||
@Repository
|
||||
public interface PlaceholderIOrderTimeRepository extends JpaRepository<XhpcPlaceholderTimeOrder, Long>, QueryByExampleExecutor<XhpcPlaceholderTimeOrder>, JpaSpecificationExecutor<XhpcPlaceholderTimeOrder>, PagingAndSortingRepository<XhpcPlaceholderTimeOrder, Long> {
|
||||
|
||||
List<XhpcPlaceholderTimeOrder> findByPlaceholderOrderIdAndDelFlag(Long placeholderTimeOrderId, Integer delFlag);
|
||||
}
|
||||
@ -0,0 +1,22 @@
|
||||
package com.xhpc.evcs.jpa;
|
||||
|
||||
import com.xhpc.order.domain.XhpcPlaceholderTimeOrder;
|
||||
import com.xhpc.order.domain.XhpcPlacreholder;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.QueryByExampleExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-08-04 16:11
|
||||
*/
|
||||
@Repository
|
||||
public interface PlaceholderIRepository extends JpaRepository<XhpcPlacreholder, Long>, QueryByExampleExecutor<XhpcPlacreholder>, JpaSpecificationExecutor<XhpcPlacreholder>, PagingAndSortingRepository<XhpcPlacreholder, Long> {
|
||||
|
||||
XhpcPlacreholder findByStatusAndChargingStationIdAndDelFlag(Integer status,Long chargingStationId,Integer delFlag);
|
||||
|
||||
XhpcPlacreholder findByChargingStationIdAndDelFlag(Long chargingStationId,Integer delFlag);
|
||||
|
||||
}
|
||||
@ -0,0 +1,21 @@
|
||||
package com.xhpc.evcs.jpa;
|
||||
|
||||
import com.xhpc.order.domain.XhpcPlaceholderITime;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderTimeOrder;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.repository.PagingAndSortingRepository;
|
||||
import org.springframework.data.repository.query.QueryByExampleExecutor;
|
||||
import org.springframework.stereotype.Repository;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-08-05 14:16
|
||||
*/
|
||||
@Repository
|
||||
public interface PlaceholderITimeRepository extends JpaRepository<XhpcPlaceholderITime, Long>, QueryByExampleExecutor<XhpcPlaceholderITime>, JpaSpecificationExecutor<XhpcPlaceholderITime>, PagingAndSortingRepository<XhpcPlaceholderITime, Long> {
|
||||
|
||||
List<XhpcPlaceholderITime> findByPlaceholderIdAndDelFlagAndChargingStationId (Long placeholderTimeOrderId, Integer delFlag,Long chargingStationId);
|
||||
}
|
||||
@ -3,7 +3,6 @@ package com.xhpc.evcs.jpa;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import org.springframework.data.domain.PageRequest;
|
||||
import org.springframework.data.domain.Pageable;
|
||||
import org.springframework.data.domain.Sort;
|
||||
import org.springframework.data.jpa.repository.JpaRepository;
|
||||
import org.springframework.data.jpa.repository.JpaSpecificationExecutor;
|
||||
import org.springframework.data.jpa.repository.Query;
|
||||
|
||||
@ -30,9 +30,8 @@ public class NotificationCancelOrderTask extends CoreDispatcher {
|
||||
|
||||
//private Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
|
||||
//推送不开放(evcs 放开)
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(fixedRate = 1000 * 15)
|
||||
//都开放
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
//Getting the orders, which need to be notified.
|
||||
|
||||
@ -43,7 +43,7 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfo4BonusTask.class);
|
||||
|
||||
/**
|
||||
* 推送充电订单信息(运营奖补)(测试环境开)
|
||||
* 推送充电订单信息(运营奖补)(老平台已停止推送)
|
||||
* @throws IOException
|
||||
*/
|
||||
//9099开放定时任务 9009不开放
|
||||
|
||||
@ -16,6 +16,10 @@ import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.PostMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
import java.time.Duration;
|
||||
import java.time.Instant;
|
||||
@ -30,6 +34,8 @@ import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
* @Author HongYun on 2021/11/1
|
||||
*/
|
||||
@Component
|
||||
@RestController
|
||||
@RequestMapping("/api/chargeOrderInfo")
|
||||
public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
|
||||
@Autowired
|
||||
@ -38,32 +44,16 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoTask.class);
|
||||
//推送不开放(evcs 放开)
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(fixedDelay = 1000 * 15)
|
||||
|
||||
//推送不开放
|
||||
//9099开放定时任务 9009不开放
|
||||
@GetMapping("/infoTask")
|
||||
//@Scheduled(cron = "0/15 * * * * ? ")
|
||||
public void run() throws JsonProcessingException {
|
||||
|
||||
Collection<String> orderKeys = REDIS.keys("order:*");
|
||||
Instant now = Instant.now();
|
||||
for (String okey : orderKeys) {
|
||||
String orderNo = okey.substring(6);
|
||||
if(orderNo.length() < 32){
|
||||
logger.error("orderNo[{}] is error", orderNo);
|
||||
continue;
|
||||
}
|
||||
|
||||
Date otime = DateUtil.orderNo2Date(orderNo);
|
||||
if (Duration.between(otime.toInstant(), now).toHours() > 24 * 3) {
|
||||
REDIS.deleteObject(okey);
|
||||
REDIS.deleteObject(okey.replace("order", "pushOrder"));
|
||||
logger.info("clear cache..{}", okey);
|
||||
}
|
||||
}
|
||||
List<AuthSecretToken> authSecretTokenList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT);
|
||||
List<XhpcHistoryOrder> xhpcHistoryOrderList =
|
||||
xhpcHistoryOrderRepository.findByConfirmResultAndSource(-1, 1);
|
||||
List<XhpcHistoryOrder> xhpcHistoryOrderList =xhpcHistoryOrderRepository.findByConfirmResultAndSource(-1, 1);
|
||||
for (XhpcHistoryOrder horder : xhpcHistoryOrderList) {
|
||||
|
||||
logger.info("==============推送开始=======111================"+horder.getSerialNumber()+"========11111==========="+horder.getInternetSerialNumber());
|
||||
if("765367656".equals(horder.getInternetSerialNumber().substring(0, 9))){
|
||||
continue;
|
||||
}
|
||||
@ -76,23 +66,19 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
xhpcHistoryOrderRepository.save(horder); // mending
|
||||
}
|
||||
}
|
||||
logger.info("==============推送开始=====222=================="+horder.getSerialNumber()+"========2222==========="+horder.getInternetSerialNumber());
|
||||
if (authSecretToken.getOperatorId3irdpty().equals(operatorId3rdptyEvcs)) {
|
||||
// final List<XhpcStatisticsTimeInterval> statisticsTimeIntervals =
|
||||
// xhpcStatisticsTimeIntervalRepository.findAllByHistoryOrderId(horder.getHistoryOrderId());
|
||||
// horder.setXhpcStatisticsTimeIntervalList(statisticsTimeIntervals); //似乎并不需要
|
||||
ChargeOrderInfo chargeOrderInfo = new ChargeOrderInfo(horder);
|
||||
final ChargeOrderInfoResponse pushResp = notify(chargeOrderInfo, authSecretToken);
|
||||
logger.info("==============推送开始======================="+horder.getSerialNumber());
|
||||
if (pushResp != null) {
|
||||
horder.setConfirmResult(pushResp.getConfirmResult());
|
||||
logger.debug("3rd part order {} push result: {}", horder.getSerialNumber(),
|
||||
pushResp.getConfirmResult());
|
||||
logger.debug("3rd part order {} push result: {}", horder.getSerialNumber(),pushResp.getConfirmResult());
|
||||
logger.info("==============推送返回值================="+pushResp.getConfirmResult()+"=========="+horder.getSerialNumber());
|
||||
xhpcHistoryOrderRepository.save(horder);
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(horder.getSerialNumber()), "horderpushed", true);
|
||||
} else {
|
||||
logger.error("3dp[{}] order[{}/{}] push fail", operatorId3rdptyEvcs,
|
||||
horder.getSerialNumber(), horder.getInternetSerialNumber());
|
||||
logger.info("==============推送开始=====3333=================="+horder.getSerialNumber()+"========3333==========="+horder.getInternetSerialNumber());
|
||||
logger.error("3dp[{}] order[{}/{}] push fail", operatorId3rdptyEvcs,horder.getSerialNumber(), horder.getInternetSerialNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -105,6 +91,7 @@ public class NotificationChargeOrderInfoTask extends CoreDispatcher {
|
||||
CommonRequest<ChargeOrderInfo> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_charge_order_info", authSecretTokenOut);
|
||||
logger.info("==============推送返回值==========responseBody============="+responseBody);
|
||||
return DTOJsonHelper.parseResponseData(responseBody,
|
||||
ChargeOrderInfoResponse.class, authSecretTokenOut);
|
||||
}
|
||||
|
||||
@ -48,12 +48,11 @@ public class NotificationEquipChargeStatusTask extends CoreDispatcher {
|
||||
* 推送充电状态(evcs 放开)
|
||||
* @throws IOException
|
||||
*/
|
||||
//推送不开放
|
||||
//9009开放定时任务 9099不开放
|
||||
//都开放
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws IOException {
|
||||
|
||||
List<AuthSecretToken> authSecretTokenOutList = authSecretTokenRepository.findBySecretTokenType(SECRET_TOKEN_TYPE_OUT);
|
||||
List<AuthSecretToken> authSecretTokenOutList = authSecretTokenRepository.findBySecretTokenTypeAndOperatorId3irdptyNot(SECRET_TOKEN_TYPE_OUT,"MA7D6FPW6");
|
||||
final Collection<String> gunkeys = REDIS.keys("gun:*");
|
||||
for (AuthSecretToken authSecretToken : authSecretTokenOutList) {
|
||||
for (String gunkey : gunkeys) {
|
||||
|
||||
@ -5,6 +5,7 @@ import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.DTOJsonHelper;
|
||||
import com.xhpc.evcs.dto.NotificationStartChargeResultRequestData;
|
||||
import com.xhpc.evcs.dto.NotificationStartStopChargeResultResponse;
|
||||
import com.xhpc.evcs.encryption.Aes128Cbc;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import org.slf4j.Logger;
|
||||
@ -34,8 +35,8 @@ public class NotificationStartChargeResultTask extends CoreDispatcher {
|
||||
* Judging the 3rd whether it has got the start charging task.
|
||||
*/
|
||||
//(evcs 放开 30 秒, 测试平台开放 15秒)
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(fixedRate = 1000 * 15)
|
||||
//都开放
|
||||
@Scheduled(cron = "0/15 * * * * ? ")
|
||||
public void run() throws IOException {
|
||||
|
||||
//Getting the charge orders which from 3rd.
|
||||
@ -46,14 +47,15 @@ public class NotificationStartChargeResultTask extends CoreDispatcher {
|
||||
if(pushOrder.get("operatorId3rdptyName") !=null && "CYC".equals((String)pushOrder.get("operatorId3rdptyName"))){
|
||||
continue;
|
||||
}
|
||||
//logger.info("===============启动推送============================"+pushOrderKey);
|
||||
Integer startChargeNotificationStat = (Integer) pushOrder.get("startChargeNotificationStat");
|
||||
if (null != startChargeNotificationStat && 1 != startChargeNotificationStat && startChargeNotificationStat <= 20) {
|
||||
logger.info("===============启动推送开始============================"+pushOrderKey);
|
||||
if(pushOrder.get("internetSerialNumber")==null || "".equals((String) pushOrder.get("internetSerialNumber"))){
|
||||
continue;
|
||||
}
|
||||
String startChargeSeq = (String) pushOrder.get("internetSerialNumber");
|
||||
String operatorId = startChargeSeq.substring(0, 9);
|
||||
Optional<AuthSecretToken> authSecretToken =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId,
|
||||
SECRET_TOKEN_TYPE_OUT);
|
||||
Optional<AuthSecretToken> authSecretToken =authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId,SECRET_TOKEN_TYPE_OUT);
|
||||
if (authSecretToken.isPresent()) {
|
||||
NotificationStartChargeResultRequestData notificationStartChargeResultRequestData =
|
||||
new NotificationStartChargeResultRequestData();
|
||||
@ -68,7 +70,7 @@ public class NotificationStartChargeResultTask extends CoreDispatcher {
|
||||
}
|
||||
notificationStartChargeResultRequestData.setStartChargeSeqStat((Integer) pushOrder.get(
|
||||
"startChargeSeqStat"));
|
||||
notify(notificationStartChargeResultRequestData, authSecretToken.get(), pushOrderKey.substring(10));
|
||||
notify(notificationStartChargeResultRequestData, authSecretToken.get(), pushOrderKey.substring(10),startChargeSeq);
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -77,21 +79,22 @@ public class NotificationStartChargeResultTask extends CoreDispatcher {
|
||||
|
||||
//Notifying others platform.
|
||||
public void notify(NotificationStartChargeResultRequestData notificationStartChargeResultRequestData,
|
||||
AuthSecretToken authSecretTokenOut, String orderNo) throws IOException {
|
||||
AuthSecretToken authSecretTokenOut, String orderNo,String startChargeSeq) throws IOException {
|
||||
|
||||
String operatorIdEvcs = "MA6DFCTD5";
|
||||
String data = JSONUtil.toJSONString(notificationStartChargeResultRequestData);
|
||||
|
||||
|
||||
CommonRequest<NotificationStartChargeResultRequestData> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_start_charge_result", authSecretTokenOut);
|
||||
NotificationStartStopChargeResultResponse notificationStartStopChargeResultResponse =
|
||||
DTOJsonHelper.parseResponseData(responseBody,
|
||||
NotificationStartStopChargeResultResponse.class, authSecretTokenOut);
|
||||
logger.info("===============启动推送结果=====responseBody======================="+responseBody+"=================orderNo================="+orderNo);
|
||||
NotificationStartStopChargeResultResponse notificationStartStopChargeResultResponse =DTOJsonHelper.parseResponseData(responseBody,NotificationStartStopChargeResultResponse.class, authSecretTokenOut);
|
||||
|
||||
if (null != notificationStartStopChargeResultResponse) {
|
||||
//Ensuring that only when startChargeNotificationStat equals 1 won't be notified.
|
||||
if(!"".equals(startChargeSeq)&& startChargeSeq !=null && "MA7D6FPW6".equals(startChargeSeq.substring(0, 9))){
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(orderNo), "startChargeNotificationStat", 1);
|
||||
}else{
|
||||
if (notificationStartStopChargeResultResponse.getSuccStat() == 0) {
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(orderNo), "startChargeNotificationStat", 1);
|
||||
} else {
|
||||
@ -102,12 +105,27 @@ public class NotificationStartChargeResultTask extends CoreDispatcher {
|
||||
} else {
|
||||
++startChargeNotificationStat;
|
||||
}
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(orderNo), "startChargeNotificationStat",
|
||||
startChargeNotificationStat);
|
||||
throw new RuntimeException(String.format("push CD start charge order status [%s] failed: %s",
|
||||
notificationStartChargeResultRequestData.getStartChargeSeq(), responseBody));
|
||||
}
|
||||
REDIS.setCacheMapValue("pushOrder:".concat(orderNo), "startChargeNotificationStat",startChargeNotificationStat);
|
||||
throw new RuntimeException(String.format("push CD start charge order status [%s] failed: %s",notificationStartChargeResultRequestData.getStartChargeSeq(), responseBody));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public static void main(String[] args) {
|
||||
try{
|
||||
String data ="tHZ+rscY6M5g77k0+NtJD+IG5Wkt30jd+IshU7P4y0DIe6m3rwmTibfudkSYF05Dco39z0eRnf6oRQwcC4Uh+oNljQF/cZz2owzPFmaMrKY=";
|
||||
|
||||
String s = Aes128Cbc.decryptString(data, "4d593ae4f74f2798", "0802395fab41d38c");
|
||||
|
||||
|
||||
System.out.println("==========s========="+s);
|
||||
}catch (Exception e){
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -50,8 +50,8 @@ public class NotificationStationStatusTask extends CoreDispatcher {
|
||||
private XhpcTerminalRepository terminalRepository;
|
||||
|
||||
//推送不开放(evcs 放开)
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(fixedRate = 1000 * 60)
|
||||
//都开放 9009 40 9099 60
|
||||
@Scheduled(cron = "0 0/1 * * * ? ")
|
||||
protected void run() throws IOException {
|
||||
|
||||
Collection<String> stationTerminalKeys = REDIS.keys("stationTerminalStatus:*");
|
||||
|
||||
@ -27,8 +27,8 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
|
||||
//(evcs 放开)
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(fixedRate = 1000 * 3)
|
||||
//都开放
|
||||
@Scheduled(cron = "0/3 * * * * ? ")
|
||||
public void run() throws Exception {
|
||||
|
||||
notifyService();
|
||||
@ -55,9 +55,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
String orderkey = "order:".concat(orderNo);
|
||||
CacheOrderData orderData = REDIS.getCacheMapValue(orderkey, "orderData");
|
||||
Map<String, Object> pushOrder = REDIS.getCacheMap(pushOrderKey);
|
||||
if (orderData != null || (pushOrder != null &&
|
||||
pushOrder.get("startChargeSeqStat") != null &&
|
||||
(Integer) pushOrder.get("startChargeSeqStat") > 3)) {
|
||||
if (orderData != null || (pushOrder != null && pushOrder.get("startChargeSeqStat") != null && (Integer) pushOrder.get("startChargeSeqStat") > 3)) {
|
||||
Boolean isStopNotified = (Boolean) pushOrder.get("isStopNotified");
|
||||
if (isStopNotified == null || !isStopNotified) {
|
||||
String internetSerialNumber = (String) pushOrder.get("internetSerialNumber");
|
||||
@ -65,9 +63,7 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
continue;
|
||||
}
|
||||
String operatorId3rdpty = internetSerialNumber.substring(0, 9);
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId3rdpty,
|
||||
SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
AuthSecretToken authSecretTokenOut =authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType(operatorId3rdpty,SECRET_TOKEN_TYPE_OUT).orElse(null);
|
||||
CommonRequest<ChargeResultRequest> commonRequest = new CommonRequest<>();
|
||||
ChargeResultRequest chargeResultRequest = new ChargeResultRequest();
|
||||
chargeResultRequest.setStartChargeSeq(internetSerialNumber);
|
||||
@ -75,13 +71,15 @@ public class NotificationStopChargeResultTask extends CoreDispatcher {
|
||||
chargeResultRequest.setConnectorID(orderkey.substring(0, 16));
|
||||
chargeResultRequest.setStartChargeSeqStat(4);
|
||||
chargeResultRequest.setSuccStat(0);
|
||||
chargeResultRequest.setFailReason(3);
|
||||
chargeResultRequest.setFailReason(0);
|
||||
//将其转换为json
|
||||
String jsonData = JSONUtil.toJSONString(chargeResultRequest);
|
||||
commonRequest.setData(jsonData);
|
||||
String result = ok(commonRequest, "/notification_stop_charge_result", authSecretTokenOut);
|
||||
ChargeResultResponse chargeResultResponse = DTOJsonHelper.parseResponseData(result,
|
||||
ChargeResultResponse.class, authSecretTokenOut);
|
||||
|
||||
System.out.println("====停止推送结果=======notification_stop_charge_result========="+result+"============orderNo========"+orderNo);
|
||||
// ChargeResultResponse chargeResultResponse = DTOJsonHelper.parseResponseData(result,
|
||||
// ChargeResultResponse.class, authSecretTokenOut);
|
||||
pushOrder.put("isStopNotified", true);
|
||||
REDIS.setCacheMap(pushOrderKey, pushOrder);
|
||||
}
|
||||
|
||||
@ -1,4 +1,4 @@
|
||||
package com.xhpc.evcs.notification;
|
||||
package com.xhpc.evcs.notification.henda;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
@ -8,13 +8,13 @@ import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.DTOJsonHelper;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -1,4 +1,4 @@
|
||||
package com.xhpc.evcs.notification;
|
||||
package com.xhpc.evcs.notification.kuaidian;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
@ -8,13 +8,13 @@ import com.xhpc.evcs.dto.CommonRequest;
|
||||
import com.xhpc.evcs.dto.DTOJsonHelper;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.XhpcHistoryOrderRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
@ -37,7 +37,7 @@ public class NotificationChargeOrderInfoKuaiDianTask extends CoreDispatcher {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoKuaiDianTask.class);
|
||||
/**
|
||||
* 推送充电快电订单信息
|
||||
* 推送充电快电订单信息(暂时不开放)
|
||||
* * @throws IOException
|
||||
*/
|
||||
//9099开放定时任务 9009不开放
|
||||
@ -0,0 +1,153 @@
|
||||
package com.xhpc.evcs.notification.kuaidian;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.PlaceholderIOrderRepository;
|
||||
import com.xhpc.evcs.jpa.PlaceholderIOrderTimeRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderOrder;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderTimeOrder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 快电占位费推送
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-07-09 14:06
|
||||
*/
|
||||
@Component
|
||||
public class NotificationOvertimeOrderInfoTask extends CoreDispatcher {
|
||||
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Autowired
|
||||
private PlaceholderIOrderRepository placeholderIOrderRepository;
|
||||
@Autowired
|
||||
private PlaceholderIOrderTimeRepository placeholderIOrderTimeRepository;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationOvertimeOrderInfoTask.class);
|
||||
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws IOException {
|
||||
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA005DBW1", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
|
||||
|
||||
if (authSecretTokenOut != null) {
|
||||
final List<XhpcPlaceholderOrder> notYetPushOrder =placeholderIOrderRepository.findTop100ByOperatorIdEvcsAndConfirmResultOrderByPlaceholderOrderIdAsc("MA005DBW1",-2);
|
||||
for (XhpcPlaceholderOrder placeholderOrder : notYetPushOrder) {
|
||||
|
||||
if(placeholderOrder.getConfirmResult()==-2){
|
||||
PlaceholderOrderInfoKuaiDian placeholderOrderInfo = new PlaceholderOrderInfoKuaiDian();
|
||||
placeholderOrderInfo.setOvertimeBillCode(placeholderOrder.getPlaceholderOrderNumber());
|
||||
placeholderOrderInfo.setStartChargeSeq(placeholderOrder.getInternetSerialNumber());
|
||||
placeholderOrderInfo.setOvertimeBillStatus(1);
|
||||
placeholderOrderInfo.setConnectorId(placeholderOrder.getTerminalNumber());
|
||||
placeholderOrderInfo.setBillEquipment(1);
|
||||
placeholderOrderInfo.setStartTime(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
placeholderOrderInfo.setEndTime(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
placeholderOrderInfo.setTotalTimeSpan(0);
|
||||
placeholderOrderInfo.setOvertimePrice(new BigDecimal(0));
|
||||
placeholderOrderInfo.setTotalMoney(new BigDecimal(0.00));
|
||||
|
||||
List<OvertimeDetail> overtimeDetails =new ArrayList<>();
|
||||
OvertimeDetail overtimeDetail = new OvertimeDetail();
|
||||
overtimeDetail.setDetailStartTime(placeholderOrderInfo.getStartTime());
|
||||
overtimeDetail.setDetailEndTime(placeholderOrderInfo.getStartTime());
|
||||
overtimeDetail.setDetailMoney(new BigDecimal(0.00));
|
||||
overtimeDetail.setOvertimePrice(new BigDecimal(0.00));
|
||||
overtimeDetails.add(overtimeDetail);
|
||||
placeholderOrderInfo.setOvertimeDetails(overtimeDetails);
|
||||
|
||||
|
||||
final OvertimeOrderInfo pushResp = notify(placeholderOrderInfo, authSecretTokenOut);
|
||||
if (pushResp != null) {
|
||||
if(pushResp.getSuccStat()==0){
|
||||
placeholderOrder.setConfirmResult(-1);
|
||||
}else{
|
||||
placeholderOrder.setConfirmResult(pushResp.getSuccStat());
|
||||
}
|
||||
//logger.info("==============推送返回值================="+pushResp.toString());
|
||||
placeholderIOrderRepository.save(placeholderOrder);
|
||||
} else {
|
||||
logger.error("新电途3dp[{}] order[{}/{}] push fail", "MA25CNM38",placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final List<XhpcPlaceholderOrder> notYetPushOrderYu =placeholderIOrderRepository.findTop100ByOperatorIdEvcsAndTypeAndConfirmResultOrderByPlaceholderOrderIdAsc("MA005DBW1",1,-1);
|
||||
for (XhpcPlaceholderOrder placeholderOrder : notYetPushOrderYu) {
|
||||
PlaceholderOrderInfoKuaiDian placeholderOrderInfo = new PlaceholderOrderInfoKuaiDian();
|
||||
placeholderOrderInfo.setOvertimeBillCode(placeholderOrder.getPlaceholderOrderNumber());
|
||||
placeholderOrderInfo.setStartChargeSeq(placeholderOrder.getInternetSerialNumber());
|
||||
placeholderOrderInfo.setOvertimeBillStatus(3);
|
||||
placeholderOrderInfo.setConnectorId(placeholderOrder.getTerminalNumber());
|
||||
placeholderOrderInfo.setBillEquipment(1);
|
||||
placeholderOrderInfo.setStartTime(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
placeholderOrderInfo.setEndTime(DateUtil.format(placeholderOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
placeholderOrderInfo.setTotalTimeSpan(placeholderOrder.getTotalTimeSpan());
|
||||
placeholderOrderInfo.setOvertimePrice(placeholderOrder.getOvertimePrice());
|
||||
placeholderOrderInfo.setTotalMoney(placeholderOrder.getTotalMoney());
|
||||
|
||||
|
||||
List<XhpcPlaceholderTimeOrder> list = placeholderIOrderTimeRepository.findByPlaceholderOrderIdAndDelFlag(placeholderOrder.getPlaceholderOrderId(), 0);
|
||||
List<OvertimeDetail> overtimeDetails =new ArrayList<>();
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
XhpcPlaceholderTimeOrder xhpcPlaceholderTimeOrder = list.get(i);
|
||||
OvertimeDetail overtimeDetail = new OvertimeDetail();
|
||||
overtimeDetail.setDetailStartTime(DateUtil.format(xhpcPlaceholderTimeOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
overtimeDetail.setDetailEndTime(DateUtil.format(xhpcPlaceholderTimeOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
overtimeDetail.setDetailMoney(xhpcPlaceholderTimeOrder.getTotalmoney());
|
||||
overtimeDetail.setOvertimePrice(xhpcPlaceholderTimeOrder.getPrice());
|
||||
overtimeDetails.add(overtimeDetail);
|
||||
|
||||
}
|
||||
placeholderOrderInfo.setOvertimeDetails(overtimeDetails);
|
||||
|
||||
|
||||
final OvertimeOrderInfo pushResp = notify(placeholderOrderInfo, authSecretTokenOut);
|
||||
if (pushResp != null) {
|
||||
placeholderOrder.setConfirmResult(pushResp.getSuccStat());
|
||||
//logger.info("==============推送返回值================="+pushResp.toString());
|
||||
placeholderIOrderRepository.save(placeholderOrder);
|
||||
} else {
|
||||
logger.error("快电3dp[{}] order[{}/{}] push fail", "MA25CNM38",placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public OvertimeOrderInfo notify(PlaceholderOrderInfoKuaiDian placeholderOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException {
|
||||
|
||||
String data = JSONUtil.toJSONString(placeholderOrderInfo);
|
||||
CommonRequest<PlaceholderOrderInfoKuaiDian> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_overtime_order_info", authSecretTokenOut);
|
||||
|
||||
logger.debug("“==========快电====responseBody=============="+responseBody);
|
||||
return DTOJsonHelper.parseResponseData(responseBody,
|
||||
OvertimeOrderInfo.class, authSecretTokenOut);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -0,0 +1,236 @@
|
||||
package com.xhpc.evcs.notification.kuaidian;
|
||||
|
||||
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;
|
||||
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.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.util.*;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-25 10:06
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class NotificationStationInfoKuaiDianTask extends CoreDispatcher {
|
||||
|
||||
@Resource
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Resource
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationStationInfoKuaiDianTask.class);
|
||||
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
//@Scheduled(cron = "0 50 0 1/1 * ? ")
|
||||
public void run() throws IOException {
|
||||
try{
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByInternetUserId(1L);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType("MA005DBW1", "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 chargingStationId = stationKey.substring(8);
|
||||
//获取场站信息
|
||||
String key = "cdjgpc:station:".concat(chargingStationId)+".notification";
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
|
||||
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(svcPrice.length()-1).append("}");
|
||||
}
|
||||
cdStationInfo.setElectricityFee(price.toString());
|
||||
cdStationInfo.setServiceFee(svcPrice.toString());
|
||||
Set<String> pks = stationDto.getPiles();
|
||||
if (pks != null) {
|
||||
List<CDEquipmentInfo> cdEquipmentInfos = new ArrayList<>();
|
||||
for (String pileNo : pks) {
|
||||
String pk = "pile:".concat(pileNo);
|
||||
String skey = "cdjgpc:".concat(pk)+".notification";
|
||||
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
|
||||
if(cdEquipmentInfo==null || "".equals(cdEquipmentInfo.getEquipmentID())){
|
||||
logger.info("该场站下面:"+pileNo+"桩未录入");
|
||||
}else{
|
||||
cdEquipmentInfos.add(cdEquipmentInfo);
|
||||
}
|
||||
}
|
||||
cdStationInfo.setEquipmentInfos(cdEquipmentInfos);
|
||||
}
|
||||
cdStationInfo.setSwapMatchCarsName(null);
|
||||
CommonRequest<CDStationInfo> commonRequest = new CommonRequest<>();
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("StationInfo",cdStationInfo);
|
||||
String data = JSONUtil.toJSONString(mapStationInfo);
|
||||
System.out.println("===新电途====data========"+data);
|
||||
commonRequest.setData(data);
|
||||
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut);
|
||||
System.out.println("===新电途==推送充电站信息==result========"+result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@ -1,23 +1,20 @@
|
||||
package com.xhpc.evcs.notification;
|
||||
package com.xhpc.evcs.notification.xindiantu;
|
||||
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.evcs.domain.*;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.jpa.*;
|
||||
import com.xhpc.evcs.utils.DateUtil;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcHistoryOrder;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Example;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
@ -36,7 +33,7 @@ public class NotificationChargeOrderInfoXinDianTuTask extends CoreDispatcher {
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationChargeOrderInfoXinDianTuTask.class);
|
||||
/**
|
||||
* 推送充电新电途订单信息
|
||||
* 推送充电新电途订单信息(暂时不开放)
|
||||
* * @throws IOException
|
||||
*/
|
||||
//9099开放定时任务 9009不开放
|
||||
@ -0,0 +1,117 @@
|
||||
package com.xhpc.evcs.notification.xindiantu;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
|
||||
import com.xhpc.evcs.jpa.PlaceholderIOrderRepository;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderOrder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.List;
|
||||
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* 新电途占位费订单信息推送
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-07-08 14:31
|
||||
*/
|
||||
@Component
|
||||
public class NotificationPlaceholderOrderInfoTask extends CoreDispatcher {
|
||||
|
||||
|
||||
@Autowired
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Autowired
|
||||
private PlaceholderIOrderRepository placeholderIOrderRepository;
|
||||
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationPlaceholderOrderInfoTask.class);
|
||||
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(fixedRate = 1000 * 30)
|
||||
public void run() throws IOException {
|
||||
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
|
||||
"MA25CNM38", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
|
||||
|
||||
if (authSecretTokenOut != null) {
|
||||
final List<XhpcPlaceholderOrder> notYetPushOrder =placeholderIOrderRepository.findTop100ByOperatorIdEvcsAndConfirmResultOrderByPlaceholderOrderIdAsc("MA25CNM38",-2);
|
||||
for (XhpcPlaceholderOrder placeholderOrder : notYetPushOrder) {
|
||||
|
||||
if(placeholderOrder.getConfirmResult()==-2){
|
||||
PlaceholderOrderInfo placeholderOrderInfo = new PlaceholderOrderInfo();
|
||||
placeholderOrderInfo.setPlaceholderOrderID(placeholderOrder.getPlaceholderOrderNumber());
|
||||
placeholderOrderInfo.setStarChargeSeq(placeholderOrder.getInternetSerialNumber());
|
||||
placeholderOrderInfo.setTimeStart(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
placeholderOrderInfo.setTimeEnd(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
placeholderOrderInfo.setHoldTime(0);
|
||||
placeholderOrderInfo.setActuallyPay(0.0);
|
||||
placeholderOrderInfo.setBillEquipment(1);
|
||||
placeholderOrderInfo.setStatus(1);
|
||||
|
||||
final ChargeOrderInfoResponse pushResp = notify(placeholderOrderInfo, authSecretTokenOut);
|
||||
if (pushResp != null) {
|
||||
if(pushResp.getConfirmResult()==0){
|
||||
placeholderOrder.setConfirmResult(-1);
|
||||
}else{
|
||||
placeholderOrder.setConfirmResult(pushResp.getConfirmResult());
|
||||
}
|
||||
logger.debug("新电途3rd part order {} push result: {}", placeholderOrder.getSerialNumber(),pushResp.getConfirmResult());
|
||||
//logger.info("==============推送返回值================="+pushResp.toString());
|
||||
placeholderIOrderRepository.save(placeholderOrder);
|
||||
} else {
|
||||
logger.error("新电途3dp[{}] order[{}/{}] push fail", "MA25CNM38",placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
final List<XhpcPlaceholderOrder> notYetPushOrderYu =placeholderIOrderRepository.findTop100ByOperatorIdEvcsAndTypeAndConfirmResultOrderByPlaceholderOrderIdAsc("MA25CNM38",1,-1);
|
||||
for (XhpcPlaceholderOrder placeholderOrder : notYetPushOrderYu) {
|
||||
PlaceholderOrderInfo placeholderOrderInfo = new PlaceholderOrderInfo();
|
||||
placeholderOrderInfo.setPlaceholderOrderID(placeholderOrder.getPlaceholderOrderNumber());
|
||||
placeholderOrderInfo.setStarChargeSeq(placeholderOrder.getInternetSerialNumber());
|
||||
placeholderOrderInfo.setTimeStart(DateUtil.format(placeholderOrder.getStartTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
placeholderOrderInfo.setTimeEnd(DateUtil.format(placeholderOrder.getEndTime(),"yyyy-MM-dd HH:mm:ss"));
|
||||
placeholderOrderInfo.setHoldTime(placeholderOrder.getTotalTimeSpan());
|
||||
placeholderOrderInfo.setActuallyPay(placeholderOrder.getTotalMoney().doubleValue());
|
||||
placeholderOrderInfo.setBillEquipment(1);
|
||||
placeholderOrderInfo.setStatus(9);
|
||||
|
||||
final ChargeOrderInfoResponse pushResp = notify(placeholderOrderInfo, authSecretTokenOut);
|
||||
if (pushResp != null) {
|
||||
placeholderOrder.setConfirmResult(pushResp.getConfirmResult());
|
||||
logger.debug("新电途3rd part order {} push result: {}", placeholderOrder.getSerialNumber(),pushResp.getConfirmResult());
|
||||
//logger.info("==============推送返回值================="+pushResp.toString());
|
||||
placeholderIOrderRepository.save(placeholderOrder);
|
||||
} else {
|
||||
logger.error("新电途3dp[{}] order[{}/{}] push fail", "MA25CNM38",placeholderOrder.getSerialNumber(), placeholderOrder.getInternetSerialNumber());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public ChargeOrderInfoResponse notify(PlaceholderOrderInfo placeholderOrderInfo, AuthSecretToken authSecretTokenOut) throws JsonProcessingException {
|
||||
|
||||
String data = JSONUtil.toJSONString(placeholderOrderInfo);
|
||||
CommonRequest<PlaceholderOrderInfo> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_placeholder_order_info", authSecretTokenOut);
|
||||
return DTOJsonHelper.parseResponseData(responseBody,
|
||||
ChargeOrderInfoResponse.class, authSecretTokenOut);
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,102 @@
|
||||
package com.xhpc.evcs.notification.xindiantu;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.xhpc.evcs.domain.AuthSecretToken;
|
||||
import com.xhpc.evcs.domain.PriceInfo;
|
||||
import com.xhpc.evcs.domain.XhpcStationInternetBlacklist;
|
||||
import com.xhpc.evcs.dto.*;
|
||||
import com.xhpc.evcs.jpa.*;
|
||||
import com.xhpc.evcs.notification.CoreDispatcher;
|
||||
import com.xhpc.evcs.utils.JSONUtil;
|
||||
import com.xhpc.order.domain.XhpcPlaceholderITime;
|
||||
import com.xhpc.order.domain.XhpcPlacreholder;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.io.IOException;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-08-06 15:30
|
||||
*/
|
||||
@Component
|
||||
public class NotificationPlaceholderRulesTask extends CoreDispatcher {
|
||||
|
||||
@Resource
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Autowired
|
||||
private PlaceholderIRepository placeholderIRepository;
|
||||
@Resource
|
||||
private PlaceholderITimeRepository placeholderITimeRepository;
|
||||
@Resource
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationPlaceholderRulesTask.class);
|
||||
|
||||
//9009开放定时任务 9099不开放
|
||||
@Scheduled(cron = "0 0 3 1/1 * ? ")
|
||||
public void run() throws IOException {
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType("MA25CNM38", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
|
||||
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByInternetUserId(1L);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
for (String stationKey : stationKeys) {
|
||||
//查询不合作的电桩
|
||||
for (XhpcStationInternetBlacklist xhpcStationInternetBlack : xhpcStationInternetBlacklist) {
|
||||
if (!stationKey.substring(8).equals(xhpcStationInternetBlack.getChargingStationId().toString())) {
|
||||
if (authSecretTokenOut != null) {
|
||||
String stationId = stationKey.substring(8);
|
||||
XhpcPlacreholder xhpcPlacreholder = placeholderIRepository.findByChargingStationIdAndDelFlag(Long.valueOf(stationId), 0);
|
||||
|
||||
PlaceholderRulesXinDianTu placeholderRulesXinDianTu = new PlaceholderRulesXinDianTu();
|
||||
|
||||
placeholderRulesXinDianTu.setStationID(stationId);
|
||||
String startTime = DateUtil.format(xhpcPlacreholder.getStartTime(), "yyyy-MM-dd HH:mm:ss");
|
||||
String endTime = DateUtil.format(xhpcPlacreholder.getEndTime(), "yyyy-MM-dd HH:mm:ss");
|
||||
placeholderRulesXinDianTu.setEffectStartTime(startTime);
|
||||
placeholderRulesXinDianTu.setEffectEndTime(endTime);
|
||||
placeholderRulesXinDianTu.setStatus(xhpcPlacreholder.getStatus());
|
||||
placeholderRulesXinDianTu.setFreeTime(xhpcPlacreholder.getFreeTime());
|
||||
placeholderRulesXinDianTu.setMaxFee(xhpcPlacreholder.getMaxFee().doubleValue());
|
||||
|
||||
List<PriceInfo> priceInfos =new ArrayList<>();
|
||||
List<XhpcPlaceholderITime> xhpcPlaceholderITimeList = placeholderITimeRepository.findByPlaceholderIdAndDelFlagAndChargingStationId(xhpcPlacreholder.getPlaceholderId(), 0,Long.valueOf(stationId));
|
||||
if(xhpcPlaceholderITimeList !=null && xhpcPlaceholderITimeList.size()>0){
|
||||
for (int j = 0; j < xhpcPlaceholderITimeList.size(); j++) {
|
||||
XhpcPlaceholderITime xhpcPlaceholderTimeOrder = xhpcPlaceholderITimeList.get(j);
|
||||
PriceInfo placeHolderPrice = new PriceInfo();
|
||||
placeHolderPrice.setStartTime(DateUtil.format(xhpcPlaceholderTimeOrder.getStartTime(),"HH:mm:ss"));
|
||||
placeHolderPrice.setPrice(xhpcPlaceholderTimeOrder.getPrice().doubleValue());
|
||||
priceInfos.add(placeHolderPrice);
|
||||
}
|
||||
}
|
||||
placeholderRulesXinDianTu.setPriceInfos(priceInfos);
|
||||
|
||||
notify(placeholderRulesXinDianTu,authSecretTokenOut);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public void notify(PlaceholderRulesXinDianTu placeholderRulesXinDianTu, AuthSecretToken authSecretTokenOut) throws JsonProcessingException {
|
||||
|
||||
String data = JSONUtil.toJSONString(placeholderRulesXinDianTu);
|
||||
CommonRequest<PlaceholderRulesXinDianTu> commonRequest = new CommonRequest<>();
|
||||
commonRequest.setData(data);
|
||||
String responseBody = ok(commonRequest, "/notification_placeholder_rules", authSecretTokenOut);
|
||||
logger.error("新电途========responseBody================"+responseBody);
|
||||
|
||||
}
|
||||
}
|
||||
@ -0,0 +1,238 @@
|
||||
package com.xhpc.evcs.notification.xindiantu;
|
||||
|
||||
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;
|
||||
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.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.util.*;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-25 10:02
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class NotificationStationInfoXinDianTuTask extends CoreDispatcher {
|
||||
|
||||
@Resource
|
||||
private AuthSecretTokenRepository authSecretTokenRepository;
|
||||
@Resource
|
||||
private XhpcStationInternetBlacklistRepository xhpcStationInternetBlacklistRepo;
|
||||
private final Logger logger = LoggerFactory.getLogger(NotificationStationInfoXinDianTuTask.class);
|
||||
|
||||
|
||||
//9099开放定时任务 9009不开放
|
||||
//@Scheduled(cron = "0 40 0 1/1 * ? ")
|
||||
public void run() throws IOException {
|
||||
try{
|
||||
List<XhpcStationInternetBlacklist> xhpcStationInternetBlacklist = xhpcStationInternetBlacklistRepo.findByInternetUserId(3L);
|
||||
List<String> stationKeys = new ArrayList<>(REDIS.keys("station:*"));
|
||||
AuthSecretToken authSecretTokenOut =
|
||||
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType("MA25CNM38", "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 chargingStationId = stationKey.substring(8);
|
||||
//获取场站信息
|
||||
String key = "cdjgpc:station:".concat(chargingStationId)+".notification";
|
||||
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
|
||||
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(svcPrice.length()-1).append("}");
|
||||
}
|
||||
cdStationInfo.setElectricityFee(price.toString());
|
||||
cdStationInfo.setServiceFee(svcPrice.toString());
|
||||
Set<String> pks = stationDto.getPiles();
|
||||
if (pks != null) {
|
||||
List<CDEquipmentInfo> cdEquipmentInfos = new ArrayList<>();
|
||||
for (String pileNo : pks) {
|
||||
String pk = "pile:".concat(pileNo);
|
||||
String skey = "cdjgpc:".concat(pk)+".notification";
|
||||
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
|
||||
if(cdEquipmentInfo==null || "".equals(cdEquipmentInfo.getEquipmentID())){
|
||||
logger.info("该场站下面:"+pileNo+"桩未录入");
|
||||
}else{
|
||||
cdEquipmentInfos.add(cdEquipmentInfo);
|
||||
}
|
||||
}
|
||||
cdStationInfo.setEquipmentInfos(cdEquipmentInfos);
|
||||
}
|
||||
cdStationInfo.setSwapMatchCarsName(null);
|
||||
CommonRequest<CDStationInfo> commonRequest = new CommonRequest<>();
|
||||
Map<String,Object> mapStationInfo =new HashMap<>();
|
||||
mapStationInfo.put("StationInfo",cdStationInfo);
|
||||
String data = JSONUtil.toJSONString(mapStationInfo);
|
||||
System.out.println("===新电途====data========"+data);
|
||||
commonRequest.setData(data);
|
||||
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut);
|
||||
System.out.println("===新电途==推送充电站信息==result========"+result);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}catch (Exception e){
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -1,12 +1,12 @@
|
||||
# Tomcat 9009 不走推送 name: evcs 9099走推送 name: jp mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
# Tomcat 9009 不走推送 name: evcs 9099 走推送 name: jp 120.26.46.180:8858
|
||||
server:
|
||||
port: 9099
|
||||
port: 9009
|
||||
|
||||
# Spring
|
||||
spring:
|
||||
application:
|
||||
# 应用名称
|
||||
name: jp
|
||||
name: evcs
|
||||
profiles:
|
||||
# 环境配置
|
||||
active: dev
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -16,10 +16,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
@ -35,7 +35,7 @@ spring:
|
||||
datasource:
|
||||
ds1:
|
||||
nacos:
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
dataId: sentinel-ruoyi-gateway
|
||||
groupId: DEFAULT_GROUP
|
||||
data-type: json
|
||||
|
||||
@ -14,12 +14,21 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
|
||||
oss:
|
||||
enabled: true
|
||||
name: qiniu
|
||||
tenant-mode: true
|
||||
endpoint: oss-accelerate.aliyuncs.com
|
||||
access-key: LTAI5tHxc8hrG6cT5nDtEkiV
|
||||
secret-key: 5kFEaIFE7eeODxKQwD5mvTRF48MK6w
|
||||
bucket-name: xhpc-bucket1
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -14,12 +14,20 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
shared-configs:
|
||||
- application-${spring.profiles.active}.${spring.cloud.nacos.config.file-extension}
|
||||
oss:
|
||||
enabled: true
|
||||
name: qiniu
|
||||
tenant-mode: true
|
||||
endpoint: oss-accelerate.aliyuncs.com
|
||||
access-key: LTAI5tHxc8hrG6cT5nDtEkiV
|
||||
secret-key: 5kFEaIFE7eeODxKQwD5mvTRF48MK6w
|
||||
bucket-name: xhpc-bucket1
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -19,10 +19,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
@ -52,3 +52,14 @@ alibaba:
|
||||
certPath: "/www/wwwroot/scxhua.cn/xhpc-payment/appCertPublicKey.crt"
|
||||
publicCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayCertPublicKey_RSA2.crt"
|
||||
rootCertPath: "/www/wwwroot/scxhua.cn/xhpc-payment/alipayRootCert.crt"
|
||||
|
||||
oss:
|
||||
enabled: true
|
||||
name: qiniu
|
||||
tenant-mode: true
|
||||
endpoint: oss-accelerate.aliyuncs.com
|
||||
access-key: LTAI5tHxc8hrG6cT5nDtEkiV
|
||||
secret-key: 5kFEaIFE7eeODxKQwD5mvTRF48MK6w
|
||||
bucket-name: xhpc-bucket1
|
||||
region: oss-cn-hangzhou
|
||||
domain: https://xhpc-bucket1.oss-cn-hangzhou.aliyuncs.com/
|
||||
|
||||
@ -2813,21 +2813,21 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService {
|
||||
int t5= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map5 =new LinkedHashMap<>();
|
||||
map5.put("title","尖单价");
|
||||
map5.put("content",new BigDecimal(t5).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟");
|
||||
map5.put("content",new BigDecimal(t5).divide(new BigDecimal(100000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟");
|
||||
list.add(map5);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
int t6= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map6 =new LinkedHashMap<>();
|
||||
map6.put("title","尖电量");
|
||||
map6.put("content",new BigDecimal(t6).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
map6.put("content",new BigDecimal(t6).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
list.add(map6);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
int t7= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map7 =new LinkedHashMap<>();
|
||||
map7.put("title","计损尖电量");
|
||||
map7.put("content",new BigDecimal(t7).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
map7.put("content",new BigDecimal(t7).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
list.add(map7);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
@ -2841,21 +2841,21 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService {
|
||||
int t9= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map9 =new LinkedHashMap<>();
|
||||
map9.put("title","峰单价");
|
||||
map9.put("content",new BigDecimal(t9).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟");
|
||||
map9.put("content",new BigDecimal(t9).divide(new BigDecimal(100000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟");
|
||||
list.add(map9);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
int t10= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map10 =new LinkedHashMap<>();
|
||||
map10.put("title","峰电量");
|
||||
map10.put("content",new BigDecimal(t10).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
map10.put("content",new BigDecimal(t10).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
list.add(map10);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
int t11= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map11 =new LinkedHashMap<>();
|
||||
map11.put("title","计损峰电量");
|
||||
map11.put("content",new BigDecimal(t11).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
map11.put("content",new BigDecimal(t11).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
list.add(map11);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
@ -2869,21 +2869,21 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService {
|
||||
int t13= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map13 =new LinkedHashMap<>();
|
||||
map13.put("title","平电价");
|
||||
map13.put("content",new BigDecimal(t13).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟");
|
||||
map13.put("content",new BigDecimal(t13).divide(new BigDecimal(100000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟");
|
||||
list.add(map13);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
int t14= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map14 =new LinkedHashMap<>();
|
||||
map14.put("title","平电量");
|
||||
map14.put("content",new BigDecimal(t14).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
map14.put("content",new BigDecimal(t14).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
list.add(map14);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
int t15= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map15 =new LinkedHashMap<>();
|
||||
map15.put("title","计损平电量");
|
||||
map15.put("content",new BigDecimal(t15).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
map15.put("content",new BigDecimal(t15).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
list.add(map15);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
@ -2897,21 +2897,21 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService {
|
||||
int t17= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map17 =new LinkedHashMap<>();
|
||||
map17.put("title","谷单价");
|
||||
map17.put("content",new BigDecimal(t17).divide(new BigDecimal(10000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟");
|
||||
map17.put("content",new BigDecimal(t17).divide(new BigDecimal(100000)).setScale(5,BigDecimal.ROUND_DOWN)+"元/分钟");
|
||||
list.add(map17);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
int t18= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map18=new LinkedHashMap<>();
|
||||
map18.put("title","谷电量");
|
||||
map18.put("content",new BigDecimal(t18).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
map18.put("content",new BigDecimal(t18).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
list.add(map18);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
int t19= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map19 =new LinkedHashMap<>();
|
||||
map19.put("title","计损谷电量");
|
||||
map19.put("content",new BigDecimal(t19).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
map19.put("content",new BigDecimal(t19).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
list.add(map19);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
@ -2940,7 +2940,7 @@ public class AnalyzeTheMessageServiceImpl implements IAnalyzeTheMessageService {
|
||||
int t23= HexUtils.reverseHexInt(content.substring(idxStart, 8 + idxStart));
|
||||
Map<String,Object> map23 =new LinkedHashMap<>();
|
||||
map23.put("title","总电量");
|
||||
map23.put("content",new BigDecimal(t23).divide(new BigDecimal(100000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
map23.put("content",new BigDecimal(t23).divide(new BigDecimal(10000)).setScale(4,BigDecimal.ROUND_DOWN));
|
||||
list.add(map23);
|
||||
|
||||
idxStart = idxStart+8;
|
||||
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
|
||||
@ -5,6 +5,7 @@ import com.xhpc.charging.station.service.IXhpcTerminalService;
|
||||
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 org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.web.bind.annotation.GetMapping;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
@ -14,6 +15,8 @@ import org.springframework.web.bind.annotation.RestController;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
|
||||
|
||||
@RestController
|
||||
@RequestMapping("/api/station")
|
||||
public class XhpcChargingStationApiController extends BaseController {
|
||||
@ -22,7 +25,8 @@ public class XhpcChargingStationApiController extends BaseController {
|
||||
private IXhpcChargingStationService xhpcChargingStationService;
|
||||
@Autowired
|
||||
private IXhpcTerminalService xhpcTerminalService;
|
||||
|
||||
@Autowired
|
||||
private RedisService redisService;
|
||||
/**
|
||||
* 微信小程序电站列表
|
||||
*
|
||||
@ -94,4 +98,13 @@ public class XhpcChargingStationApiController extends BaseController {
|
||||
return AjaxResult.success(xhpcChargingStationService.getPlaceholderTimeMassage(chargingStationId));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping(value = "/getReis")
|
||||
public AjaxResult getReis(String serialNumber,Integer voltageUpperLimits,Integer currentLimit) {
|
||||
Map<String, Object> pileDataModel = redisService.getCacheMap("pile:" + serialNumber);
|
||||
pileDataModel.put("voltageUpperLimits",voltageUpperLimits);
|
||||
pileDataModel.put("currentLimit",currentLimit);
|
||||
redisService.setCacheMap("pile:" + serialNumber,pileDataModel);
|
||||
return AjaxResult.success();
|
||||
}
|
||||
}
|
||||
|
||||
@ -63,7 +63,7 @@ public class XhpcChargingPileController extends BaseController {
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Log(title = "场站-添加桩", businessType = BusinessType.INSERT)
|
||||
// @Log(title = "场站-添加桩", businessType = BusinessType.INSERT)
|
||||
@PostMapping(value = "/addXhpcChargingPile")
|
||||
public AjaxResult addXhpcChargingPile(@RequestBody XhpcChargingPile xhpcChargingPile) {
|
||||
|
||||
|
||||
@ -9,6 +9,7 @@ import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.domain.XhpcChargingStation;
|
||||
import com.xhpc.common.log.annotation.Log;
|
||||
import com.xhpc.common.log.enums.BusinessType;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.common.security.annotation.PreAuthorize;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.scheduling.annotation.Scheduled;
|
||||
@ -34,6 +35,7 @@ public class XhpcChargingStationController extends BaseController {
|
||||
@Autowired
|
||||
private IXhpcChargingStationService xhpcChargingStationService;
|
||||
|
||||
|
||||
@Log(title = "充电站状态编辑", businessType = BusinessType.UPDATE)
|
||||
@PostMapping("/editStationStatus")
|
||||
public AjaxResult editStationStatus(@RequestBody Map<String, Object> map) {
|
||||
|
||||
@ -0,0 +1,162 @@
|
||||
package com.xhpc.charging.station.controller;
|
||||
|
||||
import cn.hutool.core.date.DateUtil;
|
||||
import cn.hutool.json.JSONArray;
|
||||
import com.xhpc.charging.station.service.IXhpcRequirementService;
|
||||
import com.xhpc.charging.station.utils.img.JSONUtil;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.core.web.controller.BaseController;
|
||||
import com.xhpc.common.core.web.page.TableDataInfo;
|
||||
import com.xhpc.common.domain.Requirement;
|
||||
import com.xhpc.common.domain.RequirementTask;
|
||||
import com.xhpc.common.domain.RequirementTime;
|
||||
import com.xhpc.common.util.LogUserUtils;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.dom4j.tree.BackedList;
|
||||
import org.springframework.web.bind.annotation.*;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import java.math.BigDecimal;
|
||||
import java.util.Date;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* 监管平台有序充电调控需求
|
||||
*
|
||||
* @author yuyang
|
||||
* @Date 2025-07-11 12:04
|
||||
*/
|
||||
@RestController
|
||||
@RequestMapping("/requirementInfo")
|
||||
public class XhpcRequirementInfoController extends BaseController {
|
||||
|
||||
@Resource
|
||||
IXhpcRequirementService xhpcRequirementServicel;
|
||||
@Resource
|
||||
LogUserUtils logUserUtils;
|
||||
|
||||
|
||||
@GetMapping("/getList")
|
||||
public TableDataInfo getPage(HttpServletRequest request,
|
||||
String name,
|
||||
String area,
|
||||
String code
|
||||
){
|
||||
LoginUser loginUser = logUserUtils.getLogUser(request);
|
||||
startPage();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("tenantId", loginUser.getTenantId());
|
||||
params.put("name", name);
|
||||
params.put("area", area);
|
||||
params.put("code", code);
|
||||
return getDataTable(xhpcRequirementServicel.getLsit(params));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/detail")
|
||||
public R getRequirementById(@RequestParam("requirementId")Long requirementId){
|
||||
return R.ok(xhpcRequirementServicel.getRequirementById(requirementId));
|
||||
}
|
||||
|
||||
|
||||
@GetMapping("/getTaskList")
|
||||
public TableDataInfo getTaskList(HttpServletRequest request,
|
||||
String taskName,
|
||||
String taskCode,
|
||||
String demandDate,
|
||||
Long stationID,
|
||||
String operatorID,
|
||||
String deliveryTime,
|
||||
String equipmentOwnerID,
|
||||
String eleNo
|
||||
){
|
||||
startPage();
|
||||
Map<String, Object> params = new HashMap<>();
|
||||
params.put("taskName", taskName);
|
||||
params.put("taskCode", taskCode);
|
||||
params.put("demandDate", demandDate);
|
||||
params.put("stationID", stationID);
|
||||
params.put("operatorID", operatorID);
|
||||
params.put("deliveryTime", deliveryTime);
|
||||
params.put("equipmentOwnerID", equipmentOwnerID);
|
||||
params.put("eleNo", eleNo);
|
||||
return getDataTable(xhpcRequirementServicel.getTaskList(params));
|
||||
}
|
||||
|
||||
@GetMapping("/taskDetail")
|
||||
public R taskDetail(@RequestParam("requirementTaskId")Long requirementTaskId){
|
||||
return R.ok(xhpcRequirementServicel.getRequirementTaskById(requirementTaskId));
|
||||
}
|
||||
|
||||
@GetMapping("/updateTaskById")
|
||||
public R updateTaskById(@RequestParam("requirementTaskId")Long requirementTaskId,@RequestParam("status")Integer status){
|
||||
return xhpcRequirementServicel.updateTaskById(requirementTaskId,status);
|
||||
}
|
||||
|
||||
|
||||
//================监管平台接口调控===========================
|
||||
|
||||
@PostMapping("/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){
|
||||
|
||||
Requirement requirement = new Requirement();
|
||||
requirement.setName(name);
|
||||
requirement.setArea(area);
|
||||
requirement.setCode(code);
|
||||
requirement.setRequireDate(DateUtil.parse(requireDate,"yyyy-MM-dd"));
|
||||
requirement.setReleaseTime(DateUtil.parse(releaseTime,"yyyy-MM-dd HH:mm:ss"));
|
||||
requirement.setDeliveryTime(DateUtil.parse(deliveryTime,"yyyy-MM-dd HH:mm:ss"));
|
||||
requirement.setCreateTime(new Date());
|
||||
xhpcRequirementServicel.addRequirement(requirement);
|
||||
|
||||
List<Map<String,String>> mapList =JSONUtil.readParams(list,List.class);
|
||||
if(list !=null && mapList.size()>0){
|
||||
for (int i = 0; i <mapList.size() ; i++) {
|
||||
Map<String, String> map = mapList.get(i);
|
||||
RequirementTime requirementTime = new RequirementTime();
|
||||
requirementTime.setStartTime(DateUtil.parse(map.get("startTime"),"yyyy-MM-dd HH:mm:ss"));
|
||||
requirementTime.setEndTime(DateUtil.parse(map.get("endTime"),"yyyy-MM-dd HH:mm:ss"));
|
||||
requirementTime.setRes(new BigDecimal(map.get("res")).doubleValue());
|
||||
requirementTime.setRequirementId(requirement.getRequirementId());
|
||||
requirementTime.setCreateTime(new Date());
|
||||
xhpcRequirementServicel.addRequirementTime(requirementTime);
|
||||
}
|
||||
}
|
||||
return R.ok();
|
||||
}
|
||||
|
||||
@PostMapping("/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){
|
||||
|
||||
RequirementTask requirementTask = new RequirementTask();
|
||||
requirementTask.setTaskName(taskName);
|
||||
requirementTask.setTaskCode(taskCode);
|
||||
requirementTask.setDemandDate(DateUtil.parse(demandDate,"yyyy-MM-dd"));
|
||||
requirementTask.setStationID(stationID);
|
||||
requirementTask.setOperatorID(operatorID);
|
||||
requirementTask.setEquipmentOwnerID(equipmentOwnerID);
|
||||
requirementTask.setEleNo(eleNo);
|
||||
requirementTask.setDeliveryTime(DateUtil.parse(deliveryTime,"yyyy-MM-dd HH:mm:ss"));
|
||||
requirementTask.setCreateTime(new Date());
|
||||
xhpcRequirementServicel.addRequirementTask(requirementTask);
|
||||
|
||||
List<Map<String,String>> mapList =JSONUtil.readParams(list,List.class);
|
||||
if(list !=null && mapList.size()>0){
|
||||
for (int i = 0; i <mapList.size() ; i++) {
|
||||
Map<String, String> map = mapList.get(i);
|
||||
RequirementTime requirementTime = new RequirementTime();
|
||||
requirementTime.setStartTime(DateUtil.parse(map.get("startTime"),"yyyy-MM-dd HH:mm:ss"));
|
||||
requirementTime.setEndTime(DateUtil.parse(map.get("endTime"),"yyyy-MM-dd HH:mm:ss"));
|
||||
requirementTime.setRes(new BigDecimal(map.get("res")).doubleValue());
|
||||
requirementTime.setRequirementTaskId(requirementTask.getRequirementTaskId());
|
||||
requirementTime.setCreateTime(new Date());
|
||||
xhpcRequirementServicel.addRequirementTime(requirementTime);
|
||||
}
|
||||
}
|
||||
|
||||
return R.ok();
|
||||
}
|
||||
}
|
||||
@ -25,9 +25,9 @@ public class XhpcTimingChargingPowerController extends BaseController {
|
||||
|
||||
|
||||
@GetMapping("/list")
|
||||
public TableDataInfo list(HttpServletRequest request, String tenantId, Long operatorId, String reason, Integer status, String startTime, String endTime, Long chargingStationId) {
|
||||
public TableDataInfo list(HttpServletRequest request, String tenantId, Long operatorId, String reason, Integer status, String startTime, String endTime, Long chargingStationId, String endSatrtTime, String endEndTime,Integer type) {
|
||||
startPage();
|
||||
List<Map<String, Object>> list = xhpcTimingChargingPowerService.list(request,tenantId,operatorId,reason, status, startTime,endTime, chargingStationId);
|
||||
List<Map<String, Object>> list = xhpcTimingChargingPowerService.list(request,tenantId,operatorId,reason, status, startTime,endTime, chargingStationId,endSatrtTime,endEndTime,type);
|
||||
return getDataTable(list);
|
||||
}
|
||||
|
||||
@ -77,7 +77,7 @@ public class XhpcTimingChargingPowerController extends BaseController {
|
||||
/**
|
||||
* 每30秒执行一次
|
||||
*/
|
||||
//@Scheduled(cron = "0/30 * * * * ?")
|
||||
@Scheduled(cron = "0/30 * * * * ?")
|
||||
@PostMapping(value = "/getXhpcTimingChargingPowerModelCron")
|
||||
public void getXhpcTimingChargingPowerModelCron(){
|
||||
xhpcTimingChargingPowerService.getXhpcTimingChargingPowerModelCron();
|
||||
|
||||
@ -0,0 +1,33 @@
|
||||
package com.xhpc.charging.station.mapper;
|
||||
|
||||
import com.xhpc.common.domain.Requirement;
|
||||
import com.xhpc.common.domain.RequirementTask;
|
||||
import com.xhpc.common.domain.RequirementTime;
|
||||
import org.apache.ibatis.annotations.Param;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-11 16:00
|
||||
*/
|
||||
public interface XhpcRequirementMapper {
|
||||
|
||||
List<Map<String,Object>> getLsit(@Param("params") Map<String, Object> params);
|
||||
|
||||
Map<String, Object> getRequirementById(@Param("requirementId")Long requirementId);
|
||||
|
||||
List<Map<String,Object>> getTaskList(@Param("params") Map<String, Object> params);
|
||||
|
||||
Map<String,Object> getRequirementTaskById(@Param("requirementTaskId")Long requirementTaskId);
|
||||
|
||||
int updateTaskById(@Param("requirementTaskId")Long requirementTaskId,@Param("status")Integer status);
|
||||
List<Map<String,Object>> getRequirementTimeList(@Param("requirementId")Long requirementId,@Param("requirementTaskId")Long requirementTaskId);
|
||||
|
||||
int addRequirement(Requirement requirement);
|
||||
|
||||
int addRequirementTime(RequirementTime requirementTime);
|
||||
|
||||
int addRequirementTask(RequirementTask requirementTask);
|
||||
}
|
||||
@ -49,7 +49,6 @@ public interface XhpcTerminalMapper {
|
||||
/**
|
||||
* 修改终端
|
||||
*
|
||||
* @param xhpcTerminal 终端
|
||||
* @return 结果
|
||||
*/
|
||||
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);
|
||||
|
||||
@ -8,7 +8,7 @@ import java.util.Map;
|
||||
|
||||
public interface XhpcTimingChargingPowerMapper {
|
||||
|
||||
List<Map<String, Object>> list(@Param("operatorId")Long operatorId, @Param("reason")String reason, @Param("status") Integer status, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("chargingStationId") Long chargingStationId, @Param("logOperatorId")Long logOperatorId, @Param("type")Integer type, @Param("tenantId")String tenantId);
|
||||
List<Map<String, Object>> list(@Param("operatorId")Long operatorId, @Param("reason")String reason, @Param("status") Integer status, @Param("startTime") String startTime, @Param("endTime") String endTime, @Param("chargingStationId") Long chargingStationId, @Param("logOperatorId")Long logOperatorId, @Param("type")Integer type, @Param("tenantId")String tenantId, @Param("endSatrtTime")String endSatrtTime, @Param("endEndTime")String endEndTime,@Param("endType")Integer endType);
|
||||
|
||||
int insertXhpcTimingChargingPowerModel(XhpcTimingChargingPowerModel xhpcTimingChargingPowerModel);
|
||||
|
||||
@ -18,7 +18,9 @@ public interface XhpcTimingChargingPowerMapper {
|
||||
|
||||
List<XhpcTimingChargingPowerModel> getXhpcTimingChargingPowerModelCron();
|
||||
|
||||
List<XhpcTimingChargingPowerModel> getXhpcEndTimingChargingPowerModelCron();
|
||||
String getXhpcChargingPile(@Param("chargingPileId")Long chargingPileId,@Param("chargingStationId")Long chargingStationId);
|
||||
|
||||
void updateXhpcChargingPile(@Param("chargingPileId")Long chargingPileId,@Param("powerNumber")Integer powerNumber);
|
||||
void updateXhpcChargingPower(@Param("timingChargingPowerId")Long timingChargingPowerId,@Param("status")Integer status,@Param("type")Integer type);
|
||||
}
|
||||
|
||||
@ -0,0 +1,32 @@
|
||||
package com.xhpc.charging.station.service;
|
||||
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.domain.Requirement;
|
||||
import com.xhpc.common.domain.RequirementTask;
|
||||
import com.xhpc.common.domain.RequirementTime;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-11 15:59
|
||||
*/
|
||||
public interface IXhpcRequirementService {
|
||||
|
||||
|
||||
List<Map<String, Object>> getLsit(Map<String, Object> params);
|
||||
|
||||
Map<String, Object> getRequirementById(Long requirementId);
|
||||
|
||||
Map<String, Object> getRequirementTaskById(Long requirementId);
|
||||
|
||||
R updateTaskById(Long requirementId,Integer status);
|
||||
List<Map<String, Object>> getTaskList(Map<String, Object> params);
|
||||
int addRequirement(Requirement requirement);
|
||||
|
||||
int addRequirementTime(RequirementTime requirementTime);
|
||||
|
||||
int addRequirementTask(RequirementTask requirementTask);
|
||||
|
||||
}
|
||||
@ -9,7 +9,7 @@ import java.util.Map;
|
||||
|
||||
public interface IXhpcTimingChargingPowerService {
|
||||
|
||||
List<Map<String, Object>> list(HttpServletRequest request, String tenantId, Long operatorId, String reason, Integer status, String startTime, String endTime, Long chargingStationId);
|
||||
List<Map<String, Object>> list(HttpServletRequest request, String tenantId, Long operatorId, String reason, Integer status, String startTime, String endTime, Long chargingStationId, String endSatrtTime, String endEndTime,Integer type);
|
||||
|
||||
R addXhpcTimingChargingPowerModel(HttpServletRequest request, XhpcTimingChargingPowerModel xhpcTimingChargingPowerModel);
|
||||
|
||||
|
||||
@ -0,0 +1,115 @@
|
||||
package com.xhpc.charging.station.service;
|
||||
|
||||
import com.xhpc.charging.station.mapper.XhpcRequirementMapper;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.domain.Requirement;
|
||||
import com.xhpc.common.domain.RequirementTask;
|
||||
import com.xhpc.common.domain.RequirementTime;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
import com.xhpc.system.api.model.LoginUser;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author yuyang
|
||||
* @Date 2025-07-11 16:00
|
||||
*/
|
||||
@Service
|
||||
public class XhpcRequirementServiceImpl implements IXhpcRequirementService{
|
||||
|
||||
@Resource
|
||||
XhpcRequirementMapper xhpcRequirementMapper;
|
||||
@Resource
|
||||
TokenService tokenService;
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getLsit(Map<String, Object> params) {
|
||||
return xhpcRequirementMapper.getLsit(params);
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getRequirementById(Long requirementId) {
|
||||
Map<String, Object> map = xhpcRequirementMapper.getRequirementById(requirementId);
|
||||
List<Map<String, Object>> list = xhpcRequirementMapper.getRequirementTimeList(requirementId, null);
|
||||
if(list !=null && list.size()>0){
|
||||
map.put("timeList",list);
|
||||
}else{
|
||||
map.put("timeList",new ArrayList<>());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> getRequirementTaskById(Long requirementTaskId) {
|
||||
Map<String, Object> map = xhpcRequirementMapper.getRequirementTaskById(requirementTaskId);
|
||||
List<Map<String, Object>> list = xhpcRequirementMapper.getRequirementTimeList(null, requirementTaskId);
|
||||
if(list !=null && list.size()>0){
|
||||
map.put("timeList",list);
|
||||
}else{
|
||||
map.put("timeList",new ArrayList<>());
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public R updateTaskById(Long requirementId,Integer status) {
|
||||
|
||||
int i = xhpcRequirementMapper.updateTaskById(requirementId, status);
|
||||
if(i>0){
|
||||
return R.ok();
|
||||
}
|
||||
return R.fail();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> getTaskList(Map<String, Object> params) {
|
||||
LoginUser loginUser = tokenService.getLoginUser();
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
Long sysUserId = sysUser.getUserId();
|
||||
if (!UserTypeUtil.SYS_USER_TYPE_ADMIN.equals(sysUser.getUserId())) {
|
||||
|
||||
if (UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())) {
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
//运营商看自己的场站
|
||||
params.put("type", 1);
|
||||
params.put("logOperatorId", logOperatorId);
|
||||
return xhpcRequirementMapper.getTaskList(params);
|
||||
} else {
|
||||
//查询赋值的场站
|
||||
params.put("type", 2);
|
||||
params.put("logOperatorId", sysUserId);
|
||||
return xhpcRequirementMapper.getTaskList(params);
|
||||
}
|
||||
} else {
|
||||
params.put("type", 0);
|
||||
params.put("logOperatorId", sysUserId);
|
||||
return xhpcRequirementMapper.getTaskList(params);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addRequirement(Requirement requirement) {
|
||||
return xhpcRequirementMapper.addRequirement(requirement);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addRequirementTime(RequirementTime requirementTime) {
|
||||
return xhpcRequirementMapper.addRequirementTime(requirementTime);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int addRequirementTask(RequirementTask requirementTask) {
|
||||
return xhpcRequirementMapper.addRequirementTask(requirementTask);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@ -4,6 +4,7 @@ import com.xhpc.charging.station.mapper.XhpcTimingChargingPowerMapper;
|
||||
import com.xhpc.common.api.PowerPileService;
|
||||
import com.xhpc.common.core.domain.R;
|
||||
import com.xhpc.common.domain.XhpcTimingChargingPowerModel;
|
||||
import com.xhpc.common.redis.service.RedisService;
|
||||
import com.xhpc.common.security.service.TokenService;
|
||||
import com.xhpc.common.util.UserTypeUtil;
|
||||
import com.xhpc.system.api.domain.SysUser;
|
||||
@ -29,11 +30,12 @@ public class XhpcTimingChargingPowerServiceImpl implements IXhpcTimingChargingPo
|
||||
private TokenService tokenService;
|
||||
@Resource
|
||||
private PowerPileService powerPileService;
|
||||
|
||||
@Autowired
|
||||
RedisService redisService;
|
||||
private final ExecutorService executorService = Executors.newFixedThreadPool(20);
|
||||
|
||||
@Override
|
||||
public List<Map<String, Object>> list(HttpServletRequest request, String tenantId, Long operatorId, String reason, Integer status, String startTime, String endTime, Long chargingStationId) {
|
||||
public List<Map<String, Object>> list(HttpServletRequest request, String tenantId, Long operatorId, String reason, Integer status, String startTime, String endTime, Long chargingStationId, String endSatrtTime, String endEndTime,Integer type) {
|
||||
LoginUser loginUser = tokenService.getLoginUser(request);
|
||||
SysUser sysUser = loginUser.getSysUser();
|
||||
|
||||
@ -42,13 +44,13 @@ public class XhpcTimingChargingPowerServiceImpl implements IXhpcTimingChargingPo
|
||||
if(UserTypeUtil.SYS_USER_TYPE_ONE.equals(sysUser.getUserType())){
|
||||
Long logOperatorId = sysUser.getOperatorId();
|
||||
//运营商看自己的场站
|
||||
return xhpcTimingChargingPowerMapper.list(operatorId,reason,status,startTime,endTime,chargingStationId,logOperatorId, 1,tenantId);
|
||||
return xhpcTimingChargingPowerMapper.list(operatorId,reason,status,startTime,endTime,chargingStationId,logOperatorId, 1,tenantId,endSatrtTime,endEndTime,type);
|
||||
}else{
|
||||
//查询赋值的场站
|
||||
return xhpcTimingChargingPowerMapper.list(operatorId,reason,status,startTime,endTime,chargingStationId,sysUserId, 2,tenantId);
|
||||
return xhpcTimingChargingPowerMapper.list(operatorId,reason,status,startTime,endTime,chargingStationId,sysUserId, 2,tenantId,endSatrtTime,endEndTime,type);
|
||||
}
|
||||
}else{
|
||||
return xhpcTimingChargingPowerMapper.list(operatorId,reason,status,startTime,endTime,chargingStationId,sysUserId, 0,tenantId);
|
||||
return xhpcTimingChargingPowerMapper.list(operatorId,reason,status,startTime,endTime,chargingStationId,sysUserId, 0,tenantId,endSatrtTime,endEndTime,type);
|
||||
}
|
||||
|
||||
}
|
||||
@ -66,19 +68,39 @@ public class XhpcTimingChargingPowerServiceImpl implements IXhpcTimingChargingPo
|
||||
if (xhpcTimingChargingPowerModel.getChargingStationId() == null || "".equals(xhpcTimingChargingPowerModel.getChargingStationId())) {
|
||||
return R.fail(1001, "场站不能为空");
|
||||
}
|
||||
if (xhpcTimingChargingPowerModel.getTimingTime() == null || "".equals(xhpcTimingChargingPowerModel.getTimingTime())) {
|
||||
return R.fail(1001, "调整时间不能为空");
|
||||
if (xhpcTimingChargingPowerModel.getStartTimingTime() == null || "".equals(xhpcTimingChargingPowerModel.getStartTimingTime())) {
|
||||
return R.fail(1001, "调整开始时间不能为空");
|
||||
}else{
|
||||
if(System.currentTimeMillis()>xhpcTimingChargingPowerModel.getTimingTime().getTime()){
|
||||
return R.fail(1001, "调整时间不能小于现在时间");
|
||||
if(System.currentTimeMillis()>xhpcTimingChargingPowerModel.getStartTimingTime().getTime()){
|
||||
return R.fail(1001, "调整开始时间不能小于现在时间");
|
||||
}
|
||||
}
|
||||
|
||||
if (xhpcTimingChargingPowerModel.getEndTimingTime() == null || "".equals(xhpcTimingChargingPowerModel.getEndTimingTime())) {
|
||||
return R.fail(1001, "调整结束时间不能为空");
|
||||
}else{
|
||||
if(System.currentTimeMillis()>xhpcTimingChargingPowerModel.getEndTimingTime().getTime()){
|
||||
return R.fail(1001, "调整结束时间不能小于现在时间");
|
||||
}
|
||||
|
||||
if(xhpcTimingChargingPowerModel.getEndTimingTime().getTime()<xhpcTimingChargingPowerModel.getStartTimingTime().getTime()){
|
||||
return R.fail(1001, "调整结束时间不能小于调整开始时间");
|
||||
}
|
||||
}
|
||||
|
||||
if (xhpcTimingChargingPowerModel.getPowerNumber() == null) {
|
||||
return R.fail(1001, "桩功率百分比不能为空");
|
||||
return R.fail(1001, "调整开始桩功率百分比不能为空");
|
||||
}else {
|
||||
if(xhpcTimingChargingPowerModel.getPowerNumber()<1 || xhpcTimingChargingPowerModel.getPowerNumber()>100){
|
||||
return R.fail(1001, "桩功率百分比范围在1~100之间");
|
||||
return R.fail(1001, "调整开始桩功率百分比范围在1~100之间");
|
||||
}
|
||||
}
|
||||
|
||||
if (xhpcTimingChargingPowerModel.getEndPowerNumber() == null) {
|
||||
return R.fail(1001, "调整结束桩功率百分比不能为空");
|
||||
}else {
|
||||
if(xhpcTimingChargingPowerModel.getEndPowerNumber()<1 || xhpcTimingChargingPowerModel.getEndPowerNumber()>100){
|
||||
return R.fail(1001, "调整结束桩功率百分比范围在1~100之间");
|
||||
}
|
||||
}
|
||||
if(xhpcTimingChargingPowerModel.getChargingPileIds().length==0){
|
||||
@ -155,17 +177,18 @@ public class XhpcTimingChargingPowerServiceImpl implements IXhpcTimingChargingPo
|
||||
@Override
|
||||
public R getXhpcTimingChargingPowerModelCron() {
|
||||
|
||||
List<XhpcTimingChargingPowerModel> list = xhpcTimingChargingPowerMapper.getXhpcTimingChargingPowerModelCron();
|
||||
; List<XhpcTimingChargingPowerModel> list = xhpcTimingChargingPowerMapper.getXhpcTimingChargingPowerModelCron();
|
||||
if(list !=null && list.size()>0){
|
||||
for (int i = 0; i < list.size(); i++) {
|
||||
XhpcTimingChargingPowerModel xhpcTimingChargingPowerModel = list.get(i);
|
||||
String pileIds = xhpcTimingChargingPowerModel.getPileIds();
|
||||
String[] split = pileIds.split(",");
|
||||
for (int j = 0; j <split.length ; j++) {
|
||||
String s = split[j];
|
||||
Long aLong = Long.valueOf(s);
|
||||
|
||||
List<String> piles = Arrays.asList(pileIds.split(","));
|
||||
//获取桩号
|
||||
for (String pileId:piles) {
|
||||
String xhpcChargingPile = xhpcTimingChargingPowerMapper.getXhpcChargingPile(Long.getLong(pileId),xhpcTimingChargingPowerModel.getChargingStationId());
|
||||
|
||||
String xhpcChargingPile = xhpcTimingChargingPowerMapper.getXhpcChargingPile(aLong,xhpcTimingChargingPowerModel.getChargingStationId());
|
||||
redisService.setCacheObject("pile:"+xhpcChargingPile+":powerNumber",xhpcTimingChargingPowerModel.getPowerNumber().toString());
|
||||
R r =powerPileService.pileConfigSettings(xhpcChargingPile,xhpcTimingChargingPowerModel.getPowerNumber().toString());
|
||||
if (r.getCode() != 200) {
|
||||
executorService.execute(new Runnable() {
|
||||
@ -173,18 +196,51 @@ public class XhpcTimingChargingPowerServiceImpl implements IXhpcTimingChargingPo
|
||||
public void run() {
|
||||
R r1 = powerPileService.pileConfigSettings(xhpcChargingPile, xhpcTimingChargingPowerModel.getPowerNumber().toString());
|
||||
if (r1.getCode() == 200) {
|
||||
xhpcTimingChargingPowerMapper.updateXhpcChargingPile(Long.getLong(pileId),xhpcTimingChargingPowerModel.getPowerNumber());
|
||||
xhpcTimingChargingPowerMapper.updateXhpcChargingPile(aLong,xhpcTimingChargingPowerModel.getPowerNumber());
|
||||
xhpcTimingChargingPowerMapper.updateXhpcChargingPower(xhpcTimingChargingPowerModel.getTimingChargingPowerId(),1,null);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
xhpcTimingChargingPowerMapper.updateXhpcChargingPile(Long.getLong(pileId),xhpcTimingChargingPowerModel.getPowerNumber());
|
||||
xhpcTimingChargingPowerMapper.updateXhpcChargingPile(aLong,xhpcTimingChargingPowerModel.getPowerNumber());
|
||||
xhpcTimingChargingPowerMapper.updateXhpcChargingPower(xhpcTimingChargingPowerModel.getTimingChargingPowerId(),1,null);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
List<XhpcTimingChargingPowerModel> mapList = xhpcTimingChargingPowerMapper.getXhpcEndTimingChargingPowerModelCron();
|
||||
if(mapList !=null && mapList.size()>0){
|
||||
for (int i = 0; i < mapList.size(); i++) {
|
||||
XhpcTimingChargingPowerModel xhpcTimingChargingPowerModel = mapList.get(i);
|
||||
String pileIds = xhpcTimingChargingPowerModel.getPileIds();
|
||||
|
||||
String[] split = pileIds.split(",");
|
||||
for (int j = 0; j <split.length ; j++) {
|
||||
String s = split[j];
|
||||
Long aLong = Long.valueOf(s);
|
||||
String xhpcChargingPile = xhpcTimingChargingPowerMapper.getXhpcChargingPile(aLong,xhpcTimingChargingPowerModel.getChargingStationId());
|
||||
redisService.setCacheObject("pile:"+xhpcChargingPile+":powerNumber",xhpcTimingChargingPowerModel.getEndPowerNumber().toString());
|
||||
R r =powerPileService.pileConfigSettings(xhpcChargingPile,xhpcTimingChargingPowerModel.getEndPowerNumber().toString());
|
||||
if (r.getCode() != 200) {
|
||||
executorService.execute(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
R r1 = powerPileService.pileConfigSettings(xhpcChargingPile, xhpcTimingChargingPowerModel.getEndPowerNumber().toString());
|
||||
if (r1.getCode() == 200) {
|
||||
xhpcTimingChargingPowerMapper.updateXhpcChargingPile(aLong,xhpcTimingChargingPowerModel.getEndPowerNumber());
|
||||
xhpcTimingChargingPowerMapper.updateXhpcChargingPower(xhpcTimingChargingPowerModel.getTimingChargingPowerId(),null,1);
|
||||
}
|
||||
}
|
||||
});
|
||||
}else{
|
||||
xhpcTimingChargingPowerMapper.updateXhpcChargingPile(aLong,xhpcTimingChargingPowerModel.getEndPowerNumber());
|
||||
xhpcTimingChargingPowerMapper.updateXhpcChargingPower(xhpcTimingChargingPowerModel.getTimingChargingPowerId(),null,1);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
@ -0,0 +1,90 @@
|
||||
package com.xhpc.charging.station.utils.img;
|
||||
|
||||
import com.alibaba.fastjson.JSON;
|
||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
||||
import com.fasterxml.jackson.databind.JavaType;
|
||||
import com.fasterxml.jackson.databind.JsonNode;
|
||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
||||
import com.fasterxml.jackson.databind.type.CollectionType;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
|
||||
public class JSONUtil {
|
||||
|
||||
private static final ObjectMapper mapper = new ObjectMapper();
|
||||
private static final Logger logger = LoggerFactory.getLogger(JSONUtil.class);
|
||||
|
||||
/**
|
||||
* 将一个对象转换成目标对象
|
||||
*
|
||||
* @param src
|
||||
* @param dest
|
||||
* @return
|
||||
*/
|
||||
public static <T> T copyProperties(Object src, Class<T> dest) throws Exception {
|
||||
|
||||
return JSON.parseObject(JSON.toJSONString(src), dest);
|
||||
}
|
||||
|
||||
public static <T> T copyProperties(Object src, JavaType type) throws Exception {
|
||||
|
||||
return JSON.parseObject(JSON.toJSONString(src), type);
|
||||
}
|
||||
|
||||
// 适用于简单对象,复杂对象参考下面的main方法
|
||||
public static <T> T readParams(String params, Class<T> clz) {
|
||||
|
||||
try {
|
||||
return mapper.readValue(params, clz);
|
||||
} catch (JsonProcessingException e) {
|
||||
logger.debug("invalid json:{}", params);
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public static <T> List<T> readParamsList(String data, Class<T> clzo) throws IOException {
|
||||
|
||||
CollectionType javaType = mapper.getTypeFactory()
|
||||
.constructCollectionType(List.class, clzo);
|
||||
return mapper.readValue(data, javaType);
|
||||
}
|
||||
|
||||
public static String toJSONString(Object o) throws JsonProcessingException {
|
||||
|
||||
return mapper.writeValueAsString(o);
|
||||
}
|
||||
|
||||
// 适用于复杂对象的例子
|
||||
public static void main(String[] args) throws IOException {
|
||||
|
||||
String json = "[\n" + "{\n" + " \"id\": \"123\",\n" + " \"phoneNumbers\": [1,2],\n \"gf\": {\"id\":\"1\"," +
|
||||
"\"name\":\"nana\"}\n" + "}\n" + "\n]";
|
||||
byte[] jsonData = json.getBytes();
|
||||
ObjectMapper objectMapper = new ObjectMapper();
|
||||
//read JSON like DOM Parser
|
||||
JsonNode rootNode = objectMapper.readTree(jsonData);
|
||||
JsonNode idNode = rootNode.path("id");
|
||||
System.out.println("id = " + idNode.asInt());
|
||||
|
||||
JsonNode phoneNosNode = rootNode.path("phoneNumbers");
|
||||
Iterator<JsonNode> elements = phoneNosNode.elements();
|
||||
while (elements.hasNext()) {
|
||||
JsonNode phone = elements.next();
|
||||
System.out.println("Phone No = " + phone.asLong());
|
||||
}
|
||||
JsonNode gfid = rootNode.path("gf").path("id");
|
||||
System.out.println("gf id: " + gfid.asInt());
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@ -14,10 +14,10 @@ spring:
|
||||
nacos:
|
||||
discovery:
|
||||
# 服务注册地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
config:
|
||||
# 配置中心地址
|
||||
server-addr: mse-e2a05960-nacos-ans.mse.aliyuncs.com:8848
|
||||
server-addr: 120.26.46.180:8858
|
||||
# 配置文件格式
|
||||
file-extension: yml
|
||||
# 共享配置
|
||||
@ -28,23 +28,31 @@ logging:
|
||||
level:
|
||||
com.xhpc.charging.station.mapper: debug
|
||||
|
||||
oss:
|
||||
enabled: true
|
||||
name: qiniu
|
||||
tenant-mode: true
|
||||
endpoint: oss-accelerate.aliyuncs.com
|
||||
access-key: LTAI5tHxc8hrG6cT5nDtEkiV
|
||||
secret-key: 5kFEaIFE7eeODxKQwD5mvTRF48MK6w
|
||||
bucket-name: xhpc-bucket1
|
||||
#二维码Logo图片获取位置:
|
||||
#imgPath: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\xhcd_logo.png"
|
||||
imgPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/logo.png"
|
||||
imgPath: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\logo.png"
|
||||
#imgPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/logo.png"
|
||||
#imgPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/logo.png"
|
||||
#生成的二维码存放位置:
|
||||
#destPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs"
|
||||
destPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs"
|
||||
destPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs"
|
||||
#destPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs"
|
||||
#destPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/XiaoHuaFullImgs"
|
||||
#生成的最终完整图片的存放位置:
|
||||
#fullImgDestPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs\\"
|
||||
fullImgDestPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs/"
|
||||
fullImgDestPath: "D:\\Enterprise_Resources\\XiaoHuaFullImgs\\"
|
||||
#fullImgDestPath: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/XiaoHuaFullImgs/"
|
||||
#fullImgDestPath: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/XiaoHuaFullImgs/"
|
||||
#底图图片存放位置:
|
||||
#bottomImg: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\BottomImg.png"
|
||||
bottomImg: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/BottomImg.png"
|
||||
bottomImg: "D:\\Enterprise_Resources\\XiaoHuaMaterialImgs\\BottomImg.png"
|
||||
#bottomImg: "/www/wwwroot/scxhua.cn/xhpc-charging-stion/BottomImg.png"
|
||||
#bottomImg: "/www/wwwroot/xhpc.scxhua.com/xhpc-charging-stion/BottomImg.png"
|
||||
#生成的二维码zip包位置
|
||||
#zipLocation: "D:\\Enterprise_Resources\\QrZip"
|
||||
zipLocation: "/www/wwwroot/scxhua.cn/dist"
|
||||
zipLocation: "D:\\Enterprise_Resources\\QrZip"
|
||||
#zipLocation: "/www/wwwroot/scxhua.cn/dist"
|
||||
#zipLocation: "/www/wwwroot/xhpc.scxhua.com/dist"
|
||||
|
||||
@ -0,0 +1,500 @@
|
||||
<?xml version="1.0" encoding="UTF-8" ?>
|
||||
<!DOCTYPE mapper
|
||||
PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN"
|
||||
"http://mybatis.org/dtd/mybatis-3-mapper.dtd">
|
||||
<mapper namespace="com.xhpc.charging.station.mapper.XhpcRequirementMapper">
|
||||
|
||||
<resultMap id="BaseResultMap" type="com.xhpc.common.domain.Requirement">
|
||||
<result property="requirementId" column="requirement_id"/>
|
||||
<result property="name" column="name"/>
|
||||
<result property="area" column="area"/>
|
||||
<result property="code" column="code"/>
|
||||
<result property="requireDate" column="require_date"/>
|
||||
<result property="deliveryTime" column="delivery_time"/>
|
||||
<result property="releaseTime" column="release_time"/>
|
||||
<result property="status" column="status"/>
|
||||
<result property="delFlag" column="del_flag"/>
|
||||
<result property="createTime" column="create_time"/>
|
||||
<result property="createBy" column="create_by"/>
|
||||
<result property="updateTime" column="update_time"/>
|
||||
<result property="updateBy" column="update_by"/>
|
||||
<result property="remark" column="remark"/>
|
||||
<result property="tenantId" column="tenant_id"/>
|
||||
</resultMap>
|
||||
|
||||
<select id="getLsit" resultType="map">
|
||||
select
|
||||
requirement_id as requirementId,
|
||||
name as name,
|
||||
area as area,
|
||||
code as code,
|
||||
status as status,
|
||||
require_date as requireDate,
|
||||
delivery_time as deliveryTime,
|
||||
release_time as releaseTime,
|
||||
create_time as createTime
|
||||
from xhpc_requirement where del_flag =0
|
||||
<if test="params.name !=null and params.name !=''">
|
||||
and name like CONCAT('%',#{params.name},'%')
|
||||
</if>
|
||||
<if test="params.area !=null and params.area !=''">
|
||||
and area like CONCAT('%',#{params.area},'%')
|
||||
</if>
|
||||
<if test="params.code !=null and params.code !=''">
|
||||
and code like CONCAT('%',#{params.code},'%')
|
||||
</if>
|
||||
order by create_time desc
|
||||
</select>
|
||||
|
||||
<select id="getRequirementById" resultType="map">
|
||||
select
|
||||
name as name,
|
||||
area as area,
|
||||
code as code,
|
||||
require_date as requireDate,
|
||||
delivery_time as deliveryTime,
|
||||
release_time as releaseTime,
|
||||
create_time as createTime
|
||||
from xhpc_requirement
|
||||
where requirement_id = #{requirementId}
|
||||
</select>
|
||||
|
||||
<select id="getRequirementTaskById" resultType="map">
|
||||
select
|
||||
xrt.requirement_task_id as requirementTaskId,
|
||||
xrt.task_name as taskName,
|
||||
xrt.task_code as taskCode,
|
||||
xrt.demand_date as demandDate,
|
||||
GROUP_CONCAT(s.name) as stationName,
|
||||
xrt.status as status,
|
||||
xrt.operator_id as operatorID,
|
||||
xrt.equipment_owner_id as equipmentOwnerID,
|
||||
xrt.ele_no as eleNo,
|
||||
xrt.delivery_time as deliveryTime,
|
||||
xrt.create_time as createTime
|
||||
from xhpc_requirement_task as xrt
|
||||
left join xhpc_charging_station as s on FIND_IN_SET(CAST(s.charging_station_id AS CHAR), xrt.station_id) > 0
|
||||
where xrt.del_flag =0 and xrt.requirement_task_id=#{requirementTaskId}
|
||||
</select>
|
||||
|
||||
<update id="updateTaskById">
|
||||
update xhpc_requirement_task set status =#{status} where requirement_task_id=#{requirementTaskId}
|
||||
</update>
|
||||
|
||||
<select id="getRequirementTimeList" resultType="map">
|
||||
select
|
||||
requirement_time_id as id,
|
||||
start_time as startTime,
|
||||
end_time as endTime,
|
||||
res as res
|
||||
from xhpc_requirement_time
|
||||
where del_flag=0
|
||||
<if test="requirementId !=null">
|
||||
and requirement_id = #{requirementId}
|
||||
</if>
|
||||
<if test="requirementTaskId !=null">
|
||||
and requirement_task_id = #{requirementTaskId}
|
||||
</if>
|
||||
</select>
|
||||
|
||||
<insert id="addRequirement" keyColumn="requirement_id" keyProperty="requirementId"
|
||||
parameterType="com.xhpc.common.domain.Requirement"
|
||||
useGeneratedKeys="true">
|
||||
insert into xhpc_requirement
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != name and ''!=name">
|
||||
name,
|
||||
</if>
|
||||
<if test="null != area and ''!=area">
|
||||
area,
|
||||
</if>
|
||||
<if test="null != code and ''!=code">
|
||||
code,
|
||||
</if>
|
||||
<if test="null != requireDate ">
|
||||
require_date,
|
||||
</if>
|
||||
<if test="null != releaseTime ">
|
||||
release_time,
|
||||
</if>
|
||||
<if test="null != deliveryTime ">
|
||||
delivery_time,
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
remark,
|
||||
</if>
|
||||
<if test="null != tenantId ">
|
||||
tenant_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != name and ''!=name">
|
||||
#{name},
|
||||
</if>
|
||||
<if test="null != area and ''!=area">
|
||||
#{area},
|
||||
</if>
|
||||
<if test="null != code and ''!=code">
|
||||
#{code},
|
||||
</if>
|
||||
<if test="null != requireDate ">
|
||||
#{requireDate},
|
||||
</if>
|
||||
<if test="null != releaseTime ">
|
||||
#{releaseTime},
|
||||
</if>
|
||||
<if test="null != deliveryTime ">
|
||||
#{deliveryTime},
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="null != tenantId ">
|
||||
#{tenantId},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
|
||||
<insert id="addRequirementTime">
|
||||
insert into xhpc_requirement_time
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != startTime">
|
||||
start_time,
|
||||
</if>
|
||||
<if test="null != endTime">
|
||||
end_time,
|
||||
</if>
|
||||
<if test="null != res">
|
||||
res,
|
||||
</if>
|
||||
<if test="null != requirementId">
|
||||
requirement_id,
|
||||
</if>
|
||||
<if test="null != requirementTaskId">
|
||||
requirement_task_id,
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
remark,
|
||||
</if>
|
||||
<if test="null != tenantId ">
|
||||
tenant_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != startTime">
|
||||
#{startTime},
|
||||
</if>
|
||||
<if test="null != endTime">
|
||||
#{endTime},
|
||||
</if>
|
||||
<if test="null != res">
|
||||
#{res},
|
||||
</if>
|
||||
<if test="null != requirementId">
|
||||
#{requirementId},
|
||||
</if>
|
||||
<if test="null != requirementTaskId">
|
||||
#{requirementTaskId},
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="null != tenantId ">
|
||||
#{tenantId},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<insert id="addRequirementTask" keyColumn="requirement_task_id" keyProperty="requirementTaskId"
|
||||
parameterType="com.xhpc.common.domain.RequirementTask"
|
||||
useGeneratedKeys="true">
|
||||
insert into xhpc_requirement_task
|
||||
<trim prefix="(" suffix=")" suffixOverrides=",">
|
||||
<if test="null != taskName and '' !=taskName ">
|
||||
task_name,
|
||||
</if>
|
||||
<if test="null != taskCode and '' !=taskCode ">
|
||||
task_code,
|
||||
</if>
|
||||
<if test="null != demandDate">
|
||||
demand_date,
|
||||
</if>
|
||||
<if test="null != stationID and '' !=stationID ">
|
||||
station_id,
|
||||
</if>
|
||||
<if test="null != operatorID and '' !=operatorID ">
|
||||
operator_id,
|
||||
</if>
|
||||
<if test="null != eleNo and '' !=eleNo ">
|
||||
ele_no,
|
||||
</if>
|
||||
<if test="null != equipmentOwnerID and '' !=equipmentOwnerID ">
|
||||
equipment_owner_id,
|
||||
</if>
|
||||
<if test="null != deliveryTime ">
|
||||
delivery_time,
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
status,
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
del_flag,
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time,
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
create_by,
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time,
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
update_by,
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
remark,
|
||||
</if>
|
||||
<if test="null != tenantId ">
|
||||
tenant_id,
|
||||
</if>
|
||||
</trim>
|
||||
<trim prefix="values (" suffix=")" suffixOverrides=",">
|
||||
<if test="null != taskName and '' !=taskName ">
|
||||
#{taskName},
|
||||
</if>
|
||||
<if test="null != taskCode and '' !=taskCode ">
|
||||
#{taskCode},
|
||||
</if>
|
||||
<if test="null != demandDate">
|
||||
#{demandDate},
|
||||
</if>
|
||||
<if test="null != stationID and '' !=stationID ">
|
||||
#{stationID},
|
||||
</if>
|
||||
<if test="null != operatorID and '' !=operatorID ">
|
||||
#{operatorID},
|
||||
</if>
|
||||
<if test="null != eleNo and '' !=eleNo ">
|
||||
#{eleNo},
|
||||
</if>
|
||||
<if test="null != equipmentOwnerID and '' !=equipmentOwnerID ">
|
||||
#{equipmentOwnerID},
|
||||
</if>
|
||||
<if test="null != deliveryTime ">
|
||||
#{deliveryTime},
|
||||
</if>
|
||||
<if test="null != status ">
|
||||
#{status},
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
#{delFlag},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
#{createTime},
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
#{createBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
#{updateTime},
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
#{updateBy},
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
#{remark},
|
||||
</if>
|
||||
<if test="null != tenantId ">
|
||||
#{tenantId},
|
||||
</if>
|
||||
</trim>
|
||||
</insert>
|
||||
|
||||
<select id="getTaskList" resultType="map">
|
||||
select
|
||||
xrt.requirement_task_id as requirementTaskId,
|
||||
xrt.task_name as taskName,
|
||||
xrt.task_code as taskCode,
|
||||
xrt.demand_date as demandDate,
|
||||
GROUP_CONCAT(s.name) as stationName,
|
||||
xrt.status as status,
|
||||
xrt.operator_id as operatorID,
|
||||
xrt.equipment_owner_id as equipmentOwnerID,
|
||||
xrt.ele_no as eleNo,
|
||||
xrt.delivery_time as deliveryTime,
|
||||
xrt.create_time as createTime
|
||||
from xhpc_requirement_task as xrt
|
||||
left join xhpc_charging_station as s on FIND_IN_SET(CAST(s.charging_station_id AS CHAR), xrt.station_id) > 0
|
||||
where xrt.del_flag =0
|
||||
<if test="params.taskName !=null and params.taskName !=''">
|
||||
and xrt.ask_name like CONCAT('%',#{params.taskName},'%')
|
||||
</if>
|
||||
<if test="params.taskCode !=null and params.taskCode !=''">
|
||||
and xrt.task_code like CONCAT('%',#{params.taskCode},'%')
|
||||
</if>
|
||||
<if test="params.demandDate !=null and params.demandDate !=''">
|
||||
and xrt.demand_date like CONCAT('%',#{params.demandDate},'%')
|
||||
</if>
|
||||
<if test="params.stationId !=null and params.stationId !=''">
|
||||
and FIND_IN_SET(CAST(#{params.stationId} AS CHAR), xrt.station_id) > 0
|
||||
</if>
|
||||
<if test="params.operatorID !=null and params.operatorID !=''">
|
||||
and xrt.demand_date =#{params.operatorID}
|
||||
</if>
|
||||
<if test="params.equipmentOwnerID !=null and params.equipmentOwnerID !=''">
|
||||
and xrt.delivery_time =#{params.equipmentOwnerID}
|
||||
</if>
|
||||
<if test="params.eleNo !=null and params.eleNo !=''">
|
||||
and xrt.ele_no like CONCAT('%',#{params.eleNo},'%')
|
||||
</if>
|
||||
order by xrt.create_time desc
|
||||
</select>
|
||||
|
||||
<update id="updateBarrierGate">
|
||||
update xhpc_barrier_gate
|
||||
<trim prefix="SET" suffixOverrides=",">
|
||||
<if test="null != barrierGateCompany and ''!=barrierGateCompany">
|
||||
barrier_gate_company=#{barrierGateCompany},
|
||||
</if>
|
||||
<if test="null != startTime">
|
||||
start_time=#{startTime},
|
||||
</if>
|
||||
<if test="null != endTime ">
|
||||
end_time=#{endTime},
|
||||
</if>
|
||||
<if test="null != status">
|
||||
status=#{status},
|
||||
</if>
|
||||
<if test="null != delFlag ">
|
||||
del_flag = #{delFlag},
|
||||
</if>
|
||||
<if test="null != createTime ">
|
||||
create_time = #{createTime},
|
||||
</if>
|
||||
<if test="null != createBy and '' != createBy">
|
||||
create_by = #{createBy},
|
||||
</if>
|
||||
<if test="null != updateTime ">
|
||||
update_time = #{updateTime},
|
||||
</if>
|
||||
<if test="null != updateBy and '' != updateBy">
|
||||
update_by =#{updateBy},
|
||||
</if>
|
||||
<if test="null != remark and '' != remark">
|
||||
remark =#{remark},
|
||||
</if>
|
||||
<if test="null != tenantId ">
|
||||
tenant_id =#{tenantId},
|
||||
</if>
|
||||
<if test="null != tenantId ">
|
||||
tenant_id =#{tenantId},
|
||||
</if>
|
||||
<if test="null != chargingStationNumber and ''!=chargingStationNumber ">
|
||||
charging_station_number =#{chargingStationNumber},
|
||||
</if>
|
||||
<if test="null != url and ''!=url ">
|
||||
url=#{url},
|
||||
</if>
|
||||
</trim>
|
||||
where barrier_gate_id = #{barrierGateId}
|
||||
</update>
|
||||
|
||||
<update id="deleteBarrierGateById">
|
||||
update xhpc_barrier_gate set del_flag =1 where barrier_gate_id = #{barrierGateId}
|
||||
</update>
|
||||
|
||||
<select id="getXhpcBarrierGateById" resultType="map">
|
||||
select
|
||||
barrier_gate_id as barrierGateId,
|
||||
barrier_gate_company as barrierGateCompany,
|
||||
charging_station_number as chargingStationNumber,
|
||||
url as url,
|
||||
start_time as startTime,
|
||||
end_time as endTime
|
||||
from xhpc_barrier_gate
|
||||
where barrier_gate_id = #{barrierGateId}
|
||||
</select>
|
||||
|
||||
<select id="getBarrierGateEndTime" resultType="Long">
|
||||
select barrier_gate_id as barrierGateId from xhpc_barrier_gate where end_time < #{date}
|
||||
</select>
|
||||
|
||||
|
||||
<update id="updateBarrierGateStatus">
|
||||
update xhpc_barrier_gate set status =1 where barrier_gate_id = #{barrierGateId}
|
||||
</update>
|
||||
</mapper>
|
||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user