diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java index 01ae0bc5a..3ce4de615 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/pile/PileStationInfoController.java @@ -227,7 +227,7 @@ public class PileStationInfoController extends BaseController { public TableDataInfo getSettingByStationId(@PathVariable("stationId") Long id) { List list = thirdPartyStationRelationService.getRelationInfoList(String.valueOf(id)); for (ThirdPartyStationRelationVO vo : list) { - vo.setThirdPartyType(ThirdPlatformTypeEnum.getLabelByCode(vo.getThirdPartyType())); + vo.setThirdPartyType(ThirdPlatformTypeEnum.getTypeLabelByTypeCode(vo.getThirdPartyType())); } return getDataTable(list); } diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/hainan/HaiNanPlatformController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/hainan/HaiNanPlatformController.java index dbe910fa4..aa8097c17 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/hainan/HaiNanPlatformController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/hainan/HaiNanPlatformController.java @@ -16,9 +16,10 @@ import com.jsowell.thirdparty.lianlian.common.CommonResult; import com.jsowell.thirdparty.lianlian.dto.CommonParamsDTO; import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; -import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic; +import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import com.jsowell.thirdparty.platform.hainan.service.HaiNanPlatformLogic; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Qualifier; import org.springframework.web.bind.annotation.*; import javax.servlet.http.HttpServletRequest; @@ -33,8 +34,12 @@ import java.util.Map; @RequestMapping("/hainan") public class HaiNanPlatformController extends BaseController { // 使用海南平台处理逻辑 + // @Autowired + // private AbsInterfaceWithPlatformLogic platformLogic = new HaiNanPlatformLogic(); + @Autowired - private AbsInterfaceWithPlatformLogic platformLogic = new HaiNanPlatformLogic(); + @Qualifier("haiNanPlatformLogic") + private ThirdPartyPlatformService platformLogic; /** * 获取token接口 @@ -86,7 +91,7 @@ public class HaiNanPlatformController extends BaseController { // 转换成相应对象 QueryStationInfoDTO queryStationInfoDTO = JSONObject.parseObject(dataStr, QueryStationInfoDTO.class); queryStationInfoDTO.setOperatorId(dto.getOperatorID()); - queryStationInfoDTO.setThirdPlatformType(ThirdPlatformTypeEnum.HAI_NAN_1.getCode()); + queryStationInfoDTO.setThirdPlatformType(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode()); Map map = platformLogic.queryStationsInfo(queryStationInfoDTO); logger.info("海南平台查询充电站信息 result:{}", JSON.toJSONString(map)); return CommonResult.success(0, "查询充电站信息成功!", map.get("Data"), map.get("Sig")); diff --git a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java index a5bb11a6f..72faae04d 100644 --- a/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java +++ b/jsowell-common/src/main/java/com/jsowell/common/enums/thirdparty/ThirdPlatformTypeEnum.java @@ -9,53 +9,87 @@ import com.jsowell.common.util.StringUtils; * @Date 2023/10/23 8:21:33 */ public enum ThirdPlatformTypeEnum { - LIAN_LIAN_PLATFORM("1", "上海联联平台"), - ZHONG_DIAN_LIAN_PLATFORM("2", "中电联平台"), - JIANG_SU_PLATFORM("3", "江苏省平台"), - YONG_CHENG_BO_CHE("4", "甬城泊车平台"), - NING_XIA_JIAO_TOU("5", "宁夏交投"), - XIN_DIAN_TU("6", "新电途平台"), - HAI_NAN_1("7", "海南一张网(监管平台)"), - HAI_NAN_2("8", "海南一张网(充电平台)"), - HUA_WEI("9", "华为平台"), - NEI_MENG_GU_PLATFORM("10", "内蒙古平台"), + LIAN_LIAN_PLATFORM("1", "上海联联平台", "425010765"), + ZHONG_DIAN_LIAN_PLATFORM("2", "中电联平台", "14405899X"), + JIANG_SU_PLATFORM("3", "江苏省平台", "726079387"), + YONG_CHENG_BO_CHE("4", "甬城泊车平台", "330205020"), + NING_XIA_JIAO_TOU("5", "宁夏交投", "MA771QENX"), + XIN_DIAN_TU("6", "新电途平台", "MA25CNM38"), + HAI_NAN_1("7", "海南一张网(监管平台)", "578725200"), + HAI_NAN_2("8", "海南一张网(充电平台)", "MAA9A0PP1"), + HUA_WEI("9", "华为平台", "MA5GTQ528"), + NEI_MENG_GU_PLATFORM("10", "内蒙古平台", ""), ; - private String code; + private String typeCode; - private String label; + private String typeLabel; - public String getCode() { - return code; + private String operatorId; + + public String getTypeCode() { + return typeCode; } - public void setCode(String code) { - this.code = code; + public void setTypeCode(String typeCode) { + this.typeCode = typeCode; } - public String getLabel() { - return label; + public String getTypeLabel() { + return typeLabel; } - public void setLabel(String label) { - this.label = label; + public void setTypeLabel(String typeLabel) { + this.typeLabel = typeLabel; } - ThirdPlatformTypeEnum(String code, String label) { - this.code = code; - this.label = label; + public String getOperatorId() { + return operatorId; + } + + public void setOperatorId(String operatorId) { + this.operatorId = operatorId; + } + + ThirdPlatformTypeEnum(String typeCode, String typeLabel, String operatorId) { + this.typeCode = typeCode; + this.typeLabel = typeLabel; + this.operatorId = operatorId; } /** - * 根据code获取停止原因描述 - * - * @param code 编码 - * @return 停止原因描述 + * 根据 type 获取 label */ - public static String getLabelByCode(String code) { + public static String getTypeLabelByTypeCode(String typeCode) { for (ThirdPlatformTypeEnum item : ThirdPlatformTypeEnum.values()) { - if (StringUtils.equals(item.getCode(), code)) { - return item.getLabel(); + if (StringUtils.equals(item.getTypeCode(), typeCode)) { + return item.getTypeLabel(); + } + } + return null; + } + + /** + * 根据 type 获取 operatorId + */ + public static String getOperatorIdByCode(String typeCode) { + for (ThirdPlatformTypeEnum item : ThirdPlatformTypeEnum.values()) { + if (StringUtils.equals(item.getTypeCode(), typeCode)) { + return item.getOperatorId(); + } + } + return null; + } + + /** + * 根据operatorId获取平台类型code + * @param operatorId + * @return + */ + public static String getTypeCodeByOperatorId(String operatorId) { + for (ThirdPlatformTypeEnum item : ThirdPlatformTypeEnum.values()) { + if (StringUtils.equals(item.getOperatorId(), operatorId)) { + return item.getTypeCode(); } } return null; diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java index 41ca31a75..a1bd9d3d7 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/PileBasicInfoService.java @@ -1,13 +1,14 @@ package com.jsowell.pile.service; -import com.jsowell.pile.thirdparty.ConnectorInfo; -import com.jsowell.pile.thirdparty.EquipmentInfo; import com.jsowell.common.core.domain.ykc.RealTimeMonitorData; import com.jsowell.pile.domain.PileBasicInfo; -import com.jsowell.pile.domain.PileStationInfo; import com.jsowell.pile.dto.IndexQueryDTO; import com.jsowell.pile.dto.QueryPileDTO; import com.jsowell.pile.dto.ReplaceMerchantStationDTO; +import com.jsowell.pile.thirdparty.ConnectorInfo; +import com.jsowell.pile.thirdparty.EquipmentInfo; +import com.jsowell.pile.thirdparty.ZDLConnectorInfo; +import com.jsowell.pile.thirdparty.ZDLEquipmentInfo; import com.jsowell.pile.vo.base.PileInfoVO; import com.jsowell.pile.vo.uniapp.GroundLockInfoVO; import com.jsowell.pile.vo.uniapp.PersonalPileInfoVO; @@ -194,7 +195,18 @@ public interface PileBasicInfoService { */ PileBasicInfo getMaxNumPileInfo(); - List getPileList(PileStationInfo pileStationInfo); + /** + * 获取充电桩列表 + * 提供给联联平台 + * @param pileStationInfo + * @return + */ + // List getPileList(PileStationInfo pileStationInfo); + // List getConnectorList(PileBasicInfo pileBasicInfo); - List getConnectorList(PileBasicInfo pileBasicInfo); + List getPileListForLianLian(String stationId); + List getConnectorListForLianLian(String pileSn); + + List getPileListForZDL(String stationId); + List getConnectorListForZDL(String pileSn); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java index a1e45a1fd..8e74c7da2 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/OrderBasicInfoServiceImpl.java @@ -303,7 +303,7 @@ public class OrderBasicInfoServiceImpl implements OrderBasicInfoService { } String thirdPartyType = orderListVO.getThirdPartyType(); if(StringUtils.isNotBlank(thirdPartyType)) { - String label = ThirdPlatformTypeEnum.getLabelByCode(thirdPartyType); + String label = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(thirdPartyType); orderListVO.setThirdPartyType(label + "启动"); } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java index f2ad75f73..7de791f6a 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/PileBasicInfoServiceImpl.java @@ -27,6 +27,8 @@ import com.jsowell.pile.mapper.PileBasicInfoMapper; import com.jsowell.pile.mapper.PileMerchantInfoMapper; import com.jsowell.pile.mapper.PileSimInfoMapper; import com.jsowell.pile.service.*; +import com.jsowell.pile.thirdparty.ZDLConnectorInfo; +import com.jsowell.pile.thirdparty.ZDLEquipmentInfo; import com.jsowell.pile.util.UserUtils; import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.base.PileInfoVO; @@ -935,7 +937,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { * @param pileStationInfo * @return */ - @Override + /*@Override public List getPileList(PileStationInfo pileStationInfo) { List resultList = new ArrayList<>(); // 通过站点id查询桩基本信息 @@ -977,6 +979,49 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { resultList.add(equipmentInfo); } return resultList; + }*/ + + @Override + public List getPileListForLianLian(String stationId) { + List resultList = new ArrayList<>(); + // 通过站点id查询桩基本信息 + List list = this.getPileListByStationId(stationId); + // 封装成联联平台对象 + for (PileBasicInfo pileBasicInfo : list) { + EquipmentInfo equipmentInfo = new EquipmentInfo(); + String pileSn = pileBasicInfo.getSn(); + + equipmentInfo.setEquipmentID(pileSn); + equipmentInfo.setManufacturerID(Constants.OPERATORID_LIANLIAN); + equipmentInfo.setConstructionTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD, pileBasicInfo.getCreateTime())); + + PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); + equipmentInfo.setEquipmentType(Integer.valueOf(modelInfo.getSpeedType())); + + // Map pileStatus = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileBasicInfo.getSn())); + Map pileStatusMap = pileConnectorInfoService.getPileStatus(Lists.newArrayList(pileSn)); + String pileStatus = pileStatusMap.get(pileSn); + if (StringUtils.equals(PileStatusEnum.ON_LINE.getValue(), pileStatus)) { + // 1-在线 + pileStatus = LianLianPileStatusEnum.NORMAL.getCode(); + } else if (StringUtils.equals(PileStatusEnum.OFF_LINE.getValue(), pileStatus)) { + // 2-离线 + pileStatus = LianLianPileStatusEnum.CLOSE_OFFLINE.getCode(); + } else if (StringUtils.equals(PileStatusEnum.FAULT.getValue(), pileStatus)) { + // 3-故障 + pileStatus = LianLianPileStatusEnum.UNDER_MAINTENANCE.getCode(); + } + equipmentInfo.setEquipmentStatus(Integer.valueOf(pileStatus)); + equipmentInfo.setEquipmentPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + equipmentInfo.setNewNationalStandard(1); + equipmentInfo.setVinFlag(1); + + List connectorList = getConnectorListForLianLian(pileSn); + equipmentInfo.setConnectorInfos(connectorList); + + resultList.add(equipmentInfo); + } + return resultList; } /** @@ -985,7 +1030,7 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { * @param pileBasicInfo * @return */ - @Override + /*@Override public List getConnectorList(PileBasicInfo pileBasicInfo) { List resultList = new ArrayList<>(); @@ -1019,6 +1064,84 @@ public class PileBasicInfoServiceImpl implements PileBasicInfoService { resultList.add(connectorInfo); } + return resultList; + }*/ + + @Override + public List getConnectorListForLianLian(String pileSn) { + List resultList = new ArrayList<>(); + + List list = pileConnectorInfoService.selectPileConnectorInfoList(pileSn); + PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); + for (PileConnectorInfo pileConnectorInfo : list) { + ConnectorInfo connectorInfo = new ConnectorInfo(); + connectorInfo.setConnectorID(pileConnectorInfo.getPileConnectorCode()); + int connectorType = StringUtils.equals("1", modelInfo.getSpeedType()) ? 4 : 3; + connectorInfo.setConnectorType(connectorType); + // 车位号 + if (StringUtils.isNotBlank(pileConnectorInfo.getParkNo())) { + connectorInfo.setParkNo(pileConnectorInfo.getParkNo()); + } + connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage())); + connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage())); + connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent())); + if (!StringUtils.equals(modelInfo.getConnectorNum(), "1")) { + // 如果不是单枪,则枪口功率需要除以枪口数量 + String ratedPowerStr = modelInfo.getRatedPower(); + BigDecimal ratedPower = new BigDecimal(ratedPowerStr); + connectorInfo.setPower(ratedPower.divide(new BigDecimal(modelInfo.getConnectorNum()), 1, BigDecimal.ROUND_HALF_UP)); + }else { + connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + } + resultList.add(connectorInfo); + } + return resultList; + } + + @Override + public List getPileListForZDL(String stationId) { + List resultList = new ArrayList<>(); + // 通过站点id查询桩基本信息 + List list = this.getPileListByStationId(stationId); + // 封装成中电联平台对象 + for (PileBasicInfo pileBasicInfo : list) { + ZDLEquipmentInfo equipmentInfo = new ZDLEquipmentInfo(); + String pileSn = pileBasicInfo.getSn(); + equipmentInfo.setEquipmentId(pileSn); + PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); + equipmentInfo.setEquipmentType(Integer.parseInt(modelInfo.getSpeedType())); + equipmentInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + + List connectorList = getConnectorListForZDL(pileSn); + equipmentInfo.setConnectorInfos(connectorList); + + resultList.add(equipmentInfo); + } + return resultList; + } + + @Override + public List getConnectorListForZDL(String pileSn) { + List resultList = new ArrayList<>(); + + List list = pileConnectorInfoService.selectPileConnectorInfoList(pileSn); + PileModelInfoVO modelInfo = pileModelInfoService.getPileModelInfoByPileSn(pileSn); + for (PileConnectorInfo pileConnectorInfo : list) { + ZDLConnectorInfo connectorInfo = new ZDLConnectorInfo(); + connectorInfo.setConnectorId(pileConnectorInfo.getPileConnectorCode()); + int connectorType = StringUtils.equals("1", modelInfo.getSpeedType()) ? 4 : 3; + connectorInfo.setConnectorType(connectorType); + // 车位号 + if (StringUtils.isNotBlank(pileConnectorInfo.getParkNo())) { + connectorInfo.setParkNo(pileConnectorInfo.getParkNo()); + } + connectorInfo.setVoltageUpperLimits(Integer.valueOf(modelInfo.getRatedVoltage())); + connectorInfo.setVoltageLowerLimits(Integer.valueOf(modelInfo.getRatedVoltage())); + connectorInfo.setCurrent(Integer.valueOf(modelInfo.getRatedCurrent())); + connectorInfo.setNationalStandard(2); + connectorInfo.setPower(new BigDecimal(modelInfo.getRatedPower()).setScale(1, BigDecimal.ROUND_HALF_UP)); + resultList.add(connectorInfo); + } return resultList; } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartyStationRelationServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartyStationRelationServiceImpl.java index db143bc03..27e7e31e8 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartyStationRelationServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdPartyStationRelationServiceImpl.java @@ -32,7 +32,7 @@ public class ThirdPartyStationRelationServiceImpl implements ThirdPartyStationRe ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); relation.setStationId(Long.parseLong(stationId)); relation.setThirdPartyType(thirdPartyType); - if (StringUtils.equals(thirdPartyType, ThirdPlatformTypeEnum.HUA_WEI.getCode())) { + if (StringUtils.equals(thirdPartyType, ThirdPlatformTypeEnum.HUA_WEI.getTypeCode())) { relation.setStartMode(Constants.ONE); } ThirdPartyStationRelationVO vo = this.selectRelationInfo(relation); diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdpartySnRelationServiceImpl.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdpartySnRelationServiceImpl.java index 80d2bd09f..4ed8b040b 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdpartySnRelationServiceImpl.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/impl/ThirdpartySnRelationServiceImpl.java @@ -4,7 +4,6 @@ import java.util.List; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; import com.jsowell.common.util.DateUtils; -import com.jsowell.pile.dto.QueryPileDTO; import com.jsowell.pile.dto.ThirdPartySnRelationDTO; import com.jsowell.pile.vo.web.ThirdPartySnRelationVO; import org.springframework.beans.factory.annotation.Autowired; @@ -103,7 +102,7 @@ public class ThirdpartySnRelationServiceImpl implements IThirdpartySnRelationSer for (ThirdPartySnRelationVO thirdPartySnRelationVO : list) { // 将第三方平台类型中文名称查询出来 String thirdPartyType = thirdPartySnRelationVO.getThirdPartyType(); - String label = ThirdPlatformTypeEnum.getLabelByCode(thirdPartyType); + String label = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(thirdPartyType); thirdPartySnRelationVO.setThirdPartyName(label); } return list; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLConnectorInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLConnectorInfo.java similarity index 93% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLConnectorInfo.java rename to jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLConnectorInfo.java index 7f6dd4b53..e613cb51e 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLConnectorInfo.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLConnectorInfo.java @@ -1,4 +1,4 @@ -package com.jsowell.thirdparty.zhongdianlian.domain; +package com.jsowell.pile.thirdparty; import com.alibaba.fastjson2.annotation.JSONField; import lombok.Data; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLEquipmentInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLEquipmentInfo.java similarity index 91% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLEquipmentInfo.java rename to jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLEquipmentInfo.java index faccdca74..6c7035c81 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLEquipmentInfo.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLEquipmentInfo.java @@ -1,4 +1,4 @@ -package com.jsowell.thirdparty.zhongdianlian.domain; +package com.jsowell.pile.thirdparty; import com.alibaba.fastjson2.annotation.JSONField; import lombok.Data; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLStationInfo.java b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLStationInfo.java similarity index 96% rename from jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLStationInfo.java rename to jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLStationInfo.java index 1e7618169..f1dd8dba2 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/domain/ZDLStationInfo.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/thirdparty/ZDLStationInfo.java @@ -1,4 +1,4 @@ -package com.jsowell.thirdparty.zhongdianlian.domain; +package com.jsowell.pile.thirdparty; import com.alibaba.fastjson2.annotation.JSONField; import lombok.AllArgsConstructor; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java index 01270971f..41d6116a7 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/CommonService.java @@ -122,7 +122,7 @@ public class CommonService { ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); relation.setStationId(dto.getStationId()); relation.setThirdPartyType(thirdPartyType); - if (StringUtils.equals(thirdPartyType, ThirdPlatformTypeEnum.HUA_WEI.getCode())) { + if (StringUtils.equals(thirdPartyType, ThirdPlatformTypeEnum.HUA_WEI.getTypeCode())) { relation.setStartMode(Constants.ONE); } ThirdPartyStationRelationVO vo = thirdPartyStationRelationService.selectRelationInfo(relation); @@ -147,27 +147,27 @@ public class CommonService { StringBuilder finalResult = new StringBuilder(); for (String type : types) { dto.setThirdPartyType(type); - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { // 推送联联 // result = lianLianService.pushStationInfo(dto); result = lianLianService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { // 中电联 // result = zdlService.pushStationInfo(dto); result = zdlService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { // 江苏省平台 // result = nrService.pushStationInfo(dto); result = nrService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), dto.getThirdPartyType())) { // 甬城泊车平台 // result = ycbcService.pushStationInfo(dto); result = ycbcService.pushStationInfoV2(dto); } - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), dto.getThirdPartyType())) { // 新电途平台 result = xdtService.pushStationInfoV2(dto); } @@ -175,7 +175,7 @@ public class CommonService { // // 华为 // result = huaWeiService.notificationOperationSystemInfo(dto); // } - if(StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), dto.getThirdPartyType())) { + if(StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(), dto.getThirdPartyType())) { // 海南 result = haiNanChargeService.pushStationInfoV2(dto); } @@ -224,7 +224,7 @@ public class CommonService { // 如果是类似华为格式,不需要传 continue; } - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) { // 联联 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); if (orderInfo == null) { @@ -240,12 +240,12 @@ public class CommonService { // 推送充电状态 lianLianService.pushChargeStatus(orderInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) { // 中电联 // log.info("推送中电联平台实时数据 pileConnectorCode:{}, connectorStatus:{}", pileConnectorCode, connectorStatus); zdlService.notificationStationStatus(pileConnectorCode, changedStatus); } - if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), thirdPartyType)) { // 先判断缓存中是否有数据 String redisKey = CacheConstants.JIANGSU_PUSH_PILE_STATUS + pileConnectorCode; Object cacheObject = redisCache.getCacheObject(redisKey); @@ -269,7 +269,7 @@ public class CommonService { // log.info("推送江苏省平台实时数据 result:{}", result); } - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), thirdPartyType)) { // 新电途平台 log.info("新电途平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus); String result1 = xdtService.notificationStationStatus(pileConnectorCode, changedStatus); @@ -282,7 +282,7 @@ public class CommonService { String result = xdtService.notificationEquipChargeStatus(orderInfo.getOrderCode()); log.info("推送新电途平台 充电状态 result:{}", result); } - if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) { // 华为平台 huaWeiService.notificationStationStatus(pileConnectorCode, changedStatus); OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByTransactionCode(transactionCode); @@ -291,11 +291,11 @@ public class CommonService { } huaWeiService.notificationEquipChargeStatus(orderInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(), thirdPartyType)) { // 海南平台 haiNanChargeService.notificationStationStatus(pileConnectorCode, changedStatus); } - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { // 甬城泊车 // log.info("推送甬城泊车平台设备状态变化推送 pileConnectorCode:{}, changedStatus:{}", pileConnectorCode, changedStatus); // 设备状态变化推送 notification_stationStatus @@ -335,7 +335,7 @@ public class CommonService { // 如果是类似华为格式,不需要传 continue; } - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) { // 联联平台 // 推送停止充电结果 lianLianService.pushStopChargeResult(orderBasicInfo.getOrderCode()); @@ -344,16 +344,16 @@ public class CommonService { // 推送充电订单信息 lianLianService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getTypeCode(), thirdPartyType)) { // 中电联 zdlService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getTypeCode(), thirdPartyType)) { // 江苏平台 // 推送订单信息 nrService.pushOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), thirdPartyType)) { // 新电途平台 // 推送停止充电结果 xdtService.notificationStopChargeResult(orderBasicInfo.getOrderCode()); @@ -367,12 +367,12 @@ public class CommonService { // // 推送订单信息 // result = huaWeiService.pushChargeOrderInfo(orderBasicInfo.getOrderCode()); // } - if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(), thirdPartyType)) { // 海南平台 haiNanChargeService.notificationChargeOrderInfo(orderBasicInfo.getOrderCode()); } - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { if (StringUtils.equals(orderBasicInfo.getStartMode(), StartModeEnum.THIRD_PARTY_PLATFORM.getValue())) { // 甬城泊车 // 推送停止充电结果 @@ -435,7 +435,7 @@ public class CommonService { String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO dto = new YCBCGetTokenDTO(); dto.setOperatorId(operatorId); dto.setDataSecret(dataSecret); @@ -513,9 +513,9 @@ public class CommonService { String payMode = dto.getPayMode(); // 判断平台类型 - if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode(), thirdPartyType)) { // 华为平台 - String label = ThirdPlatformTypeEnum.getLabelByCode(thirdPartyType); + String label = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(thirdPartyType); // query_station_status 查询站点枪口详情 Map map = huaweiServiceV2.queryStationStatus(stationIds); String status = map.get(pileConnectorCode); diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java index 0922748ae..271631166 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/huawei/HuaweiServiceV2.java @@ -31,8 +31,6 @@ import com.jsowell.pile.dto.huawei.*; import com.jsowell.pile.service.*; import com.jsowell.pile.service.programlogic.AbstractProgramLogic; import com.jsowell.pile.service.programlogic.ProgramLogicFactory; -import com.jsowell.pile.transaction.dto.OrderTransactionDTO; -import com.jsowell.pile.transaction.service.TransactionService; import com.jsowell.pile.vo.huawei.QueryChargeStatusVO; import com.jsowell.pile.vo.huawei.QueryEquipAuthVO; import com.jsowell.pile.vo.huawei.QueryStartChargeVO; @@ -50,7 +48,6 @@ import org.apache.commons.collections4.CollectionUtils; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; -import javax.annotation.Resource; import java.io.UnsupportedEncodingException; import java.math.BigDecimal; import java.math.RoundingMode; @@ -120,7 +117,7 @@ public class HuaweiServiceV2 { } // 通过华为的type查询出密钥配置 ThirdPartySettingInfo info = new ThirdPartySettingInfo(); - info.setType(ThirdPlatformTypeEnum.HUA_WEI.getCode()); + info.setType(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode()); ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.selectSettingInfo(info); String operatorSecret = settingInfo.getOperatorSecret(); @@ -938,7 +935,7 @@ public class HuaweiServiceV2 { private ThirdPartySettingInfo getHuaWeiSettingInfo() { // 通过华为的type查询出密钥配置 ThirdPartySettingInfo info = new ThirdPartySettingInfo(); - info.setType(ThirdPlatformTypeEnum.HUA_WEI.getCode()); + info.setType(ThirdPlatformTypeEnum.HUA_WEI.getTypeCode()); ThirdPartySettingInfo settingInfo = thirdPartySettingInfoService.selectSettingInfo(info); return settingInfo; } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java index 0e04274ea..5f710eb51 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/service/impl/LianLianServiceImpl.java @@ -317,7 +317,7 @@ public class LianLianServiceImpl implements LianLianService { info.setAreaCode(subAreaCode); // 截取运营商组织机构代码(去除最后一位后的最后九位) String organizationCode = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), dto.getThirdPartyType())) { // 联联平台先使用自己运营商的组织机构代码 organizationCode = Constants.OPERATORID_LIANLIAN; info.setEquipmentOwnerID(organizationCode); @@ -797,7 +797,7 @@ public class LianLianServiceImpl implements LianLianService { .build(); String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(dto.getOperatorId()); - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), type)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), type)) { // 如果是新电途平台,则将 startChargeSeqStat 改为 1-启动中 vo.setStartChargeSeqStat(1); } @@ -837,7 +837,7 @@ public class LianLianServiceImpl implements LianLianService { public Map query_equip_charge_status(QueryEquipChargeStatusDTO dto) { String operatorID = dto.getOperatorID(); String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(operatorID); - String operatorName = ThirdPlatformTypeEnum.getLabelByCode(type); + String operatorName = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(type); // 通过订单号查询订单信息 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getStartChargeSeq()); // logger.info(operatorName + "查询订单信息 orderInfo:{}", orderInfo); @@ -950,7 +950,7 @@ public class LianLianServiceImpl implements LianLianService { vo.setFailReason(0); String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(dto.getOperatorId()); - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), type)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), type)) { // 如果是新电途平台,则将 startChargeSeqStat 改为 3-停止中 vo.setStartChargeSeqStat(3); } @@ -1070,7 +1070,7 @@ public class LianLianServiceImpl implements LianLianService { // 获取令牌 String result = ""; String token = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO dto = new YCBCGetTokenDTO(); dto.setOperatorId(operatorId); dto.setDataSecret(dataSecret); @@ -1273,7 +1273,7 @@ public class LianLianServiceImpl implements LianLianService { String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO dto = new YCBCGetTokenDTO(); dto.setOperatorId(operatorId); dto.setDataSecret(dataSecret); @@ -1343,7 +1343,7 @@ public class LianLianServiceImpl implements LianLianService { // 获取令牌 String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO ycbcGetTokenDTO = new YCBCGetTokenDTO(); ycbcGetTokenDTO.setOperatorId(operatorId); ycbcGetTokenDTO.setDataSecret(dataSecret); @@ -1419,7 +1419,7 @@ public class LianLianServiceImpl implements LianLianService { // 获取token String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO dto = new YCBCGetTokenDTO(); dto.setOperatorId(operatorId); dto.setDataSecret(dataSecret); @@ -1491,7 +1491,7 @@ public class LianLianServiceImpl implements LianLianService { // 获取令牌 String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO dto = new YCBCGetTokenDTO(); dto.setOperatorId(operatorId); dto.setDataSecret(dataSecret); diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java index ae36f05fa..abfd6affe 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/lianlian/util/HttpRequestUtil.java @@ -125,7 +125,7 @@ public class HttpRequestUtil { String dataSecretIV, String operatorId, String sigSecret, String thirdPlatformType) { String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(operatorId); - String label = ThirdPlatformTypeEnum.getLabelByCode(type); + String label = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(type); if(StringUtils.isBlank(label)) { label = operatorId + "(" + url + ")"; } @@ -143,7 +143,7 @@ public class HttpRequestUtil { params.put("Seq", "001"); // 此处是与其他获取令牌方法唯一不同之处,甬城泊车获取令牌需要添加此字段 - if (ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode().equals(thirdPlatformType)) { + if (ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode().equals(thirdPlatformType)) { params.put("Portname", "wcc-pro"); } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/AbsInterfaceWithPlatformLogic.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/AbsInterfaceWithPlatformLogic.java index 49e5ac916..adcbfb9f1 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/AbsInterfaceWithPlatformLogic.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/AbsInterfaceWithPlatformLogic.java @@ -21,8 +21,8 @@ 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.lianlian.vo.LianLianResultVO; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLConnectorInfo; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLEquipmentInfo; +import com.jsowell.pile.thirdparty.ZDLConnectorInfo; +import com.jsowell.pile.thirdparty.ZDLEquipmentInfo; import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import org.slf4j.Logger; import org.slf4j.LoggerFactory; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java new file mode 100644 index 000000000..e44fa1be5 --- /dev/null +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/ThirdPartyPlatformService.java @@ -0,0 +1,372 @@ +package com.jsowell.thirdparty.platform; + +import cn.hutool.http.HttpUtil; +import cn.hutool.json.JSONUtil; +import com.alibaba.fastjson2.JSON; +import com.jsowell.common.util.DateUtils; +import com.jsowell.pile.dto.*; +import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; +import com.jsowell.thirdparty.lianlian.util.Cryptos; +import com.jsowell.thirdparty.lianlian.util.Encodes; +import com.jsowell.thirdparty.lianlian.util.GBSignUtils; +import com.jsowell.thirdparty.lianlian.vo.LianLianResultVO; + +import java.nio.charset.StandardCharsets; +import java.util.Date; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.Map; + +public interface ThirdPartyPlatformService { + // =================================================================================== // + // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由我方平台实现此接口,对方平台调用的查询接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ // + // =================================================================================== // + + /** + * 查询运营商信息 query_operator_info + * supervise_query_operator_info + * + * @param dto 查询运营商信息DTO + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryOperatorInfo(QueryOperatorInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 查询充电站信息 query_stations_info + * 此接口用于查询对接平台的充电站的信息 + * + * @param dto 查询站点信息dto + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryStationsInfo(QueryStationInfoDTO dto){ + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 设备接口状态查询 query_station_status + * + * @param dto 查询站点信息dto + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryStationStatus(QueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 查询统计信息 query_station_stats + * + * @param dto 查询站点信息dto + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryStationStats(QueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 查询充电电量信息 query_order_info + * + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryOrderInfo(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 请求设备认证 query_equip_auth + * 业务信息交换 + * + * @param dto 联联平台请求设备认证 + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryEquipAuth(QueryEquipmentDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 请求启动充电 query_start_charge + * + * @param dto 请求启动充电DTO + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryStartCharge(QueryStartChargeDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 查询充电状态 query_equip_charge_status + * + * @param dto 查询充电状态DTO + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryEquipChargeStatus(QueryEquipChargeStatusDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 请求停止充电 query_stop_charge + * + * @param dto 请求启动充电DTO + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryStopCharge(QueryStartChargeDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 充电站内充电桩空闲状态查询 query_free_pile_number + * + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryFreePileNumber(NXJTQueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 某车牌号消费记录查询 query_orders_info_by_Plate_number + * + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryOrdersInfoByPlateNumber(NXJTQueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 某段时间内消费记录查询 query_orders_info + * + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryOrdersInfo(NXJTQueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 查询业务策略信息结果 + * 请求计费策略 request_equip_business_policy + * + * @param dto 请求启动充电DTO + * @throws UnsupportedOperationException 未实现异常 + */ + default Map queryEquipBusinessPolicy(QueryStartChargeDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * VIN码充电 insert_start_charge + * 华为平台 + * + * @throws UnsupportedOperationException 未实现异常 + */ + default Map insertStartCharge(QueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 下发计费策略响应 notification_deliver_equip_business_policy_result + * 华为平台 + * + * @throws UnsupportedOperationException 未实现异常 + */ + default Map notificationDeliverEquipBusinessPolicyResult(QueryStationInfoDTO dto) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + + // =================================================================================== // + // ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ 由对方平台实现此接口,我方平台调用的通知接口 ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ ↓ // + // =================================================================================== // + + /** + * 充电站信息变化推送 notification_stationInfo + * 新站需要推送。当站点信息发生变化时,推送新的信息通知到市级平台 + * + * @param stationId 充电站id + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationStationInfo(String stationId) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 设备状态变化推送 notification_stationStatus + * 推送充电设备接口状态信息 supervise_notification_station_status + * + * @param pileConnectorCode 充电枪口编号 + * @param status 枪口状态 + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationStationStatus(String pileConnectorCode, String status) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 设备充电中状态变化推送 notification_connector_charge_status + * + * @param orderCode 订单编号 + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationConnectorChargeStatus(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 订单信息推送 notification_orderInfo + * + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationOrderInfo(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 站点费率变化推送 notification_stationFee + * + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationStationFee(String stationId) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 充电订单推送 notification_charge_order_info + * TODO 海南一张网文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 + * TODO 甬城泊车平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 + * TODO 华为平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 + * TODO 内蒙古平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 + * + * @param orderCode 订单编号 + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationChargeOrderInfo(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 告警信息推送 notification_alarmInfo + * + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationAlarmInfo() { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 推送启动充电结果 notification_start_charge_result + * + * @param orderCode 订单编号 + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationStartChargeResult(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 推送充电状态 notification_equip_charge_status + * 推送充电状态信息 supervise_notification_equip_charge_status + * + * @param orderCode 订单编号 + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationEquipChargeStatus(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 推送停止充电结果 notification_stop_charge_result + * + * @param orderCode 订单编号 + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationStopChargeResult(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 华为平台 + * 平台充电设备编码同步 notification_operation_system_info + * + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationOperationSystemInfo(String orderCode) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 推送充换电站用能统计信息 supervise_notification_operation_stats_info + * + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationOperationStatsInfo(String stationId) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + /** + * 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history + * + * @throws UnsupportedOperationException 未实现异常 + */ + default String notificationChargeOrderInfoHistory(String stationId) { + throw new UnsupportedOperationException("This method is not yet implemented"); + } + + // -------------------------------------- 以下是公用方法 --------------------------------------- // + /** + * 从联联平台获取令牌 + * + * @param operatorId 运营商id + * @param operatorSecret + * @return + */ + default String getToken(String urlAddress, String operatorId, String operatorSecret, + String dataSecretIv, String signSecret, String dataSecret) { + String token = ""; + try { + // 请求地址 + String requestUrl = urlAddress + "query_token"; + + // 请求data + Map data = new HashMap<>(); + data.put("OperatorID", operatorId); + data.put("OperatorSecret", operatorSecret); + data.put("DataSecretIV", dataSecretIv); + String dataJson = JSONUtil.toJsonStr(data); + + // 加密 + byte[] encryptText = Cryptos.aesEncrypt(dataJson.getBytes(StandardCharsets.UTF_8), + dataSecret.getBytes(), dataSecretIv.getBytes()); + String strData = Encodes.encodeBase64(encryptText); + + Map request = new LinkedHashMap<>(); + request.put("OperatorID", operatorId); + request.put("Data", strData); + request.put("TimeStamp", DateUtils.parseDateToStr(DateUtils.YYYYMMDDHHMMSS, new Date())); + request.put("Seq", "0001"); + + // 生成签名 + String sig = GBSignUtils.sign(request, signSecret); + request.put("Sig", sig); + + String tokenRequest = JSONUtil.toJsonStr(request); + + String response = HttpUtil.post(requestUrl, tokenRequest); + LianLianResultVO result = JSON.parseObject(response, LianLianResultVO.class); + // logger.info("获取令牌 result:{}", result); + + if (result.getRet() == 0) { + // 解密data + byte[] plainText = Cryptos.aesDecrypt(Encodes.decodeBase64((String) result.getData()), + dataSecret.getBytes(), dataSecretIv.getBytes()); + String dataStr = new String(plainText, StandardCharsets.UTF_8); + Map resultMap = (Map) JSON.parse(dataStr); + token = resultMap.get("AccessToken"); + // logger.info("token: {}", token); + } + // logger.info("获取令牌 result:{}, token: {}", result, token); + } catch (Exception e) { + return token; + } + return token; + } + +} diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/domain/HNStationInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/domain/HNStationInfo.java index 5a679c684..08972d399 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/domain/HNStationInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/domain/HNStationInfo.java @@ -1,7 +1,7 @@ package com.jsowell.thirdparty.platform.hainan.domain; import com.alibaba.fastjson2.annotation.JSONField; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLStationInfo; +import com.jsowell.pile.thirdparty.ZDLStationInfo; import lombok.AllArgsConstructor; import lombok.Data; import lombok.NoArgsConstructor; diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformLogic.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformLogic.java index 6dc5f68f4..ac4d35187 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformLogic.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/hainan/service/HaiNanPlatformLogic.java @@ -20,7 +20,7 @@ import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.*; import com.jsowell.pile.domain.ykcCommond.StartChargingCommand; import com.jsowell.pile.dto.*; -import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; +import com.jsowell.pile.service.*; import com.jsowell.pile.vo.base.ConnectorInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; @@ -40,13 +40,17 @@ import com.jsowell.thirdparty.lianlian.vo.EquipmentAuthVO; import com.jsowell.thirdparty.lianlian.vo.QueryChargingStatusVO; import com.jsowell.thirdparty.lianlian.vo.QueryStartChargeVO; import com.jsowell.thirdparty.lianlian.vo.QueryStopChargeVO; -import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic; -import com.jsowell.thirdparty.platform.InterfaceWithPlatformLogicFactory; +import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import com.jsowell.thirdparty.platform.hainan.domain.HNStationInfo; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLEquipmentInfo; +import com.jsowell.pile.thirdparty.ZDLEquipmentInfo; +import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import org.apache.commons.collections4.CollectionUtils; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; +import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.math.BigDecimal; import java.math.RoundingMode; import java.nio.charset.StandardCharsets; @@ -63,30 +67,61 @@ import java.util.stream.Collectors; * @Date 2024/1/18 10:05:23 */ @Service -public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { - @Override - public void afterPropertiesSet() throws Exception { - InterfaceWithPlatformLogicFactory.register(ThirdPlatformTypeEnum.HAI_NAN_1.getCode(), this); - } +public class HaiNanPlatformLogic implements ThirdPartyPlatformService { + Logger logger = LoggerFactory.getLogger(HaiNanPlatformLogic.class); + // 平台类型 + private final String platformType = ThirdPlatformTypeEnum.HAI_NAN_1.getTypeCode(); + + @Autowired + private PileMerchantInfoService pileMerchantInfoService; + + @Autowired + private PileStationInfoService pileStationInfoService; + + @Autowired + private PileBasicInfoService pileBasicInfoService; + + @Autowired + private PileConnectorInfoService pileConnectorInfoService; + + @Autowired + private PileBillingTemplateService pileBillingTemplateService; + + @Autowired + private OrderBasicInfoService orderBasicInfoService; + + @Autowired + private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService; + + @Autowired + private ThirdPartySettingInfoService thirdPartySettingInfoService; + + @Resource + private ThirdPartyStationRelationService thirdPartyStationRelationService; + + @Autowired + private YKCPushCommandService ykcPushCommandService; + + @Autowired + private PileRemoteService pileRemoteService; + + @Autowired + private ZDLService zdlService; + + // @Override + // public void afterPropertiesSet() throws Exception { + // InterfaceWithPlatformLogicFactory.register(platformType, this); + // } public String pushStationInfoV2(PushStationInfoDTO dto) { return zdlService.pushStationInfoV2(dto); } - /** - * 查询运营商信息 - * - * @param dto 查询运营商信息DTO - */ - @Override - public Map queryOperatorInfo(QueryOperatorInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } /** * 6.2 查询充电站信息 */ + @Override public Map queryStationsInfo(QueryStationInfoDTO dto) { // 查询出要查询的充电站id并set进 dto 的stationIds if (StringUtils.isNotBlank(dto.getThirdPlatformType())) { @@ -154,7 +189,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { stationInfo.setPictures(Lists.newArrayList()); } - List pileList = getPileList(pileStationInfo); + List pileList = pileBasicInfoService.getPileListForZDL(stationId); if (CollectionUtils.isNotEmpty(pileList)) { stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表 } @@ -278,40 +313,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { return result; } - /** - * 设备充电中状态变化推送 notification_connector_charge_status - * - * @param pileConnectorCode 充电枪口编号 - * @param status 枪口状态 - */ - @Override - public String notificationConnectorChargeStatus(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 订单信息推送 notification_orderInfo - * - * @param orderCode - */ - @Override - public String notificationOrderInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 站点费率变化推送 notification_stationFee - * - * @param stationId - */ - @Override - public String notificationStationFee(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - /** * 6.4 充电订单推送 * @@ -360,15 +361,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { return result; } - /** - * 告警信息推送 notification_alarmInfo - */ - @Override - public String notificationAlarmInfo() { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - /** * 6.5 设备接口状态查询 * @@ -559,29 +551,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { return resultMap; } - /** - * 查询充电电量信息 query_order_info - * - * @param orderCode - */ - @Override - public Map queryOrderInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 充电站信息变化推送 notification_stationInfo - * 新站需要推送。当站点信息发生变化时,推送新的信息通知到市级平台 - * - * @param stationId 充电站id - */ - @Override - public String notificationStationInfo(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - /** * 请求设备认证 * @@ -700,29 +669,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { return resultMap; } - /** - * VIN码充电 insert_start_charge - * 华为平台 - * - * @param dto - */ - @Override - public Map insertStartCharge(QueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 下发计费策略响应 notification_deliver_equip_business_policy_result - * 华为平台 - * - * @param dto - */ - @Override - public Map notificationDeliverEquipBusinessPolicyResult(QueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } /** * 推送启动充电结果 @@ -827,7 +773,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { .build(); String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(dto.getOperatorId()); - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), type)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), type)) { // 如果是新电途平台,则将 startChargeSeqStat 改为 1-启动中 vo.setStartChargeSeqStat(1); } @@ -855,7 +801,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { public Map queryEquipChargeStatus(QueryEquipChargeStatusDTO dto) { String operatorID = dto.getOperatorID(); String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(operatorID); - String operatorName = ThirdPlatformTypeEnum.getLabelByCode(type); + String operatorName = ThirdPlatformTypeEnum.getTypeLabelByTypeCode(type); // 通过订单号查询订单信息 OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(dto.getStartChargeSeq()); // logger.info(operatorName + "查询订单信息 orderInfo:{}", orderInfo); @@ -1017,7 +963,7 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { vo.setFailReason(0); String type = ThirdPartyOperatorIdEnum.getTypeByOperatorId(dto.getOperatorId()); - if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode(), type)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode(), type)) { // 如果是新电途平台,则将 startChargeSeqStat 改为 3-停止中 vo.setStartChargeSeqStat(3); } @@ -1035,39 +981,6 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { return resultMap; } - /** - * 充电站内充电桩空闲状态查询 query_free_pile_number - * - * @param dto - */ - @Override - public Map queryFreePileNumber(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 某车牌号消费记录查询 query_orders_info_by_Plate_number - * - * @param dto - */ - @Override - public Map queryOrdersInfoByPlateNumber(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 某段时间内消费记录查询 query_orders_info - * - * @param dto - */ - @Override - public Map queryOrdersInfo(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - /** * 推送停止充电结果 * @@ -1114,38 +1027,4 @@ public class HaiNanPlatformLogic extends AbsInterfaceWithPlatformLogic { return result; } - /** - * 华为平台 - * 平台充电设备编码同步 notification_operation_system_info - * - * @param orderCode - */ - @Override - public String notificationOperationSystemInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充换电站用能统计信息 supervise_notification_operation_stats_info - * - * @param stationId - */ - @Override - public String notificationOperationStatsInfo(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history - * - * @param stationId - */ - @Override - public String notificationChargeOrderInfoHistory(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformLogic.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformLogic.java index 8f9efdf81..b9a82652a 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformLogic.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/lianlian/service/LianLianPlatformLogic.java @@ -18,8 +18,8 @@ import com.jsowell.common.util.DateUtils; import com.jsowell.common.util.PageUtils; import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.*; -import com.jsowell.pile.dto.*; -import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; +import com.jsowell.pile.dto.QueryStationInfoDTO; +import com.jsowell.pile.service.*; import com.jsowell.pile.thirdparty.EquipmentInfo; import com.jsowell.pile.vo.base.*; import com.jsowell.pile.vo.lianlian.AccumulativeInfoVO; @@ -31,10 +31,12 @@ import com.jsowell.thirdparty.lianlian.util.Cryptos; import com.jsowell.thirdparty.lianlian.util.Encodes; import com.jsowell.thirdparty.lianlian.util.GBSignUtils; import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; -import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic; -import com.jsowell.thirdparty.platform.InterfaceWithPlatformLogicFactory; +import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import org.apache.commons.collections4.CollectionUtils; +import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.stereotype.Service; +import javax.annotation.Resource; import java.math.BigDecimal; import java.util.ArrayList; import java.util.LinkedHashMap; @@ -42,27 +44,43 @@ import java.util.List; import java.util.Map; import java.util.stream.Collectors; -public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { +@Service +public class LianLianPlatformLogic implements ThirdPartyPlatformService { // 平台类型 - private final String platformType = ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(); + private final String platformType = ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(); - @Override - public void afterPropertiesSet() throws Exception { - InterfaceWithPlatformLogicFactory.register(platformType, this); - } + @Autowired + private PileMerchantInfoService pileMerchantInfoService; - /** - * 查询运营商信息 query_operator_info - * supervise_query_operator_info - * - * @param dto 查询运营商信息DTO - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryOperatorInfo(QueryOperatorInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } + @Autowired + private PileStationInfoService pileStationInfoService; + + @Autowired + private PileBasicInfoService pileBasicInfoService; + + @Autowired + private PileConnectorInfoService pileConnectorInfoService; + + @Autowired + private PileBillingTemplateService pileBillingTemplateService; + + @Autowired + private OrderBasicInfoService orderBasicInfoService; + + @Autowired + private ThirdPartyPlatformConfigService thirdPartyPlatformConfigService; + + @Autowired + private ThirdPartySettingInfoService thirdPartySettingInfoService; + + @Resource + private ThirdPartyStationRelationService thirdPartyStationRelationService; + + + // @Override + // public void afterPropertiesSet() throws Exception { + // InterfaceWithPlatformLogicFactory.register(platformType, this); + // } /** * 查询充电站信息 query_stations_info @@ -90,7 +108,8 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { PageInfo pageInfo = new PageInfo<>(stationInfos); for (ThirdPartyStationInfoVO pileStationInfo : pageInfo.getList()) { StationInfo stationInfo = new StationInfo(); - stationInfo.setStationID(String.valueOf(pileStationInfo.getId())); + String stationId = String.valueOf(pileStationInfo.getId()); + stationInfo.setStationID(stationId); // MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfo(String.valueOf(pileStationInfo.getMerchantId())); stationInfo.setOperatorID(Constants.OPERATORID_LIANLIAN); // 组织机构代码 stationInfo.setEquipmentOwnerID(String.valueOf(pileStationInfo.getMerchantId())); @@ -123,7 +142,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { stationInfo.setBarrierFlag(Integer.valueOf(pileStationInfo.getBarrierFlag())); stationInfo.setParkingLockFlag(Integer.valueOf(pileStationInfo.getParkingLockFlag())); - List pileList = pileBasicInfoService.getPileList(pileStationInfo); + List pileList = pileBasicInfoService.getPileListForLianLian(stationId); if (CollectionUtils.isNotEmpty(pileList)) { stationInfo.setEquipmentInfos(pileList); // 充电设备信息列表 } @@ -168,7 +187,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { } ConnectorStatusInfo connectorStatusInfo; for (String stationId : stationIds) { - StationStatusInfo stationStatusInfo= new StationStatusInfo(); + StationStatusInfo stationStatusInfo = new StationStatusInfo(); stationStatusInfo.setStationId(stationId); // 根据站点id查询 List list = pileConnectorInfoService.getConnectorListForLianLian(Long.parseLong(stationId)); @@ -183,7 +202,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { continue; } List chargingRealTimeData = orderBasicInfoService.getChargingRealTimeData(orderBasicInfo.getTransactionCode()); - if(CollectionUtils.isNotEmpty(chargingRealTimeData)) { + if (CollectionUtils.isNotEmpty(chargingRealTimeData)) { RealTimeMonitorData realTimeMonitorData = chargingRealTimeData.get(0); info.setStartChargeSeq(orderBasicInfo.getOrderCode()); @@ -342,141 +361,6 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { return resultMap; } - /** - * 查询充电电量信息 query_order_info - * - * @param orderCode - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryOrderInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 请求设备认证 query_equip_auth - * 业务信息交换 - * - * @param dto 联联平台请求设备认证 - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryEquipAuth(QueryEquipmentDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 请求启动充电 query_start_charge - * - * @param dto 请求启动充电DTO - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryStartCharge(QueryStartChargeDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 查询充电状态 query_equip_charge_status - * - * @param dto 查询充电状态DTO - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryEquipChargeStatus(QueryEquipChargeStatusDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 请求停止充电 query_stop_charge - * - * @param dto 请求启动充电DTO - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryStopCharge(QueryStartChargeDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 充电站内充电桩空闲状态查询 query_free_pile_number - * - * @param dto - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryFreePileNumber(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 某车牌号消费记录查询 query_orders_info_by_Plate_number - * - * @param dto - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryOrdersInfoByPlateNumber(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 某段时间内消费记录查询 query_orders_info - * - * @param dto - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryOrdersInfo(NXJTQueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 查询业务策略信息结果 - * 请求计费策略 request_equip_business_policy - * - * @param dto 请求启动充电DTO - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map queryEquipBusinessPolicy(QueryStartChargeDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * VIN码充电 insert_start_charge - * 华为平台 - * - * @param dto - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map insertStartCharge(QueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 下发计费策略响应 notification_deliver_equip_business_policy_result - * 华为平台 - * - * @param dto - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public Map notificationDeliverEquipBusinessPolicyResult(QueryStationInfoDTO dto) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } /** * 充电站信息变化推送 notification_stationInfo @@ -541,11 +425,11 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { info.setAreaCode(subAreaCode); // 截取运营商组织机构代码(去除最后一位后的最后九位) String organizationCode = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), platformType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getTypeCode(), platformType)) { // 联联平台先使用自己运营商的组织机构代码 organizationCode = Constants.OPERATORID_LIANLIAN; info.setEquipmentOwnerID(organizationCode); - }else { + } else { MerchantInfoVO merchantInfo = pileMerchantInfoService.getMerchantInfoVO(String.valueOf(pileStationInfo.getMerchantId())); organizationCode = merchantInfo.getOrganizationCode(); if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) { @@ -576,7 +460,7 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { if (StringUtils.isNotBlank(String.valueOf(pileStationInfo.getCapacity()))) { info.setCapacity(pileStationInfo.getCapacity().setScale(4, BigDecimal.ROUND_HALF_UP)); } - List pileList = pileBasicInfoService.getPileList(pileStationInfo); + List pileList = pileBasicInfoService.getPileListForLianLian(stationId); if (CollectionUtils.isNotEmpty(pileList)) { info.setEquipmentInfos(pileList); // 充电设备信息列表 } @@ -884,105 +768,5 @@ public class LianLianPlatformLogic extends AbsInterfaceWithPlatformLogic { return result; } - /** - * 充电订单推送 notification_charge_order_info - * TODO 海南一张网文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 - * TODO 甬城泊车平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 - * TODO 华为平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 - * TODO 内蒙古平台文档中的接口,检查一下是否和订单信息推送notification_orderInfo一致 - * - * @param orderCode 订单编号 - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationChargeOrderInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 告警信息推送 notification_alarmInfo - * - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationAlarmInfo() { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送启动充电结果 notification_start_charge_result - * - * @param orderCode 订单编号 - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationStartChargeResult(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充电状态 notification_equip_charge_status - * 推送充电状态信息 supervise_notification_equip_charge_status - * - * @param orderCode 订单编号 - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationEquipChargeStatus(String orderCode) throws UnsupportedOperationException { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送停止充电结果 notification_stop_charge_result - * - * @param orderCode 订单编号 - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationStopChargeResult(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 华为平台 - * 平台充电设备编码同步 notification_operation_system_info - * - * @param orderCode - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationOperationSystemInfo(String orderCode) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充换电站用能统计信息 supervise_notification_operation_stats_info - * - * @param stationId - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationOperationStatsInfo(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } - - /** - * 推送充电站历史充电订单信息 supervise_notification_charge_order_info_history - * - * @param stationId - * @throws UnsupportedOperationException 未实现异常 - */ - @Override - public String notificationChargeOrderInfoHistory(String stationId) { - //方法未实现,抛出异常 - throw new UnsupportedOperationException("This method is not yet implemented"); - } } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformLogic.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformLogic.java index 48f268227..8408e6c8f 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformLogic.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformLogic.java @@ -5,17 +5,21 @@ import com.jsowell.pile.dto.*; import com.jsowell.pile.dto.ningxiajiaotou.NXJTQueryStationInfoDTO; import com.jsowell.thirdparty.platform.AbsInterfaceWithPlatformLogic; import com.jsowell.thirdparty.platform.InterfaceWithPlatformLogicFactory; +import org.springframework.stereotype.Service; import java.util.Map; /** * 内蒙古监测平台逻辑 */ +@Service public class NeiMengGuPlatformLogic extends AbsInterfaceWithPlatformLogic { + // 平台类型 + private final String platformType = ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getTypeCode(); @Override public void afterPropertiesSet() throws Exception { - InterfaceWithPlatformLogicFactory.register(ThirdPlatformTypeEnum.NEI_MENG_GU_PLATFORM.getCode(), this); + InterfaceWithPlatformLogicFactory.register(platformType, this); } /** diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/xindiantu/service/impl/XDTServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/xindiantu/service/impl/XDTServiceImpl.java index 94ad7cbb7..6d9cde29f 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/xindiantu/service/impl/XDTServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/xindiantu/service/impl/XDTServiceImpl.java @@ -1,9 +1,6 @@ package com.jsowell.thirdparty.xindiantu.service.impl; -import com.jsowell.common.enums.thirdparty.ThirdPartyOperatorIdEnum; import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum; -import com.jsowell.common.util.StringUtils; -import com.jsowell.pile.domain.PileStationInfo; import com.jsowell.pile.domain.ThirdPartyStationRelation; import com.jsowell.pile.dto.*; import com.jsowell.pile.service.PileStationInfoService; @@ -80,7 +77,7 @@ public class XDTServiceImpl implements XDTService { public Map queryStationsInfo(QueryStationInfoDTO dto) { // 查询出要查询的充电站id并set进 dto 的stationIds ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); - relation.setThirdPartyType(ThirdPlatformTypeEnum.XIN_DIAN_TU.getCode()); + relation.setThirdPartyType(ThirdPlatformTypeEnum.XIN_DIAN_TU.getTypeCode()); List xdtList = relationService.selectThirdPartyStationRelationList(relation); if (CollectionUtils.isNotEmpty(xdtList)) { List stationList = xdtList.stream() diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/impl/YCBCServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/impl/YCBCServiceImpl.java index 7423fec86..24cc989ac 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/impl/YCBCServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/yongchengboche/service/impl/YCBCServiceImpl.java @@ -157,7 +157,7 @@ public class YCBCServiceImpl implements YCBCService { public Map queryStationsInfo(QueryStationInfoDTO dto) { // 查询出要查询的充电站id并set进 dto 的stationIds ThirdPartyStationRelation relation = new ThirdPartyStationRelation(); - relation.setThirdPartyType(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode()); + relation.setThirdPartyType(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode()); List ycbcList = relationService.selectThirdPartyStationRelationList(relation); if (CollectionUtils.isNotEmpty(ycbcList)) { List stationList = ycbcList.stream() diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/impl/ZDLServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/impl/ZDLServiceImpl.java index c537387e4..a71ba8a63 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/impl/ZDLServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/zhongdianlian/service/impl/ZDLServiceImpl.java @@ -27,9 +27,9 @@ import com.jsowell.thirdparty.lianlian.util.GBSignUtils; import com.jsowell.thirdparty.lianlian.util.HttpRequestUtil; import com.jsowell.thirdparty.yongchengboche.dto.YCBCGetTokenDTO; import com.jsowell.thirdparty.yongchengboche.service.YCBCService; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLConnectorInfo; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLEquipmentInfo; -import com.jsowell.thirdparty.zhongdianlian.domain.ZDLStationInfo; +import com.jsowell.pile.thirdparty.ZDLConnectorInfo; +import com.jsowell.pile.thirdparty.ZDLEquipmentInfo; +import com.jsowell.pile.thirdparty.ZDLStationInfo; import com.jsowell.thirdparty.zhongdianlian.dto.ZDLGetTokenDTO; import com.jsowell.thirdparty.zhongdianlian.service.ZDLService; import org.apache.commons.collections4.CollectionUtils; @@ -172,7 +172,7 @@ public class ZDLServiceImpl implements ZDLService { // 获取令牌 String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), thirdPartyType)) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), thirdPartyType)) { YCBCGetTokenDTO ycbcGetTokenDTO = new YCBCGetTokenDTO(); ycbcGetTokenDTO.setOperatorId(operatorId); ycbcGetTokenDTO.setDataSecret(dataSecret); @@ -261,7 +261,7 @@ public class ZDLServiceImpl implements ZDLService { // 获取令牌 String token = ""; String result = ""; - if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getCode(), dto.getThirdPartyType())) { + if (StringUtils.equals(ThirdPlatformTypeEnum.YONG_CHENG_BO_CHE.getTypeCode(), dto.getThirdPartyType())) { YCBCGetTokenDTO ycbcGetTokenDTO = new YCBCGetTokenDTO(); ycbcGetTokenDTO.setOperatorId(operatorId); ycbcGetTokenDTO.setDataSecret(dataSecret);