From 5eccd5ead8bca14730a8c3c49a565031a70ea9ed Mon Sep 17 00:00:00 2001 From: Guoqs Date: Mon, 15 Apr 2024 17:02:50 +0800 Subject: [PATCH] =?UTF-8?q?update=20=E5=AF=B9=E6=8E=A5=E5=86=85=E8=92=99?= =?UTF-8?q?=E5=8F=A4=E5=B9=B3=E5=8F=B0?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../ThirdPartyStationRelationMapper.java | 7 ++- .../ThirdPartyStationRelationService.java | 3 ++ .../ThirdPartyStationRelationServiceImpl.java | 6 +++ .../com/jsowell/pile/util/MerchantUtils.java | 8 ++++ .../jsowell/pile/vo/base/MerchantInfoVO.java | 5 +++ .../pile/ThirdPartyStationRelationMapper.xml | 18 ++++++++ .../neimenggu/domain/SupOperatorInfo.java | 26 +++++++---- .../service/NeiMengGuPlatformServiceImpl.java | 43 ++++++++----------- 8 files changed, 82 insertions(+), 34 deletions(-) diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartyStationRelationMapper.java b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartyStationRelationMapper.java index c7eebeb79..389b31e1f 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartyStationRelationMapper.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/mapper/ThirdPartyStationRelationMapper.java @@ -1,12 +1,13 @@ package com.jsowell.pile.mapper; -import java.util.List; - import com.jsowell.pile.domain.ThirdPartyStationRelation; +import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; import org.apache.ibatis.annotations.Param; import org.springframework.stereotype.Component; +import java.util.List; + /** * 站点、第三方推送平台配置对应Mapper接口 * @@ -85,4 +86,6 @@ public interface ThirdPartyStationRelationMapper { * @return */ int updateRelationDelFlag(@Param("stationId") String stationId, @Param("types") List types); + + List selectMerchantList(String thirdPlatformType); } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/service/ThirdPartyStationRelationService.java b/jsowell-pile/src/main/java/com/jsowell/pile/service/ThirdPartyStationRelationService.java index c339538d7..c58c731d7 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/service/ThirdPartyStationRelationService.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/service/ThirdPartyStationRelationService.java @@ -1,6 +1,7 @@ package com.jsowell.pile.service; import com.jsowell.pile.domain.ThirdPartyStationRelation; +import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; import java.util.List; @@ -93,4 +94,6 @@ public interface ThirdPartyStationRelationService { public int deleteThirdPartyStationRelationById(Long id); int updateRelationDelFlag(String stationId, List types); + + List selectMerchantList(String thirdPlatformType); } 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 27e7e31e8..c34da7546 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 @@ -7,6 +7,7 @@ import com.jsowell.common.util.StringUtils; import com.jsowell.pile.domain.ThirdPartyStationRelation; import com.jsowell.pile.mapper.ThirdPartyStationRelationMapper; import com.jsowell.pile.service.ThirdPartyStationRelationService; +import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.stereotype.Service; @@ -165,4 +166,9 @@ public class ThirdPartyStationRelationServiceImpl implements ThirdPartyStationRe public int updateRelationDelFlag(String stationId, List types) { return thirdPartyStationRelationMapper.updateRelationDelFlag(stationId, types); } + + @Override + public List selectMerchantList(String thirdPlatformType) { + return thirdPartyStationRelationMapper.selectMerchantList(thirdPlatformType); + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/util/MerchantUtils.java b/jsowell-pile/src/main/java/com/jsowell/pile/util/MerchantUtils.java index f1f63b0c9..9c910c24d 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/util/MerchantUtils.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/util/MerchantUtils.java @@ -15,4 +15,12 @@ public class MerchantUtils { return StringUtils.equals(XIXIAO_MERCHANT_ID, merchantId); } + /** + * + * @param organizationCode + * @return + */ + public static String getOperatorID(String organizationCode) { + return organizationCode.substring(9, 18); + } } diff --git a/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/MerchantInfoVO.java b/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/MerchantInfoVO.java index 8a95d715b..e5d52a26d 100644 --- a/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/MerchantInfoVO.java +++ b/jsowell-pile/src/main/java/com/jsowell/pile/vo/base/MerchantInfoVO.java @@ -40,4 +40,9 @@ public class MerchantInfoVO { */ private String deptId; + /** + * 运营商地址 + */ + private String merchantAddress; + } diff --git a/jsowell-pile/src/main/resources/mapper/pile/ThirdPartyStationRelationMapper.xml b/jsowell-pile/src/main/resources/mapper/pile/ThirdPartyStationRelationMapper.xml index 0cc6f9112..9ee30e423 100644 --- a/jsowell-pile/src/main/resources/mapper/pile/ThirdPartyStationRelationMapper.xml +++ b/jsowell-pile/src/main/resources/mapper/pile/ThirdPartyStationRelationMapper.xml @@ -209,4 +209,22 @@ #{type,jdbcType=VARCHAR} + + \ No newline at end of file diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/domain/SupOperatorInfo.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/domain/SupOperatorInfo.java index a09bb2936..ffd7dc30e 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/domain/SupOperatorInfo.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/domain/SupOperatorInfo.java @@ -1,13 +1,16 @@ package com.jsowell.thirdparty.platform.neimenggu.domain; -import lombok.Getter; -import lombok.Setter; +import com.alibaba.fastjson2.annotation.JSONField; +import lombok.*; /** * 内蒙古平台运营商信息 */ @Getter @Setter +@NoArgsConstructor +@AllArgsConstructor +@Builder public class SupOperatorInfo { /** * 名称: 运营商ID @@ -16,6 +19,7 @@ public class SupOperatorInfo { * 类型: 字符串 * 长度: 9字符 */ + @JSONField(name = "OperatorID") private String operatorID; /** @@ -25,7 +29,8 @@ public class SupOperatorInfo { * 类型: 字符串 * 长度: 18字符 */ - private String OperatorUSCID; + @JSONField(name = "OperatorUSCID") + private String operatorUSCID; /** * 名称: 运营商名称 @@ -34,7 +39,8 @@ public class SupOperatorInfo { * 类型: 字符串 * 长度: ≤64字符 */ - private String OperatorName; + @JSONField(name = "OperatorName") + private String operatorName; /** * 名称: 运营商电话1 @@ -43,7 +49,8 @@ public class SupOperatorInfo { * 类型: 字符串 * 长度: ≤32字符 */ - private String OperatorTel1; + @JSONField(name = "OperatorTel1") + private String operatorTel1; /** * 名称: 运营商电话2 @@ -52,7 +59,8 @@ public class SupOperatorInfo { * 类型: 字符串 * 长度: ≤32字符 */ - private String OperatorTel2; + @JSONField(name = "OperatorTel2") + private String operatorTel2; /** * 名称: 运营商注册地址 @@ -61,7 +69,8 @@ public class SupOperatorInfo { * 类型: 字符串 * 长度: ≤64字符 */ - private String OperatorRegAddress; + @JSONField(name = "OperatorRegAddress") + private String operatorRegAddress; /** * 名称: 运营商备注 @@ -70,5 +79,6 @@ public class SupOperatorInfo { * 类型: 字符串 * 长度: ≤255字符 */ - private String OperatorNote; + @JSONField(name = "OperatorNote") + private String operatorNote; } diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformServiceImpl.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformServiceImpl.java index 9fb02c474..d79547e22 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformServiceImpl.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/platform/neimenggu/service/NeiMengGuPlatformServiceImpl.java @@ -29,6 +29,7 @@ import com.jsowell.pile.thirdparty.CommonParamsDTO; import com.jsowell.pile.thirdparty.EquipmentInfo; import com.jsowell.pile.util.MerchantUtils; import com.jsowell.pile.vo.base.ConnectorInfoVO; +import com.jsowell.pile.vo.base.MerchantInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationInfoVO; import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO; import com.jsowell.pile.vo.uniapp.BillingPriceVO; @@ -42,6 +43,7 @@ import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; import com.jsowell.thirdparty.platform.common.StationInfo; import com.jsowell.thirdparty.platform.neimenggu.domain.ChargeOrderInfo; import com.jsowell.thirdparty.platform.neimenggu.domain.SupChargeDetails; +import com.jsowell.thirdparty.platform.neimenggu.domain.SupOperatorInfo; import com.jsowell.thirdparty.platform.util.Cryptos; import com.jsowell.thirdparty.platform.util.Encodes; import com.jsowell.thirdparty.platform.util.HttpRequestUtil; @@ -78,6 +80,9 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { @Autowired private PileStationInfoService pileStationInfoService; + @Autowired + private PileMerchantInfoService pileMerchantInfoService; + @Autowired private PileConnectorInfoService pileConnectorInfoService; @@ -105,7 +110,6 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { // 通过operatorId 查出 operatorSecret ThirdPartyPlatformConfig platformConfig = thirdPartyPlatformConfigService.getInfoByOperatorId(operatorId); if (platformConfig == null) { - // throw new BusinessException("1", "无此对接平台"); failReason = 1; succStat = 1; } else { @@ -120,7 +124,6 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { } // 对比密钥 if (!StringUtils.equals(operatorSecret, inputOperatorSecret)) { - // throw new RuntimeException("密钥不一致"); failReason = 1; succStat = 1; } else { @@ -139,8 +142,6 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { return resultMap; } - - /** * 查询运营商信息 query_operator_info * supervise_query_operator_info @@ -151,10 +152,20 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { @Override public Map queryOperatorInfo(QueryOperatorInfoDTO dto) { Map resultMap = Maps.newHashMap(); - // TODO 查询接入内蒙古平台的站点信息 - List thirdPartyStationRelations = - thirdPartyStationRelationService.selectThirdPartyStationRelationList(thirdPlatformType); - + List merchantList = thirdPartyStationRelationService.selectMerchantList(thirdPlatformType); + if (CollectionUtils.isNotEmpty(merchantList)) { + List operatorInfos = Lists.newArrayList(); + SupOperatorInfo supOperatorInfo; + for (MerchantInfoVO merchantInfoVO : merchantList) { + supOperatorInfo = new SupOperatorInfo(); + supOperatorInfo.setOperatorID(MerchantUtils.getOperatorID(merchantInfoVO.getOrganizationCode())); + supOperatorInfo.setOperatorUSCID(merchantInfoVO.getOrganizationCode()); + supOperatorInfo.setOperatorName(merchantInfoVO.getMerchantName()); + supOperatorInfo.setOperatorTel1(merchantInfoVO.getMerchantTel()); + supOperatorInfo.setOperatorRegAddress(merchantInfoVO.getMerchantAddress()); + operatorInfos.add(supOperatorInfo); + } + } return resultMap; } @@ -231,14 +242,6 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { map.put("ItemSize", resultList.size()); map.put("StationInfos", resultList); - // Map resultMap = Maps.newLinkedHashMap(); - // 加密数据 - // String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv()); - // resultMap.put("Data", encryptData); - // 生成sig - // String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); - // resultMap.put("Sig", resultSign); - Map resultMap = ThirdPartyPlatformUtils.generateResultMap(map, configInfo); return resultMap; } @@ -317,14 +320,6 @@ public class NeiMengGuPlatformServiceImpl implements ThirdPartyPlatformService { map.put("Total", total); map.put("StationStatusInfos", collect); - // Map resultMap = Maps.newLinkedHashMap(); - // // 加密数据 - // String encryptData = Cryptos.aesEncrypt(JSON.toJSONString(map), configInfo.getDataSecret(), configInfo.getDataSecretIv()); - // resultMap.put("Data", encryptData); - // // 生成sig - // String resultSign = GBSignUtils.sign(resultMap, configInfo.getSignSecret()); - // resultMap.put("Sig", resultSign); - Map resultMap = ThirdPartyPlatformUtils.generateResultMap(map, configInfo); return resultMap; }