update 对接内蒙古平台

This commit is contained in:
2024-04-15 17:02:50 +08:00
parent 3526fd8a22
commit 5eccd5ead8
8 changed files with 82 additions and 34 deletions

View File

@@ -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<String> types);
List<MerchantInfoVO> selectMerchantList(String thirdPlatformType);
}

View File

@@ -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<String> types);
List<MerchantInfoVO> selectMerchantList(String thirdPlatformType);
}

View File

@@ -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<String> types) {
return thirdPartyStationRelationMapper.updateRelationDelFlag(stationId, types);
}
@Override
public List<MerchantInfoVO> selectMerchantList(String thirdPlatformType) {
return thirdPartyStationRelationMapper.selectMerchantList(thirdPlatformType);
}
}

View File

@@ -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);
}
}

View File

@@ -40,4 +40,9 @@ public class MerchantInfoVO {
*/
private String deptId;
/**
* 运营商地址
*/
private String merchantAddress;
}

View File

@@ -209,4 +209,22 @@
#{type,jdbcType=VARCHAR}
</foreach>
</update>
<select id="selectMerchantList" resultType="com.jsowell.pile.vo.base.MerchantInfoVO">
select
t3.id as merchantId,
t3.merchant_name as merchantName,
t3.service_phone as merchantTel,
t3.organization_code as organizationCode,
t3.dept_id as deptId,
t3.merchant_level as merchantLevel,
t3.address as merchantAddress
from
thirdparty_station_relation t1
join pile_station_info t2 on t2.id = t1.station_id and t2.del_flag = '0'
join pile_merchant_info t3 on t3.id = t2.merchant_id and t3.del_flag = '0'
where t1.del_flag = '0'
and t1.third_party_type = #{thirdPlatformType,jdbcType=VARCHAR}
GROUP BY t3.id
</select>
</mapper>

View File

@@ -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;
}

View File

@@ -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<String, String> queryOperatorInfo(QueryOperatorInfoDTO dto) {
Map<String, String> resultMap = Maps.newHashMap();
// TODO 查询接入内蒙古平台的站点信息
List<ThirdPartyStationRelation> thirdPartyStationRelations =
thirdPartyStationRelationService.selectThirdPartyStationRelationList(thirdPlatformType);
List<MerchantInfoVO> merchantList = thirdPartyStationRelationService.selectMerchantList(thirdPlatformType);
if (CollectionUtils.isNotEmpty(merchantList)) {
List<SupOperatorInfo> 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<String, String> 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<String, String> 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<String, String> 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<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMap(map, configInfo);
return resultMap;
}