mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 02:55:04 +08:00
新增 华为平台充电设备编码同步接口
This commit is contained in:
17
jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiController.java
vendored
Normal file
17
jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/huawei/HuaWeiController.java
vendored
Normal file
@@ -0,0 +1,17 @@
|
||||
package com.jsowell.web.controller.thirdparty.huawei;
|
||||
|
||||
import com.jsowell.common.annotation.Anonymous;
|
||||
import org.springframework.web.bind.annotation.RequestMapping;
|
||||
import org.springframework.web.bind.annotation.RestController;
|
||||
|
||||
/**
|
||||
* 华为 Controller
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2024/1/15 13:52:05
|
||||
*/
|
||||
@Anonymous
|
||||
@RestController
|
||||
@RequestMapping("/xindiantu")
|
||||
public class HuaWeiController {
|
||||
}
|
||||
@@ -48,6 +48,7 @@ import com.jsowell.netty.handler.TransactionRecordsRequestHandler;
|
||||
import com.jsowell.netty.service.camera.impl.CameraBusinessServiceImpl;
|
||||
import com.jsowell.netty.service.yunkuaichong.YKCBusinessService;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.domain.huawei.HWStationInfo;
|
||||
import com.jsowell.pile.domain.ykcCommond.IssueQRCodeCommand;
|
||||
import com.jsowell.pile.domain.ykcCommond.ProofreadTimeCommand;
|
||||
import com.jsowell.pile.dto.*;
|
||||
@@ -258,6 +259,13 @@ public class SpringBootTestController {
|
||||
}
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testnotificationOperationSystemInfo() {
|
||||
// HWStationInfo hwStationInfo = huaWeiService.notificationOperationSystemInfo("19");
|
||||
// String s = JSONObject.toJSONString(hwStationInfo);
|
||||
// System.out.println(s);
|
||||
}
|
||||
|
||||
@Test
|
||||
public void selectByMemberWalletListTest() {
|
||||
String memberId = "12345678";
|
||||
|
||||
@@ -0,0 +1,107 @@
|
||||
package com.jsowell.pile.domain.huawei;
|
||||
|
||||
import com.fasterxml.jackson.annotation.JsonProperty;
|
||||
import lombok.AllArgsConstructor;
|
||||
import lombok.Builder;
|
||||
import lombok.Data;
|
||||
import lombok.NoArgsConstructor;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* TODO
|
||||
*
|
||||
* @author Lemon
|
||||
* @Date 2024/1/15 14:03:40
|
||||
*/
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public class HWStationInfo {
|
||||
/**
|
||||
* 充电站ID
|
||||
*/
|
||||
@JsonProperty(value = "StationId")
|
||||
private String stationId;
|
||||
|
||||
/**
|
||||
* 充电站名称
|
||||
*/
|
||||
@JsonProperty(value = "StationName")
|
||||
private String stationName;
|
||||
|
||||
/**
|
||||
* 充电设备数量
|
||||
*/
|
||||
@JsonProperty(value = "EquipmentInfoNum")
|
||||
private Integer equipmentInfoNum;
|
||||
|
||||
/**
|
||||
* 充电设备信息列表
|
||||
*/
|
||||
@JsonProperty(value = "EquipmentLogicInfos")
|
||||
private List<EquipmentLogicInfo> equipmentLogicInfos;
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public static class EquipmentLogicInfo {
|
||||
|
||||
/**
|
||||
* 充电设备编码
|
||||
*/
|
||||
@JsonProperty(value = "EquipmentID")
|
||||
private String equipmentId;
|
||||
|
||||
/**
|
||||
* 充电设备类型 N
|
||||
*/
|
||||
@JsonProperty(value = "EquipmentType")
|
||||
private Integer equipmentType;
|
||||
|
||||
/**
|
||||
* 充电设备ESN
|
||||
*/
|
||||
@JsonProperty(value = "ChargeHostESN")
|
||||
private String chargeHostESN;
|
||||
|
||||
/**
|
||||
* 充电设备接口数量
|
||||
*/
|
||||
@JsonProperty(value = "ConnectorInfoNum")
|
||||
private Integer connectorInfoNum;
|
||||
|
||||
/**
|
||||
* 充电设备接口信息列表
|
||||
*/
|
||||
@JsonProperty(value = "ConnectorInfos")
|
||||
private List<ConnectorInfo> connectorInfos;
|
||||
|
||||
|
||||
@Data
|
||||
@NoArgsConstructor
|
||||
@AllArgsConstructor
|
||||
@Builder
|
||||
public static class ConnectorInfo {
|
||||
/**
|
||||
* 充电设备接口编码
|
||||
*/
|
||||
@JsonProperty(value = "ConnectorID")
|
||||
private String connectorID;
|
||||
|
||||
/**
|
||||
* 充电设备接口编号
|
||||
*/
|
||||
@JsonProperty(value = "ConnectorNumber")
|
||||
private Integer connectorNumber;
|
||||
|
||||
/**
|
||||
* 充电设备接口名称 N
|
||||
*/
|
||||
@JsonProperty(value = "ConnectorName")
|
||||
private String connectorName;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,10 +1,8 @@
|
||||
package com.jsowell.thirdparty.huawei;
|
||||
|
||||
|
||||
import com.jsowell.pile.dto.QueryEquipChargeStatusDTO;
|
||||
import com.jsowell.pile.dto.QueryEquipmentDTO;
|
||||
import com.jsowell.pile.dto.QueryStartChargeDTO;
|
||||
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.pile.domain.huawei.HWStationInfo;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.dto.huawei.DeliverEquipBusinessDTO;
|
||||
import com.jsowell.pile.dto.huawei.ReceiveDeliverDTO;
|
||||
import com.jsowell.pile.dto.huawei.VinStartChargeDTO;
|
||||
@@ -199,4 +197,16 @@ public interface HuaWeiService {
|
||||
* @throws Exception
|
||||
*/
|
||||
Map<String, String> vinStartCharge(VinStartChargeDTO dto) throws Exception;
|
||||
|
||||
|
||||
/**
|
||||
* 平台充电设备编码同步
|
||||
* 平台 --> 华为
|
||||
*
|
||||
* notification_operation_system_info
|
||||
*
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
String notificationOperationSystemInfo(PushStationInfoDTO dto);
|
||||
}
|
||||
|
||||
@@ -9,17 +9,17 @@ import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.util.BytesUtil;
|
||||
import com.jsowell.common.util.StringUtils;
|
||||
import com.jsowell.common.util.YKCUtils;
|
||||
import com.jsowell.pile.domain.MemberPlateNumberRelation;
|
||||
import com.jsowell.pile.domain.PileBasicInfo;
|
||||
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
|
||||
import com.jsowell.pile.domain.ThirdPartyStationRelation;
|
||||
import com.jsowell.pile.domain.*;
|
||||
import com.jsowell.pile.domain.huawei.HWStationInfo;
|
||||
import com.jsowell.pile.dto.*;
|
||||
import com.jsowell.pile.dto.huawei.DeliverEquipBusinessDTO;
|
||||
import com.jsowell.pile.dto.huawei.ReceiveDeliverDTO;
|
||||
import com.jsowell.pile.dto.huawei.VinStartChargeDTO;
|
||||
import com.jsowell.pile.service.*;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
||||
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.thirdparty.huawei.HuaWeiService;
|
||||
import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO;
|
||||
import com.jsowell.thirdparty.lianlian.util.Cryptos;
|
||||
@@ -76,6 +76,12 @@ public class HuaWeiServiceImpl implements HuaWeiService {
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileStationInfoService pileStationInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileConnectorInfoService pileConnectorInfoService;
|
||||
|
||||
/**
|
||||
* 获取令牌
|
||||
* @param dto
|
||||
@@ -531,4 +537,120 @@ public class HuaWeiServiceImpl implements HuaWeiService {
|
||||
return resultMap;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 平台充电设备编码同步
|
||||
* @param dto
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String notificationOperationSystemInfo(PushStationInfoDTO dto) {
|
||||
// 通过站点id查询配置密钥等
|
||||
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
|
||||
relation.setStationId(dto.getStationId());
|
||||
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
|
||||
if (relationInfo == null) {
|
||||
// 新增
|
||||
relation.setThirdPartyType(dto.getThirdPartyType());
|
||||
thirdPartyStationRelationService.insertThirdPartyStationRelation(relation);
|
||||
|
||||
relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
|
||||
}
|
||||
String operatorId = relationInfo.getOperatorId();
|
||||
String operatorSecret = relationInfo.getOperatorSecret();
|
||||
String signSecret = relationInfo.getSignSecret();
|
||||
String dataSecret = relationInfo.getDataSecret();
|
||||
String dataSecretIv = relationInfo.getDataSecretIv();
|
||||
String urlAddress = relationInfo.getUrlAddress();
|
||||
String thirdPartyType = relation.getThirdPartyType();
|
||||
|
||||
List<HWStationInfo
|
||||
.EquipmentLogicInfo> equipmentLogicInfos = new ArrayList<>();
|
||||
|
||||
// 通过站点id查询站点信息
|
||||
PileStationVO stationInfo = pileStationInfoService.getStationInfo(String.valueOf(dto.getStationId()));
|
||||
if (stationInfo == null) {
|
||||
return null;
|
||||
}
|
||||
HWStationInfo hwStationInfo = HWStationInfo.builder()
|
||||
.stationId(stationInfo.getId())
|
||||
.stationName(stationInfo.getStationName())
|
||||
|
||||
.build();
|
||||
// 查询桩列表
|
||||
equipmentLogicInfos = getPileList(String.valueOf(dto.getStationId()));
|
||||
|
||||
hwStationInfo.setEquipmentInfoNum(equipmentLogicInfos.size());
|
||||
hwStationInfo.setEquipmentLogicInfos(equipmentLogicInfos);
|
||||
|
||||
String jsonString = JSONObject.toJSONString(hwStationInfo);
|
||||
|
||||
String url = urlAddress + "notification_operation_system_info";
|
||||
// 获取令牌
|
||||
ZDLGetTokenDTO getTokenDTO = new ZDLGetTokenDTO();
|
||||
getTokenDTO.setOperatorId(operatorId);
|
||||
getTokenDTO.setDataSecret(dataSecret);
|
||||
getTokenDTO.setSignSecret(signSecret);
|
||||
getTokenDTO.setUrlAddress(urlAddress);
|
||||
getTokenDTO.setDataSecretIv(dataSecretIv);
|
||||
getTokenDTO.setOperatorSecret(operatorSecret);
|
||||
String token = HWGetToken(getTokenDTO);
|
||||
// 发送请求
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
private List<HWStationInfo.EquipmentLogicInfo> getPileList(String stationId) {
|
||||
List<HWStationInfo
|
||||
.EquipmentLogicInfo> equipmentLogicInfos = new ArrayList<>();
|
||||
HWStationInfo
|
||||
.EquipmentLogicInfo equipmentLogicInfo = null;
|
||||
|
||||
List<PileBasicInfo> pileBasicInfos = pileBasicInfoService.getPileListByStationId(stationId);
|
||||
if (CollectionUtils.isEmpty(pileBasicInfos)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
for (PileBasicInfo pileBasicInfo : pileBasicInfos) {
|
||||
String pileSn = pileBasicInfo.getSn();
|
||||
equipmentLogicInfo = HWStationInfo.EquipmentLogicInfo.builder()
|
||||
.equipmentId(pileSn)
|
||||
// .equipmentType()
|
||||
.chargeHostESN(pileSn)
|
||||
.build();
|
||||
// 获取枪口信息
|
||||
List<HWStationInfo.EquipmentLogicInfo
|
||||
.ConnectorInfo> connectorInfoList = getConnectorInfoList(pileSn);
|
||||
if (CollectionUtils.isEmpty(connectorInfoList)) {
|
||||
continue;
|
||||
}
|
||||
equipmentLogicInfo.setConnectorInfoNum(connectorInfoList.size());
|
||||
equipmentLogicInfo.setConnectorInfos(connectorInfoList);
|
||||
|
||||
equipmentLogicInfos.add(equipmentLogicInfo);
|
||||
}
|
||||
return equipmentLogicInfos;
|
||||
}
|
||||
|
||||
private List<HWStationInfo.EquipmentLogicInfo.ConnectorInfo> getConnectorInfoList(String pileSn) {
|
||||
List<HWStationInfo.EquipmentLogicInfo
|
||||
.ConnectorInfo> connectorInfoList = new ArrayList<>();
|
||||
HWStationInfo.EquipmentLogicInfo
|
||||
.ConnectorInfo connectorInfo = null;
|
||||
|
||||
List<PileConnectorInfo> pileConnectorInfos = pileConnectorInfoService.selectPileConnectorInfoList(pileSn);
|
||||
if (CollectionUtils.isEmpty(pileConnectorInfos)) {
|
||||
return new ArrayList<>();
|
||||
}
|
||||
for (PileConnectorInfo pileConnectorInfo : pileConnectorInfos) {
|
||||
connectorInfo = HWStationInfo.EquipmentLogicInfo.ConnectorInfo.builder()
|
||||
.connectorID(pileConnectorInfo.getPileConnectorCode())
|
||||
.connectorNumber(pileConnectorInfo.getId())
|
||||
|
||||
.build();
|
||||
connectorInfoList.add(connectorInfo);
|
||||
}
|
||||
return connectorInfoList;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user