成都市平台接口

This commit is contained in:
yuyang 2023-09-15 15:09:04 +08:00
parent 888284e7b1
commit 4a5f38b6ae
48 changed files with 2261 additions and 194 deletions

View File

@ -0,0 +1,57 @@
package com.xhpc.evcs.cdjgpc.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.Data;
/**
* @author yuyang
* @date 2023-09-07 15:41
*/
@JsonPropertyOrder({
"DetailStartTime",
"DetailEndTime",
"ElecPrice",
"SevicePrice",
"DetailPower",
"DetailElecMoney",
"DetailSeviceMoney"
})
@Data
public class CDChargeDetails {
/**
* 开始时间
*/
@JsonProperty("DetailStartTime")
public String detailStartTime;
/**
* 结束时间
*/
@JsonProperty("DetailEndTime")
public String detailEndTime;
/**
* 时段电价
*/
@JsonProperty("ElecPrice")
public Double elecPrice;
/**
* 时段服务 费价格
*/
@JsonProperty("SevicePrice")
public Double sevicePrice;
/**
* 时段充电量
*/
@JsonProperty("DetailPower")
public Double detailPower;
/**
* 时段电费
*/
@JsonProperty("DetailElecMoney")
public Double detailElecMoney;
/**
* 时段服务
*/
@JsonProperty("DetailSeviceMoney")
public Double detailSeviceMoney;
}

View File

@ -0,0 +1,133 @@
package com.xhpc.evcs.cdjgpc.dto;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.Data;
/**
* @author yuyang
* @date 2023-09-07 15:16
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"StartChargeSeq",
"ConnectorID",
"ConnectorStatus",
"Vin",
"CurrentA",
"CurrentB",
"CurrentC",
"VoltageA",
"VoltageB",
"VoltageC",
"Soc",
"StartTime",
"EndTime",
"PushTime",
"LastPushTime",
"TotalPower",
"ElecMoney",
"SeviceMoney",
"TotalMoney"
})
@Data
public class CDConnectorChargeStatusInfo {
/**
* 充电订单号
*/
@JsonProperty("StartChargeSeq")
public String startChargeSeq;
/**
* 充电设备接 口编码
*/
@JsonProperty("ConnectorID")
public String connectorID;
/**
* 充电设备接 口状态
*/
@JsonProperty("ConnectorStatus")
public Integer connectorStatus;
/**
* 车辆识别码
*/
@JsonProperty("Vin")
public String vin;
/**
* A 相电流
*/
@JsonProperty("CurrentA")
public Double currentA;
/**
* B 相电流
*/
@JsonProperty("CurrentB")
public Double currentB;
/**
* C 相电流
*/
@JsonProperty("CurrentC")
public Double currentC;
/**
* A 相电压
*/
@JsonProperty("VoltageA")
public Double voltageA;
/**
* B 相电压
*/
@JsonProperty("VoltageB")
public Double voltageB;
/**
* C 相电压
*/
@JsonProperty("VoltageC")
public Double voltageC;
/**
* 电池剩余电量
*/
@JsonProperty("Soc")
public Double soc;
/**
* 开始充电时间
*/
@JsonProperty("StartTime")
public String startTime;
/**
* 本次采样时间
*/
@JsonProperty("EndTime")
public String endTime;
/**
* 本次推送时间
*/
@JsonProperty("PushTime")
public String pushTime;
/**
* 上次推送时
*/
@JsonProperty("LastPushTime")
public String lastPushTime;
/**
* 累计充电量
*/
@JsonProperty("TotalPower")
public Double totalPower;
/**
* 累计电费
*/
@JsonProperty("ElecMoney")
public Double elecMoney;
/**
* 累计服务费
*/
@JsonProperty("SeviceMoney")
public Double seviceMoney;
/**
* 累计总金额
*/
@JsonProperty("TotalMoney")
public Double totalMoney;
}

View File

@ -0,0 +1,130 @@
package com.xhpc.evcs.cdjgpc.dto;
import com.fasterxml.jackson.annotation.*;
import com.xhpc.evcs.dto.ConnectorInfo;
import com.xhpc.evcs.dto.EquipmentInfo;
import lombok.Data;
import org.springframework.format.annotation.DateTimeFormat;
import javax.persistence.Transient;
import java.util.List;
/**
* @author yuyang
* @date 2023-09-07 14:40
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"EquipmentID",
"ManufacturerID",
"ManufacturerName",
"EquipmentModel",
"EquipmentProductCode",
"TransformerID",
"ProductionDate",
"ConstructionTime",
"EquipmentType",
"EquipmentStatus",
"EquipmentPurpose",
"EquipmentPower",
"NewNationalStandard",
"ConnectorInfos",
"VinFlag"
})
@Data
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
public class CDEquipmentInfo {
/**
* 设备编码
*/
@JsonProperty("EquipmentID")
public String equipmentID;
/**
* 设备生产商组织机构代码
*/
@JsonProperty("ManufacturerID")
public String manufacturerID;
/**
* 设备生产商名称
*/
@JsonProperty("ManufacturerName")
public String manufacturerName;
/**
* 设备型号
*/
@Transient
@JsonProperty("EquipmentModel")
public String equipmentModel;
/**
* 设备出厂编码
*/
@JsonProperty("EquipmentProductCode")
public String equipmentProductCode;
/**
* 变压器户号
*/
@JsonProperty("TransformerID")
public String transformerID;
/**
* 设备名称
*/
// @JsonProperty("EquipmentName")
// public String equipmentName;
/**
* 设备生产日期
*/
@JsonProperty("ProductionDate")
public String productionDate;
/**
* 建设时间
*/
@JsonProperty("ConstructionTime")
public String constructionTime;
/**
* 设备类型
*/
@JsonProperty("EquipmentType")
public Integer equipmentType;
/**
* 设备状态
*/
@JsonProperty("EquipmentStatus")
public Integer equipmentStatus;
/**
* 设备用途
*/
@JsonProperty("EquipmentPurpose")
public Integer equipmentPurpose;
/**
* 额定功率
*/
@JsonProperty("EquipmentPower")
public Double equipmentPower;
/**
* 新国标
*/
@JsonProperty("NewNationalStandard")
public Integer newNationalStandard;
/**
* 充电设备 接口列表
*/
@JsonProperty("ConnectorInfos")
public List<ConnectorInfo> connectorInfos;
/**
* 经度
*/
// @JsonProperty("EquipmentLng")
// public Double equipmentLng;
/**
* 充电设备 纬度
*/
// @JsonProperty("EquipmentLat")
// public Double equipmentLat;
/**
* 是否支持 VIN 码识别
*/
@JsonProperty("VinFlag")
public Integer vinFlag;
}

View File

@ -0,0 +1,174 @@
package com.xhpc.evcs.cdjgpc.dto;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.xhpc.evcs.dto.ConnectorInfo;
import lombok.Data;
import java.util.List;
/**
* @author yuyang
* @date 2023-09-07 15:31
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"OperatorID",
"EquipmentOwnerID",
"StationID",
"EquipmentID",
"ConnectorID",
"StartChargeSeq",
"UserChargeType",
"MobileNumber",
"Money",
"ElectMoney",
"ServiceMoney",
"Elect",
"StartTime",
"EndTime",
"PaymentAmount",
"PayTime",
"PayChannel",
"DiscountInfo",
"StopReason",
"SumPeriod",
"Power",
"ChargeLast",
"MeterValueStart",
"MeterValueEnd",
"ChargeDetails"
})
@Data
public class CDOrderInfo {
/**
* 运营平台 ID
*/
@JsonProperty("OperatorID")
public String operatorID;
/**
* 设备产权所 属单位 ID
*/
@JsonProperty("EquipmentOwnerID")
public String equipmentOwnerID;
/**
* 充电站 ID
*/
@JsonProperty("StationID")
public String stationID;
/**
* 设备编码
*/
@JsonProperty("EquipmentID")
public String equipmentID;
/**
* 充电设备接 口编码
*/
@JsonProperty("ConnectorID")
public String connectorID;
/**
* 充电订单号
*/
@JsonProperty("StartChargeSeq")
public String startChargeSeq;
/**
* 用户发起充 电类型
*/
@JsonProperty("UserChargeType")
public String userChargeType;
/**
* 用户手机号
*/
@JsonProperty("MobileNumber")
public String mobileNumber;
/**
* 本次充电消费总金额
*/
@JsonProperty("Money")
public Double money;
/**
* 本本次充电电费总金额
*/
@JsonProperty("ElectMoney")
public Double electMoney;
/**
* 本次充电 服务费金额
*/
@JsonProperty("ServiceMoney")
public Double serviceMoney;
/**
* 本次充电电量
*/
@JsonProperty("Elect")
public Double elect;
/**
* 本次充电开始时间
*/
@JsonProperty("StartTime")
public String startTime;
/**
* 本次充电结束时间
*/
@JsonProperty("EndTime")
public String endTime;
/**
* 支付金额
*/
@JsonProperty("PaymentAmount")
public Double paymentAmount;
/**
* 支付时
*/
@JsonProperty("PayTime")
public String payTime;
/**
* 支付方式
*/
@JsonProperty("PayChannel")
public Integer payChannel;
/**
* 优惠信息描述
*/
@JsonProperty("DiscountInfo")
public String discountInfo;
/**
* 充电结束
* 原因
*/
@JsonProperty("StopReason")
public Integer stopReason;
/**
* 时段数 N
*/
@JsonProperty("SumPeriod")
public Integer sumPeriod;
/**
* 接口额定功
*/
@JsonProperty("Power")
public Double power;
/**
* 充电时长
*/
@JsonProperty("ChargeLast")
public Integer chargeLast;
/**
* 电表总起值
*/
@JsonProperty("MeterValueStart")
public Double meterValueStart;
/**
* 电表总止值
*/
@JsonProperty("MeterValueEnd")
public Double meterValueEnd;
/**
* 充电明细信息
*/
@JsonProperty("ChargeDetails")
public List<CDChargeDetails> chargeDetails;
}

View File

@ -0,0 +1,309 @@
package com.xhpc.evcs.cdjgpc.dto;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import com.xhpc.evcs.dto.CommonStationInfo;
import lombok.Data;
import javax.persistence.Transient;
import java.util.Arrays;
import java.util.List;
/**
* @author yuyang
* @date 2023-09-07 14:13
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"StationID",
"OperatorID",
"EquipmentOwnerID",
"StationName",
"IsAloneApply",
"AccountNumber",
"Capacity",
"CountryCode",
"AreaCode",
"Address",
"StationTel",
"ServiceTel",
"StationType",
"IsOpen",
"StationStatus",
"ParkNums",
"StationLng",
"StationLat",
"Construction",
"OpenAllDay",
"ServiceFee",
"ParkFree",
"ParkFee",
"Payment",
"EquipmentInfos",
"ParkFeeType",
"ToiletFlag",
"StoreFlag",
"LoungeFlag",
"CanopyFlag",
"PrinterFlag",
"BarrierFlag",
"ParkingLockFlag",
"IsDemandResponse",
"IsSupportOrderlyCharging",
"ISEnergystorage"
})
@Data
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
public class CDStationInfo extends CommonStationInfo {
/**
* 是否独立报桩
*/
@Transient
@JsonProperty("IsAloneApply")
public Integer isAloneApply;
/**
* 户号
*/
@Transient
@JsonProperty("AccountNumber")
public String accountNumber;
/**
* 容量
*/
@Transient
@JsonProperty("Capacity")
public Double capacity;
/**
* 充电站省市辖区编码
*/
@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("IsOpen")
public Integer isOpen;
/**
* 站点状态
*/
@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("ParkOwner")
// public String parkOwner;
/**
* 停车场管理方
*/
// @Transient
// @JsonProperty("ParkManager")
// public String parkManager;
/**
* 全天开放
*/
@Transient
@JsonProperty("OpenAllDay")
public Integer openAllDay;
/**
* 营业时间
*/
// @Transient
// @JsonProperty("BusineHours")
// public String busineHours;
/**
*
*/
// @Transient
// @JsonProperty("ElectricityFee")
// public String electricityFee;
/**
* 服务费率
*/
@Transient
@JsonProperty("ServiceFee")
public String serviceFee;
/**
* 免费停车
*/
@Transient
@JsonProperty("ParkFree")
public Integer parkFree;
/**
* 停车费
*/
@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<CDEquipmentInfo> equipmentInfos = null;
/**
* 停车收费类型
*/
@Transient
@JsonProperty("ParkFeeType")
public Integer parkFeeType;
/**
* 是否配备卫生间
*/
@Transient
@JsonProperty("ToiletFlag")
public Integer toiletFlag;
/**
* 是否配备便利店
*/
@Transient
@JsonProperty("StoreFlag")
public Integer storeFlag;
/**
* 是否配备休息室
*/
@Transient
@JsonProperty("LoungeFlag")
public Integer loungeFlag;
/**
* 是否配备雨棚
*/
@Transient
@JsonProperty("CanopyFlag")
public Integer canopyFlag;
/**
* 是否有小票机
*/
@Transient
@JsonProperty("PrinterFlag")
public Integer printerFlag;
/**
* 是否有道闸
*/
@Transient
@JsonProperty("BarrierFlag")
public Integer barrierFlag;
/**
* 是否有地锁
*/
@Transient
@JsonProperty("ParkingLockFlag")
public Integer parkingLockFlag;
/**
* 是否参与需求响应
*/
@Transient
@JsonProperty("IsDemandResponse")
public Integer isDemandResponse;
/**
* 有序充电场站
*/
@Transient
@JsonProperty("IsSupportOrderlyCharging")
public Integer isSupportOrderlyCharging;
/**
* 有是否有储能设备
*/
@Transient
@JsonProperty("ISEnergystorage")
public Integer iSEnergystorage;
}

View File

@ -0,0 +1,19 @@
package com.xhpc.evcs.cdjgpc.dto;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.Data;
/**
* @author yuyang
* @date 2023-09-15 11:30
*/
@JsonPropertyOrder({
"Status"
})
@Data
public class CDStationInfoResponse {
@JsonProperty("Status")
private Integer status;
}

View File

@ -0,0 +1,42 @@
package com.xhpc.evcs.cdjgpc.dto;
import com.fasterxml.jackson.annotation.JsonAutoDetect;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonPropertyOrder;
import lombok.Data;
import javax.persistence.Entity;
import javax.persistence.Id;
/**
* 产权单位信息
* @author yuyang
* @date 2023-09-07 10:57
*/
@JsonInclude(JsonInclude.Include.NON_NULL)
@JsonPropertyOrder({
"EquipmentOwnerID",
"FullName",
"ShortName",
"OperatorID",
"Remark"
})
@Data
@Entity(name = "ET_EQUIPMENT_OWNER_INFO")
@JsonAutoDetect(fieldVisibility = JsonAutoDetect.Visibility.ANY, getterVisibility = JsonAutoDetect.Visibility.NONE,
setterVisibility = JsonAutoDetect.Visibility.NONE, creatorVisibility = JsonAutoDetect.Visibility.NONE)
public class EquipmentOwnerInfo {
@Id
@JsonProperty("EquipmentOwnerID")
private String equipmentOwnerId;
@JsonProperty("FullName")
String fullName;
@JsonProperty("ShortName")
String shortName;
@JsonProperty("OperatorID")
String operatorID;
@JsonProperty("Remark")
String remark;
}

View File

@ -94,6 +94,44 @@ public class XhpcChargingPile extends BaseEntity {
@Column(name = "current")
private Integer current;
@Column(name = "search_value")
private String searchValue;
/**
* 设备出厂编码
*/
@Column(name = "equipment_product_code")
private String equipmentProductCode;
/**
* 设备出厂编码
*/
@Column(name = "transformer_id")
private String transformerID;
/**
* 新国标
*/
@Column(name = "new_national_standard")
private Integer newNationalStandard;
/**
* 是否支持 VIN 码识别
*/
@Column(name = "vin_flag")
private Integer vinFlag;
/**
* 设备状态
*/
@Column(name = "equipment_status")
private Integer equipmentStatus;
/**
* 设备用途
*/
@Column(name = "equipment_purpose")
private Integer equipmentPurpose;
@Column(name = "manufacturer_id")
private String manufacturerId;
private String constructionTime;
public Integer getEquipmentType() {
return equipmentType;
@ -374,4 +412,120 @@ public class XhpcChargingPile extends BaseEntity {
this.id = id;
}
public String getEquipmentProductCode() {
return equipmentProductCode;
}
public void setEquipmentProductCode(String equipmentProductCode) {
this.equipmentProductCode = equipmentProductCode;
}
public String getTransformerID() {
return transformerID;
}
public void setTransformerID(String transformerID) {
this.transformerID = transformerID;
}
public Integer getNewNationalStandard() {
return newNationalStandard;
}
public void setNewNationalStandard(Integer newNationalStandard) {
this.newNationalStandard = newNationalStandard;
}
public Integer getVinFlag() {
return vinFlag;
}
public void setVinFlag(Integer vinFlag) {
this.vinFlag = vinFlag;
}
public Integer getEquipmentStatus() {
return equipmentStatus;
}
public void setEquipmentStatus(Integer equipmentStatus) {
this.equipmentStatus = equipmentStatus;
}
public Integer getEquipmentPurpose() {
return equipmentPurpose;
}
public void setEquipmentPurpose(Integer equipmentPurpose) {
this.equipmentPurpose = equipmentPurpose;
}
public String getManufacturerId() {
return manufacturerId;
}
public void setManufacturerId(String manufacturerId) {
this.manufacturerId = manufacturerId;
}
@Override
public String getSearchValue() {
return searchValue;
}
@Override
public void setSearchValue(String searchValue) {
this.searchValue = searchValue;
}
public String getConstructionTime() {
return constructionTime;
}
public void setConstructionTime(String constructionTime) {
this.constructionTime = constructionTime;
}
@Override
public String toString() {
return "XhpcChargingPile{" +
"id=" + id +
", chargingStationId=" + chargingStationId +
", name='" + name + '\'' +
", nationalStandard='" + nationalStandard + '\'' +
", power=" + power +
", auxiliaryPowerSupply=" + auxiliaryPowerSupply +
", inputVoltage=" + inputVoltage +
", maxVoltage=" + maxVoltage +
", minVoltage=" + minVoltage +
", maxElectricCurrent=" + maxElectricCurrent +
", minElectricCurrent=" + minElectricCurrent +
", serialNumber='" + serialNumber + '\'' +
", type=" + type +
", programVersion='" + programVersion + '\'' +
", networkLinkType='" + networkLinkType + '\'' +
", gunNumber=" + gunNumber +
", communicationProtocolVersion='" + communicationProtocolVersion + '\'' +
", communicationOperator='" + communicationOperator + '\'' +
", simCard='" + simCard + '\'' +
", status=" + status +
", delFlag=" + delFlag +
", rateModelId=" + rateModelId +
", brandModel='" + brandModel + '\'' +
", productionDate='" + productionDate + '\'' +
", manufactureName='" + manufactureName + '\'' +
", connectorType=" + connectorType +
", equipmentType=" + equipmentType +
", current=" + current +
", searchValue='" + searchValue + '\'' +
", equipmentProductCode='" + equipmentProductCode + '\'' +
", transformerID='" + transformerID + '\'' +
", newNationalStandard=" + newNationalStandard +
", vinFlag=" + vinFlag +
", equipmentStatus=" + equipmentStatus +
", equipmentPurpose=" + equipmentPurpose +
", manufacturerId='" + manufacturerId + '\'' +
", constructionTime='" + constructionTime + '\'' +
'}';
}
}

View File

@ -0,0 +1,100 @@
package com.xhpc.evcs.cdjgpc.api;
import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.redis.service.RedisService;
import com.xhpc.evcs.cdjgpc.dto.CDEquipmentInfo;
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
import com.xhpc.evcs.cdjgpc.dto.CDStationInfoResponse;
import com.xhpc.evcs.domain.AuthSecretToken;
import com.xhpc.evcs.dto.*;
import com.xhpc.evcs.jpa.AuthSecretTokenRepository;
import com.xhpc.evcs.notification.CoreDispatcher;
import com.xhpc.evcs.utils.JSONUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
import javax.annotation.Resource;
import java.util.*;
import static com.xhpc.evcs.domain.AuthSecretToken.SECRET_TOKEN_TYPE_OUT;
/**
* @author yuyang
* @date 2023-09-07 16:12
*/
@Slf4j
@RestController
public class CDNotificationStationInfoController extends CoreDispatcher {
@Resource
private AuthSecretTokenRepository authSecretTokenRepository;
//充电站信息变化推送
@PostMapping("/v10/getNotificationStationInfo")
public R getNotificationStationInfo(@RequestBody Map<String, Object> map){
try{
String chargingStationId = map.get("chargingStationId").toString();
AuthSecretToken authSecretTokenOut =
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(
"765367656", "MA6DFCTD5", SECRET_TOKEN_TYPE_OUT).orElse(null); //todo
// maybe对接第三方
if (authSecretTokenOut != null) {
//获取场站信息
String key = "cdjgpc:station:".concat(chargingStationId)+".notification";
CDStationInfo cdStationInfo =REDIS.getCacheObject(key);
CommonRequest<CDStationInfo> commonRequest = new CommonRequest<>();
Map<String,Object> mapStationInfo =new HashMap<>();
mapStationInfo.put("StationInfo",cdStationInfo);
String data =JSONUtil.toJSONString(mapStationInfo);
commonRequest.setData(data);
String result =ok(commonRequest,"/notification_stationInfo",authSecretTokenOut,"MA6DFCTD5");
System.out.println("=======responseBody========"+result);
CDStationInfoResponse cdStationInfoResponse = DTOJsonHelper.parseResponseData(result, CDStationInfoResponse.class, authSecretTokenOut);
System.out.println("=======cdStationInfoResponse========"+cdStationInfoResponse.getStatus());
}
}catch (Exception e){
e.printStackTrace();
}
return R.ok();
}
@PostMapping("/v10/getNotificationStationStatus")
public R getNotificationStationStatus(@RequestBody Map<String, Object> map){
try {
AuthSecretToken authSecretTokenOut = authSecretTokenRepository.findByOperatorId3irdptyAndSecretTokenType("765367656", SECRET_TOKEN_TYPE_OUT).orElse(null);
log.debug("nss pushing to: {}", authSecretTokenOut.getOperatorId3irdpty());
if (authSecretTokenOut != null) {
ConnectorStatusInfoReq connectorStatusInfoReq = new ConnectorStatusInfoReq();
ConnectorStatusInfo connectorStatusInfo = new ConnectorStatusInfo();
connectorStatusInfo.setConnectorID(map.get("connectorID").toString());
connectorStatusInfo.setStatus(ConnectorStatusInfo.FREE);
connectorStatusInfoReq.setConnectorStatusInfo(connectorStatusInfo);
String data = JSONUtil.toJSONString(connectorStatusInfoReq);
log.info("===============data=================="+data);
CommonRequest<ConnectorStatusInfoReq> commonRequest = new CommonRequest<>();
commonRequest.setData(data);
String ok = ok(commonRequest, "/notification_stationStatus", authSecretTokenOut);
log.info("===============3333=================="+ok);
}
}catch (Exception e){
log.info("===============eeee==================");
e.printStackTrace();
}
return R.ok();
}
}

View File

@ -47,7 +47,8 @@ import java.util.Scanner;
@Slf4j
//@Component //spring boot way, see https://www.surasint.com/spring-boot-webfilter-instead-of-component/
//@Order(1) not supported, see https://github.com/spring-projects/spring-boot/issues/8276
@WebFilter(urlPatterns = {"/v1/*", "/v2/*"}, filterName = "v1n2filter") //multiple filters execute by filterName order
//成都市监管平台v10 恒大v20 新电途 v30 快电 v40 小桔v50
@WebFilter(urlPatterns = {"/v1/*", "/v2/*", "/v10/*"}, filterName = "v1n2filter") //multiple filters execute by filterName order
public class EvcsFilter extends OncePerRequestFilter {
@Resource

View File

@ -11,7 +11,7 @@ public class InterceptorConfig implements WebMvcConfigurer {
@Override
public void addInterceptors(InterceptorRegistry registry) {
registry.addInterceptor(getEvcsInterceptor()).addPathPatterns("/v1/**");
registry.addInterceptor(getEvcsInterceptor()).addPathPatterns("/v1/**").addPathPatterns("/v10/**");
}
@Bean

View File

@ -44,7 +44,7 @@ public class NotificationChargeOrderInfo4BonusTask extends CoreDispatcher {
* 推送充电订单信息运营奖补
* @throws IOException
*/
@Scheduled(fixedDelay = 1000 * 60)
//@Scheduled(fixedDelay = 1000 * 60)
public void run() throws IOException {
AuthSecretToken authSecretTokenOut =
authSecretTokenRepository.findByOperatorId3irdptyAndOperatorIdAndSecretTokenType(

45
sql/v2.2.sql Normal file
View File

@ -0,0 +1,45 @@
ALTER TABLE `xhpc_charging_station`
ADD COLUMN `equipment_owner_id` `equipment_owner_id` VARCHAR(10) NULL DEFAULT NULL COMMENT '产权所属单位ID' COLLATE 'utf8mb4_general_ci' AFTER `running_total_power`,
ADD COLUMN `is_alone_apply` INT NULL COMMENT '是否独立报桩' AFTER `equipment_owner_id`,
ADD COLUMN `account_number` VARCHAR(20) NULL COMMENT '户号(国网电费账单 户号)' AFTER `is_alone_apply`,
ADD COLUMN `capacity` `capacity` DOUBLE(10,4) NULL DEFAULT NULL COMMENT '容量(独立电表 申请的功 率)' AFTER `account_number`,
ADD COLUMN `country_code` VARCHAR(4) NULL DEFAULT NULL COMMENT '充电站国家代码' AFTER `capacity`,
ADD COLUMN `is_open` INT(4) NULL DEFAULT NULL COMMENT '小区是否对外开放0 否 1是' AFTER `country_area_code`;
ADD COLUMN `is_open` `is_open` INT(4) NULL DEFAULT '0' COMMENT '小区是否对外开放0 否 1是' AFTER `country_area_code`,
ADD COLUMN `park_fee_type` INT(10) NULL DEFAULT '3' COMMENT '停车收费类型0停车收费 1停车免费 2限时免费 3充电限免' AFTER `is_open`,
ADD COLUMN `toilet_flag` INT(10) NULL DEFAULT '1' COMMENT '是否配备卫生间0无 1有' AFTER `park_fee_type`,
ADD COLUMN `store_flag` INT(10) NULL DEFAULT '0' COMMENT '是否配备便利店0无 1有' AFTER `toilet_flag`,
ADD COLUMN `lounge_flag` INT(10) NULL DEFAULT '0' COMMENT '是否配备休息室0无 1有' AFTER `store_flag`,
ADD COLUMN `canopy_flag` INT(10) NULL DEFAULT '0' COMMENT '是否配备雨棚0无 1有' AFTER `lounge_flag`,
ADD COLUMN `printer_flag` INT(10) NULL DEFAULT '0' COMMENT '是否有小票机0无 1有' AFTER `canopy_flag`,
ADD COLUMN `barrier_flag` INT(10) NULL DEFAULT '1' COMMENT '是否有道闸0无 1有' AFTER `printer_flag`,
ADD COLUMN `parking_lock_flag` INT(10) NULL DEFAULT '0' COMMENT '是否有地锁0无 1有' AFTER `barrier_flag`,
ADD COLUMN `is_demand_response` INT(10) NULL DEFAULT '0' COMMENT '是否参与需求响应0否 1是' AFTER `parking_lock_flag`,
ADD COLUMN `is_support_orderly_charging` INT(10) NULL DEFAULT '0' COMMENT '有序充电场站0否 1是' AFTER `is_demand_response`,
ADD COLUMN `is_energystorage` INT(10) NULL DEFAULT '0' COMMENT '是否有存能设备0否 1是' AFTER `is_support_orderly_charging`,
ADD COLUMN `construction_time` VARCHAR(50) NULL DEFAULT NULL COMMENT '建设时间' AFTER `is_energystorage`,
ADD COLUMN `station_status` INT(4) NULL DEFAULT NULL COMMENT '场站建设状态' AFTER `construction_time`,
ADD COLUMN `open_all_day` INT(4) NULL DEFAULT NULL COMMENT '是否全天开放0 否 1是为零时营业时间必填' AFTER `station_status`,
ADD COLUMN `busine_hours` VARCHAR(100) NULL DEFAULT NULL COMMENT '推荐格 式:周一 至周日 00:00-24:00' AFTER `open_all_day`,
ADD COLUMN `service_fee` VARCHAR(100) NULL DEFAULT NULL COMMENT '服务费率' AFTER `busine_hours`,
ADD COLUMN `park_free` INT(4) NULL DEFAULT NULL COMMENT '是否免费停车0 否 1是' AFTER `service_fee`,
ADD COLUMN `park_fee` VARCHAR(100) NULL DEFAULT NULL COMMENT '停车费描述' AFTER `park_free`,
ADD COLUMN `payment` VARCHAR(100) NULL DEFAULT NULL COMMENT '支付方式:刷卡、线上、现金 电子钱包:微信/支付宝 ' AFTER `park_fee`;
ALTER TABLE `xhpc_charging_pile`
ADD COLUMN `equipment_product_code` VARCHAR(30) NULL DEFAULT NULL COMMENT '设备出厂编码(由设备生厂商定义的设备出厂唯一编码)' AFTER `tenant_id`,
ADD COLUMN `transformer_id` VARCHAR(30) NULL DEFAULT NULL COMMENT '变压器户号' AFTER `equipment_product_code`,
ADD COLUMN `new_national_standard` INT(4) NULL DEFAULT NULL COMMENT '是否新国标0否 1是' AFTER `construction_time`,
ADD COLUMN `vin_flag` INT(4) NULL DEFAULT NULL COMMENT '是否支持VIN码识别0否 1是' AFTER `new_national_standard`,
ADD COLUMN `equipment_status` INT(4) NULL DEFAULT NULL COMMENT '设备状态0未知 1建设中 5关闭下线 6维护中 50正常使用' AFTER `vin_flag`,
ADD COLUMN `equipment_purpose` INT(4) NULL DEFAULT NULL COMMENT '设备用户1公共 50个人 100公交专用' AFTER `equipment_status`,
ADD COLUMN `manufacturer_id` VARCHAR(50) NULL DEFAULT NULL COMMENT '设备生产商组织机构代码' AFTER `equipment_purpose`;
UPDATE `rycloud`.`xhpc_area` SET `code`='510156' WHERE `code`=510186;
INSERT INTO `rycloud`.`xhpc_area` (`code`, `pcode`, `name`, `short_name`, `merger_name`, `province`, `city`, `level`, `lng`, `lat`, `letter`, `pinyin`, `first_char`, `status`, `create_user`, `create_dept`, `create_time`, `update_user`, `update_time`, `is_deleted`, `tenant_id`)
VALUES ('510102', '510100', '高新区', '高新区', '四川省/成都市/高新区', '四川省', '成都市', '3', '104.08347', '30.65614', 'JXQ', 'gaoxingqu', 'C', '0', NULL, NULL, '2019-12-19 11:44:50', NULL, '2019-12-19 11:44:50', '0', '000000');

View File

@ -221,4 +221,13 @@ public class XhpcChargingPileController extends BaseController {
return AjaxResult.success(configRateReply);
}
@GetMapping("/getChargingPileSerialNumber")
public R getChargingPileSerialNumber(String serialNumber){
return xhpcChargingPileService.getChargingPileSerialNumber(serialNumber);
}
}

View File

@ -2,6 +2,7 @@ package com.xhpc.charging.station.controller;
import com.xhpc.charging.station.service.IXhpcChargingStationService;
import com.xhpc.common.api.dto.XhpcChargingStationDto;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.core.web.page.TableDataInfo;
@ -220,4 +221,12 @@ public class XhpcChargingStationController extends BaseController {
return xhpcChargingStationService.updateXhpcRateTime(request, xhpcChargingStationDto);
}
/**
* 获取场站信息
*/
@GetMapping("/getChargingStationServiceById")
public R getChargingStationServiceById(Long stationId){
return xhpcChargingStationService.getChargingStationServiceById(stationId);
}
}

View File

@ -1,5 +1,6 @@
package com.xhpc.charging.station.service;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcChargingPile;
@ -86,4 +87,6 @@ public interface IXhpcChargingPileService {
*/
AjaxResult generateQrCode(Long chargingStationId, Long pileId);
R getChargingPileSerialNumber(String serialNumber);
}

View File

@ -1,6 +1,7 @@
package com.xhpc.charging.station.service;
import com.xhpc.common.api.dto.XhpcChargingStationDto;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcChargingStation;
import com.xhpc.common.domain.XhpcRate;
@ -253,5 +254,6 @@ public interface IXhpcChargingStationService {
Map<String,Object> activityDiscountTime(Long userId, Date startTime, Integer source, Long chargingStationId, String tenantId);
R getChargingStationServiceById(Long stationId);
}

View File

@ -286,6 +286,17 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error("添加桩入缓存失败,请稍后在试");
}
}else{
Long chargingStationId = xhpcChargingPile.getChargingStationId();
String serialNumber = xhpcChargingPile.getSerialNumber();
HashSet<String> noSet = new HashSet<>();
noSet.add(serialNumber);
R r = powerPileService.addPileWhitelist(chargingStationId, xhpcChargingPile.getCommunicationProtocolVersion(), noSet);
if (r.getCode() != 200) {
//数据回滚-手动回滚
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return AjaxResult.error("添加桩入缓存失败,请稍后在试");
}
}
xhpcChargingPileMapper.updaeXhpcChargingPile(xhpcChargingPile);
@ -555,4 +566,11 @@ public class XhpcChargingPileServiceImpl extends BaseService implements IXhpcCha
}
return AjaxResult.success();
}
@Override
public R getChargingPileSerialNumber(String serialNumber) {
XhpcChargingPile xhpc = xhpcChargingPileMapper.getXhpcChargingPileBySerialNumber(serialNumber);
return R.ok(xhpc);
}
}

View File

@ -1568,6 +1568,11 @@ public class XhpcChargingStationServiceImpl extends BaseService implements IXhpc
return map;
}
@Override
public R getChargingStationServiceById(Long stationId) {
Map<String, Object> map = xhpcChargingStationMapper.getXhpcChargingStationMessage(stationId);
return R.ok(map,"获取场站基本信息成功");
}
}

View File

@ -34,6 +34,13 @@
<result property="remark" column="remark"/>
<result property="brandModel" column="brand_model"/>
<result property="chargingStationName" column="charging_station_name"/>
<result property="equipmentProductCode" column="equipment_product_code"/>
<result property="transformerID" column="transformer_id"/>
<result property="newNationalStandard" column="new_national_standard"/>
<result property="vinFlag" column="vin_flag"/>
<result property="equipmentStatus" column="equipment_status"/>
<result property="equipmentPurpose" column="equipment_purpose"/>
<result property="manufacturerId" column="manufacturer_id"/>
</resultMap>
<sql id="selectXhpcChargingPileVo">
select charging_pile_id,
@ -368,6 +375,14 @@
xcp.connector_type connectorType,
xcp.current,
xcp.equipment_type equipmentType,
xcp.equipment_product_code,
xcp.transformer_id,
xcp.new_national_standard,
xcp.vin_flag,
xcp.equipment_status,
xcp.equipment_purpose,
xcp.manufacturer_id manufacturerId,
xcs.construction_time as constructionTime,
xcs.name as charging_station_name
from xhpc_charging_pile xcp
left join xhpc_charging_station as xcs on xcs.charging_station_id = xcp.charging_station_id
@ -467,7 +482,7 @@
select count(charging_pile_id) from xhpc_charging_pile WHERE charging_station_id =#{chargingStationId} and def_flag=0
</select>
<select id="getXhpcChargingPileBySerialNumber" resultType="com.xhpc.common.domain.XhpcChargingPile">
<select id="getXhpcChargingPileBySerialNumber" resultMap="BaseResultMap">
select
charging_pile_id,
charging_station_id,
@ -502,9 +517,16 @@
manufacture_name manufactureName,
connector_type connectorType,
current,
equipment_type equipmentType
equipment_type equipmentType,
equipment_product_code,
transformer_id,
new_national_standard,
vin_flag,
equipment_status,
equipment_purpose,
manufacturer_id manufacturerId
from xhpc_charging_pile
where serial_number = #{serialNumber}
where serial_number = #{serialNumber} and del_flag =0
</select>
<select id="selectXhpcChargingPilesBy" resultMap="BaseResultMap">
<include refid="selectXhpcChargingPileVo"/>

View File

@ -247,35 +247,63 @@
</select>
<select id="getXhpcChargingStationMessage" resultType="java.util.Map">
select ct.charging_station_id as chargingStationId,
ct.name as name,
ct.operator_id as operatorId,
ct.operator_id_evcs as operatorIdEvcs,
ct.station_type as stationType,
op.name as operatorName,
ct.type as type,
select ct.charging_station_id as chargingStationId,
ct.name as name,
ct.operator_id as operatorId,
ct.operator_id_evcs as operatorIdEvcs,
ct.equipment_owner_id as equipmentOwnerId,
ct.is_alone_apply as isAloneApply,
ct.account_number as accountNumber,
ct.capacity as capacity,
ct.country_code as countryCcode,
ct.area_code as countryAreaCode,
ct.is_open as isOpen,
ct.station_status as stationStatus,
ct.open_all_day as openAllDay,
ct.busine_hours as busineHours,
ct.service_fee as serviceFee,
ct.park_free as parkFree,
ct.park_fee as parkFee,
ct.payment as payment,
ct.park_fee_type as parkFeeType,
ct.toilet_flag as toiletFlag,
ct.store_flag as storeFlag,
ct.lounge_flag as loungeFlag,
ct.canopy_flag as canopyFlag,
ct.printer_flag as printerFlag,
ct.barrier_flag as barrierFlag,
ct.parking_lock_flag as parkingLockFlag,
ct.is_demand_response as isDemandResponse,
ct.is_support_orderly_charging as isSupportOrderlyCharging,
ct.is_energystorage as isEnergystorage,
ct.station_type as stationType,
ct.longitude as longitude,
ct.latitude as latitude,
ct.construction_site as constructionSite,
op.name as operatorName,
ct.type as type,
(select dict_value
from xhpc_dict_biz
where code = 'charging_station_type'
and dict_key = ct.station_type) as stationTypeName,
ct.serial_number as serialNumber,
ct.construction_site as constructionSite,
and dict_key = ct.station_type) as stationTypeName,
ct.serial_number as serialNumber,
ct.construction_site as constructionSite,
(select dict_value
from xhpc_dict_biz
where code = 'charging_construction_site'
and dict_key = ct.construction_site) as constructionSiteName,
ct.address as address,
ct.remark as remark,
ct.detailed_address as detailedAddress,
ct.periphery_facilities as peripheryFacilities,
ct.service_facilities as serviceFacilities,
ct.parking_instructions as parkingInstructions,
ct.business_instructions as businessInstructions,
ct.reminder_instructions as reminderInstructions,
ct.client_visible as clientVisible,
ct.img_id as imgId,
ct.service_tel as serviceTel,
ct.park_nums as parkNums,
and dict_key = ct.construction_site) as constructionSiteName,
ct.address as address,
ct.remark as remark,
ct.detailed_address as detailedAddress,
ct.periphery_facilities as peripheryFacilities,
ct.service_facilities as serviceFacilities,
ct.parking_instructions as parkingInstructions,
ct.business_instructions as businessInstructions,
ct.reminder_instructions as reminderInstructions,
ct.client_visible as clientVisible,
ct.img_id as imgId,
ct.service_tel as serviceTel,
ct.park_nums as parkNums,
GROUP_CONCAT(DISTINCT xdbs.dict_value ORDER BY xdbs.create_time ASC separator ',' ) serviceFacilitiesName,
GROUP_CONCAT(DISTINCT xdbp.dict_value ORDER BY xdbp.create_time ASC separator ',' ) peripheryFacilitiesName
from xhpc_charging_station as ct

View File

@ -0,0 +1,24 @@
package com.xhpc.common.api;
import com.xhpc.common.api.factory.ChargingStationServiceFactory;
import com.xhpc.common.core.constant.ServiceNameConstants;
import org.springframework.cloud.openfeign.FeignClient;
import org.springframework.web.bind.annotation.GetMapping;
import com.xhpc.common.core.domain.R;
import org.springframework.web.bind.annotation.PathVariable;
/**
* @author yuyang
* @date 2023-09-12 9:51
*/
@FeignClient(contextId = "ChargingStationService", value = ServiceNameConstants.XHPC_CHARGING_STATION, fallbackFactory = ChargingStationServiceFactory.class)
public interface ChargingStationService {
//获取场站信息
@GetMapping("/station/getChargingStationServiceById")
R getChargingStationServiceById(@PathVariable("stationId") Long stationId);
//获取场站桩信息
@GetMapping("/chargingPile/getChargingPileSerialNumber")
R getChargingPileSerialNumber(@PathVariable("serialNumber") String serialNumber);
}

View File

@ -50,4 +50,7 @@ public interface PowerPileService {
@PostMapping("/pile/{pileNo}/reboot")
R pileReboot(@PathVariable("pileNo") String pileNo);
@GetMapping("/station/getNotificationStationInfo/{stationId}")
R getNotificationStationInfo(@Param("stationId") Long stationId);
}

View File

@ -173,4 +173,24 @@ public class ChargingStationDto {
return serviceTel;
}
@Override
public String toString() {
return "ChargingStationDto{" +
"stationId=" + stationId +
", piles=" + piles +
", rateModelId=" + rateModelId +
", operatorId='" + operatorId + '\'' +
", lat=" + lat +
", lng=" + lng +
", type=" + type +
", construction=" + construction +
", address='" + address + '\'' +
", areaCode='" + areaCode + '\'' +
", name='" + name + '\'' +
", serviceTel='" + serviceTel + '\'' +
", parkNums=" + parkNums +
", installedTotalPower=" + installedTotalPower +
", runningTotalPower=" + runningTotalPower +
'}';
}
}

View File

@ -0,0 +1,42 @@
package com.xhpc.common.api.factory;
import com.xhpc.common.api.ChargingStationService;
import com.xhpc.common.core.domain.R;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;
/**
* 场站服务
* @author yuyang
* @date 2023-09-12 9:52
*/
@Component
public class ChargingStationServiceFactory implements FallbackFactory<ChargingStationService> {
private static final Logger logger = LoggerFactory.getLogger(ChargingStationServiceFactory.class);
/**
* Returns an instance of the fallback appropriate for the given cause.
*
* @param cause cause of an exception.
* @return fallback
*/
@Override
public ChargingStationService create(Throwable cause) {
logger.error("场站服务调用失败:{}//fallback", cause.getMessage());
return new ChargingStationService() {
@Override
public R getChargingStationServiceById(Long stationId) {
return R.fail(500,"场站查询信息接口失败:" + cause.getMessage());
}
@Override
public R getChargingPileSerialNumber(String serialNumber) {
return R.fail(500,"桩查询信息接口失败:" + cause.getMessage());
}
};
}
}

View File

@ -75,6 +75,11 @@ public class PowerPileFallbackFactory implements FallbackFactory<PowerPileServic
return R.fail(3886,"重启桩程序失败:" + cause.getMessage());
}
@Override
public R getNotificationStationInfo(Long stationId) {
return R.fail(500,"组装场站信息失败:" + cause.getMessage());
}
};
}

View File

@ -125,6 +125,34 @@ public class XhpcChargingPile extends BaseEntity {
//桩停用提示语
private String prompt;
/**
* 设备出厂编码
*/
private String equipmentProductCode;
/**
* 设备出厂编码
*/
private String transformerID;
/**
* 新国标
*/
private Integer newNationalStandard;
/**
* 是否支持 VIN 码识别
*/
private Integer vinFlag;
/**
* 设备状态
*/
private Integer equipmentStatus;
/**
* 设备用途
*/
private Integer equipmentPurpose;
private String constructionTime;
private String manufacturerId;
public String getTypeName() {
@ -451,4 +479,68 @@ public class XhpcChargingPile extends BaseEntity {
public void setPrompt(String prompt) {
this.prompt = prompt;
}
public String getEquipmentProductCode() {
return equipmentProductCode;
}
public void setEquipmentProductCode(String equipmentProductCode) {
this.equipmentProductCode = equipmentProductCode;
}
public String getTransformerID() {
return transformerID;
}
public void setTransformerID(String transformerID) {
this.transformerID = transformerID;
}
public Integer getNewNationalStandard() {
return newNationalStandard;
}
public void setNewNationalStandard(Integer newNationalStandard) {
this.newNationalStandard = newNationalStandard;
}
public Integer getVinFlag() {
return vinFlag;
}
public void setVinFlag(Integer vinFlag) {
this.vinFlag = vinFlag;
}
public Integer getEquipmentStatus() {
return equipmentStatus;
}
public void setEquipmentStatus(Integer equipmentStatus) {
this.equipmentStatus = equipmentStatus;
}
public Integer getEquipmentPurpose() {
return equipmentPurpose;
}
public void setEquipmentPurpose(Integer equipmentPurpose) {
this.equipmentPurpose = equipmentPurpose;
}
public String getConstructionTime() {
return constructionTime;
}
public void setConstructionTime(String constructionTime) {
this.constructionTime = constructionTime;
}
public String getManufacturerId() {
return manufacturerId;
}
public void setManufacturerId(String manufacturerId) {
this.manufacturerId = manufacturerId;
}
}

View File

@ -13,6 +13,11 @@ public class AliyunTemplate {
* 阿里云短信签名
*/
public static final String SIGNATURE_NAME = "小华充电";
/**
* 阿里云短信签名
*/
public static final String SIGNATURE_OREDER_NAME = "小华充电订单异常";
/**
* 电量充满
*/
@ -61,4 +66,9 @@ public class AliyunTemplate {
*/
public static final String OPERATOR_CASHED = "SMS_237216616";
/**
* 订单异常
*/
public static final String OPERATOR_ORDER_REFUND = "SMS_462691150";
}

View File

@ -60,5 +60,10 @@ public class AliyunTemplateKeyWord {
*/
public static final String OPERATOR_CASHED = "提现到银行账户";
/**
* 退款订单异常
*/
public static final String OPERATOR_ORDER_REFUND ="尊敬的管理员,用户退款订单";
public static final String OPERATOR_CODE= "您的验证码是";
}

View File

@ -109,6 +109,9 @@ public class XhpcSmsController extends BaseController {
} else if (content.contains(AliyunTemplateKeyWord.OPERATOR_CASHED)) {
signatureName = AliyunTemplate.SIGNATURE_NAME;
templateId = AliyunTemplate.OPERATOR_CASHED;
}else if (content.contains(AliyunTemplateKeyWord.OPERATOR_ORDER_REFUND)) {
signatureName = AliyunTemplate.SIGNATURE_OREDER_NAME;
templateId = AliyunTemplate.OPERATOR_ORDER_REFUND;
}
xhpcSmsService.sendNotice(phone, signatureName, templateId, paramMap);

View File

@ -257,6 +257,44 @@ public class XhpcSmsServiceImpl implements IXhpcSmsService {
if (AliyunTemplate.REFUND_FAIL.equals(templateId)) {
return "【小华充电】退款-尊敬的用户,当前退款人数较多,申请退款失败,请您重新提交申请!";
}
if (AliyunTemplate.OPERATOR_ORDER_REFUND.equals(templateId)) {
String number=paramMap.get("number");
return "【小华充电订单异常】尊敬的管理员,用户退款订单:"+number+",有问题请速速查看。";
}
throw new Exception("没有对应的模板id");
}
public static void main(String[] args) {
Client client = null;
try {
client = SmsUtil.createClient(accessKeyId, accessKeySecret);
SendSmsRequest sendSmsRequest = new SendSmsRequest();
sendSmsRequest.setPhoneNumbers("18123374652");
sendSmsRequest.setSignName("小华充电订单异常");
sendSmsRequest.setTemplateCode("SMS_462691150");
//添加模板参数
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("phone", "18123374652");
paramMap.put("number", "45634654");
paramMap.put("content", "【小华充电订单异常】尊敬的管理员用户退款订单741258963有问题请速速查看。");
String templateParam = JSONUtil.toJsonStr(paramMap);
sendSmsRequest.setTemplateParam(templateParam);
SendSmsResponse sendSmsResponse = client.sendSms(sendSmsRequest);
//获取发送结果状态码
String statusCode = sendSmsResponse.getBody().getCode();
//获取阿里云的返回值json字符串
SendSmsResponseBody body = sendSmsResponse.getBody();
String jsonResult = JSONUtil.toJsonStr(body);
//存放后面需要使用的返回值
HashMap<String, String> valueParam = new HashMap<>();
valueParam.put("statusCode", statusCode);
valueParam.put("templateContent", "【小华充电订单异常】尊敬的管理员用户退款订单324324324有问题请速速查看。");
valueParam.put("jsonResult", jsonResult);
System.out.println("====valueParam======"+valueParam.toString());
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@ -41,12 +41,19 @@ public class SmsUtil {
java.util.List<String> args = java.util.Arrays.asList(args_);
com.aliyun.dysmsapi20170525.Client client = SmsUtil.createClient(accessKeyId, accessKeySecret);
SendSmsRequest sendSmsRequest = new SendSmsRequest()
.setPhoneNumbers("13060166032")
.setSignName("小华充电")
.setTemplateCode("SMS_226935795")
.setTemplateParam("{\"money\":\"5\"}");
.setPhoneNumbers("18123374652")
.setSignName("小华充电订单异常")
.setTemplateCode("SMS_462691150")
.setTemplateParam("尊敬的管理员用户退款订单458765465461有问题请速速查看。");
// 复制代码运行请自行打印 API 的返回值
client.sendSms(sendSmsRequest);
}
}

View File

@ -6,18 +6,23 @@ import com.xhpc.common.core.constant.StatusConstants;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.utils.WXPayUtil;
import com.xhpc.common.core.web.controller.BaseController;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcRefundOrder;
import com.xhpc.common.log.annotation.Log;
import com.xhpc.common.log.enums.BusinessType;
import com.xhpc.common.security.service.TokenService;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.domain.XhpcAppUser;
import com.xhpc.payment.domain.XhpcRefundAudit;
import com.xhpc.payment.mapper.XhpcRefundOrderMapper;
import com.xhpc.payment.mapper.XhpcRefundOriginalOrderMapper;
import com.xhpc.payment.mapper.XhpcUserAccountStatementMapper;
import com.xhpc.payment.service.IXhpcRefundAuditService;
import com.xhpc.payment.service.IXhpcRefundOrderService;
import com.xhpc.payment.service.IXhpcRefundOriginalOrderService;
import com.xhpc.payment.util.AESUtil;
import com.xhpc.system.api.model.LoginUser;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.slf4j.Logger;
@ -35,8 +40,12 @@ import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.PrintWriter;
import java.math.BigDecimal;
import java.util.Date;
import java.util.HashMap;
import java.util.Map;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.Executors;
/**
* @author yuyang
@ -45,8 +54,7 @@ import java.util.Map;
@RestController
@RequestMapping("/refundOriginalOrder")
@Api(value = "原路退回接口", tags = "原路退回接口")
public class XhpcRefundOriginalOrderController {
public class XhpcRefundOriginalOrderController extends BaseController {
@Resource
private IXhpcRefundOriginalOrderService xhpcRefundOriginalOrderService;
@ -56,6 +64,12 @@ public class XhpcRefundOriginalOrderController {
private XhpcUserAccountStatementMapper xhpcUserAccountStatementMapper;
@Resource
private IXhpcRefundAuditService iXhpcRefundAuditService;
@Resource
private IXhpcRefundOrderService iXhpcRefundOrderService;
@Resource
private XhpcRefundOrderMapper xhpcRefundOrderMapper;
private final ExecutorService executorService = Executors.newFixedThreadPool(40);
private static final Logger logger = LoggerFactory.getLogger(XhpcRefundOriginalOrderController.class);
@ -63,42 +77,6 @@ public class XhpcRefundOriginalOrderController {
@GetMapping("/refundOrder")
@ApiOperation(value = "支付宝支付")
public R refundOrder(Long refundOrderId) throws Exception {
XhpcRefundOrder xhpcRefundOrder = xhpcRefundOriginalOrderMapper.getXhpcRefundOrder(refundOrderId);
if(xhpcRefundOrder==null){
return R.fail(HttpStatus.DATA_ERROR, "退款订单不存在");
}
if (!StatusConstants.REFUND_ORDER_STATUS_WAIT.equals(xhpcRefundOrder.getStatus())) {
return R.fail(HttpStatus.DATA_ERROR, "退款订单状态不能审核");
}
if (!StatusConstants.REFUND_ORDER_STATUS_WAIT.equals(xhpcRefundOrder.getExamineStatus())) {
return R.fail(HttpStatus.DATA_ERROR, "退款订单状态不能审核");
}
Integer source = xhpcRefundOrder.getSource();
Long userId = xhpcRefundOrder.getUserId();
if(UserTypeUtil.USER_TYPE.equals(source)){
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(userId);
xhpcAppUser.setIsRefundApplication(0);
int refundApplication = xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
if (refundApplication == 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return R.fail();
}
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(userId, null, 0);
if (i == 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return R.fail();
}
}else{
AjaxResult.error(HttpStatus.DATA_ERROR, "该用户不能退款");
}
xhpcRefundOrder.setRefundOrderId(refundOrderId);
// xhpcRefundOrder.setStatus(2);
// xhpcRefundOrder.setExamineStatus(2);
// xhpcRefundOrder.setRemark("退款订单状态不对");
// xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,xhpcRefundOrder.getAmount(),1,xhpcRefundOrder.getType());
return xhpcRefundOriginalOrderService.zhbRefundOriginalOrder(refundOrderId);
}
@ -106,36 +84,6 @@ public class XhpcRefundOriginalOrderController {
@GetMapping("/refundWxOrder")
@ApiOperation(value = "微信支付")
public R refundWxOrder(Long refundOrderId) throws Exception {
XhpcRefundOrder xhpcRefundOrder = xhpcRefundOriginalOrderMapper.getXhpcRefundOrder(refundOrderId);
if(xhpcRefundOrder==null){
return R.fail(HttpStatus.DATA_ERROR, "退款订单不存在");
}
if (!StatusConstants.REFUND_ORDER_STATUS_WAIT.equals(xhpcRefundOrder.getStatus())) {
return R.fail(HttpStatus.DATA_ERROR, "退款订单状态不能审核");
}
if (!StatusConstants.REFUND_ORDER_STATUS_WAIT.equals(xhpcRefundOrder.getExamineStatus())) {
return R.fail(HttpStatus.DATA_ERROR, "退款订单状态不能审核");
}
Integer source = xhpcRefundOrder.getSource();
Long userId = xhpcRefundOrder.getUserId();
if(UserTypeUtil.USER_TYPE.equals(source)){
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(userId);
xhpcAppUser.setIsRefundApplication(0);
int refundApplication = xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
if (refundApplication == 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return R.fail();
}
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(userId, null, 0);
if (i == 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return R.fail();
}
}else{
AjaxResult.error(HttpStatus.DATA_ERROR, "该用户不能退款");
}
return xhpcRefundOriginalOrderService.wxRefundOriginalOrder(refundOrderId);
}
@ -144,9 +92,6 @@ public class XhpcRefundOriginalOrderController {
*/
@RequestMapping("/paymentCallback")
public Object payNotify(HttpServletRequest request, HttpServletResponse response) {
logger.info("==================微信回调Api========================");
logger.info("==================微信回调Api========================");
logger.info("==================微信回调Api========================");
try {
ServletInputStream in = null;
BufferedReader reader = null;
@ -212,18 +157,88 @@ public class XhpcRefundOriginalOrderController {
@ApiOperation(value = "退款审核")
@Transactional
public R info(@RequestBody XhpcRefundAudit xhpcRefundAudit) {
Long refundOrderId = xhpcRefundAudit.getRefundOrderId();
iXhpcRefundAuditService.insert(xhpcRefundAudit);
XhpcRefundOrder xhpcRefundOrder = xhpcRefundOriginalOrderMapper.getXhpcRefundOrder(refundOrderId);
if(xhpcRefundOrder==null){
return R.fail(HttpStatus.DATA_ERROR, "退款订单不存在");
}
if(xhpcRefundAudit.getStatus()==2){
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,2,3);
xhpcRefundOrder.setRemark("订单已取消审核");
return R.ok("订单已取消审核");
}
if (!StatusConstants.REFUND_ORDER_STATUS_WAIT.equals(xhpcRefundOrder.getStatus())) {
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,2,2);
xhpcRefundOrder.setRemark("订单状态不能退款");
return R.fail(HttpStatus.DATA_ERROR, "订单状态不能退款");
}
Integer source = xhpcRefundOrder.getSource();
Long userId = xhpcRefundOrder.getUserId();
if(UserTypeUtil.USER_TYPE.equals(source)){
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(userId);
xhpcAppUser.setIsRefundApplication(0);
int refundApplication = xhpcUserAccountStatementMapper.updateAppUserRefundApplication(xhpcAppUser);
if (refundApplication == 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return R.fail("修改用户信息失败");
}
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(userId);
BigDecimal amount = new BigDecimal(appUserInfo.get("balance").toString());
if(amount.compareTo(xhpcRefundOrder.getAmount()) !=0){
xhpcRefundOrder.setStatus(2);
xhpcRefundOrder.setRemark("订单金额出错");
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,4,2);
return R.fail("订单金额出错");
}
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(userId, null, 0);
if (i == 0) {
TransactionAspectSupport.currentTransactionStatus().setRollbackOnly();
return R.fail("获取社区用户失败");
}
Map<String, Object> communityPersonnel = iXhpcRefundAuditService.getCommunityPersonnelById(userId, xhpcRefundOrder.getTenantId());
BigDecimal amount = new BigDecimal(communityPersonnel.get("balance").toString());
if(amount.compareTo(xhpcRefundOrder.getAmount()) !=0){
xhpcRefundOrder.setStatus(2);
xhpcRefundOrder.setRemark("订单金额出错");
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,4,2);
return R.fail("订单金额出错");
}
}else{
AjaxResult.error(HttpStatus.DATA_ERROR, "该用户不能退款");
}
if(xhpcRefundOrder.getType() == UserTypeUtil.OPERATION_WX_TYPE){
try {
return refundWxOrder(refundOrderId);
logger.info("=========进入微信退款============"+refundOrderId);
R r = refundWxOrder(refundOrderId);
if(r.getCode()==200){
return R.ok(null,"微信退款中");
}else{
xhpcRefundOrder.setStatus(2);
xhpcRefundOrder.setRemark("订单金额出错");
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,4,2);
return R.fail(r.getMsg());
}
} catch (Exception e) {
e.printStackTrace();
}
}else{
try {
return refundOrder(refundOrderId);
logger.info("=========进入支付宝退款============"+refundOrderId);
R r = refundOrder(refundOrderId);
if(r.getCode()==200){
return R.ok(null,"支付宝退款中");
}else{
xhpcRefundOrder.setStatus(2);
xhpcRefundOrder.setRemark("订单金额出错");
xhpcRefundOriginalOrderService.updateXhpcRefundOrder(xhpcRefundOrder,null,4,2);
return R.fail(r.getMsg());
}
} catch (Exception e) {
e.printStackTrace();
}
@ -253,4 +268,97 @@ public class XhpcRefundOriginalOrderController {
}
//平台退款快捷方式
@PostMapping("/getUserApplyForBalance")
@ApiOperation(value = "平台退款快捷方式")
public R getUserApplyForBalance(HttpServletRequest request, @RequestBody Map<String, Object> map){
String tenantId = StringUtils.valueOf(map.get("tenantId"));
String userId = StringUtils.valueOf(map.get("userId"));
String source = StringUtils.valueOf(map.get("source"));
String amount = StringUtils.valueOf(map.get("balance"));
String weixinOpenId = StringUtils.valueOf(map.get("weixinOpenId"));
String alipayOpenId = StringUtils.valueOf(map.get("alipayOpenId"));
String type = StringUtils.valueOf(map.get("type"));
if (UserTypeUtil.CUSTOMERS_TYPE.equals(source)) {
return R.fail(HttpStatus.ERROR_STATUS, "大客户不支持退款");
}
if (StringUtils.isEmpty(amount)) {
return R.fail(HttpStatus.NOT_NULL, "退款金额不能为空");
} else {
if("1".equals(type)){
if (new BigDecimal(0.3).compareTo(new BigDecimal(amount)) == 1) {
return R.fail(HttpStatus.NOT_NULL, "微信平台规定退款金额不能少于0.3元");
}
}
}
//用户信息id
if (StringUtils.isEmpty(userId)) {
return R.fail(HttpStatus.NOT_NULL, "用户信息不能为空");
}
//1 微信 2 支付宝
if (StringUtils.isEmpty(type)) {
return R.fail(HttpStatus.NOT_NULL, "退款渠道不能为空");
}else{
if("1".equals(type)){
if("".equals(weixinOpenId) || weixinOpenId ==null){
return R.fail(HttpStatus.NOT_NULL, "该用户未登录微信小程序不能退款,请选择支付宝退款方式");
}
}else if("2".equals(type)){
if("".equals(alipayOpenId) || alipayOpenId ==null){
return R.fail(HttpStatus.NOT_NULL, "该用户未登录支付宝小程序不能退款,请选择微信退款方式");
}
}else{
return R.fail(HttpStatus.NOT_NULL, "该用户未登录微信或支付宝小程序不能退款");
}
}
//是否有实时数据
int i = iXhpcRefundOrderService.countXhpcRealTimeOrder(Long.valueOf(userId), Integer.valueOf(source), tenantId);
if (i > 0) {
return R.fail(1103, "车辆正在充电,不能退款");
}
// 是否有异常订单
int j = iXhpcRefundOrderService.countXhpcChargeOrder(Long.valueOf(userId), Integer.valueOf(source), tenantId);
if (j > 0) {
return R.fail(1103, "有异常订单未解决,请拨打客服电话进行解决");
}
//生成退款订单
String orderOutNumber = StringUtils.numFormat(Long.valueOf(userId), Integer.parseInt(type),
StatusConstants.FLOWING_WATER_REFUND_TYPE);
String remark = StringUtils.valueOf(map.get("remark"));
XhpcRefundOrder xhpcRefundOrder = new XhpcRefundOrder();
xhpcRefundOrder.setUserId(Long.valueOf(userId));
xhpcRefundOrder.setAmount(new BigDecimal(amount));
xhpcRefundOrder.setRefundOrderNumber(orderOutNumber);
xhpcRefundOrder.setType(Integer.parseInt(type));
xhpcRefundOrder.setRemark(remark);
xhpcRefundOrder.setSource(Integer.valueOf(source));
xhpcRefundOrder.setCreateTime(new Date());
xhpcRefundOrder.setUpdateTime(new Date());
xhpcRefundOrder.setTenantId(tenantId);
if (StatusConstants.OPERATION_WX_TYPE.equals(type)) {
xhpcRefundOrder.setOpenId(weixinOpenId);
} else {
xhpcRefundOrder.setAlipayId(alipayOpenId);
}
xhpcRefundOriginalOrderService.addXhpcRefundOrder(xhpcRefundOrder);
executorService.execute(new Runnable() {
@Override
public void run() {
XhpcRefundAudit xhpcRefundAudit =new XhpcRefundAudit();
xhpcRefundAudit.setRefundOrderId(xhpcRefundOrder.getRefundOrderId());
xhpcRefundAudit.setStatus(1);
xhpcRefundAudit.setRemark("自动审核通过");
info(xhpcRefundAudit);
}
});
return R.ok(null,"申请退款成功");
}
@GetMapping("/getTestSms")
@ApiOperation(value = "短信测试")
public void getTestSms(String number){
xhpcRefundOriginalOrderService.getTestSms(number);
}
}

View File

@ -17,7 +17,6 @@ public interface XhpcRefundOriginalOrderMapper {
//查询是否满足退款条件
Map<String, Object> compareTotalTimeMoney(@Param("refundOrderId")Long refundOrderId, @Param("startTime")String startTime, @Param("endTime")String endTime);
Map<String, Object> compareTotalMoney(@Param("userId")Long userId,@Param("source") Integer source);
//查询以前充值记录
List<XhpcRechargeOrder> getTotalMoneyList(@Param("userId")Long userId,@Param("source") Integer source,@Param("createTime")String createTime);
@ -33,4 +32,9 @@ public interface XhpcRefundOriginalOrderMapper {
XhpcRefundOriginalOrder getXhpcRefundOriginalOrderRefundId(@Param("refundId")String refundId);
void updateXhpcRefundOriginalOrder(XhpcRefundOriginalOrder xhpcRefundOriginalOrder);
int addXhpcRefundOrder(XhpcRefundOrder xhpcRefundOrder);
void updateRechargeOrderRefundStatus(@Param("userId")Long userId,@Param("source")Integer source);
}

View File

@ -23,4 +23,9 @@ public interface IXhpcRefundOriginalOrderService {
void updateXhpcRefundOriginalOrder(Map<String, String> reqInfo);
void updateXhpcRefundOrder(XhpcRefundOrder refundOrder, BigDecimal refundFee, Integer type,Integer status);
//新增退款订单
void addXhpcRefundOrder(XhpcRefundOrder xhpcRefundOrder);
void getTestSms(String number);
}

View File

@ -18,12 +18,10 @@ import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.DateUtils;
import com.xhpc.common.core.utils.StringUtils;
import com.xhpc.common.core.utils.WXPayUtil;
import com.xhpc.common.core.web.domain.AjaxResult;
import com.xhpc.common.domain.XhpcRechargeOrder;
import com.xhpc.common.domain.XhpcRefundOrder;
import com.xhpc.common.domain.XhpcSettingConfig;
import com.xhpc.common.util.UserTypeUtil;
import com.xhpc.payment.controller.XhpcRefundAuditController;
import com.xhpc.payment.domain.XhpcAppUser;
import com.xhpc.payment.domain.XhpcRefundOriginalOrder;
import com.xhpc.payment.mapper.XhpcRefundOriginalOrderMapper;
@ -104,6 +102,8 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
BigDecimal wxMoney = new BigDecimal(stringIntegerMap.get("wxMoney").toString());
BigDecimal totalMoney = new BigDecimal(stringIntegerMap.get("totalMoney").toString());
BigDecimal zero = new BigDecimal(0);
// logger.info("=============endTime============="+endTime);
// logger.info("=============startTime============="+startTime);
//支付宝充值的金额大于退款金额
if("1".equals(stringIntegerMap.get("zfbStatus").toString()) && zfbMoney.compareTo(zero)>0){
List<XhpcRechargeOrder> xhpcRechargeOrderList = xhpcRefundOriginalOrderMapper.getXhpcRechargeOrderList(2, refundOrderId, startTime, endTime);
@ -111,7 +111,7 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
XhpcRechargeOrder rechargeOrder = xhpcRechargeOrderList.get(i);
BigDecimal rechargeAmount = rechargeOrder.getAmount();//充值金额
BigDecimal refundFee = rechargeOrder.getRefundFee();//已退款总金额
String orderNumber = StringUtils.numFormat(11L, 1, StatusConstants.FLOWING_WATER_REFUND_TYPE);
String orderNumber = StringUtils.numFormat(rechargeOrder.getUserId(), 1, StatusConstants.FLOWING_WATER_REFUND_TYPE);
int number =0;//退款失败在调用一次
if(rechargeOrder.getRefundStatus()==0){
if(amount.compareTo(rechargeAmount)<=0) {
@ -121,9 +121,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
//修改退款订单状态
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,1,2);
}else{
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,2,2);
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,4,2);
}
return R.ok();
return R.ok("支付宝退款成功");
}else{
//还差一部分
R r = getalipayTradeRefund(xhpcSettingConfig, xhpcRefundOrder, rechargeOrder, rechargeAmount, orderNumber, number);
@ -141,9 +141,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
//修改退款订单状态
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,1,2);
}else{
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,2,2);
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,4,2);
}
return R.ok();
return R.ok("支付宝退款成功");
}else{
//还差一部分
R r =getalipayTradeRefund(xhpcSettingConfig,xhpcRefundOrder,rechargeOrder,subtract,orderNumber,number);
@ -200,9 +200,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
//修改退款订单状态
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,1,2);
}else{
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,2,2);
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,4,2);
}
return R.ok();
return R.ok("支付宝退款成功");
}else{
//还差一部分
R r = getalipayTradeRefund(xhpcSettingConfig, xhpcRefundOrder, rechargeOrder, rechargeAmount, orderNumber, number);
@ -220,9 +220,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
//修改退款订单状态
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,1,2);
}else{
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,2,2);
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,4,2);
}
return R.ok();
return R.ok("支付宝退款成功");
}else{
//还差一部分
R r =getalipayTradeRefund(xhpcSettingConfig,xhpcRefundOrder,rechargeOrder,subtract,orderNumber,number);
@ -270,9 +270,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
//修改退款订单状态
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,1,2);
}else{
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,2,2);
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,4,2);
}
return R.ok();
return R.ok("支付宝退款成功");
}else{
//还差一部分
R r = getalipayTradeRefund(xhpcSettingConfig, xhpcRefundOrder, rechargeOrder, rechargeAmount, orderNumber, number);
@ -290,9 +290,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
//修改退款订单状态
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,1,2);
}else{
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,2,2);
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,4,2);
}
return R.ok();
return R.ok("支付宝退款成功");
}else{
//还差一部分
R r =getalipayTradeRefund(xhpcSettingConfig,xhpcRefundOrder,rechargeOrder,subtract,orderNumber,number);
@ -317,7 +317,7 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
zhbCheckOut(xhpcSettingConfig,xhpcRefundOrder,amount);
}
return R.ok();
return R.ok("支付宝退款成功");
}else{
// 没有这种情况出现则需要通知管理员
return R.fail("退款异常订单,请管理员进行查看");
@ -329,7 +329,7 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
}
}
return R.ok();
return R.ok("支付宝退款成功");
}
@ -391,9 +391,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
if(r.getCode()==200){
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,1,2);
}else{
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,2,2);
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,4,2);
}
return R.ok();
return R.ok("退款订单已提交支付宝,退款中...");
}
}else{
BigDecimal subtract1 = rechargeAmount.subtract(rechargeOrder.getRefundFee());
@ -411,12 +411,13 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
//修改退款订单状态
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,1,2);
}else{
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,2,2);
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,4,2);
}
return R.ok();
return R.ok("退款订单已提交支付宝,退款中...");
}
}
}
return R.ok("C端用户退款成功");
}else if(UserTypeUtil.COMMUNIT_TYPE==xhpcRefundOrder.getSource()){
BigDecimal bigDecimal = amount;
if(wxMoney.compareTo(zero)>0){
@ -447,9 +448,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
if(r.getCode()==200){
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,1,2);
}else{
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,2,2);
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,4,2);
}
return R.ok();
return R.ok("退款订单已提交支付宝,退款中...");
}
}else{
BigDecimal subtract1 = rechargeAmount.subtract(rechargeOrder.getRefundFee());
@ -464,9 +465,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
//修改退款订单状态
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,1,2);
}else{
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,2,2);
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,4,2);
}
return R.ok();
return R.ok("退款订单已提交支付宝,退款中...");
}
}
}
@ -477,7 +478,7 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
wxCheckOut(xhpcRefundOrder,bigDecimal);
}
}
return R.ok();
return R.ok("社区用户退款成功");
}
}else if("2".equals(stringIntegerMap.get("wxStatus").toString()) && "2".equals(stringIntegerMap.get("refundStatus").toString())){
//查询该用所有充值记录
@ -501,9 +502,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
//修改退款订单状态
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,1,2);
}else{
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,2,2);
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,4,2);
}
return R.ok();
return R.ok("退款订单已提交支付宝,退款中...");
}else{
//还差一部分
R r = getalipayTradeRefund(xhpcSettingConfig, xhpcRefundOrder, rechargeOrder, rechargeAmount, orderNumber, number);
@ -521,9 +522,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
//修改退款订单状态
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,1,2);
}else{
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,2,2);
updateXhpcRefundOrder(xhpcRefundOrder,refundFee,4,2);
}
return R.ok();
return R.ok("退款订单已提交支付宝,退款中...");
}else{
//还差一部分
R r =getalipayTradeRefund(xhpcSettingConfig,xhpcRefundOrder,rechargeOrder,subtract,orderNumber,number);
@ -601,6 +602,10 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
xhpcAppUser.setIsRefundApplication(0);
}
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
if(surplus.compareTo(new BigDecimal(0))==0){
xhpcRefundOriginalOrderMapper.updateRechargeOrderRefundStatus(userId,source);
}
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
Map<String, Object> communityPersonnel = iXhpcRefundAuditService.getCommunityPersonnelById(userId, xhpcRefundOriginalOrder.getTenantId());
BigDecimal surplus =new BigDecimal(communityPersonnel.get("balance").toString()).subtract(refundFeeAmount);
@ -609,6 +614,9 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
}else{
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(userId, surplus,null);
}
if(surplus.compareTo(new BigDecimal(0))==0){
xhpcRefundOriginalOrderMapper.updateRechargeOrderRefundStatus(userId,source);
}
}
}else{
//退款失败
@ -785,7 +793,7 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
//随机字符串
param += "&nonce_str=" + nonceStr;
//退款结果通知url
String url="https://xhpc.scxhua.com/prod-api/xhpc-payment/refundOriginalOrder/paymentCallback";
String url="https://scxhua.cn/prod-api/xhpc-payment/refundOriginalOrder/paymentCallback";
param += "&notify_url=" + url;
//商户退款单号
param += "&out_refund_no=" + orderNumber;
@ -882,12 +890,13 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
/** 实例化具体API对应的request类类名称和接口名称对应,当前调用接口名称alipay.fund.trans.uni.transfer(单笔转账接口) **/
AlipayTradeRefundRequest request = new AlipayTradeRefundRequest();
/** 设置业务参数具体接口参数传值以文档说明为准https://opendocs.alipay.com/apis/api_28/alipay.fund.trans.uni.transfer/ **/
AlipayFundTransUniTransferModel model = new AlipayFundTransUniTransferModel();
//AlipayFundTransUniTransferModel model = new AlipayFundTransUniTransferModel();
JSONObject bizContent = new JSONObject();
bizContent.put("trade_no", rechargeOrder.getAlipayNumber());
bizContent.put("refund_amount", refundFee);
bizContent.put("out_request_no", orderNumber);
request.setBizContent(bizContent.toString());
logger.info("=====支付宝退款订单=======bizContent=========================="+bizContent.toString());
AlipayTradeRefundResponse response = alipayClient.certificateExecute(request);
if("Y".equals(response.getFundChange())){
System.out.println("调用退款成功");
@ -1040,10 +1049,16 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
BigDecimal surplus =new BigDecimal(balance).subtract(refundFee);
xhpcAppUser.setBalance(surplus);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
if(surplus.compareTo(new BigDecimal(0))==0){
xhpcRefundOriginalOrderMapper.updateRechargeOrderRefundStatus(userId,source);
}
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
Map<String, Object> communityPersonnel = iXhpcRefundAuditService.getCommunityPersonnelById(userId, rechargeOrder.getTenantId());
BigDecimal surplus =new BigDecimal(communityPersonnel.get("balance").toString()).subtract(refundFee);
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(userId, surplus,null);
if(surplus.compareTo(new BigDecimal(0))==0){
xhpcRefundOriginalOrderMapper.updateRechargeOrderRefundStatus(userId,source);
}
}
}
@ -1051,47 +1066,69 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
* 修改订单状态
* @param refundOrder
* @param refundFee 退款总金额
* @param type 1成功 2失败
* @param type 1成功 2失败 4需要管理员审核
* @param status 1微信 2支付宝
*/
@Override
public void updateXhpcRefundOrder(XhpcRefundOrder refundOrder,BigDecimal refundFee,Integer type,Integer status){
Long userId = refundOrder.getUserId();
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(userId);
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(userId);
xhpcAppUser.setIsRefundApplication(0);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
Integer source = refundOrder.getSource();
String phone ="";
if(UserTypeUtil.USER_TYPE.equals(source)){
Map<String, Object> appUserInfo = xhpcUserAccountStatementMapper.appUserInfo(userId);
phone =appUserInfo.get("phone").toString();
//减少用户余额
XhpcAppUser xhpcAppUser = new XhpcAppUser();
xhpcAppUser.setAppUserId(userId);
xhpcAppUser.setIsRefundApplication(0);
xhpcUserAccountStatementMapper.updateAppUserBalance(xhpcAppUser);
}else if(UserTypeUtil.COMMUNIT_TYPE.equals(source)){
Map<String, Object> communityPersonnel = iXhpcRefundAuditService.getCommunityPersonnelById(userId, refundOrder.getTenantId());
phone =communityPersonnel.get("phone").toString();
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(userId, null,0);
}
if(type==1){
refundOrder.setStatus(1);
refundOrder.setExamineStatus(1);
if(status==1){
refundOrder.setRemark("微信退款成功");
}else{
refundOrder.setRemark("支付宝退款成功");
}
}else{
// if(status==1){
// refundOrder.setRemark("微信退款成功");
// }else{
// refundOrder.setRemark("支付宝退款成功");
// }
}else if(type==2){
refundOrder.setStatus(2);
refundOrder.setExamineStatus(1);
if(status==1){
refundOrder.setRemark("微信退款失败");
}else{
refundOrder.setRemark("支付宝退款失败");
}
if(type ==2){
try{
//发送短信
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("phone", appUserInfo.get("phone").toString());
paramMap.put("content", "【小华充电】退款-尊敬的用户,当前退款人数较多,申请退款失败,请您重新提交申请!");
smsService.sendNotice(paramMap);
}catch (Exception e){
}
}
// if(status==1){
// refundOrder.setRemark("微信退款失败");
// }else{
// refundOrder.setRemark("支付宝退款失败");
// }
// try{
// //发送短信
// HashMap<String, String> paramMap = new HashMap<>();
// paramMap.put("phone", phone);
// paramMap.put("content", "【小华充电】退款-尊敬的用户,当前退款人数较多,申请退款失败,请您重新提交申请!");
// smsService.sendNotice(paramMap);
// }catch (Exception e){
//
// }
}else{
refundOrder.setStatus(4);
refundOrder.setExamineStatus(0);
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("number",refundOrder.getRefundOrderId()+"");
paramMap.put("phone", "18123374652");
paramMap.put("content", "【小华充电订单异常】尊敬的管理员,用户退款订单:"+refundOrder.getRefundOrderId()+",有问题请速速查看。");
smsService.sendNotice(paramMap);
}
iXhpcRefundOrderService.update(refundOrder);
}
@Override
public void addXhpcRefundOrder(XhpcRefundOrder xhpcRefundOrder) {
xhpcRefundOriginalOrderMapper.addXhpcRefundOrder(xhpcRefundOrder);
}
//添加原路退回订单记录
public void addXhpcRefundOriginalOrder(AlipayTradeRefundResponse response,XhpcRefundOrder refundOrder,XhpcRechargeOrder rechargeOrder,BigDecimal refundFee){
XhpcRefundOriginalOrder xhpcRefundOriginalOrder = new XhpcRefundOriginalOrder();
@ -1243,7 +1280,7 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
}
}
}
return R.ok("退款成功");
return R.ok("退款订单已提交微信,退款中...");
}
}catch (Exception e){
e.printStackTrace();
@ -1335,7 +1372,6 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
BigDecimal surplus1 =new BigDecimal(communityPersonnel.get("balance").toString()).subtract(refundFee);
int i = iXhpcRefundAuditService.updateCommunityPersonnelMoney(userId, surplus1,null);
}
logger.info("===================11111111===================");
//增加用户流水记录
xhpcUserAccountStatementService.add(refundOrder.getRefundOrderId(), "-"+refundFee, userId.toString(), StatusConstants.FLOWING_WATER_REFUND,source,refundOrder.getTenantId());
@ -1345,7 +1381,6 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
refundOrder.setPayFundOrderId(response.getPayFundOrderId());
refundOrder.setTransPayTime(response.getTransDate());
updateXhpcRefundOrder(refundOrder,refundFee,1,2);
logger.info("===================222222===================");
XhpcRefundOriginalOrder xhpcRefundOriginalOrder = new XhpcRefundOriginalOrder();
xhpcRefundOriginalOrder.setUserId(refundOrder.getUserId());
xhpcRefundOriginalOrder.setType(3);
@ -1363,7 +1398,6 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
xhpcRefundOriginalOrder.setBuyerUserId(uid);
xhpcRefundOriginalOrder.setRefundOrderId(refundOrder.getRefundOrderId());
xhpcRefundOriginalOrderMapper.addXhpcRefundOriginalOrder(xhpcRefundOriginalOrder);
logger.info("===================33333===================");
//增加用户流水记录
xhpcUserAccountStatementService.add(refundOrder.getRefundOrderId(), "-"+refundFee, userId.toString(), StatusConstants.FLOWING_WATER_REFUND,source,refundOrder.getTenantId());
//查询以前充值记录
@ -1401,6 +1435,18 @@ public class XhpcRefundOriginalOrderServiceImpl implements IXhpcRefundOriginalOr
return R.fail();
}
//退款失败统一发送一条短信提示
@Override
public void getTestSms(String number){
HashMap<String, String> paramMap = new HashMap<>();
paramMap.put("phone", "18123374652");
paramMap.put("content", "【小华充电订单异常】尊敬的管理员,用户退款订单:"+number+",有问题请速速查看。");
smsService.sendNotice(paramMap);
}
public static void main(String[] args) throws AlipayApiException {
String privateKey ="MIIEvQIBADANBgkqhkiG9w0BAQEFAASCBKcwggSjAgEAAoIBAQCw/+WnBJiVAqs2j4ghmQBYLH8dQY4mRD45ZhXlDJsNGkNap4uKCi1Q1UkNajWO949j4nZ+pDa0hCEIK4f8QQ/JBc+5PTGitRIKh5LUdk0KVBevivsfMZNhdvIJG2zcF5ht7q+MRnhUQvRDMVcEBTPCBWxSkjy+6sOat8yaP8/V1GzZ94Pz5WQpEgBKYwrabSvqtdk6OYw0wnhgbHfAcPi40+xtNazQvVAPKGb+EAq/qxFOxzuaZ4Al7ZZ2x/zNJorgxWMxXgolC8u71vLM35UThd+/CGFSls2BNl6cYRxdKllgTKD763gWwbkB9v0IgjsT0PtQNaWPqo3jahmdy/CdAgMBAAECggEATvb7R9X/FIuKQt8qBoMx6iR/2VeDyYKsmAL5RaSoD+Jlpi4VTNJZgTSGUNvPZScA67j+0GUGmuZPrkttcZa9KhvTnnq0iDhsAhKV6P+WQ0NdBc3lVvdRHyxnsrRvjolgUbsoylYuHLl6K/f5MCv5+VdeCkB/pVUrSv0w5KgPWv+Z+nOQuHzrNmUNJaAf8x4IFlrVD/rKcrhpWpe5PKQ1BJ9Sbr/+fxY+p+1810Rg27jVErznB8g2cAGAyihGKH++sz3x9Kk7nsZRJ0AjUUtqdN0RD+EBtAV4HRHXcbjfSpFtxqBC03Vt5FFp3g70m92GjU+NWZzQ9Wtn1IsFF8+S6QKBgQDik0pwokU3X6nA/EQXMee0jNMZK/V6BQ/eQMIa0LCAUL5L60FYPZGQQaQhrT29DEki4IstVkHxgLXsQ0vnATHDGbCpaGPGj9Ur+97fuC5PL+Uqxp/dQBwKiHAioE/MDWH8qPDm1cEsgony5NhZX0L/v7Du0VHiUVJcNIA0/1QudwKBgQDH/Gn6kx8nNOPmUtICmimAyNZx3CY+ytL65pYRmVrso++Hw2iT+XLmiWDbGiPacH3R9fLXpFgBe82pOTOetkcgUw/Y2FedeBelmjzxLwF6R/AEV2zB4O3qcBkKn6gqgmJsypFsDOlVWkLSbc4mmsgHES2P1sK/olTtDmnnrR56iwKBgHNwljnjA58d95CjN1IWFDcSlS+7DPxZfedAWWVuNK979CkcORPrcrHsL+MUsGMU0mKZw2+bBkg0yvwQoaiWHDOKcE8wJ73wZK1fTAPyhG3GOl3cC3GgC2l2cKPDyERwAR/JN8x01lKGRCDkZjLK7Yj+svhK4AyOYIcoHLZj7RErAoGAMIcotFxE//+OmdJZEbaVAaI6n1B7m1seTTHtEoIzFR9GvZwGYXnzjsuhTCmQr64CahOThQ5lKJ8BLeIqi4XRxp9BRi5hPF3q5w2BYkk0w5Z3QKZyRq2tLelbuj850G7pMVsKZLzRVhvcATISBz4h8c0SUEgd4+ChWRDZVBWnQrcCgYEAvStqps5r3RB1dk5gn3Ob32zPXu5ZxNJDaykcDK83LsaFf8PT/a6fpkLjaCZ4IT5pbXkD1pef5Gx9GSfygy0ceZzsJ/pWlqYYyLdtljU6gdJZhgoyI655nEhbpwsM0o3sjna4tkB/vdPKXqAfOKxp+yow9Al8usBkjEt8sI5MRro=";
/** 初始化 **/

View File

@ -388,7 +388,7 @@
from xhpc_recharge_order
where refund_status !=2 and user_id=(select user_id from xhpc_refund_order where refund_order_id =#{refundOrderId}) and type =#{type}
and create_time &gt;= #{startTime} and create_time &lt;=#{endTime}
order by create_time desc
order by recharge_order_id desc
</select>
<select id="getXhpcRefundOrder" resultType="com.xhpc.common.domain.XhpcRefundOrder">
@ -444,4 +444,113 @@
<include refid="Base_Column_List"/>
from xhpc_refund_original_order where refund_id = #{refundId}
</select>
<insert id="addXhpcRefundOrder" parameterType="com.xhpc.common.domain.XhpcRefundOrder" useGeneratedKeys="true"
keyProperty="refundOrderId">
INSERT INTO xhpc_refund_order
<trim prefix="(" suffix=")" suffixOverrides=",">
<if test="null != refundOrderNumber and '' != refundOrderNumber">
refund_order_number,
</if>
<if test="null != userId and '' != userId">
user_id,
</if>
<if test="null != openId and '' != openId">
open_id,
</if>
<if test="null != alipayId and '' != alipayId">
alipay_id,
</if>
<if test="null != amount and '' != amount">
amount,
</if>
<if test="null != type and '' != type">
type,
</if>
<if test="null != examineStatus and '' != examineStatus">
examine_status,
</if>
<if test="null != status and '' != status">
status,
</if>
<if test="null != delFlag and '' != 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 != source">
source,
</if>
<if test="null != tenantId">
tenant_id,
</if>
</trim>
<trim prefix="values (" suffix=")" suffixOverrides=",">
<if test="null != refundOrderNumber and '' != refundOrderNumber">
#{refundOrderNumber},
</if>
<if test="null != userId and '' != userId">
#{userId},
</if>
<if test="null != openId and '' != openId">
#{openId},
</if>
<if test="null != alipayId and '' != alipayId">
#{alipayId},
</if>
<if test="null != amount and '' != amount">
#{amount},
</if>
<if test="null != type and '' != type">
#{type},
</if>
<if test="null != examineStatus and '' != examineStatus">
#{examineStatus},
</if>
<if test="null != status and '' != status">
#{status},
</if>
<if test="null != delFlag and '' != 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 != source">
#{source},
</if>
<if test="null != tenantId">
#{tenantId},
</if>
</trim>
</insert>
<update id="updateRechargeOrderRefundStatus">
update xhpc_recharge_order set refund_status=2 where user_id=#{userId} and source =#{source} and (refund_status=0 or refund_status =1)
</update>
</mapper>

View File

@ -149,8 +149,7 @@ public class ChargingController {
@PutMapping("charging/stop/{orderNo}/{pileNo}/{connectorId}/{version}")
public R stopCharging(@PathVariable("orderNo") String orderNo, @PathVariable("pileNo") String pileNo,
@PathVariable("connectorId") String connectorId,
@PathVariable(
"version") String version) {
@PathVariable("version") String version) {
String pkey = "pile:".concat(pileNo);
Map<String, String> cachePile = REDIS.getCacheMap(pkey);
@ -398,8 +397,34 @@ public class ChargingController {
public static void main(String[] args) {
Integer f70C0000 = HexUtils.reverseHexInt("0000");
System.out.println("f70C0000 转化成="+f70C0000);
Integer F401 = HexUtils.reverseHexInt("F401");
System.out.println("F401 转化成="+F401);
Integer D007 = HexUtils.reverseHexInt("D007");
System.out.println("D007 转化成="+D007);
Integer F620 = HexUtils.reverseHexInt("F620");
System.out.println("F620 转化成="+F620);
Integer F03 = HexUtils.reverseHexInt("03");
System.out.println("F03 转化成="+F03);
Integer D3C0F = HexUtils.reverseHexInt("3C0F");
System.out.println("3C0F 转化成="+D3C0F);
Integer f4C1D = HexUtils.reverseHexInt("4C1D");
System.out.println("f4C1D 转化成="+f4C1D);
Integer DC05 = HexUtils.reverseHexInt("DC05");
System.out.println("DC05 转化成="+DC05);
Integer A00F = HexUtils.reverseHexInt("A00F");
System.out.println("A00F 转化成="+A00F);
Integer FCF3 = HexUtils.reverseHexInt("FCF3");
System.out.println("FCF3 转化成="+FCF3);
Integer f70C0001 = HexUtils.reverseHexInt("D8B68A0400");
System.out.println("f70C0001 转化成="+f70C0001);

View File

@ -5,7 +5,9 @@ import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.core.utils.HttpUtils;
import com.xhpc.common.enums.StationDeviceEnum;
import com.xhpc.evcs.cdjgpc.dto.CDEquipmentInfo;
import com.xhpc.evcs.domain.XhpcChargingPile;
import com.xhpc.evcs.dto.ConnectorInfo;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import com.xhpc.pp.logic.RateModelRequestLogic;
import com.xhpc.pp.logic.RemoteRebootDataLogic;
@ -23,12 +25,7 @@ import org.springframework.web.bind.annotation.RestController;
import javax.annotation.Resource;
import java.io.IOException;
import java.util.Arrays;
import java.util.Calendar;
import java.util.Collection;
import java.util.Date;
import java.util.Map;
import java.util.Set;
import java.util.*;
import java.util.concurrent.TimeUnit;
import static cn.hutool.core.date.DatePattern.NORM_DATETIME_FORMAT;
@ -50,7 +47,7 @@ public class PileController {
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
private final String[] GUNNAMES = {"", "A", "B", "C", "D"};
@PostMapping("pile/whitelist/add/{stationId}/{version}")
public Object addWhitelist(@PathVariable("stationId") Long stationId,
@ -92,6 +89,7 @@ public class PileController {
cachePile.put("nationalStandard", xhpcChargingPile.getNationalStandard().equals("2011") ? 1 : 2);
cachePile.put("equipmentType", xhpcChargingPile.getEquipmentType());
REDIS.setCacheMap("pile:".concat(pileNo), cachePile);
getEquipmentInfo(xhpcChargingPile);
}
}
//添加桩和枪信息
@ -422,4 +420,62 @@ public class PileController {
}
return R.ok();
}
//组装充电设备接口信息
public void getEquipmentInfo(XhpcChargingPile xhpcChargingPile){
String serialNumber = xhpcChargingPile.getSerialNumber();
String skey = "cdjgpc:pile:".concat(serialNumber)+".notification";
REDIS.deleteObject(skey);
CDEquipmentInfo cdEquipmentInfo = new CDEquipmentInfo();
cdEquipmentInfo.setEquipmentID(serialNumber);
cdEquipmentInfo.setManufacturerID(xhpcChargingPile.getManufacturerId());
cdEquipmentInfo.setManufacturerName(xhpcChargingPile.getManufactureName());
cdEquipmentInfo.setEquipmentModel(xhpcChargingPile.getBrandModel());
cdEquipmentInfo.setEquipmentProductCode(xhpcChargingPile.getEquipmentProductCode());
cdEquipmentInfo.setTransformerID(xhpcChargingPile.getTransformerID());
cdEquipmentInfo.setProductionDate(xhpcChargingPile.getProductionDate());
cdEquipmentInfo.setConstructionTime(xhpcChargingPile.getConstructionTime());
cdEquipmentInfo.setEquipmentType(xhpcChargingPile.getEquipmentType());
cdEquipmentInfo.setEquipmentStatus(xhpcChargingPile.getEquipmentStatus());
cdEquipmentInfo.setEquipmentPurpose(xhpcChargingPile.getEquipmentPurpose());
cdEquipmentInfo.setEquipmentPower(xhpcChargingPile.getPower());
cdEquipmentInfo.setNewNationalStandard(xhpcChargingPile.getNewNationalStandard());
cdEquipmentInfo.setVinFlag(xhpcChargingPile.getVinFlag());
cdEquipmentInfo.setConnectorInfos(getConnectorInfos(serialNumber,xhpcChargingPile));
REDIS.setCacheObject(skey, cdEquipmentInfo);
}
private List<ConnectorInfo> getConnectorInfos(String pileNo,XhpcChargingPile xhpcChargingPile) {
final Map<String, Object> cachePile = REDIS.getCacheMap("pile:".concat(pileNo));
List<ConnectorInfo> connectorInfoList = new ArrayList<>();
Integer gunNumCache = (Integer) cachePile.get("gunNum");
gunNumCache = gunNumCache == null ? 2 : gunNumCache;
for (int i = 1; i <= gunNumCache; i++) {
String gunId = pileNo.concat(String.format("%02d", i));
ConnectorInfo connectorInfo = new ConnectorInfo();
connectorInfo.setConnectorID(gunId);
String connectorName = REDIS.getCacheMapValue("gun:".concat(gunId), "terminalName"); //todo set them in redis!
connectorInfo.setConnectorName(connectorName == null ?
Integer.parseInt(pileNo.substring(10, 14)) + "号桩-" + GUNNAMES[i] +
"" : connectorName);
Integer connectorType = (Integer) cachePile.get("connectorType");
connectorInfo.setConnectorType(connectorType == null ? 4 : connectorType);
Integer voltageUpperLimits = xhpcChargingPile.getMaxVoltage().intValue();
connectorInfo.setVoltageUpperLimits(voltageUpperLimits == null ? 750 : voltageUpperLimits);
Integer voltageLowerLimits = xhpcChargingPile.getMinVoltage().intValue();
connectorInfo.setVoltageLowerLimits(voltageLowerLimits == null ? 300 : voltageLowerLimits);
Integer current = (Integer) cachePile.get("current");
connectorInfo.setCurrent(current == null ? 250 : current);
Double power = xhpcChargingPile.getPower();
connectorInfo.setPower(power == null ? 120.0 : power);
Integer nationalStandard = (Integer) cachePile.get("nationalStandard");
connectorInfo.setNationalStandard(nationalStandard == null ? 2 : nationalStandard);
connectorInfoList.add(connectorInfo);
}
return connectorInfoList;
}
}

View File

@ -1,18 +1,29 @@
package com.xhpc.pp.controller;
import com.xhpc.common.api.ChargingStationService;
import com.xhpc.common.api.dto.ChargingStationDto;
import com.xhpc.common.core.domain.R;
import com.xhpc.common.data.redis.CacheRateModel;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;
import com.xhpc.evcs.cdjgpc.dto.CDEquipmentInfo;
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
import com.xhpc.pp.mapper.XhpcDeviceMessageMapper;
import org.springframework.web.bind.annotation.*;
import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import java.util.Set;
import static com.xhpc.common.data.redis.StaticBeanUtil.REDIS;
@RestController
public class StationController {
@Resource
XhpcDeviceMessageMapper deviceMessageMapper;
@PostMapping("station/rateModel/{stationId}/{rateModelId}")
public Object setStationRateModel(@PathVariable Long stationId, @PathVariable Long rateModelId, @RequestBody CacheRateModel rateModel) {
@ -23,7 +34,50 @@ public class StationController {
REDIS.setCacheObject(skey, cacheStation);
String rkey = "rateModel:".concat(rateModelId.toString());
REDIS.setCacheObject(rkey, rateModel);
addNotificationStationInfo(stationId);
return R.ok();
}
//组装场站信息
public void addNotificationStationInfo(Long stationId){
CDStationInfo xhpcChargingStation = deviceMessageMapper.getXhpcChargingStation(stationId);
if(xhpcChargingStation !=null){
//场站信息入缓存
String skey = "cdjgpc:station:".concat(stationId.toString())+".notification";
REDIS.deleteObject(skey);
xhpcChargingStation.setEquipmentInfos(new ArrayList<>());
REDIS.setCacheObject(skey, xhpcChargingStation);
}
}
//组合场站数据
@GetMapping("station/getNotificationStationInfo/{stationId}")
public R getNotificationStationInfo(Long chargingStationId){
String key = "cdjgpc:station:".concat(chargingStationId.toString())+".notification";
CDStationInfo cdStationInfo = REDIS.getCacheObject(key);
cdStationInfo.setEquipmentInfos(new ArrayList<>());
//查询场站是桩是否对应上
ChargingStationDto stationDto = REDIS.getCacheObject("station:"+chargingStationId);
Set<String> pks = stationDto.getPiles();
if (pks != null) {
List<CDEquipmentInfo> cdEquipmentInfos = new ArrayList<>();
for (String pileNo : pks) {
String pk = "pile:".concat(pileNo);
String skey = "cdjgpc:".concat(pk)+".notification";
CDEquipmentInfo cdEquipmentInfo = REDIS.getCacheObject(skey);
if(cdEquipmentInfo==null || "".equals(cdEquipmentInfo.getEquipmentID())){
return R.fail("该场站下面:"+pileNo+"桩未录入");
}
cdEquipmentInfos.add(cdEquipmentInfo);
}
cdStationInfo.setEquipmentInfos(cdEquipmentInfos);
REDIS.setCacheObject(key, cdStationInfo);
return R.ok();
}
return R.fail("场站未查询到充电桩信息");
}
}

View File

@ -25,6 +25,10 @@ public class BmsChargingCompletedDataLogic implements ServiceLogic {
@Override
public ServiceResult service(ServiceParameter sp) throws Exception {
log.error("====0X19======getServiceName================"+sp.getServiceName());
log.error("====0X19======getPileNo================"+sp.getPileNo());
log.error("====0X19======getParameters================"+sp.getParameters());
log.error("====0X19======getVersion================"+sp.getVersion());
String remark = "充电桩与 BMS 充电结束阶段报文";
Map<String, Object> req = sp.getParameters();

View File

@ -29,7 +29,10 @@ public class RemoteStopReplyDataLogic implements ServiceLogic {
@Override
public ServiceResult service(ServiceParameter sp) throws Exception {
log.error("=====0X35=====getServiceName================"+sp.getServiceName());
log.error("=====0X35=====getPileNo================"+sp.getPileNo());
log.error("=====0X35=====getParameters================"+sp.getParameters());
log.error("=====0X35=====getVersion================"+sp.getVersion());
Map<String, Object> req = sp.getParameters();
ObjectMapper objectMapper = new ObjectMapper();
RemoteStopReplyData remoteStopReplyData = objectMapper.convertValue(req, RemoteStopReplyData.class);

View File

@ -21,6 +21,10 @@ public class ServiceMainLogic {
private Map<String, ServiceLogic> serviceLogics;
public ServiceResult process(ServiceParameter sp) {
log.error("==========getServiceName================"+sp.getServiceName());
log.error("==========getPileNo================"+sp.getPileNo());
log.error("==========getParameters================"+sp.getParameters());
log.error("==========getVersion================"+sp.getVersion());
ServiceResult result;
try {
ServiceLogic logic = getServiceLogic(sp.getServiceName());

View File

@ -1,6 +1,7 @@
package com.xhpc.pp.mapper;
import com.xhpc.evcs.cdjgpc.dto.CDStationInfo;
import com.xhpc.evcs.domain.XhpcChargingPile;
import com.xhpc.pp.domain.XhpcDeviceMessage;
import org.apache.ibatis.annotations.Mapper;
@ -16,4 +17,5 @@ public interface XhpcDeviceMessageMapper {
XhpcChargingPile getXhpcChargingPile(@Param("pileNo") String pileNo);
CDStationInfo getXhpcChargingStation(@Param("chargingStationId") Long chargingStationId);
}

View File

@ -78,6 +78,7 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
log.error("incorrect input data |{}| len[{}]", dataStr, d.length);
}
String crc = calcCrc(d);
log.info("====111=====crc==================="+crc+"==========dataStr==============="+dataStr);
if (!dataStr.endsWith(crc)) {
log.error("incorrect input data crc {}", crc);
continue;
@ -93,11 +94,13 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
InterruptedException {
String serviceName = toHex(data, 5, 6);
log.error("==========ChargingPileBinaryHandler================"+serviceName);
String version = ChargingPileServer.getVersion(handler.getName());
Map<String, Object> req = analysis(data, serviceName, version);
int seq = HexUtils.toInteger(data, 2, 4);
req.put("seqint", seq);
String pileNo = (String) req.get("pileNo");
log.error("==========ChargingPileBinaryHandler====="+serviceName+"======req====="+req.toString());
ServiceParameter sp = new ServiceParameter(serviceName, pileNo, req);
ServiceResult result = servicemainLogic.process(sp);
String resultCode = result.getCode();
@ -243,12 +246,20 @@ public class ChargingPileBinaryHandler implements ClientBinaryHandler {
}
public static void main(String[] args) {
byte[] data ={104, 34, 0, -125, 0, 1, -128, -125, 96, 0, 6, 0, 1, 1, 2, 12, 78, 71, 53, 46, 52, 46, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -89, -69};
// byte[] data ={104, 34, 0, -125, 0, 1, -128, -125, 96, 0, 6, 0, 1, 1, 2, 12, 78, 71, 53, 46, 52, 46, 55, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, -89, -69};
//
// byte[] datas ={100,101,102,103,104,105,106,107,108,10,11,12,13,14,15,16,17,18,19,109};
// int i = HexUtils.toInteger(datas, 1, 2) ;
//
// System.out.println(i);
String dataStr ="68A700C0003B80836000180001012309081438500002808360001800010150C3260E0809175898270E080917C027090000000000000000000000000000350C0000000000000000000000000040420F00000000000000000000000000804F12000000000000000000000000005C3B0400005C3B040000000000000000000000000000534149544552303030303030303030303101409C270E08091740000000000000000000660100006D70";
String crc ="6D70";
boolean b = dataStr.endsWith(crc);
System.out.println("==b=="+b);
byte[] datas ={100,101,102,103,104,105,106,107,108,10,11,12,13,14,15,16,17,18,19,109};
int i = HexUtils.toInteger(datas, 1, 2) ;
System.out.println(i);
}

View File

@ -17,6 +17,48 @@
<result property="remark" column="remark"/>
</resultMap>
<resultMap id="BaseResultMap" type="com.xhpc.evcs.domain.XhpcChargingPile">
<result property="id" column="charging_pile_id"/>
<result property="chargingStationId" column="charging_station_id"/>
<result property="name" column="name"/>
<result property="nationalStandard" column="national_standard"/>
<result property="power" column="power"/>
<result property="auxiliaryPowerSupply" column="auxiliary_power_supply"/>
<result property="inputVoltage" column="input_voltage"/>
<result property="maxVoltage" column="max_voltage"/>
<result property="minVoltage" column="min_voltage"/>
<result property="maxElectricCurrent" column="max_electric_current"/>
<result property="minElectricCurrent" column="min_electric_current"/>
<result property="serialNumber" column="serial_number"/>
<result property="type" column="type"/>
<result property="programVersion" column="program_version"/>
<result property="networkLinkType" column="network_link_type"/>
<result property="gunNumber" column="gun_number"/>
<result property="communicationProtocolVersion" column="communication_protocol_version"/>
<result property="communicationOperator" column="communication_operator"/>
<result property="simCard" column="sim_card"/>
<result property="rateModelId" column="rate_model_id"/>
<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="brandModel" column="brand_model"/>
<result property="manufactureName" column="manufacture_name"/>
<result property="connectorType" column="connector_type"/>
<result property="equipmentType" column="equipment_type"/>
<result property="current" column="current"/>
<result property="searchValue" column="search_value"/>
<result property="equipmentProductCode" column="equipment_product_code"/>
<result property="transformerID" column="transformer_id"/>
<result property="newNationalStandard" column="new_national_standard"/>
<result property="vinFlag" column="vin_flag"/>
<result property="equipmentStatus" column="equipment_status"/>
<result property="equipmentPurpose" column="equipment_purpose"/>
<result property="manufacturerId" column="manufacturer_id"/>
</resultMap>
<insert id="insertByDomain" parameterType="com.xhpc.pp.domain.XhpcDeviceMessage">
insert into xhpc_device_message(
@ -49,9 +91,91 @@
where create_time <![CDATA[ <= ]]> #{expireDate};
</delete>
<select id="getXhpcChargingPile" parameterType="com.xhpc.evcs.domain.XhpcChargingPile">
select * from xhpc_charging_pile where serial_number =#{pileNo} and del_flag =0 limit 1
<select id="getXhpcChargingPile" parameterType="com.xhpc.evcs.domain.XhpcChargingPile"
resultType="com.xhpc.evcs.domain.XhpcChargingPile">
select
xcp.charging_pile_id as id,
xcp.charging_station_id as chargingStationId,
xcp.name name,
xcp.national_standard as nationalStandard,
xcp.power power,
xcp.auxiliary_power_supply auxiliaryPowerSupply,
xcp.input_voltage inputVoltage,
xcp.max_voltage maxVoltage,
xcp.min_voltage minVoltage,
xcp.max_electric_current maxElectricCurrent,
xcp.min_electric_current minElectricCurrent,
xcp.serial_number serialNumber,
xcp.type type,
xcp.program_version programVersion,
xcp.network_link_type networkLinkType,
xcp.gun_number gunNumber,
xcp.communication_protocol_version communicationProtocolVersion,
xcp.communication_operator communicationOperator,
xcp.sim_card simCard,
xcp.status status,
xcp.del_flag delFlag,
xcp.rate_model_id rateModelId,
xcp.brand_model brandModel,
date_format(xcp.production_date,'%Y-%m-%d') productionDate,
xcp.manufacture_name manufactureName,
xcp.connector_type connectorType,
xcp.equipment_type equipmentType,
xcp.current as current,
xcp.search_value searchValue,
xcp.equipment_product_code equipmentProductCode,
xcp.transformer_id transformerID,
xcp.new_national_standard newNationalStandard,
xcp.vin_flag vinFlag,
xcp.equipment_status equipmentStatus,
xcp.equipment_purpose equipmentPurpose,
xcp.manufacturer_id manufacturerId,
date_format(xcs.construction_time,'%Y-%m-%d') as constructionTime
from xhpc_charging_pile xcp
left join xhpc_charging_station xcs on xcs.charging_station_id = xcp.charging_station_id
where xcp.serial_number =#{pileNo} and xcp.del_flag =0 limit 1
</select>
<select id="getXhpcChargingStation" parameterType="com.xhpc.evcs.cdjgpc.dto.CDStationInfo"
resultType="com.xhpc.evcs.cdjgpc.dto.CDStationInfo">
select CAST(ct.charging_station_id AS CHAR(10)) as stationId,
ct.name as stationName,
ct.operator_id_evcs as operatorId,
ct.equipment_owner_id as equipmentOwnerId,
ct.is_alone_apply as isAloneApply,
ct.account_number as accountNumber,
ct.capacity as capacity,
ct.country_code as countryCcode,
CAST(ct.area_code AS CHAR(10)) as areaCode,
ct.address as address,
ct.service_tel as serviceTel,
ct.station_type as stationType,
ct.is_open as isOpen,
ct.country_code as countryCode,
ct.station_status as stationStatus,
ct.park_nums as parkNums,
ROUND(ct.longitude,6) as stationLng,
ROUND(ct.latitude,6) as stationLat,
ct.construction_site as construction,
ct.open_all_day as openAllDay,
ct.busine_hours as busineHours,
ct.service_fee as serviceFee,
ct.park_free as parkFree,
ct.park_fee as parkFee,
ct.payment as payment,
ct.park_fee_type as parkFeeType,
ct.toilet_flag as toiletFlag,
ct.store_flag as storeFlag,
ct.lounge_flag as loungeFlag,
ct.canopy_flag as canopyFlag,
ct.printer_flag as printerFlag,
ct.barrier_flag as barrierFlag,
ct.parking_lock_flag as parkingLockFlag,
ct.is_demand_response as isDemandResponse,
ct.is_support_orderly_charging as isSupportOrderlyCharging,
ct.is_energystorage as isEnergystorage
from xhpc_charging_station as ct
where ct.charging_station_id = #{chargingStationId}
and ct.del_flag = 0
</select>
</mapper>

View File

@ -192,6 +192,7 @@
<select id="selectAppUserList" parameterType="java.lang.Long" resultType="java.util.Map">
select xau.app_user_id appUserId, xau.phone, xau.balance,soc,
xau.weixin_open_id weixinOpenId,xau.alipay_open_id alipayOpenId,tenant_id tenantId,
xau.`status`,xau.create_time createTime,xau.is_refund_application isRefundApplication,
CASE WHEN xau.`status` = 0 THEN '正常' else '禁用' end statusName,
CASE WHEN a.count > 0 THEN '老用户' else '新用户' end newUser

View File

@ -250,6 +250,8 @@
community_personnel_id AS communityPersonnelId,
name AS name,
community_id AS communityId,
weixin_open_id as weixinOpenId,
alipay_open_id AS alipayOpenId,
account AS account,
phone AS phone,
recharge_money AS rechargeMoney,