This commit is contained in:
2024-01-22 16:48:58 +08:00
parent 6962397a2e
commit f40859260e
4 changed files with 50 additions and 3 deletions

View File

@@ -3,6 +3,7 @@ package com.jsowell.thirdparty.hainan.service;
import com.github.pagehelper.PageInfo;
import com.google.common.collect.Lists;
import com.jsowell.common.constant.Constants;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.util.PageUtils;
import com.jsowell.common.util.StringUtils;
import com.jsowell.pile.domain.ThirdPartyPlatformConfig;
@@ -10,7 +11,8 @@ import com.jsowell.pile.dto.QueryStationInfoDTO;
import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO;
import com.jsowell.pile.vo.uniapp.BillingPriceVO;
import com.jsowell.thirdparty.hainan.domain.HNStationInfo;
import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformService;
import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic;
import com.jsowell.thirdparty.platform.InterfaceWithPlatformLogicFactory;
import org.apache.commons.collections4.CollectionUtils;
import org.springframework.stereotype.Service;
@@ -26,7 +28,11 @@ import java.util.Map;
* @Date 2024/1/18 10:05:23
*/
@Service
public class HaiNanChargeService extends AbsInterfaceWithPlatformService {
public class HaiNanChargeService extends AbsInterfaceWithPlatformLogic {
@Override
public void afterPropertiesSet() throws Exception {
InterfaceWithPlatformLogicFactory.register(ThirdPlatformTypeEnum.HAI_NAN.getCode(), this);
}
/**
* 6.2 查询充电站信息
@@ -148,6 +154,8 @@ public class HaiNanChargeService extends AbsInterfaceWithPlatformService {
return null;
}
/**
* 身份认证
*

View File

@@ -16,6 +16,7 @@ import com.jsowell.thirdparty.lianlian.util.Encodes;
import com.jsowell.thirdparty.lianlian.util.GBSignUtils;
import com.jsowell.thirdparty.lianlian.vo.AccessTokenVO;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import org.springframework.beans.factory.InitializingBean;
import org.springframework.beans.factory.annotation.Autowired;
import java.nio.charset.StandardCharsets;
@@ -25,7 +26,7 @@ import java.util.Map;
/**
* 对接第三方平台抽象类
*/
public abstract class AbsInterfaceWithPlatformService {
public abstract class AbsInterfaceWithPlatformLogic implements InitializingBean {
@Autowired
protected PileStationInfoService pileStationInfoService;

View File

@@ -0,0 +1,37 @@
package com.jsowell.thirdparty.platform;
import com.google.common.collect.Maps;
import com.jsowell.common.util.StringUtils;
import java.util.Map;
import java.util.Objects;
/**
* 工厂设计模式
* 对接第三方平台逻辑工厂类
*/
public class InterfaceWithPlatformLogicFactory {
private static final Map<String, AbsInterfaceWithPlatformLogic> platformMap = Maps.newHashMap();
/**
* 注册
* @param str
* @param handler
*/
public static void register(String str, AbsInterfaceWithPlatformLogic handler) {
if (StringUtils.isBlank(str) || Objects.isNull(handler)) {
return;
}
platformMap.put(str, handler);
}
/**
* 获取
* @param name
* @return
*/
public static AbsInterfaceWithPlatformLogic getPlatformLogic(String name) {
return platformMap.get(name);
}
}