mirror of
https://codeup.aliyun.com/67c68d4e484ca2f0a13ac3c1/ydc/jsowell-charger-web.git
synced 2026-04-20 19:15:35 +08:00
update
This commit is contained in:
@@ -1,114 +0,0 @@
|
||||
package com.jsowell.thirdparty.dubbo.api.impl;
|
||||
|
||||
import com.jsowell.common.dto.RealTimeMonitorData;
|
||||
|
||||
import com.jsowell.common.service.thirdparty.domin.OrderBasicInfo;
|
||||
import com.jsowell.common.service.thirdparty.domin.OrderDetail;
|
||||
import com.jsowell.common.service.thirdparty.dto.*;
|
||||
import com.jsowell.common.service.thirdparty.tempservice.OrderBasicInfoApi;
|
||||
import com.jsowell.common.service.thirdparty.vo.*;
|
||||
import com.jsowell.pile.service.OrderBasicInfoService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
@DubboService(group = "thirdparty" , version = "1.0.0")
|
||||
public class OrderBasicInfoApiImpl implements OrderBasicInfoApi {
|
||||
|
||||
@Autowired
|
||||
private OrderBasicInfoService orderBasicInfoService;
|
||||
|
||||
/**
|
||||
* 转换实体类
|
||||
* @param orderBasicInfo
|
||||
* @return
|
||||
*/
|
||||
public OrderBasicInfo getOrderBasicInfoVO(com.jsowell.pile.domain.OrderBasicInfo orderBasicInfo){
|
||||
OrderBasicInfo orderBasicInfoVO = new OrderBasicInfo();
|
||||
BeanUtils.copyProperties(orderBasicInfo, orderBasicInfoVO);
|
||||
return orderBasicInfoVO;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public OrderBasicInfo getOrderInfoByOrderCode(String orderCode) {
|
||||
com.jsowell.pile.domain.OrderBasicInfo orderInfoByOrderCode = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
|
||||
return getOrderBasicInfoVO(orderInfoByOrderCode);
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public OrderBasicInfo queryChargingByPileConnectorCode(String pileConnectorCode) {
|
||||
com.jsowell.pile.domain.OrderBasicInfo orderBasicInfo = orderBasicInfoService.queryChargingByPileConnectorCode(pileConnectorCode);
|
||||
|
||||
return getOrderBasicInfoVO(orderBasicInfo);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderDetail getOrderDetailByOrderCode(String orderCode) {
|
||||
com.jsowell.pile.domain.OrderDetail orderDetailByOrderCode = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
|
||||
if (orderDetailByOrderCode == null) {
|
||||
return null;
|
||||
}
|
||||
OrderDetail orderDetail = new OrderDetail();
|
||||
BeanUtils.copyProperties(orderDetailByOrderCode, orderDetail);
|
||||
return orderDetail;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<RealTimeMonitorData> getChargingRealTimeData(String transactionCode) {
|
||||
List<com.jsowell.common.core.domain.ykc.RealTimeMonitorData> chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(transactionCode);
|
||||
List<RealTimeMonitorData> result = new ArrayList<>();
|
||||
chargingRealTimeData.forEach(realTimeMonitorData -> {
|
||||
RealTimeMonitorData monitorData = new RealTimeMonitorData();
|
||||
BeanUtils.copyProperties(realTimeMonitorData, monitorData);
|
||||
result.add(monitorData);
|
||||
});
|
||||
return result;
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<AccumulativeInfoVO> getAccumulativeInfoForLianLian(QueryStationInfoDTO dto) {
|
||||
com.jsowell.pile.dto.QueryStationInfoDTO queryStationInfoDTO = new com.jsowell.pile.dto.QueryStationInfoDTO();
|
||||
BeanUtils.copyProperties(dto, queryStationInfoDTO);
|
||||
List<com.jsowell.pile.vo.lianlian.AccumulativeInfoVO> accumulativeInfoForLianLian = orderBasicInfoService.getAccumulativeInfoForLianLian(queryStationInfoDTO);
|
||||
List<AccumulativeInfoVO> result = new ArrayList<>();
|
||||
accumulativeInfoForLianLian.forEach(accumulativeInfoVO -> {
|
||||
AccumulativeInfoVO info = new AccumulativeInfoVO();
|
||||
BeanUtils.copyProperties(accumulativeInfoVO, info);
|
||||
result.add(info);
|
||||
});
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Map<String, Object> generateOrderForThirdParty(QueryStartChargeDTO dto) {
|
||||
com.jsowell.pile.dto.QueryStartChargeDTO queryStartChargeDTO = new com.jsowell.pile.dto.QueryStartChargeDTO();
|
||||
BeanUtils.copyProperties(dto, queryStartChargeDTO);
|
||||
return orderBasicInfoService.generateOrderForThirdParty(queryStartChargeDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> tempGetOrderCodes(QueryOrder2DTO dto) {
|
||||
com.jsowell.pile.dto.QueryOrderDTO queryOrderDTO = new com.jsowell.pile.dto.QueryOrderDTO();
|
||||
BeanUtils.copyProperties(dto, queryOrderDTO);
|
||||
return orderBasicInfoService.tempGetOrderCodes(queryOrderDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public OrderBasicInfo getOrderInfoByTransactionCode(String transactionCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,89 +0,0 @@
|
||||
package com.jsowell.thirdparty.dubbo.api.impl;
|
||||
|
||||
import com.jsowell.common.service.thirdparty.domin.PileBasicInfo;
|
||||
import com.jsowell.common.service.thirdparty.tempservice.PileBasicInfoApi;
|
||||
import com.jsowell.common.service.thirdparty.vo.PileConnectorDetailVO;
|
||||
import com.jsowell.common.service.thirdparty.vo.PileDetailInfoVO;
|
||||
import com.jsowell.common.vo.PileInfoVO;
|
||||
import com.jsowell.pile.service.PileBasicInfoService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@DubboService(group = "thirdparty" , version = "1.0.0")
|
||||
public class PileBasicInfoApiImpl implements PileBasicInfoApi {
|
||||
|
||||
|
||||
@Autowired
|
||||
private PileBasicInfoService pileBasicInfoService;
|
||||
|
||||
@Override
|
||||
public PileBasicInfo selectPileBasicInfoBySN(String pileSn) {
|
||||
com.jsowell.pile.domain.PileBasicInfo pileBasicInfo = pileBasicInfoService.selectPileBasicInfoBySN(pileSn);
|
||||
if (pileBasicInfo == null) {
|
||||
return null;
|
||||
}
|
||||
PileBasicInfo result = new PileBasicInfo();
|
||||
BeanUtils.copyProperties(pileBasicInfo, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PileInfoVO selectPileInfoBySn(String pileSn) {
|
||||
com.jsowell.pile.vo.base.PileInfoVO pileInfoVO = pileBasicInfoService.selectPileInfoBySn(pileSn);
|
||||
if (pileInfoVO == null) {
|
||||
return null;
|
||||
}
|
||||
PileInfoVO result = new PileInfoVO();
|
||||
BeanUtils.copyProperties(pileInfoVO, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PileConnectorDetailVO queryPileConnectorDetail(String pileConnectorCode) {
|
||||
com.jsowell.pile.vo.uniapp.customer.PileConnectorDetailVO pileConnectorDetailVO = pileBasicInfoService.queryPileConnectorDetail(pileConnectorCode);
|
||||
if (pileConnectorDetailVO == null) {
|
||||
return null;
|
||||
}
|
||||
PileConnectorDetailVO result = new PileConnectorDetailVO();
|
||||
BeanUtils.copyProperties(pileConnectorDetailVO, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<PileDetailInfoVO> getPileDetailInfoList(String stationId) {
|
||||
List<com.jsowell.pile.thirdparty.PileDetailInfoVO> pileDetailInfoList = pileBasicInfoService.getPileDetailInfoList(stationId);
|
||||
if (pileDetailInfoList == null || pileDetailInfoList.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<PileDetailInfoVO> result = new ArrayList<>();
|
||||
for (com.jsowell.pile.thirdparty.PileDetailInfoVO pileDetailInfoVO : pileDetailInfoList) {
|
||||
PileDetailInfoVO info = new PileDetailInfoVO();
|
||||
BeanUtils.copyProperties(pileDetailInfoVO, info);
|
||||
result.add(info);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<PileBasicInfo> getPileListByStationId(String stationId) {
|
||||
List<com.jsowell.pile.domain.PileBasicInfo> pileListByStationId = pileBasicInfoService.getPileListByStationId(stationId);
|
||||
List<PileBasicInfo> result = new ArrayList<>();
|
||||
for (com.jsowell.pile.domain.PileBasicInfo basicInfo : pileListByStationId) {
|
||||
PileBasicInfo pileBasicInfo = new PileBasicInfo();
|
||||
BeanUtils.copyProperties(basicInfo, pileBasicInfo);
|
||||
result.add(pileBasicInfo);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
@@ -1,47 +0,0 @@
|
||||
package com.jsowell.thirdparty.dubbo.api.impl;
|
||||
|
||||
import com.jsowell.common.service.thirdparty.tempservice.PileBillingTemplateApi;
|
||||
import com.jsowell.common.service.thirdparty.vo.BillingPriceVO;
|
||||
import com.jsowell.common.vo.BillingTemplateVO;
|
||||
import com.jsowell.pile.service.PileBillingTemplateService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@DubboService(group = "thirdparty",version = "1.0.0")
|
||||
public class PileBillingTemplateApiImpl implements PileBillingTemplateApi {
|
||||
|
||||
@Autowired
|
||||
private PileBillingTemplateService pileBillingTemplateService;
|
||||
|
||||
|
||||
@Override
|
||||
public List<BillingPriceVO> queryBillingPrice(String stationId) {
|
||||
List<com.jsowell.pile.vo.uniapp.customer.BillingPriceVO> billingPriceVOS = pileBillingTemplateService.queryBillingPrice(stationId);
|
||||
if (billingPriceVOS == null || billingPriceVOS.isEmpty()){
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<BillingPriceVO> billingPriceVOList = new ArrayList<>();
|
||||
for (com.jsowell.pile.vo.uniapp.customer.BillingPriceVO billingPriceVO : billingPriceVOS){
|
||||
BillingPriceVO vo = new BillingPriceVO();
|
||||
BeanUtils.copyProperties(billingPriceVO,vo);
|
||||
}
|
||||
return billingPriceVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BillingTemplateVO selectBillingTemplateDetailByPileSn(String pileSn) {
|
||||
com.jsowell.pile.vo.web.BillingTemplateVO billingTemplateVO = pileBillingTemplateService.selectBillingTemplateDetailByPileSn(pileSn);
|
||||
if (billingTemplateVO == null){
|
||||
return null;
|
||||
}
|
||||
BillingTemplateVO vo = new BillingTemplateVO();
|
||||
BeanUtils.copyProperties(billingTemplateVO,vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,74 +0,0 @@
|
||||
package com.jsowell.thirdparty.dubbo.api.impl;
|
||||
|
||||
import com.jsowell.common.service.thirdparty.domin.PileConnectorInfo;
|
||||
|
||||
import com.jsowell.common.service.thirdparty.tempservice.PileConnectorInfoApi;
|
||||
import com.jsowell.common.service.thirdparty.vo.ConnectorInfoVO;
|
||||
import com.jsowell.common.service.thirdparty.vo.PileConnectorInfoVO;
|
||||
import com.jsowell.pile.service.PileConnectorInfoService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
|
||||
@DubboService(group = "thirdparty" , version = "1.0.0")
|
||||
public class PileConnectorInfoApiImpl implements PileConnectorInfoApi {
|
||||
|
||||
@Autowired
|
||||
private PileConnectorInfoService pileConnectorInfoService;
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public List<PileConnectorInfo> selectPileConnectorInfoList(String pileSn) {
|
||||
List<com.jsowell.pile.domain.PileConnectorInfo> pileConnectorInfos = pileConnectorInfoService.selectPileConnectorInfoList(pileSn);
|
||||
if (pileConnectorInfos == null || pileConnectorInfos.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<PileConnectorInfo> result = new ArrayList<>();
|
||||
for (com.jsowell.pile.domain.PileConnectorInfo info : pileConnectorInfos) {
|
||||
PileConnectorInfo resultInfo = new PileConnectorInfo();
|
||||
BeanUtils.copyProperties(info, resultInfo);
|
||||
result.add(resultInfo);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
|
||||
@Override
|
||||
public PileConnectorInfoVO getPileConnectorInfoByConnectorCode(String connectorCode) {
|
||||
com.jsowell.pile.vo.web.PileConnectorInfoVO info = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(connectorCode);
|
||||
if (info == null) {
|
||||
return null;
|
||||
}
|
||||
PileConnectorInfoVO resultInfo = new PileConnectorInfoVO();
|
||||
BeanUtils.copyProperties(info, resultInfo);
|
||||
return resultInfo;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConnectorInfoVO> batchSelectConnectorList(List<String> stationIds) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ConnectorInfoVO> getConnectorListForLianLian(Long stationId) {
|
||||
List<com.jsowell.pile.vo.base.ConnectorInfoVO> connectorListForLianLian = pileConnectorInfoService.getConnectorListForLianLian(stationId);
|
||||
if (connectorListForLianLian == null || connectorListForLianLian.isEmpty()) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<ConnectorInfoVO> result = new ArrayList<>();
|
||||
for (com.jsowell.pile.vo.base.ConnectorInfoVO info : connectorListForLianLian) {
|
||||
ConnectorInfoVO resultInfo = new ConnectorInfoVO();
|
||||
BeanUtils.copyProperties(info, resultInfo);
|
||||
result.add(resultInfo);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -1,27 +0,0 @@
|
||||
package com.jsowell.thirdparty.dubbo.api.impl;
|
||||
|
||||
import com.jsowell.common.service.thirdparty.tempservice.PileMerchantInfoApi;
|
||||
import com.jsowell.common.service.thirdparty.vo.MerchantInfoVO;
|
||||
import com.jsowell.pile.service.PileMerchantInfoService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@DubboService(group = "thirdparty", version = "1.0.0")
|
||||
public class PileMerchantInfoApiImpl implements PileMerchantInfoApi {
|
||||
|
||||
@Autowired
|
||||
private PileMerchantInfoService pileMerchantInfoService;
|
||||
|
||||
@Override
|
||||
public MerchantInfoVO getMerchantInfoVO(String merchantId) {
|
||||
com.jsowell.pile.vo.base.MerchantInfoVO merchantInfoVO = pileMerchantInfoService.getMerchantInfoVO(merchantId);
|
||||
if (merchantInfoVO == null) {
|
||||
return null;
|
||||
}
|
||||
MerchantInfoVO vo = new MerchantInfoVO();
|
||||
BeanUtils.copyProperties(merchantInfoVO, vo);
|
||||
return vo;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,30 +0,0 @@
|
||||
package com.jsowell.thirdparty.dubbo.api.impl;
|
||||
|
||||
|
||||
import com.jsowell.common.service.thirdparty.tempservice.PileModelInfoApi;
|
||||
import com.jsowell.common.service.thirdparty.vo.PileModelInfoVO;
|
||||
import com.jsowell.pile.service.PileModelInfoService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
|
||||
@DubboService(group = "thirdparty", version = "1.0.0")
|
||||
public class PileModelInfoApiImpl implements PileModelInfoApi {
|
||||
|
||||
@Autowired
|
||||
private PileModelInfoService pileModelInfoService;
|
||||
|
||||
|
||||
@Override
|
||||
public PileModelInfoVO getPileModelInfoByPileSn(String pileSn) {
|
||||
com.jsowell.pile.vo.web.PileModelInfoVO pileModelInfoByPileSn = pileModelInfoService.getPileModelInfoByPileSn(pileSn);
|
||||
if (pileModelInfoByPileSn == null) {
|
||||
return null;
|
||||
}
|
||||
PileModelInfoVO pileModelInfoVO = new PileModelInfoVO();
|
||||
BeanUtils.copyProperties(pileModelInfoByPileSn, pileModelInfoVO);
|
||||
return pileModelInfoVO;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.jsowell.thirdparty.dubbo.api.impl;
|
||||
|
||||
import com.jsowell.common.service.thirdparty.tempservice.PileRemoteApi;
|
||||
import com.jsowell.pile.service.PileRemoteService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
|
||||
import javax.annotation.Resource;
|
||||
|
||||
|
||||
@DubboService(group = "thirdparty", version = "1.0.0")
|
||||
public class PileRemoteApiImpl implements PileRemoteApi {
|
||||
|
||||
@Resource
|
||||
private PileRemoteService pileRemoteService;
|
||||
|
||||
@Override
|
||||
public void remoteStopCharging(String pileSn , String connectorCode , String transactionCode) {
|
||||
pileRemoteService.remoteStopCharging(pileSn, connectorCode, transactionCode);
|
||||
}
|
||||
}
|
||||
@@ -1,65 +0,0 @@
|
||||
package com.jsowell.thirdparty.dubbo.api.impl;
|
||||
|
||||
import com.jsowell.common.service.thirdparty.domin.PileStationInfo;
|
||||
|
||||
import com.jsowell.common.service.thirdparty.dto.QueryStationInfoDTO;
|
||||
import com.jsowell.common.service.thirdparty.tempservice.PileStationInfoApi;
|
||||
import com.jsowell.common.service.thirdparty.vo.PileStationVO;
|
||||
import com.jsowell.common.service.thirdparty.vo.ThirdPartyStationInfoVO;
|
||||
import com.jsowell.pile.service.PileStationInfoService;
|
||||
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@DubboService(group = "thirdparty", version = "1.0.0")
|
||||
public class PileStationInfoApiImpl implements PileStationInfoApi {
|
||||
|
||||
@Autowired
|
||||
private PileStationInfoService pileStationInfoService;
|
||||
|
||||
|
||||
@Override
|
||||
public PileStationInfo selectPileStationInfoById(Long id) {
|
||||
com.jsowell.pile.domain.PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(id);
|
||||
if (pileStationInfo == null) {
|
||||
return null;
|
||||
}
|
||||
PileStationInfo result = new PileStationInfo();
|
||||
BeanUtils.copyProperties(pileStationInfo, result);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public List<ThirdPartyStationInfoVO> selectStationInfosByThirdParty(QueryStationInfoDTO dto) {
|
||||
com.jsowell.pile.dto.QueryStationInfoDTO dto1 = new com.jsowell.pile.dto.QueryStationInfoDTO();
|
||||
BeanUtils.copyProperties(dto, dto1);
|
||||
List<com.jsowell.pile.vo.base.ThirdPartyStationInfoVO> thirdPartyStationInfoVOS = pileStationInfoService.selectStationInfosByThirdParty(dto1);
|
||||
if (thirdPartyStationInfoVOS == null) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
List<ThirdPartyStationInfoVO> result = new ArrayList<>();
|
||||
for (com.jsowell.pile.vo.base.ThirdPartyStationInfoVO stationInfo : thirdPartyStationInfoVOS) {
|
||||
ThirdPartyStationInfoVO thirdPartyStationInfoVO = new ThirdPartyStationInfoVO();
|
||||
BeanUtils.copyProperties(stationInfo, thirdPartyStationInfoVO);
|
||||
result.add(thirdPartyStationInfoVO);
|
||||
}
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PileStationVO getStationInfoByPileConnectorCode(String pileConnectorCode) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PileStationVO getStationInfo(String stationId) {
|
||||
return null;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,77 +0,0 @@
|
||||
package com.jsowell.thirdparty.dubbo.api.impl;
|
||||
|
||||
import com.jsowell.common.service.thirdparty.tempservice.ThirdpartySecretInfoApi;
|
||||
import com.jsowell.common.service.thirdparty.vo.StationInfoVO;
|
||||
import com.jsowell.common.service.thirdparty.vo.ThirdPartySecretInfoVO;
|
||||
import com.jsowell.thirdparty.service.ThirdpartySecretInfoService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
@DubboService(group = "thirdparty", version = "1.0.0")
|
||||
public class ThirdpartySecretInfoApiImpl implements ThirdpartySecretInfoApi {
|
||||
|
||||
@Autowired
|
||||
public ThirdpartySecretInfoService thirdpartySecretInfoService;
|
||||
|
||||
/**
|
||||
* 通过组织结构代码,查询平台密钥配置信息
|
||||
* @param theirOperatorId 组织结构代码
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ThirdPartySecretInfoVO queryByOperatorId(String theirOperatorId) {
|
||||
com.jsowell.pile.vo.ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByOperatorId(theirOperatorId);
|
||||
if (thirdPartySecretInfoVO == null){
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO1 = new ThirdPartySecretInfoVO();
|
||||
BeanUtils.copyProperties(thirdPartySecretInfoVO, thirdPartySecretInfoVO1);
|
||||
return thirdPartySecretInfoVO1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 通过第三方平台类型,查询平台密钥配置信息
|
||||
* @param thirdPlatformType 第三方平台类型, 参见{@link com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum}
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public ThirdPartySecretInfoVO queryByThirdPlatformType(String thirdPlatformType) {
|
||||
com.jsowell.pile.vo.ThirdPartySecretInfoVO thirdPartySecretInfoVO = thirdpartySecretInfoService.queryByThirdPlatformType(thirdPlatformType);
|
||||
if (thirdPartySecretInfoVO == null){
|
||||
return null;
|
||||
}
|
||||
ThirdPartySecretInfoVO thirdPartySecretInfoVO1 = new ThirdPartySecretInfoVO();
|
||||
BeanUtils.copyProperties(thirdPartySecretInfoVO, thirdPartySecretInfoVO1);
|
||||
return thirdPartySecretInfoVO1;
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 根据第三方平台类型查询对接第三方平台的站点列表
|
||||
* @param thirdPlatformType
|
||||
* @return
|
||||
*/
|
||||
@Override
|
||||
public List<StationInfoVO> selectStationList(String thirdPlatformType) {
|
||||
List<com.jsowell.pile.vo.base.StationInfoVO> stationInfoVOS = thirdpartySecretInfoService.selectStationList(thirdPlatformType);
|
||||
if (stationInfoVOS == null || stationInfoVOS.isEmpty()){
|
||||
return null;
|
||||
}
|
||||
List<StationInfoVO> stationInfoVOList = new java.util.ArrayList<>();
|
||||
for (com.jsowell.pile.vo.base.StationInfoVO stationInfoVO : stationInfoVOS){
|
||||
StationInfoVO stationInfoVO1 = new StationInfoVO();
|
||||
BeanUtils.copyProperties(stationInfoVO, stationInfoVO1);
|
||||
stationInfoVOList.add(stationInfoVO1);
|
||||
}
|
||||
return stationInfoVOList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ThirdPartySecretInfoVO> queryStationToPlatformList(String stationId) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
}
|
||||
@@ -1,22 +0,0 @@
|
||||
package com.jsowell.thirdparty.dubbo.api.impl;
|
||||
|
||||
import com.jsowell.common.service.thirdparty.domin.ykcCommond.StartChargingCommand;
|
||||
import com.jsowell.common.service.thirdparty.tempservice.YKCPushCommandApi;
|
||||
import com.jsowell.pile.service.YKCPushCommandService;
|
||||
import org.apache.dubbo.config.annotation.DubboService;
|
||||
import org.springframework.beans.BeanUtils;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
|
||||
@DubboService(group = "thirdparty" ,version = "1.0.0")
|
||||
public class YKCPushCommandApiImpl implements YKCPushCommandApi {
|
||||
|
||||
@Autowired
|
||||
private YKCPushCommandService ykcpushCommandService;
|
||||
|
||||
@Override
|
||||
public void pushStartChargingCommand(StartChargingCommand startChargingCommand) {
|
||||
com.jsowell.pile.domain.ykcCommond.StartChargingCommand command = new com.jsowell.pile.domain.ykcCommond.StartChargingCommand();
|
||||
BeanUtils.copyProperties(startChargingCommand, command);
|
||||
ykcpushCommandService.pushStartChargingCommand(command);
|
||||
}
|
||||
}
|
||||
@@ -1,88 +0,0 @@
|
||||
package com.jsowell.thirdparty.dubbo.factory;
|
||||
|
||||
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
|
||||
import com.jsowell.common.exception.BusinessException;
|
||||
import com.jsowell.common.service.thirdparty.ThirdPartyPlatformApi;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.apache.dubbo.config.ReferenceConfig;
|
||||
import org.apache.dubbo.config.bootstrap.DubboBootstrap;
|
||||
import org.springframework.stereotype.Component;
|
||||
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* 动态服务工厂
|
||||
*/
|
||||
@Component
|
||||
@Slf4j
|
||||
public class DynamicThirdPartyPlatformFactory {
|
||||
|
||||
// 缓存已获取的服务代理
|
||||
private static final ConcurrentHashMap<String, ThirdPartyPlatformApi> serviceCache = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 根据平台类型动态获取远程服务
|
||||
* @param platformType 平台类型(需与远程服务的@DubboService(group)一致)
|
||||
* @return 远程服务代理
|
||||
*/
|
||||
public static ThirdPartyPlatformApi getPlatformService(String platformType) {
|
||||
|
||||
if (platformType == null || platformType.isEmpty()) {
|
||||
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
|
||||
}
|
||||
|
||||
// 1. 先从缓存获取
|
||||
ThirdPartyPlatformApi service = serviceCache.get(platformType);
|
||||
|
||||
if (service != null) {
|
||||
return service;
|
||||
}
|
||||
|
||||
// 2. 动态创建服务引用
|
||||
synchronized (DynamicThirdPartyPlatformFactory.class) {
|
||||
service = serviceCache.get(platformType);
|
||||
if (service != null) {
|
||||
return service;
|
||||
}
|
||||
|
||||
try {
|
||||
// 创建ReferenceConfig实例
|
||||
// 要与jsowell-charge-thirdparty的远程服务的@DubboService配置一致
|
||||
ReferenceConfig<ThirdPartyPlatformApi> referenceConfig = new ReferenceConfig<>();
|
||||
referenceConfig.setInterface(ThirdPartyPlatformApi.class);
|
||||
referenceConfig.setGroup(platformType);
|
||||
referenceConfig.setVersion("1.0.0");
|
||||
referenceConfig.setTimeout(10000); // 设置超时时间为10秒,默认为1秒
|
||||
referenceConfig.setRetries(2); //失败重试次数为2
|
||||
// referenceConfig.setAsync(true); //异步调用
|
||||
|
||||
|
||||
// 根据特定的配置,在nacos中寻找jsowell-charge-thirdparty注册的服务
|
||||
// 使用DubboBootstrap注册并获取服务
|
||||
DubboBootstrap
|
||||
.getInstance() // 获取DubboBootstrap实例
|
||||
.reference( // 引用服务配置
|
||||
referenceConfig,
|
||||
DubboBootstrap
|
||||
.getInstance()
|
||||
.getApplicationModel()
|
||||
.getDefaultModule());
|
||||
|
||||
// 获取服务代理
|
||||
service = referenceConfig.get();
|
||||
serviceCache.put(platformType, service);
|
||||
log.info("缓存中有的缓存有: "+ serviceCache.toString());
|
||||
return service;
|
||||
} catch (Exception e) {
|
||||
throw new BusinessException(ReturnCodeEnum.valueOf("获取平台[" + platformType + "]的服务失败: " + e.getMessage()));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 清理缓存
|
||||
*/
|
||||
public static void clearCache() {
|
||||
serviceCache.clear();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user