修改代码

This commit is contained in:
Guoqs
2024-05-10 17:00:27 +08:00
parent bfd25e28b6
commit 6cecaf50e2
3 changed files with 69 additions and 2 deletions

View File

@@ -27,6 +27,7 @@ import com.jsowell.pile.dto.ThirdPartyCommonStopChargeDTO;
import com.jsowell.pile.dto.lutongyunting.BindCouponDTO;
import com.jsowell.pile.dto.ruanjie.UseCouponDTO;
import com.jsowell.pile.service.*;
import com.jsowell.pile.vo.ThirdPartySecretInfoVO;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.pile.vo.huawei.QueryStartChargeVO;
import com.jsowell.pile.vo.web.PileStationVO;
@@ -39,11 +40,13 @@ import com.jsowell.thirdparty.platform.util.HttpRequestUtil;
import com.jsowell.thirdparty.lutongyunting.service.LTYTService;
import com.jsowell.thirdparty.nanrui.service.NRService;
import com.jsowell.thirdparty.ruanjie.service.RJService;
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
import com.jsowell.thirdparty.xindiantu.service.XDTService;
import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO;
import com.jsowell.thirdparty.yongchengboche.service.YCBCService;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import lombok.extern.slf4j.Slf4j;
import lombok.val;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
@@ -52,6 +55,7 @@ import java.io.UnsupportedEncodingException;
import java.text.ParseException;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.concurrent.TimeUnit;
/**
@@ -115,6 +119,12 @@ public class CommonService {
@Autowired
private RedisCache redisCache;
@Autowired
private ThirdpartySecretInfoService thirdpartySecretInfoService;
@Autowired
private NotificationService notificationService;
/**
* 将站点--第三方平台类型对应关系存入关系表
* @param dto
@@ -355,6 +365,49 @@ public class CommonService {
}
}
/**
* 推送实时数据到第三方平台
* @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;
}
// 查询订单信息
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode);
// 推送
for (ThirdPartySecretInfoVO thirdPartySecretInfoVO : thirdPartySecretInfoVOS) {
NotificationDTO dto = new NotificationDTO();
dto.setStationId(stationId);
dto.setPileConnectorCode(pileConnectorCode);
dto.setStatus(changedStatus);
dto.setPlatformType(thirdPartySecretInfoVO.getPlatformType());
if (Objects.nonNull(orderInfo)) {
dto.setOrderCode(orderInfo.getOrderCode());
}
notificationService.notificationConnectorChargeStatus(dto);
}
}
/**
* 统一方法推送订单信息