mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-23 12:35:07 +08:00
update
This commit is contained in:
@@ -23,6 +23,7 @@ import com.jsowell.pile.thirdparty.ConnectorInfo;
|
||||
import com.jsowell.pile.thirdparty.EquipmentInfo;
|
||||
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.pile.vo.base.ConnectorInfoVO;
|
||||
import com.jsowell.pile.vo.base.MerchantInfoVO;
|
||||
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO;
|
||||
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
|
||||
@@ -73,6 +74,9 @@ public class WeiWangKuaiDianPlatformServiceImpl implements ThirdPartyPlatformSer
|
||||
@Autowired
|
||||
private PileConnectorInfoService pileConnectorInfoService;
|
||||
|
||||
@Autowired
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
@@ -153,6 +157,83 @@ public class WeiWangKuaiDianPlatformServiceImpl implements ThirdPartyPlatformSer
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 推送站点信息
|
||||
* @param stationId 充电站id
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public String notificationStationInfo(String stationId) {
|
||||
List<SupStationInfo> stationInfos = new ArrayList<>();
|
||||
// 通过id查询站点相关信息
|
||||
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(Long.parseLong(stationId));
|
||||
// 查询相关配置信息
|
||||
ThirdPartySecretInfoVO ningBoSecretInfoVO = getweiWangKuaiDianPlatformSecretInfo();
|
||||
|
||||
String operatorId = Constants.OPERATORID_JIANG_SU;
|
||||
String operatorSecret = ningBoSecretInfoVO.getTheirOperatorSecret();
|
||||
String signSecret = ningBoSecretInfoVO.getTheirSigSecret();
|
||||
String dataSecret = ningBoSecretInfoVO.getTheirDataSecret();
|
||||
String dataSecretIv = ningBoSecretInfoVO.getTheirDataSecretIv();
|
||||
String urlAddress = ningBoSecretInfoVO.getTheirUrlPrefix();
|
||||
|
||||
// 组装中电联平台所需要的数据格式
|
||||
SupStationInfo info = SupStationInfo.builder()
|
||||
.stationID(stationId)
|
||||
.operatorID(Constants.OPERATORID_JIANG_SU)
|
||||
// .equipmentOwnerId(Constants.OPERATORID_JIANG_SU)
|
||||
.stationName(pileStationInfo.getStationName())
|
||||
.countryCode(pileStationInfo.getCountryCode())
|
||||
.areaCode(pileStationInfo.getAreaCode())
|
||||
.address(pileStationInfo.getAddress())
|
||||
.serviceTel(pileStationInfo.getStationTel())
|
||||
.stationType(Integer.valueOf(pileStationInfo.getStationType()))
|
||||
.stationStatus(Integer.valueOf(pileStationInfo.getStationStatus()))
|
||||
.parkNums(Integer.valueOf(pileStationInfo.getParkNums()))
|
||||
.stationLng(new BigDecimal(pileStationInfo.getStationLng()))
|
||||
.stationLat(new BigDecimal(pileStationInfo.getStationLat()))
|
||||
.construction(Integer.valueOf(pileStationInfo.getConstruction()))
|
||||
.build();
|
||||
String areaCode = pileStationInfo.getAreaCode(); // 330000,330200,330213
|
||||
// 根据逗号分组
|
||||
String[] split = StringUtils.split(areaCode, ",");
|
||||
// 只取最后一部分 330213
|
||||
String subAreaCode = split[split.length - 1];
|
||||
info.setAreaCode(subAreaCode);
|
||||
// 截取运营商组织机构代码(去除最后一位后的最后九位)
|
||||
MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId()));
|
||||
String organizationCode = merchantInfo.getOrganizationCode();
|
||||
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
|
||||
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
|
||||
info.setEquipmentOwnerID(equipmentOwnerId);
|
||||
}
|
||||
// 站点图片
|
||||
if (StringUtils.isNotBlank(pileStationInfo.getPictures())) {
|
||||
info.setPictures(Lists.newArrayList(pileStationInfo.getPictures().split(",")));
|
||||
}
|
||||
|
||||
List<EquipmentInfo> pileList = getPileList(pileStationInfo);
|
||||
if (CollectionUtils.isNotEmpty(pileList)) {
|
||||
info.setEquipmentInfos(pileList); // 充电设备信息列表
|
||||
}
|
||||
stationInfos.add(info);
|
||||
|
||||
// 调用中电联平台接口
|
||||
String url = urlAddress + "notification_stationInfo";
|
||||
|
||||
JSONObject data = new JSONObject();
|
||||
data.put("StationInfos", stationInfos);
|
||||
|
||||
String jsonString = JSON.toJSONString(data);
|
||||
System.out.println("jsonString : " + jsonString);
|
||||
|
||||
// 获取令牌
|
||||
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
||||
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* 查询站点信息
|
||||
* @param dto 查询站点信息dto
|
||||
|
||||
Reference in New Issue
Block a user