This commit is contained in:
Lemon
2023-11-07 08:59:56 +08:00
parent 12c7cb7927
commit 3e4152e62a
3 changed files with 174 additions and 45 deletions

View File

@@ -20,6 +20,8 @@ import com.jsowell.thirdparty.lianlian.util.Cryptos;
import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.lianlian.util.GBSignUtils;
import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil;
import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO;
import com.jsowell.thirdparty.yongchengboche.service.YCBCService;
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLConnectorInfo;
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLEquipmentInfo;
import com.jsowell.thirdparty.zhongdianlian.domain.ZDLStationInfo;
@@ -48,6 +50,9 @@ public class ZDLServiceImpl implements ZDLService {
@Autowired
private LianLianService lianLianService;
@Autowired
private YCBCService ycbcService;
@Autowired
private IPileStationInfoService pileStationInfoService;
@@ -109,6 +114,7 @@ public class ZDLServiceImpl implements ZDLService {
String dataSecret = relationInfo.getDataSecret();
String dataSecretIv = relationInfo.getDataSecretIv();
String urlAddress = relationInfo.getUrlAddress();
String thirdPartyType = relation.getThirdPartyType();
// 组装中电联平台所需要的数据格式
ZDLStationInfo info = ZDLStationInfo.builder()
@@ -151,22 +157,31 @@ public class ZDLServiceImpl implements ZDLService {
System.out.println("jsonString : " + jsonString);
// 获取令牌
ZDLGetTokenDTO tokenDTO = ZDLGetTokenDTO.builder()
.urlAddress(urlAddress)
.operatorId(operatorId)
.operatorSecret(operatorSecret)
.dataSecret(dataSecret)
.dataSecretIv(dataSecretIv)
.signSecret(signSecret)
.build();
String token = ZDLGetToken(tokenDTO);
String token = "";
String result = "";
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), relationInfo.getThirdPartyType())) {
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) {
YCBCGetTokenDTO ycbcGetTokenDTO = new YCBCGetTokenDTO();
ycbcGetTokenDTO.setOperatorId(operatorId);
ycbcGetTokenDTO.setDataSecret(dataSecret);
ycbcGetTokenDTO.setSignSecret(signSecret);
ycbcGetTokenDTO.setUrlAddress(urlAddress);
ycbcGetTokenDTO.setDataSecretIv(dataSecretIv);
ycbcGetTokenDTO.setOperatorSecret(operatorSecret);
token = ycbcService.YCBCGetToken(ycbcGetTokenDTO);
result = HttpRequestUtil.YCBCSendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
}else {
ZDLGetTokenDTO tokenDTO = ZDLGetTokenDTO.builder()
.urlAddress(urlAddress)
.operatorId(operatorId)
.operatorSecret(operatorSecret)
.dataSecret(dataSecret)
.dataSecretIv(dataSecretIv)
.signSecret(signSecret)
.build();
token = ZDLGetToken(tokenDTO);
result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
}
// System.out.println(result);
return result;
}