mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-21 03:25:12 +08:00
update 联联平台相关配置信息从数据库调取
This commit is contained in:
@@ -28,6 +28,7 @@ import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
|
||||
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileModelInfoVO;
|
||||
import com.jsowell.pile.vo.web.PileStationVO;
|
||||
import com.jsowell.thirdparty.domain.*;
|
||||
import com.jsowell.thirdparty.service.LianLianService;
|
||||
import com.jsowell.thirdparty.vo.*;
|
||||
@@ -42,11 +43,11 @@ import java.util.stream.Collectors;
|
||||
@Service
|
||||
public class LianLianServiceImpl implements LianLianService {
|
||||
private static final String TEST_URL = "http://dataexchange.evchargeonline.com:81/shevcs/v1/"; // http://testdataexchange.evchargeonline.com:82/shevcs/v1/
|
||||
private static final String OPERATOR_ID = "MA1JLFUU8"; // MA1JLFUU8 987654321
|
||||
private static final String OPERATOR_SECRET = "fGwLsxW1HdzLw7jp"; // fGwLsxW1HdzLw7jp 1234567890abcdef
|
||||
private static final String SIG_SECRET = "TmsdVaFVTtjzZbLi"; // 签名秘钥 TmsdVaFVTtjzZbLi 1234567890abcdef
|
||||
private static final String DATA_SECRET = "R1Hdq80mSWswwCzt"; // 消息密钥 R1Hdq80mSWswwCzt 1234567890abcdef
|
||||
private static final String DATA_SECRETIV = "LVpz3qHD8sM2PYjl"; // 消息密钥初始化向量 LVpz3qHD8sM2PYjl 1234567890abcdef
|
||||
// private static final String OPERATOR_ID = "MA1JLFUU8"; // MA1JLFUU8 987654321
|
||||
// private static final String OPERATOR_SECRET = "fGwLsxW1HdzLw7jp"; // fGwLsxW1HdzLw7jp 1234567890abcdef
|
||||
// private static final String SIG_SECRET = "TmsdVaFVTtjzZbLi"; // 签名秘钥 TmsdVaFVTtjzZbLi 1234567890abcdef
|
||||
// private static final String DATA_SECRET = "R1Hdq80mSWswwCzt"; // 消息密钥 R1Hdq80mSWswwCzt 1234567890abcdef
|
||||
// private static final String DATA_SECRETIV = "LVpz3qHD8sM2PYjl"; // 消息密钥初始化向量 LVpz3qHD8sM2PYjl 1234567890abcdef
|
||||
|
||||
@Autowired
|
||||
private IPileMerchantInfoService pileMerchantInfoService;
|
||||
@@ -72,6 +73,9 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
@Autowired
|
||||
private IPileBillingTemplateService pileBillingTemplateService;
|
||||
|
||||
@Autowired
|
||||
private IThirdPartySettingInfoService thirdPartySettingInfoService;
|
||||
|
||||
@Override
|
||||
public void pushMerchantInfo(Long merchantId) {
|
||||
// 通过id查询运营商信息
|
||||
@@ -101,10 +105,21 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
|
||||
// 通过id查询站点相关信息
|
||||
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(dto.getStationId());
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(dto.getStationId());
|
||||
if (settingInfo == null) {
|
||||
return;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
|
||||
// 组装联联平台所需要的数据格式
|
||||
StationInfo info = StationInfo.builder()
|
||||
.stationID(String.valueOf(dto.getStationId()))
|
||||
.operatorID(dto.getOperatorID())
|
||||
.operatorID(operatorId)
|
||||
.equipmentOwnerID(Constants.OPERATORID_LIANLIAN)
|
||||
.stationName(pileStationInfo.getStationName())
|
||||
.isAloneApply(Integer.valueOf(pileStationInfo.getAloneApply()))
|
||||
@@ -157,9 +172,9 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
System.out.println("jsonString : " + jsonString);
|
||||
|
||||
// 获取令牌
|
||||
String token = getToken(dto.getOperatorID(), OPERATOR_SECRET);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dto.getDataSecret()
|
||||
, dto.getDataSecretIV(), dto.getOperatorID(), dto.getSigSecret());
|
||||
String token = getToken(operatorId, operatorSecret);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret
|
||||
, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
System.out.println(result);
|
||||
|
||||
@@ -632,10 +647,24 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
*/
|
||||
@Override
|
||||
public String pushConnectorStatus(String pileConnectorCode, String status) {
|
||||
// 查出该桩所属哪个站点
|
||||
String pileSn = StringUtils.substring(pileConnectorCode, 0, 16);
|
||||
PileStationVO stationVO = pileStationInfoService.getStationInfoByPileSn(pileSn);
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(stationVO.getId()));
|
||||
if (settingInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
|
||||
String url = TEST_URL + "notification_stationStatus";
|
||||
|
||||
// 获取令牌
|
||||
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
|
||||
String token = getToken(operatorId, operatorSecret);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return null;
|
||||
}
|
||||
@@ -648,7 +677,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
json.put("ConnectorStatusInfo", info);
|
||||
String jsonString = JSONObject.toJSONString(json);
|
||||
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -665,12 +694,23 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
|
||||
if (settingInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
|
||||
String url = TEST_URL + "notification_orderInfo";
|
||||
|
||||
// 拼装成联联平台所需格式对象
|
||||
OrderInfo orderInfo = OrderInfo.builder()
|
||||
.operatorID(OPERATOR_ID)
|
||||
.equipmentOwnerID(OPERATOR_ID)
|
||||
.operatorID(operatorId)
|
||||
.equipmentOwnerID(Constants.OPERATORID_LIANLIAN)
|
||||
.stationID(orderBasicInfo.getStationId())
|
||||
.equipmentID(orderBasicInfo.getPileSn())
|
||||
.connectorID(orderBasicInfo.getPileConnectorCode())
|
||||
@@ -750,7 +790,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
orderInfo.setChargeDetails(chargeDetails);
|
||||
|
||||
// 获取令牌
|
||||
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
|
||||
String token = getToken(operatorId, operatorSecret);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return null;
|
||||
}
|
||||
@@ -759,7 +799,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
json.put("OrderInfo", orderInfo);
|
||||
String jsonString = JSONObject.toJSONString(json);
|
||||
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -776,10 +816,21 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
if (orderInfo == null) {
|
||||
return null;
|
||||
}
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
|
||||
if (settingInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
|
||||
// 推送启动充电结果(调用接口 notification_start_charge_result)
|
||||
String url = TEST_URL + "notification_start_charge_result";
|
||||
// 获取令牌
|
||||
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
|
||||
String token = getToken(operatorId, operatorSecret);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return null;
|
||||
}
|
||||
@@ -804,7 +855,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
|
||||
String jsonString = JSONObject.toJSONString(json);
|
||||
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -816,10 +867,23 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
*/
|
||||
@Override
|
||||
public String pushChargeStatus(String orderCode) {
|
||||
// 根据订单号查询订单信息
|
||||
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
|
||||
if (settingInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
|
||||
// 调用 查询充电状态方法
|
||||
QueryChargingStatusVO vo = query_equip_charge_status(orderCode);
|
||||
// 获取令牌
|
||||
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
|
||||
String token = getToken(operatorId, operatorSecret);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return null;
|
||||
}
|
||||
@@ -827,7 +891,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
// 调用联联平台接口
|
||||
String jsonString = JSONObject.toJSONString(vo);
|
||||
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -845,6 +909,17 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
if (orderInfo == null) {
|
||||
return null;
|
||||
}
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
|
||||
if (settingInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
|
||||
String orderStatus = orderInfo.getOrderStatus();
|
||||
String successFlag = "1";
|
||||
if (StringUtils.equals(orderStatus, OrderStatusEnum.IN_THE_CHARGING.getValue())) {
|
||||
@@ -858,7 +933,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
orderStatus = "5";
|
||||
}
|
||||
// 获取token
|
||||
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
|
||||
String token = getToken(operatorId, operatorSecret);
|
||||
if (StringUtils.isBlank(token)) {
|
||||
return null;
|
||||
}
|
||||
@@ -874,7 +949,7 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
String jsonString = JSONObject.toJSONString(json);
|
||||
|
||||
// 发送请求
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -890,6 +965,17 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
|
||||
if (settingInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("StartChargeSeq", orderCode);
|
||||
json.put("ConnectorID", orderBasicInfo.getPileConnectorCode());
|
||||
@@ -902,12 +988,12 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
json.put("StopReason", 2); // 2:BMS 停止充电
|
||||
|
||||
String jsonString = JSONObject.toJSONString(json);
|
||||
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
|
||||
String token = getToken(operatorId, operatorSecret);
|
||||
if (token == null) {
|
||||
return null;
|
||||
}
|
||||
// 发送请求
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -954,13 +1040,27 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("StartChargeSeq", orderCode);
|
||||
String jsonString = JSONObject.toJSONString(json);
|
||||
|
||||
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
|
||||
if (settingInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
|
||||
// 获取令牌
|
||||
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
|
||||
String token = getToken(operatorId, operatorSecret);
|
||||
if (StringUtils.isBlank(token)){
|
||||
return null;
|
||||
}
|
||||
// 发送请求
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
@@ -980,6 +1080,18 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
if (orderInfo == null || orderDetail == null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
// 通过站点id查询相关配置信息
|
||||
ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderInfo.getStationId()));
|
||||
if (settingInfo == null) {
|
||||
return null;
|
||||
}
|
||||
String operatorId = settingInfo.getOperatorId();
|
||||
String operatorSecret = settingInfo.getOperatorSecret();
|
||||
String signSecret = settingInfo.getSignSecret();
|
||||
String dataSecret = settingInfo.getDataSecret();
|
||||
String dataSecretIv = settingInfo.getDataSecretIv();
|
||||
|
||||
JSONObject json = new JSONObject();
|
||||
json.put("CheckOrderSeq", orderCode);
|
||||
json.put("StartTime", DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime()));
|
||||
@@ -997,13 +1109,13 @@ public class LianLianServiceImpl implements LianLianService {
|
||||
json.put("ChargeOrders", list);
|
||||
|
||||
// 获取令牌
|
||||
String token = getToken(OPERATOR_ID, OPERATOR_SECRET);
|
||||
String token = getToken(operatorId, operatorSecret);
|
||||
if (StringUtils.isBlank(token)){
|
||||
return null;
|
||||
}
|
||||
String jsonString = JSONObject.toJSONString(json);
|
||||
// 发送请求
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, DATA_SECRET, DATA_SECRETIV, OPERATOR_ID, SIG_SECRET);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user