2024-01-18 17:03:08 +08:00
|
|
|
|
package com.jsowell.thirdparty.common;
|
|
|
|
|
|
|
2024-03-19 16:22:40 +08:00
|
|
|
|
import com.alibaba.fastjson2.JSON;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import com.alibaba.fastjson2.JSONObject;
|
2024-04-01 16:17:00 +08:00
|
|
|
|
import com.google.common.collect.Lists;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import com.jsowell.common.constant.CacheConstants;
|
|
|
|
|
|
import com.jsowell.common.constant.Constants;
|
|
|
|
|
|
import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
|
|
|
|
|
|
import com.jsowell.common.core.redis.RedisCache;
|
2024-04-07 14:31:11 +08:00
|
|
|
|
import com.jsowell.common.enums.parkplatform.ParkingPlatformEnum;
|
2024-01-25 16:00:35 +08:00
|
|
|
|
import com.jsowell.common.enums.thirdparty.BusinessInformationExchangeEnum;
|
2024-01-19 11:43:20 +08:00
|
|
|
|
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
|
2024-05-07 15:10:58 +08:00
|
|
|
|
import com.jsowell.common.enums.ykc.PileConnectorStatusEnum;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
|
|
|
|
|
import com.jsowell.common.enums.ykc.StartModeEnum;
|
|
|
|
|
|
import com.jsowell.common.exception.BusinessException;
|
|
|
|
|
|
import com.jsowell.common.util.DateUtils;
|
2024-01-19 11:43:20 +08:00
|
|
|
|
import com.jsowell.common.util.StringUtils;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import com.jsowell.pile.domain.OrderBasicInfo;
|
|
|
|
|
|
import com.jsowell.pile.domain.PileBasicInfo;
|
2024-01-18 17:03:08 +08:00
|
|
|
|
import com.jsowell.pile.domain.ThirdPartyStationRelation;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import com.jsowell.pile.domain.ThirdpartyParkingConfig;
|
2024-04-19 15:22:31 +08:00
|
|
|
|
import com.jsowell.pile.dto.PushRealTimeInfoDTO;
|
2024-01-18 17:03:08 +08:00
|
|
|
|
import com.jsowell.pile.dto.PushStationInfoDTO;
|
2024-03-25 08:46:40 +08:00
|
|
|
|
import com.jsowell.pile.dto.ThirdPartyCommonStartChargeDTO;
|
2024-03-26 15:35:08 +08:00
|
|
|
|
import com.jsowell.pile.dto.ThirdPartyCommonStopChargeDTO;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import com.jsowell.pile.dto.lutongyunting.BindCouponDTO;
|
2024-09-26 17:02:56 +08:00
|
|
|
|
import com.jsowell.pile.dto.nanrui.PushAlarmInfoDTO;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import com.jsowell.pile.dto.ruanjie.UseCouponDTO;
|
|
|
|
|
|
import com.jsowell.pile.service.*;
|
2024-05-10 17:00:27 +08:00
|
|
|
|
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
|
2024-01-18 17:03:08 +08:00
|
|
|
|
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
|
2024-03-20 08:18:35 +08:00
|
|
|
|
import com.jsowell.pile.vo.huawei.QueryStartChargeVO;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import com.jsowell.pile.vo.web.PileStationVO;
|
2024-03-20 08:18:35 +08:00
|
|
|
|
import com.jsowell.thirdparty.huawei.HuaweiServiceV2;
|
2024-09-13 16:12:26 +08:00
|
|
|
|
import com.jsowell.thirdparty.lianlian.service.LianLianService;
|
|
|
|
|
|
import com.jsowell.thirdparty.lutongyunting.service.LTYTService;
|
|
|
|
|
|
import com.jsowell.thirdparty.nanrui.service.NRService;
|
2024-06-05 10:06:16 +08:00
|
|
|
|
import com.jsowell.thirdparty.platform.service.impl.DianXingPlatformServiceImpl;
|
2024-05-10 15:46:01 +08:00
|
|
|
|
import com.jsowell.thirdparty.platform.service.impl.HaiNanPlatformServiceImpl;
|
2024-08-08 10:59:35 +08:00
|
|
|
|
import com.jsowell.thirdparty.platform.service.impl.NingXiaPlatformServiceImpl;
|
2024-05-10 15:46:01 +08:00
|
|
|
|
import com.jsowell.thirdparty.platform.service.impl.QingHaiPlatformServiceImpl;
|
2024-03-27 16:13:43 +08:00
|
|
|
|
import com.jsowell.thirdparty.platform.util.HttpRequestUtil;
|
2024-09-26 17:02:56 +08:00
|
|
|
|
import com.jsowell.thirdparty.platform.util.ThirdPartyPlatformUtils;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import com.jsowell.thirdparty.ruanjie.service.RJService;
|
2024-05-10 17:00:27 +08:00
|
|
|
|
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
2024-01-19 11:43:20 +08:00
|
|
|
|
import com.jsowell.thirdparty.xindiantu.service.XDTService;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO;
|
2024-01-19 11:43:20 +08:00
|
|
|
|
import com.jsowell.thirdparty.yongchengboche.service.YCBCService;
|
|
|
|
|
|
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
|
|
|
import org.apache.commons.collections4.CollectionUtils;
|
2024-06-05 10:06:16 +08:00
|
|
|
|
import org.bouncycastle.crypto.CryptoException;
|
2024-01-18 17:03:08 +08:00
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
|
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import java.io.UnsupportedEncodingException;
|
2024-06-05 10:06:16 +08:00
|
|
|
|
import java.security.NoSuchAlgorithmException;
|
|
|
|
|
|
import java.security.NoSuchProviderException;
|
|
|
|
|
|
import java.security.spec.InvalidKeySpecException;
|
2024-01-19 11:43:20 +08:00
|
|
|
|
import java.text.ParseException;
|
|
|
|
|
|
import java.util.List;
|
2024-03-20 08:18:35 +08:00
|
|
|
|
import java.util.Map;
|
2024-05-10 17:00:27 +08:00
|
|
|
|
import java.util.Objects;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
import java.util.concurrent.TimeUnit;
|
2024-01-19 11:43:20 +08:00
|
|
|
|
|
2024-01-18 17:03:08 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* TODO
|
|
|
|
|
|
*
|
|
|
|
|
|
* @author Lemon
|
|
|
|
|
|
* @Date 2024/1/18 15:11:32
|
|
|
|
|
|
*/
|
|
|
|
|
|
@Service
|
2024-01-25 11:37:38 +08:00
|
|
|
|
@Slf4j
|
2024-01-18 17:03:08 +08:00
|
|
|
|
public class CommonService {
|
|
|
|
|
|
|
2024-01-25 11:37:38 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private PileBasicInfoService pileBasicInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private PileStationInfoService pileStationInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private OrderBasicInfoService orderBasicInfoService;
|
|
|
|
|
|
|
2024-01-18 17:03:08 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private ThirdPartyStationRelationService thirdPartyStationRelationService;
|
|
|
|
|
|
|
2024-01-25 11:37:38 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private ThirdPartyParkingConfigService thirdPartyParkingConfigService;
|
|
|
|
|
|
|
2024-01-19 11:43:20 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private LianLianService lianLianService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private ZDLService zdlService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private NRService nrService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private YCBCService ycbcService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private XDTService xdtService;
|
|
|
|
|
|
|
2024-01-25 11:37:38 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private LTYTService ltytService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private RJService rjService;
|
|
|
|
|
|
|
2024-03-20 08:18:35 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private HuaweiServiceV2 huaweiServiceV2;
|
|
|
|
|
|
|
2024-01-25 11:37:38 +08:00
|
|
|
|
@Autowired
|
2024-03-27 11:46:11 +08:00
|
|
|
|
private HaiNanPlatformServiceImpl haiNanChargeService;
|
2024-01-25 11:37:38 +08:00
|
|
|
|
|
2024-04-10 09:23:38 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private QingHaiPlatformServiceImpl qingHaiPlatformService;
|
|
|
|
|
|
|
2024-05-30 09:38:29 +08:00
|
|
|
|
@Autowired
|
2024-08-08 10:59:35 +08:00
|
|
|
|
private NingXiaPlatformServiceImpl ninaXiaPlatformService;
|
2024-05-30 09:38:29 +08:00
|
|
|
|
|
2024-06-05 10:06:16 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private DianXingPlatformServiceImpl dianXingPlatformService;
|
|
|
|
|
|
|
2024-01-25 11:37:38 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private RedisCache redisCache;
|
|
|
|
|
|
|
2024-05-10 17:00:27 +08:00
|
|
|
|
@Autowired
|
|
|
|
|
|
private ThirdpartySecretInfoService thirdpartySecretInfoService;
|
|
|
|
|
|
|
|
|
|
|
|
@Autowired
|
|
|
|
|
|
private NotificationService notificationService;
|
|
|
|
|
|
|
2024-01-18 17:03:08 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 将站点--第三方平台类型对应关系存入关系表
|
|
|
|
|
|
* @param dto
|
|
|
|
|
|
*/
|
|
|
|
|
|
public void insertInfo2DataBase(PushStationInfoDTO dto) {
|
2024-03-18 09:25:01 +08:00
|
|
|
|
String thirdPartyType = dto.getThirdPartyType();
|
2024-01-18 17:03:08 +08:00
|
|
|
|
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
|
|
|
|
|
|
relation.setStationId(dto.getStationId());
|
2024-03-18 09:25:01 +08:00
|
|
|
|
relation.setThirdPartyType(thirdPartyType);
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(thirdPartyType, ThirdPlatformTypeEnum.HUA_WEI.getTypeCode())) {
|
2024-03-18 09:25:01 +08:00
|
|
|
|
relation.setStartMode(Constants.ONE);
|
|
|
|
|
|
}
|
2024-01-18 17:03:08 +08:00
|
|
|
|
ThirdPartyStationRelationVO vo = thirdPartyStationRelationService.selectRelationInfo(relation);
|
|
|
|
|
|
if (vo != null) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
// 新增数据库
|
|
|
|
|
|
thirdPartyStationRelationService.insertThirdPartyStationRelation(relation);
|
|
|
|
|
|
}
|
2024-01-19 11:43:20 +08:00
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 统一方法推送站点信息
|
|
|
|
|
|
* @param dto
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws ParseException
|
|
|
|
|
|
*/
|
|
|
|
|
|
public String commonPushStation(PushStationInfoDTO dto) throws ParseException {
|
|
|
|
|
|
List<String> types = dto.getThirdPartyTypes();
|
|
|
|
|
|
|
|
|
|
|
|
String result = "";
|
|
|
|
|
|
StringBuilder finalResult = new StringBuilder();
|
|
|
|
|
|
for (String type : types) {
|
|
|
|
|
|
dto.setThirdPartyType(type);
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), dto.getThirdPartyType())) {
|
2024-01-19 11:43:20 +08:00
|
|
|
|
// 推送联联
|
|
|
|
|
|
// result = lianLianService.pushStationInfo(dto);
|
|
|
|
|
|
result = lianLianService.pushStationInfoV2(dto);
|
|
|
|
|
|
}
|
2024-10-31 14:21:08 +08:00
|
|
|
|
// if (StringUtils.equals(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode(), dto.getThirdPartyType())) {
|
|
|
|
|
|
// // 中电联
|
|
|
|
|
|
// // result = zdlService.pushStationInfo(dto);
|
|
|
|
|
|
// result = zdlService.pushStationInfoV2(dto);
|
|
|
|
|
|
// }
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), dto.getThirdPartyType())) {
|
2024-01-19 11:43:20 +08:00
|
|
|
|
// 江苏省平台
|
|
|
|
|
|
// result = nrService.pushStationInfo(dto);
|
|
|
|
|
|
result = nrService.pushStationInfoV2(dto);
|
|
|
|
|
|
}
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), dto.getThirdPartyType())) {
|
2024-01-19 11:43:20 +08:00
|
|
|
|
// 甬城泊车平台
|
|
|
|
|
|
// result = ycbcService.pushStationInfo(dto);
|
|
|
|
|
|
result = ycbcService.pushStationInfoV2(dto);
|
|
|
|
|
|
}
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), dto.getThirdPartyType())) {
|
2024-01-19 11:43:20 +08:00
|
|
|
|
// 新电途平台
|
|
|
|
|
|
result = xdtService.pushStationInfoV2(dto);
|
|
|
|
|
|
}
|
|
|
|
|
|
// if(StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), dto.getThirdPartyType())) {
|
|
|
|
|
|
// // 华为
|
|
|
|
|
|
// result = huaWeiService.notificationOperationSystemInfo(dto);
|
|
|
|
|
|
// }
|
2024-04-08 15:26:18 +08:00
|
|
|
|
if(StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1_PLATFORM.getTypeCode(), dto.getThirdPartyType())) {
|
2024-02-19 14:44:45 +08:00
|
|
|
|
// 海南
|
2024-01-29 16:04:13 +08:00
|
|
|
|
result = haiNanChargeService.pushStationInfoV2(dto);
|
2024-01-29 16:03:36 +08:00
|
|
|
|
}
|
2024-04-19 11:15:48 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode(), dto.getThirdPartyType())) {
|
|
|
|
|
|
// 青海平台
|
|
|
|
|
|
insertInfo2DataBase(dto);
|
|
|
|
|
|
result = dto.getThirdPartyType() + ":" + "OK";
|
|
|
|
|
|
}
|
2024-05-15 09:58:28 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.DIAN_XING_PLATFORM.getTypeCode(), dto.getThirdPartyType())) {
|
|
|
|
|
|
// 宁波点行平台
|
|
|
|
|
|
insertInfo2DataBase(dto);
|
|
|
|
|
|
result = ThirdPlatformTypeEnum.DIAN_XING_PLATFORM.getTypeLabel() + ":" + "OK";
|
|
|
|
|
|
}
|
2024-01-19 11:43:20 +08:00
|
|
|
|
finalResult.append(result).append("\n");
|
|
|
|
|
|
}
|
|
|
|
|
|
return finalResult.toString();
|
|
|
|
|
|
}
|
2024-01-25 11:37:38 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 统一推送第三方平台实时数据
|
|
|
|
|
|
* @param pileSn 桩编号
|
|
|
|
|
|
* @param connectorCode 枪口号
|
|
|
|
|
|
* @param connectorStatus 枪口状态
|
|
|
|
|
|
* @param realTimeMonitorData 实时数据
|
|
|
|
|
|
* @param transactionCode 交易流水号
|
|
|
|
|
|
*/
|
|
|
|
|
|
public void pushRealTimeInfo(String pileSn, String connectorCode, String connectorStatus,
|
|
|
|
|
|
RealTimeMonitorData realTimeMonitorData, String transactionCode) throws UnsupportedEncodingException {
|
|
|
|
|
|
// 推送第三方平台,先通过桩编号查出站点信息 pushToThirdPartyPlatforms
|
|
|
|
|
|
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn);
|
|
|
|
|
|
|
|
|
|
|
|
// 查询该站点是否推送第三方平台
|
|
|
|
|
|
List<ThirdPartyStationRelationVO> list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(pileBasicInfo.getStationId()));
|
|
|
|
|
|
if (CollectionUtils.isEmpty(list)) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
String pileConnectorCode = pileSn + connectorCode;
|
|
|
|
|
|
// 将枪口状态转换成对接平台的状态
|
|
|
|
|
|
String changedStatus = changeConnectorStatus(connectorStatus, realTimeMonitorData.getPutGunType());
|
2024-04-19 15:22:31 +08:00
|
|
|
|
PushRealTimeInfoDTO dto = new PushRealTimeInfoDTO();
|
|
|
|
|
|
dto.setPileConnectorCode(pileConnectorCode);
|
|
|
|
|
|
dto.setStatus(changedStatus);
|
2024-01-25 11:37:38 +08:00
|
|
|
|
for (ThirdPartyStationRelationVO vo : list) {
|
|
|
|
|
|
String thirdPartyType = vo.getThirdPartyType();
|
2024-03-18 18:18:16 +08:00
|
|
|
|
if (StringUtils.equals(Constants.ONE, vo.getStartMode())) {
|
|
|
|
|
|
// 如果是类似华为格式,不需要传
|
2024-03-18 09:25:01 +08:00
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 联联
|
|
|
|
|
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
2024-09-13 16:12:26 +08:00
|
|
|
|
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 设备状态变化推送 notification_stationStatus
|
2024-04-19 15:22:31 +08:00
|
|
|
|
dto.setThirdPartyType(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode());
|
|
|
|
|
|
lianLianService.pushConnectorStatus(dto);
|
2024-01-25 11:37:38 +08:00
|
|
|
|
if (StringUtils.equals(connectorStatus, "03")) {
|
|
|
|
|
|
// 充电中
|
|
|
|
|
|
lianLianService.pushPileChargeStatusChange(orderInfo.getOrderCode());
|
2024-08-19 14:29:37 +08:00
|
|
|
|
// 推送充电状态
|
|
|
|
|
|
lianLianService.pushChargeStatus(orderInfo.getOrderCode());
|
2024-01-25 11:37:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-10-31 14:21:08 +08:00
|
|
|
|
// if (StringUtils.equals(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode(), thirdPartyType)) {
|
|
|
|
|
|
// // 中电联
|
|
|
|
|
|
// dto.setThirdPartyType(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode());
|
|
|
|
|
|
// // log.info("推送中电联平台实时数据 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus);
|
|
|
|
|
|
// zdlService.notificationStationStatus(dto);
|
|
|
|
|
|
// }
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), thirdPartyType)) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 先判断缓存中是否有数据
|
|
|
|
|
|
String redisKey = CacheConstants.JIANGSU_PUSH_PILE_STATUS + pileConnectorCode;
|
|
|
|
|
|
Object cacheObject = redisCache.getCacheObject(redisKey);
|
|
|
|
|
|
|
2024-04-19 15:22:31 +08:00
|
|
|
|
dto.setThirdPartyType(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode());
|
|
|
|
|
|
realTimeMonitorData.setThirdPartyType(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode());
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 江苏省平台(充电状态至少一分钟推送一次)
|
|
|
|
|
|
if (StringUtils.equals(connectorStatus, "03")) {
|
|
|
|
|
|
// 充电状态
|
|
|
|
|
|
// 如果缓存有数据,证明上次推送未超过一分钟,不予推送,若缓存中无数据,说明需要推送
|
|
|
|
|
|
if (cacheObject == null) {
|
|
|
|
|
|
// log.info("推送江苏省平台 充电状态 params:{}", realTimeMonitorData);
|
|
|
|
|
|
String result = nrService.pushPileStatus(realTimeMonitorData);
|
|
|
|
|
|
redisCache.setCacheObject(redisKey, realTimeMonitorData, 1, TimeUnit.MINUTES);
|
|
|
|
|
|
// log.info("推送江苏省平台 充电状态 result:{}", result);
|
|
|
|
|
|
}
|
|
|
|
|
|
} else {
|
|
|
|
|
|
// 如果不是充电状态,直接推送就可以
|
|
|
|
|
|
// log.info("推送江苏省平台 非充电状态 params:{}", realTimeMonitorData);
|
|
|
|
|
|
String result = nrService.pushPileStatus(realTimeMonitorData);
|
|
|
|
|
|
// log.info("推送江苏省平台 非充电状态 result:{}", result);
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// log.info("推送江苏省平台实时数据 result:{}", result);
|
|
|
|
|
|
}
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), thirdPartyType)) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 新电途平台
|
2024-04-19 15:22:31 +08:00
|
|
|
|
dto.setThirdPartyType(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode());
|
|
|
|
|
|
log.info("新电途平台设备状态变化推送 params:{}", JSON.toJSONString(dto));
|
|
|
|
|
|
String result1 = xdtService.notificationStationStatus(dto);
|
2024-01-25 11:37:38 +08:00
|
|
|
|
log.info("新电途平台设备状态变化推送 result:{}", result1);
|
|
|
|
|
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
|
|
|
|
|
if (orderInfo == null) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
log.info("推送新电途平台 充电状态 params:{}", orderInfo.getOrderCode());
|
|
|
|
|
|
String result = xdtService.notificationEquipChargeStatus(orderInfo.getOrderCode());
|
|
|
|
|
|
log.info("推送新电途平台 充电状态 result:{}", result);
|
|
|
|
|
|
}
|
2024-03-26 15:35:08 +08:00
|
|
|
|
// if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), thirdPartyType)) {
|
|
|
|
|
|
// // 华为平台
|
|
|
|
|
|
// huaWeiService.notificationStationStatus(pileConnectorCode, changedStatus);
|
|
|
|
|
|
// OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
|
|
|
|
|
// if (orderInfo == null) {
|
|
|
|
|
|
// return;
|
|
|
|
|
|
// }
|
|
|
|
|
|
// huaWeiService.notificationEquipChargeStatus(orderInfo.getOrderCode());
|
|
|
|
|
|
// }
|
2024-04-08 15:26:18 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1_PLATFORM.getTypeCode(), thirdPartyType)) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 海南平台
|
2024-04-19 15:22:31 +08:00
|
|
|
|
dto.setThirdPartyType(ThirdPlatformTypeEnum.HAI_NAN_1_PLATFORM.getTypeCode());
|
|
|
|
|
|
haiNanChargeService.notificationStationStatus(dto);
|
2024-01-25 11:37:38 +08:00
|
|
|
|
}
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 甬城泊车
|
2024-04-19 15:22:31 +08:00
|
|
|
|
dto.setThirdPartyType(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode());
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// log.info("推送甬城泊车平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus);
|
|
|
|
|
|
// 设备状态变化推送 notification_stationStatus
|
2024-04-19 15:22:31 +08:00
|
|
|
|
String result1 = ycbcService.notificationStationStatus(dto);
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// log.info("推送甬城泊车平台设备状态变化推送 result:{}", result1);
|
|
|
|
|
|
// 推送充电状态
|
|
|
|
|
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
|
|
|
|
|
if (orderInfo == null) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.equals(orderInfo.getStartMode(), StartModeEnum.THIRD_PARTY_PLATFORM.getValue())) {
|
|
|
|
|
|
// log.info("推送甬城泊车充电订单状态 param:{}", orderInfo);
|
|
|
|
|
|
String result2 = ycbcService.pushChargeStatus(orderInfo.getOrderCode());
|
|
|
|
|
|
// log.info("推送甬城泊车充电订单状态 result:{}", result2);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-04-10 09:23:38 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode(), thirdPartyType)) {
|
|
|
|
|
|
// 青海省平台
|
2024-04-19 15:22:31 +08:00
|
|
|
|
dto.setThirdPartyType(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode());
|
|
|
|
|
|
String result = qingHaiPlatformService.notificationStationStatus(dto);
|
|
|
|
|
|
log.info("推送青海平台设备状态变化推送 params:{}", JSON.toJSONString(dto));
|
2024-04-19 11:15:48 +08:00
|
|
|
|
// 先判断缓存中是否有数据
|
|
|
|
|
|
String redisKey = CacheConstants.JIANGSU_PUSH_PILE_STATUS + pileConnectorCode;
|
|
|
|
|
|
Object cacheObject = redisCache.getCacheObject(redisKey);
|
|
|
|
|
|
|
|
|
|
|
|
if (StringUtils.equals(connectorStatus, "03")) {
|
|
|
|
|
|
// 充电状态, 查出订单信息
|
|
|
|
|
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
|
|
|
|
|
if (orderInfo == null) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
// 如果缓存有数据,证明上次推送未超过2分钟,不予推送,若缓存中无数据,说明需要推送
|
|
|
|
|
|
if (cacheObject == null) {
|
|
|
|
|
|
String pushResult = qingHaiPlatformService.notificationEquipChargeStatus(orderInfo.getOrderCode());
|
|
|
|
|
|
redisCache.setCacheObject(redisKey, realTimeMonitorData, 2, TimeUnit.MINUTES);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-05-30 09:38:29 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.NING_XIA_PLATFORM.getTypeCode(), thirdPartyType)) {
|
|
|
|
|
|
// 宁夏平台
|
|
|
|
|
|
dto.setThirdPartyType(ThirdPlatformTypeEnum.NING_XIA_PLATFORM.getTypeCode());
|
|
|
|
|
|
String result = ninaXiaPlatformService.notificationStationStatus(dto);
|
|
|
|
|
|
log.info("宁夏平台推送充电设备接口状态信息 result:{}", result);
|
|
|
|
|
|
if (StringUtils.equals(connectorStatus, "03")) {
|
|
|
|
|
|
// 充电状态, 查出订单信息
|
|
|
|
|
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
|
|
|
|
|
if (orderInfo == null) {
|
2024-06-12 14:13:22 +08:00
|
|
|
|
continue;
|
2024-05-30 09:38:29 +08:00
|
|
|
|
}
|
2024-06-12 14:13:22 +08:00
|
|
|
|
log.info("宁夏平台推送充电状态信息 params:{}", JSONObject.toJSONString(orderInfo));
|
2024-05-30 09:38:29 +08:00
|
|
|
|
String result2 = ninaXiaPlatformService.notificationEquipChargeStatus(orderInfo.getOrderCode());
|
|
|
|
|
|
log.info("宁夏平台推送充电状态信息 result:{}", result2);
|
|
|
|
|
|
}
|
2024-04-10 09:23:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-25 11:37:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-10 17:00:27 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 推送实时数据到第三方平台
|
|
|
|
|
|
* @param pileSn
|
|
|
|
|
|
* @param connectorCode
|
|
|
|
|
|
* @param connectorStatus
|
|
|
|
|
|
* @param realTimeMonitorData
|
|
|
|
|
|
* @param transactionCode
|
|
|
|
|
|
* @throws UnsupportedEncodingException
|
|
|
|
|
|
*/
|
|
|
|
|
|
public void pushRealTimeInfoV2(String pileSn, String connectorCode, String connectorStatus,
|
|
|
|
|
|
RealTimeMonitorData realTimeMonitorData, String transactionCode) throws UnsupportedEncodingException {
|
|
|
|
|
|
// 推送第三方平台,先通过桩编号查出站点信息 pushToThirdPartyPlatforms
|
|
|
|
|
|
PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn);
|
|
|
|
|
|
|
|
|
|
|
|
String pileConnectorCode = pileSn + connectorCode;
|
|
|
|
|
|
// 将枪口状态转换成对接平台的状态
|
|
|
|
|
|
String changedStatus = changeConnectorStatus(connectorStatus, realTimeMonitorData.getPutGunType());
|
|
|
|
|
|
|
|
|
|
|
|
String stationId = String.valueOf(pileBasicInfo.getStationId());
|
|
|
|
|
|
// 查询该站点是否推送第三方平台
|
|
|
|
|
|
List<ThirdPartySecretInfoVO> thirdPartySecretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
|
|
|
|
|
if (CollectionUtils.isEmpty(thirdPartySecretInfoVOS)) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
// 推送
|
|
|
|
|
|
for (ThirdPartySecretInfoVO thirdPartySecretInfoVO : thirdPartySecretInfoVOS) {
|
|
|
|
|
|
NotificationDTO dto = new NotificationDTO();
|
|
|
|
|
|
dto.setStationId(stationId);
|
|
|
|
|
|
dto.setPileConnectorCode(pileConnectorCode);
|
|
|
|
|
|
dto.setStatus(changedStatus);
|
|
|
|
|
|
dto.setPlatformType(thirdPartySecretInfoVO.getPlatformType());
|
2024-08-14 10:36:03 +08:00
|
|
|
|
|
2024-08-19 14:29:37 +08:00
|
|
|
|
notificationService.notificationStationStatus(dto);
|
|
|
|
|
|
|
|
|
|
|
|
// 查询订单信息
|
|
|
|
|
|
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
|
|
|
|
|
|
if (Objects.isNull(orderInfo)) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
dto.setOrderCode(orderInfo.getOrderCode());
|
2024-05-10 17:00:27 +08:00
|
|
|
|
notificationService.notificationConnectorChargeStatus(dto);
|
2024-08-14 10:36:03 +08:00
|
|
|
|
|
2024-05-10 17:00:27 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-25 11:37:38 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 统一方法推送订单信息
|
|
|
|
|
|
* @param orderBasicInfo 订单信息
|
|
|
|
|
|
*/
|
2024-06-05 10:06:16 +08:00
|
|
|
|
public void commonPushOrderInfo(OrderBasicInfo orderBasicInfo) throws NoSuchAlgorithmException, InvalidKeySpecException, NoSuchProviderException, CryptoException {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 查询该站点是否推送第三方平台
|
|
|
|
|
|
// ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
|
|
|
|
|
|
// relation.setStationId(Long.parseLong(orderBasicInfo.getStationId()));
|
|
|
|
|
|
List<ThirdPartyStationRelationVO> relationInfoList = thirdPartyStationRelationService.getRelationInfoList(orderBasicInfo.getStationId());
|
|
|
|
|
|
// ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
|
|
|
|
|
|
if (CollectionUtils.isEmpty(relationInfoList)) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
for (ThirdPartyStationRelationVO relationVO : relationInfoList) {
|
|
|
|
|
|
String thirdPartyType = relationVO.getThirdPartyType();
|
2024-03-18 18:18:16 +08:00
|
|
|
|
if (StringUtils.equals(Constants.ONE, relationVO.getStartMode())) {
|
|
|
|
|
|
// 如果是类似华为格式,不需要传
|
2024-03-18 09:25:01 +08:00
|
|
|
|
continue;
|
|
|
|
|
|
}
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 联联平台
|
|
|
|
|
|
// 推送停止充电结果
|
|
|
|
|
|
lianLianService.pushStopChargeResult(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
// 推送订单信息
|
|
|
|
|
|
lianLianService.pushOrderInfo(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
// 推送充电订单信息
|
|
|
|
|
|
lianLianService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
}
|
2024-10-31 14:21:08 +08:00
|
|
|
|
// if (StringUtils.equals(ThirdPlatformTypeEnum.NING_BO_PLATFORM.getTypeCode(), thirdPartyType)) {
|
|
|
|
|
|
// // 中电联
|
|
|
|
|
|
// zdlService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
// }
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), thirdPartyType)) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 江苏平台
|
|
|
|
|
|
// 推送订单信息
|
|
|
|
|
|
nrService.pushOrderInfo(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
}
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), thirdPartyType)) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 新电途平台
|
|
|
|
|
|
// 推送停止充电结果
|
|
|
|
|
|
xdtService.notificationStopChargeResult(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
// 推送订单信息
|
|
|
|
|
|
xdtService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
}
|
|
|
|
|
|
// if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), thirdPartyType)) {
|
|
|
|
|
|
// // 华为
|
|
|
|
|
|
// // 推送停止充电结果
|
|
|
|
|
|
// result = huaWeiService.notificationStopChargeResult(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
// // 推送订单信息
|
|
|
|
|
|
// result = huaWeiService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
// }
|
2024-04-08 15:26:18 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1_PLATFORM.getTypeCode(), thirdPartyType)) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 海南平台
|
2024-03-23 08:46:46 +08:00
|
|
|
|
haiNanChargeService.notificationChargeOrderInfo(orderBasicInfo.getOrderCode());
|
2024-01-25 11:37:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
if (StringUtils.equals(orderBasicInfo.getStartMode(), StartModeEnum.THIRD_PARTY_PLATFORM.getValue())) {
|
|
|
|
|
|
// 甬城泊车
|
|
|
|
|
|
// 推送停止充电结果
|
|
|
|
|
|
ycbcService.pushStopChargeResult(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
// 推送订单信息
|
|
|
|
|
|
// log.info("甬城泊车平台 推送充电订单信息 param:{}", orderBasicInfo.getOrderCode());
|
|
|
|
|
|
ycbcService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
// log.info("甬城泊车平台 推送充电订单信息 result:{}", result);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-04-19 11:15:48 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.QING_HAI_PLATFORM.getTypeCode(), thirdPartyType)) {
|
|
|
|
|
|
// 青海平台
|
|
|
|
|
|
qingHaiPlatformService.notificationChargeOrderInfo(orderBasicInfo.getOrderCode());
|
2024-06-05 10:06:16 +08:00
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.NING_XIA_PLATFORM.getTypeCode(), thirdPartyType)) {
|
|
|
|
|
|
// 宁夏平台
|
|
|
|
|
|
ninaXiaPlatformService.notificationChargeOrderInfo(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
}
|
|
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.DIAN_XING_PLATFORM.getTypeCode(), thirdPartyType)) {
|
2024-06-06 08:51:46 +08:00
|
|
|
|
log.info("点行平台推送订单数据 params:{}", orderBasicInfo);
|
|
|
|
|
|
String result = dianXingPlatformService.notificationChargeOrderInfo(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
log.info("点行平台推送订单数据 result:{}", result);
|
2024-04-19 11:15:48 +08:00
|
|
|
|
}
|
2024-01-25 11:37:38 +08:00
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-05-10 17:15:47 +08:00
|
|
|
|
public void commonPushOrderInfoV2(OrderBasicInfo orderBasicInfo) {
|
|
|
|
|
|
String stationId = orderBasicInfo.getStationId();
|
|
|
|
|
|
// 查询该站点是否推送第三方平台
|
|
|
|
|
|
List<ThirdPartySecretInfoVO> relationInfoList = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
|
|
|
|
|
// ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
|
|
|
|
|
|
if (CollectionUtils.isEmpty(relationInfoList)) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
for (ThirdPartySecretInfoVO relationVO : relationInfoList) {
|
|
|
|
|
|
NotificationDTO dto = new NotificationDTO();
|
|
|
|
|
|
dto.setStationId(stationId);
|
|
|
|
|
|
dto.setPlatformType(relationVO.getPlatformType());
|
|
|
|
|
|
dto.setOrderCode(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
notificationService.notificationChargeOrderInfo(dto);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-09-26 17:02:56 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 统一推送告警信息
|
|
|
|
|
|
* @param pileConnectorCode
|
|
|
|
|
|
* @param connectorStatus
|
|
|
|
|
|
*/
|
2024-09-28 10:17:14 +08:00
|
|
|
|
public void commonPushAlarmInfo(String pileConnectorCode, String connectorStatus, String putGunType) {
|
|
|
|
|
|
String changeConnectorStatus = changeConnectorStatus(connectorStatus, putGunType);
|
2024-09-26 17:02:56 +08:00
|
|
|
|
// 查询站点信息
|
|
|
|
|
|
PileStationVO stationVO = pileStationInfoService.getStationInfoByPileConnectorCode(pileConnectorCode);
|
|
|
|
|
|
String stationId = stationVO.getId();
|
|
|
|
|
|
// 查询该站点是否推送第三方平台
|
|
|
|
|
|
List<ThirdPartySecretInfoVO> relationInfoList = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
|
|
|
|
|
|
if (CollectionUtils.isEmpty(relationInfoList)) {
|
|
|
|
|
|
return;
|
|
|
|
|
|
}
|
|
|
|
|
|
for (ThirdPartySecretInfoVO relationVO : relationInfoList) {
|
|
|
|
|
|
NotificationDTO notificationDTO = new NotificationDTO();
|
2024-09-28 10:17:14 +08:00
|
|
|
|
notificationDTO.setStatus(changeConnectorStatus);
|
2024-09-26 17:02:56 +08:00
|
|
|
|
notificationDTO.setPileConnectorCode(pileConnectorCode);
|
|
|
|
|
|
notificationDTO.setStationId(stationId);
|
|
|
|
|
|
notificationDTO.setPlatformType(relationVO.getPlatformType());
|
|
|
|
|
|
|
|
|
|
|
|
notificationService.notificationAlarmInfo(notificationDTO);
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-01-25 11:37:38 +08:00
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 统一推送启动充电结果
|
|
|
|
|
|
* @param orderBasicInfo
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public String commonPushStartChargeResult(OrderBasicInfo orderBasicInfo) {
|
2024-04-19 15:22:31 +08:00
|
|
|
|
// 通过第三方平台类型查询相关配置信息
|
2024-01-25 11:37:38 +08:00
|
|
|
|
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
|
2024-04-19 15:22:31 +08:00
|
|
|
|
relation.setThirdPartyType(orderBasicInfo.getThirdPartyType());
|
2024-01-25 11:37:38 +08:00
|
|
|
|
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
|
|
|
|
|
|
// ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(orderBasicInfo.getStationId()));
|
|
|
|
|
|
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();
|
|
|
|
|
|
|
|
|
|
|
|
// 推送启动充电结果(调用接口 notification_start_charge_result)
|
2024-01-25 16:00:35 +08:00
|
|
|
|
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_START_CHARGE_RESULT.getValue();
|
2024-01-25 11:37:38 +08:00
|
|
|
|
|
|
|
|
|
|
// String orderStatus = orderInfo.getOrderStatus();
|
|
|
|
|
|
// // 订单状态统一
|
|
|
|
|
|
// if (StringUtils.equals(OrderStatusEnum.IN_THE_CHARGING.getValue(), orderStatus)) {
|
|
|
|
|
|
// // 充电中
|
|
|
|
|
|
// orderStatus = "2";
|
|
|
|
|
|
// } else if (StringUtils.equals(OrderStatusEnum.NOT_START.getValue(), orderStatus)) {
|
|
|
|
|
|
// // 未启动
|
|
|
|
|
|
// orderStatus = "1";
|
|
|
|
|
|
// } else {
|
|
|
|
|
|
// // 其他状态都为 未知
|
|
|
|
|
|
// orderStatus = "5";
|
|
|
|
|
|
// }
|
|
|
|
|
|
// 拼装参数
|
|
|
|
|
|
JSONObject json = new JSONObject();
|
|
|
|
|
|
json.put("StartChargeSeq", orderBasicInfo.getOrderCode());
|
|
|
|
|
|
json.put("ConnectorID", orderBasicInfo.getPileConnectorCode());
|
|
|
|
|
|
json.put("StartChargeSeqStat", 2); // 一定要给 2-充电中
|
|
|
|
|
|
json.put("StartTime", DateUtils.getDateTime());
|
|
|
|
|
|
|
2024-03-19 16:22:40 +08:00
|
|
|
|
String jsonString = JSON.toJSONString(json);
|
2024-01-25 11:37:38 +08:00
|
|
|
|
|
|
|
|
|
|
String token = "";
|
|
|
|
|
|
String result = "";
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
YCBCGetTokenDTO dto = new YCBCGetTokenDTO();
|
|
|
|
|
|
dto.setOperatorId(operatorId);
|
|
|
|
|
|
dto.setDataSecret(dataSecret);
|
|
|
|
|
|
dto.setSignSecret(signSecret);
|
|
|
|
|
|
dto.setUrlAddress(urlAddress);
|
|
|
|
|
|
dto.setDataSecretIv(dataSecretIv);
|
|
|
|
|
|
dto.setOperatorSecret(operatorSecret);
|
|
|
|
|
|
|
|
|
|
|
|
token = ycbcService.YCBCGetToken(dto);
|
|
|
|
|
|
result = HttpRequestUtil.YCBCSendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
|
|
|
|
|
}else {
|
|
|
|
|
|
token = lianLianService.getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
|
|
|
|
|
|
result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
|
|
|
|
|
|
}
|
|
|
|
|
|
return result;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
* 绑定优惠券
|
|
|
|
|
|
*
|
|
|
|
|
|
* @param orderBasicInfo
|
|
|
|
|
|
* @return
|
|
|
|
|
|
* @throws UnsupportedEncodingException
|
|
|
|
|
|
*/
|
|
|
|
|
|
public String bindCoupon(OrderBasicInfo orderBasicInfo) throws UnsupportedEncodingException {
|
|
|
|
|
|
if (orderBasicInfo == null) {
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
// 如果该站点的停车场优惠券信息配置不为空,则需绑定一张优惠券
|
|
|
|
|
|
String stationId = orderBasicInfo.getStationId();
|
|
|
|
|
|
PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId);
|
|
|
|
|
|
if (StringUtils.isBlank(stationInfo.getParkingId())) {
|
|
|
|
|
|
return orderBasicInfo.getOrderCode() + " 该订单无需绑定优惠券";
|
|
|
|
|
|
}
|
2024-04-07 14:31:11 +08:00
|
|
|
|
if (StringUtils.equals(ParkingPlatformEnum.LU_TONG_YUN_TING_PLATFORM.getCode(), stationInfo.getParkingId())) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 路通云停
|
|
|
|
|
|
// 查询密钥等配置
|
|
|
|
|
|
ThirdpartyParkingConfig parkingInfo = thirdPartyParkingConfigService.selectByPrimaryKey(Integer.parseInt(stationInfo.getParkingId()));
|
|
|
|
|
|
if (parkingInfo == null) {
|
|
|
|
|
|
throw new BusinessException(ReturnCodeEnum.CODE_QUERY_PARKING_INFO_IS_NULL);
|
|
|
|
|
|
}
|
|
|
|
|
|
BindCouponDTO dto = BindCouponDTO.builder()
|
|
|
|
|
|
.appId(parkingInfo.getAppId())
|
|
|
|
|
|
.merchantId(parkingInfo.getParkingMerchantId())
|
|
|
|
|
|
.couponId(parkingInfo.getCouponId())
|
|
|
|
|
|
.secretKey(parkingInfo.getSecretKey())
|
|
|
|
|
|
.plateNumber(orderBasicInfo.getPlateNumber())
|
|
|
|
|
|
.plateColor(5) // 5-绿牌车
|
2024-10-15 16:02:43 +08:00
|
|
|
|
.orderBasicInfo(orderBasicInfo)
|
2024-01-25 11:37:38 +08:00
|
|
|
|
.build();
|
|
|
|
|
|
// 绑定优惠券
|
|
|
|
|
|
return ltytService.bindCoupon(dto);
|
2024-04-07 14:31:11 +08:00
|
|
|
|
} else if (StringUtils.equals(ParkingPlatformEnum.RUAN_JIE_PLATFORM.getCode(), stationInfo.getParkingId())) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 软杰
|
|
|
|
|
|
UseCouponDTO dto = UseCouponDTO.builder()
|
|
|
|
|
|
.fCouponCode(orderBasicInfo.getOrderCode()) // 优惠券编号(使用订单编号)
|
|
|
|
|
|
.fCouponType("2") // 优惠类型 2-时长
|
|
|
|
|
|
.fCouponValue("120") // 优惠券面额 单位:分钟
|
|
|
|
|
|
.fPlateCode(orderBasicInfo.getPlateNumber()) // 车牌号
|
|
|
|
|
|
.build();
|
|
|
|
|
|
return rjService.useCoupon(dto);
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
2024-03-20 08:18:35 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 统一请求启动充电,目前给华为平台用
|
2024-03-25 08:46:40 +08:00
|
|
|
|
* @param dto
|
2024-03-20 08:18:35 +08:00
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
2024-03-25 08:46:40 +08:00
|
|
|
|
public String commonQueryStartCharge(ThirdPartyCommonStartChargeDTO dto) {
|
|
|
|
|
|
String thirdPartyType = dto.getThirdPartyType();
|
2024-04-01 16:17:00 +08:00
|
|
|
|
// List<String> stationIds = dto.getStationIds();
|
|
|
|
|
|
// String pileConnectorCode = dto.getPileConnectorCode();
|
|
|
|
|
|
// BigDecimal chargeAmount = dto.getChargeAmount();
|
|
|
|
|
|
// String payMode = dto.getPayMode();
|
2024-03-25 08:46:40 +08:00
|
|
|
|
|
2024-03-20 08:18:35 +08:00
|
|
|
|
// 判断平台类型
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) {
|
2024-03-20 08:18:35 +08:00
|
|
|
|
// 华为平台
|
2024-04-01 16:17:00 +08:00
|
|
|
|
String result = huaweiServiceV2.startChargeFlow(dto);
|
|
|
|
|
|
log.info("华为统一请求启动充电 result:{}", result);
|
2024-03-20 08:18:35 +08:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-26 15:35:08 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 统一停止充电
|
|
|
|
|
|
* @param dto
|
|
|
|
|
|
* @return
|
|
|
|
|
|
*/
|
|
|
|
|
|
public String commonStopCharge(ThirdPartyCommonStopChargeDTO dto) {
|
|
|
|
|
|
OrderBasicInfo orderBasicInfo = dto.getOrderBasicInfo();
|
|
|
|
|
|
String thirdPartyType = dto.getThirdPartyType();
|
|
|
|
|
|
|
|
|
|
|
|
// 判断平台类型
|
2024-03-27 11:46:11 +08:00
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) {
|
2024-03-26 15:35:08 +08:00
|
|
|
|
QueryStartChargeVO vo = huaweiServiceV2.queryStopCharge(orderBasicInfo.getOrderCode());
|
|
|
|
|
|
return String.valueOf(vo.getSuccStat());
|
|
|
|
|
|
}
|
|
|
|
|
|
return null;
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
2024-03-20 08:18:35 +08:00
|
|
|
|
|
2024-01-25 11:37:38 +08:00
|
|
|
|
/**
|
|
|
|
|
|
* 转换枪口状态
|
|
|
|
|
|
* @param connectorStatus 有电充平台枪口状态
|
|
|
|
|
|
* @param putGunType 是否插枪
|
|
|
|
|
|
* @return 第三方平台枪口状态
|
|
|
|
|
|
*/
|
2024-07-09 14:13:56 +08:00
|
|
|
|
public String changeConnectorStatus(String connectorStatus, String putGunType) {
|
2024-05-07 15:10:58 +08:00
|
|
|
|
if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FREE.getValue())) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 空闲
|
|
|
|
|
|
return Constants.ONE;
|
2024-05-07 15:10:58 +08:00
|
|
|
|
} else if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FREE.getValue()) && StringUtils.equals(putGunType, "01")) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 占用(未充电)
|
|
|
|
|
|
return Constants.TWO;
|
2024-05-07 15:10:58 +08:00
|
|
|
|
} else if (StringUtils.equals(connectorStatus, PileConnectorStatusEnum.FAULT.getValue())) {
|
2024-01-25 11:37:38 +08:00
|
|
|
|
// 故障
|
|
|
|
|
|
return "255";
|
|
|
|
|
|
}else {
|
|
|
|
|
|
// 0-离网和 3-充电中不需要转换,直接返回
|
|
|
|
|
|
return connectorStatus;
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-04-01 16:17:00 +08:00
|
|
|
|
|
|
|
|
|
|
public void commonQueryStationStatus(String stationId, String thirdPartyType) {
|
|
|
|
|
|
if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) {
|
|
|
|
|
|
// 华为平台
|
|
|
|
|
|
Map<String, String> map = huaweiServiceV2.queryStationStatus(Lists.newArrayList(stationId));
|
|
|
|
|
|
// key: pileConnectorCode,
|
|
|
|
|
|
// value: status
|
|
|
|
|
|
}
|
|
|
|
|
|
}
|
2024-01-18 17:03:08 +08:00
|
|
|
|
}
|