|
|
|
|
@@ -20,6 +20,7 @@ import com.jsowell.common.util.JWTUtils;
|
|
|
|
|
import com.jsowell.common.util.PageUtils;
|
|
|
|
|
import com.jsowell.common.util.StringUtils;
|
|
|
|
|
import com.jsowell.pile.domain.*;
|
|
|
|
|
import com.jsowell.pile.dto.PushRealTimeInfoDTO;
|
|
|
|
|
import com.jsowell.pile.dto.QueryEquipChargeStatusDTO;
|
|
|
|
|
import com.jsowell.pile.dto.QueryOperatorInfoDTO;
|
|
|
|
|
import com.jsowell.pile.dto.QueryStationInfoDTO;
|
|
|
|
|
@@ -32,8 +33,11 @@ import com.jsowell.pile.vo.base.MerchantInfoVO;
|
|
|
|
|
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
|
|
|
|
|
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
|
|
|
|
import com.jsowell.pile.vo.uniapp.customer.BillingPriceVO;
|
|
|
|
|
import com.jsowell.pile.vo.uniapp.customer.CurrentTimePriceDetails;
|
|
|
|
|
import com.jsowell.pile.vo.web.PileConnectorInfoVO;
|
|
|
|
|
import com.jsowell.pile.vo.web.PileMerchantInfoVO;
|
|
|
|
|
import com.jsowell.pile.vo.web.PileStationVO;
|
|
|
|
|
import com.jsowell.pile.vo.zdl.EquipBusinessPolicyVO;
|
|
|
|
|
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
|
|
|
|
|
import com.jsowell.thirdparty.lianlian.vo.QueryChargingStatusVO;
|
|
|
|
|
import com.jsowell.thirdparty.platform.domain.*;
|
|
|
|
|
@@ -257,12 +261,35 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
|
|
|
|
|
stationInfo.setPrinterFlag(Integer.valueOf(pileStationInfo.getPrinterFlag()));
|
|
|
|
|
stationInfo.setBarrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag()));
|
|
|
|
|
stationInfo.setParkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag()));
|
|
|
|
|
// 根据桩号查询正在使用的计费模板
|
|
|
|
|
List<BillingPriceVO> billingPriceVOList = pileBillingTemplateService.queryBillingPrice(String.valueOf(pileStationInfo.getId()));
|
|
|
|
|
|
|
|
|
|
if (CollectionUtils.isEmpty(billingPriceVOList)) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
SupStationInfo.PolicyInfo policyInfo = null;
|
|
|
|
|
// 获取计费模板
|
|
|
|
|
List<SupStationInfo.PolicyInfo> policyInfoList = new ArrayList<>();
|
|
|
|
|
for (BillingPriceVO billingPriceVO : billingPriceVOList) {
|
|
|
|
|
// 将时段开始时间、电费、服务费信息进行封装
|
|
|
|
|
policyInfo = new SupStationInfo.PolicyInfo();
|
|
|
|
|
String startTime = billingPriceVO.getStartTime() + ":00"; // 00:00:00 格式
|
|
|
|
|
// 需要将中间的冒号去掉,改为 000000 格式
|
|
|
|
|
String replace = StringUtils.replace(startTime, ":", "");
|
|
|
|
|
policyInfo.setStartTime(replace);
|
|
|
|
|
policyInfo.setElecFee(new BigDecimal(billingPriceVO.getElectricityPrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
policyInfo.setServiceFee(new BigDecimal(billingPriceVO.getServicePrice()).setScale(4, BigDecimal.ROUND_HALF_UP));
|
|
|
|
|
|
|
|
|
|
policyInfoList.add(policyInfo);
|
|
|
|
|
}
|
|
|
|
|
stationInfo.setPolicyInfos(policyInfoList);
|
|
|
|
|
List<EquipmentInfo> pileList = pileBasicInfoService.getPileListForLianLian(stationId);
|
|
|
|
|
if (CollectionUtils.isNotEmpty(pileList)) {
|
|
|
|
|
stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表
|
|
|
|
|
}
|
|
|
|
|
resultList.add(stationInfo);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
Map<String, Object> map = new LinkedHashMap<>();
|
|
|
|
|
map.put("PageNo", pageInfo.getPageNum());
|
|
|
|
|
map.put("PageCount", pageInfo.getPages());
|
|
|
|
|
@@ -292,10 +319,8 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
|
|
|
|
|
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(Long.parseLong(stationId));
|
|
|
|
|
|
|
|
|
|
// 查询第三方平台配置信息
|
|
|
|
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
|
|
|
|
if (thirdPartySecretInfoVO == null) {
|
|
|
|
|
throw new BusinessException("", "无此平台配置信息");
|
|
|
|
|
}
|
|
|
|
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getZheJiangPlatformSecretInfo();
|
|
|
|
|
|
|
|
|
|
String operatorId = thirdPartySecretInfoVO.getOurOperatorId();
|
|
|
|
|
String operatorSecret = thirdPartySecretInfoVO.getTheirOperatorSecret();
|
|
|
|
|
String signSecret = thirdPartySecretInfoVO.getTheirSigSecret();
|
|
|
|
|
@@ -454,44 +479,52 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
|
|
|
|
|
public String notificationEquipChargeStatus(String orderCode) {
|
|
|
|
|
// 根据订单号查询订单信息
|
|
|
|
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
|
|
|
|
// 通过第三方平台类型查询相关配置信息
|
|
|
|
|
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
|
|
|
|
|
relation.setThirdPartyType(orderInfo.getThirdPartyType());
|
|
|
|
|
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
|
|
|
|
|
if (relationInfo == null) {
|
|
|
|
|
return null;
|
|
|
|
|
}
|
|
|
|
|
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 = relationInfo.getThirdPartyType();
|
|
|
|
|
// 查询枪口状态
|
|
|
|
|
PileConnectorInfoVO info = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(orderInfo.getPileConnectorCode());
|
|
|
|
|
|
|
|
|
|
// 调用 查询充电状态方法
|
|
|
|
|
QueryEquipChargeStatusDTO dto = new QueryEquipChargeStatusDTO();
|
|
|
|
|
dto.setStartChargeSeq(orderCode);
|
|
|
|
|
// 根据type获取operatorId
|
|
|
|
|
String operatorIdByType = ThirdPartyOperatorIdEnum.getOperatorIdByType(thirdPartyType);
|
|
|
|
|
dto.setOperatorID(operatorIdByType);
|
|
|
|
|
Map<String, String> map = queryEquipChargeStatus(dto);
|
|
|
|
|
if (map == null) {
|
|
|
|
|
return null;
|
|
|
|
|
// 查询相关配置信息
|
|
|
|
|
ThirdPartySecretInfoVO zheJiangPlatformSecretInfo = getZheJiangPlatformSecretInfo();
|
|
|
|
|
|
|
|
|
|
String operatorId = zheJiangPlatformSecretInfo.getTheirOperatorId();
|
|
|
|
|
String operatorSecret = zheJiangPlatformSecretInfo.getTheirOperatorSecret();
|
|
|
|
|
String signSecret = zheJiangPlatformSecretInfo.getTheirSigSecret();
|
|
|
|
|
String dataSecret = zheJiangPlatformSecretInfo.getTheirDataSecret();
|
|
|
|
|
String dataSecretIv = zheJiangPlatformSecretInfo.getTheirDataSecretIv();
|
|
|
|
|
String urlAddress = zheJiangPlatformSecretInfo.getTheirUrlPrefix();
|
|
|
|
|
|
|
|
|
|
String dateTime = DateUtils.getDateTime();
|
|
|
|
|
SupEquipChargeStatusInfo supEquipChargeStatusInfo = SupEquipChargeStatusInfo.builder()
|
|
|
|
|
.operatorID(Constants.OPERATORID_JIANG_SU)
|
|
|
|
|
.equipmentOwnerID(Constants.OPERATORID_JIANG_SU)
|
|
|
|
|
.stationID(orderInfo.getStationId())
|
|
|
|
|
.equipmentID(orderInfo.getPileSn())
|
|
|
|
|
.connectorID(orderInfo.getPileConnectorCode())
|
|
|
|
|
.orderNo(orderInfo.getOrderCode())
|
|
|
|
|
.orderStatus(2)
|
|
|
|
|
.pushTimeStamp(dateTime)
|
|
|
|
|
.connectorStatus(info.getStatus()) // 3-充电中
|
|
|
|
|
.currentA(info.getCurrent().setScale(1, BigDecimal.ROUND_HALF_UP))
|
|
|
|
|
.voltageA(info.getVoltage().setScale(1, BigDecimal.ROUND_HALF_UP))
|
|
|
|
|
.soc(new BigDecimal(info.getSOC()))
|
|
|
|
|
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime()))
|
|
|
|
|
.endTime(dateTime)
|
|
|
|
|
.totalPower(info.getChargingDegree())
|
|
|
|
|
.eventTime(dateTime)
|
|
|
|
|
.chargeVoltage(info.getVoltage().setScale(1, BigDecimal.ROUND_HALF_UP))
|
|
|
|
|
.chargeCurrent(info.getCurrent().setScale(1, BigDecimal.ROUND_HALF_UP))
|
|
|
|
|
.build();
|
|
|
|
|
|
|
|
|
|
// 查询运营商信息
|
|
|
|
|
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(orderInfo.getStationId());
|
|
|
|
|
String organizationCode = pileMerchantInfoVO.getOrganizationCode();
|
|
|
|
|
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
|
|
|
|
|
String equipmentOwnerId = StringUtils.substring(organizationCode, organizationCode.length() - 10, organizationCode.length() - 1);
|
|
|
|
|
supEquipChargeStatusInfo.setEquipmentOwnerID(equipmentOwnerId);
|
|
|
|
|
}
|
|
|
|
|
String data = map.get("Data");
|
|
|
|
|
// 解密data (此处解密需用 thirdparty_platform_config 的密钥配置)
|
|
|
|
|
ThirdPartyPlatformConfig configInfo = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorIdByType);
|
|
|
|
|
ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
|
|
|
|
byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64(data),
|
|
|
|
|
configInfo.getDataSecret().getBytes(), configInfo.getDataSecretIv().getBytes());
|
|
|
|
|
String dataStr = new String(plainText, StandardCharsets.UTF_8);
|
|
|
|
|
// 转成对应的对象
|
|
|
|
|
QueryChargingStatusVO vo = JSONObject.parseObject(dataStr, QueryChargingStatusVO.class);
|
|
|
|
|
|
|
|
|
|
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_EQUIP_CHARGE_STATUS.getValue();
|
|
|
|
|
// 调用联联平台接口
|
|
|
|
|
String jsonString = JSON.toJSONString(vo);
|
|
|
|
|
// 调用平台接口
|
|
|
|
|
String jsonString = JSON.toJSONString(supEquipChargeStatusInfo);
|
|
|
|
|
|
|
|
|
|
// 获取令牌
|
|
|
|
|
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
|
|
|
|
|