新增 区划代码信息实体类、Service

This commit is contained in:
Lemon
2024-12-20 15:50:57 +08:00
parent bd59654994
commit 87eb7a3977
7 changed files with 566 additions and 25 deletions

View File

@@ -95,6 +95,9 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
@Autowired
private PileBillingTemplateService pileBillingTemplateService;
@Autowired
private IAreaCodeInfoService areaCodeInfoService;
@Autowired
private RedisCache redisCache;
@@ -165,8 +168,12 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
}
public static void main(String[] args) {
String address = "贵州省黔西南州安龙县社保局后侧";
// String address = "贵州省黔西南州安龙县社保局后侧";
// String address = "贵州省遵义市习水县习水伟业汽修";
String address = "贵州省赤水市元厚镇五柱峰村三组";
GeoCodeInfo geoCode = TermRelationTreeCoordinate.completeGeoCode(address);
String countyName = geoCode.getCountyName(); // 习水县
}
/**
@@ -236,7 +243,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
SupStationInfo info = SupStationInfo.builder()
.stationID(String.valueOf(pileStationInfo.getId()))
.operatorID(Constants.OPERATORID_JIANG_SU)
// .equipmentOwnerID()
.equipmentOwnerID(ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileStationInfo.getOrganizationCode()))
.stationName(pileStationInfo.getStationName())
.countryCode(pileStationInfo.getCountryCode())
// .areaCode()
@@ -268,8 +275,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
String subAreaCode = split[split.length - 1];
info.setAreaCode(subAreaCode);
info.setEquipmentOwnerID(Constants.OPERATORID_GUI_ZHOU);
// 容量
if (StringUtils.isNotBlank(String.valueOf(pileStationInfo.getCapacity()))) {
info.setCapacity(pileStationInfo.getCapacity().setScale(2, RoundingMode.HALF_UP));
@@ -285,12 +290,21 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
info.setRatedPower(stationRatedPower);
// areaCodeCountryside
GeoCodeInfo geoCode = TermRelationTreeCoordinate.completeGeoCode(pileStationInfo.getAddress());
if (geoCode != null) {
if (geoCode == null) {
// String areaCodeCountryside = geoCode.getCounty_code();
String areaCodeCountryside = "123456789101";
info.setAreaCodeCountryside(areaCodeCountryside);
info.setAreaCodeCountryside("123456789101");
}else {
AreaCodeInfo areaCodeInfo = new AreaCodeInfo();
if (StringUtils.isNotBlank(geoCode.getTownName())) {
String townName = geoCode.getTownName();
areaCodeInfo.setName(townName);
}else {
String countyName = geoCode.getCountyName();
areaCodeInfo.setName(countyName);
}
List<AreaCodeInfo> areaCodeInfoList = areaCodeInfoService.selectAreaCodeInfoList(areaCodeInfo);
info.setAreaCodeCountryside(String.valueOf(areaCodeInfoList.get(0).getAreaCode()));
}
info.setAreaCodeCountryside("123456789101");
resultList.add(info);
}
@@ -299,7 +313,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
map.put("PageCount", pageInfo.getPages());
map.put("ItemSize", pageInfo.getTotal());
map.put("StationInfos", resultList);
logger.info("贵州省平台查询站点信息 resultData:{}", JSON.toJSONString(map));
// logger.info("贵州省平台查询站点信息 resultData:{}", JSON.toJSONString(map));
Map<String, String> resultMap = ThirdPartyPlatformUtils.generateResultMapV2(map, thirdPartySecretInfoVO.getOurDataSecret(),
thirdPartySecretInfoVO.getOurDataSecretIv(), thirdPartySecretInfoVO.getTheirSigSecret());
return resultMap;
@@ -313,6 +327,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
public String notificationStationInfo(String stationId) {
// 通过id查询站点相关信息
PileStationInfo pileStationInfo = pileStationInfoService.selectPileStationInfoById(Long.parseLong(stationId));
PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(String.valueOf(pileStationInfo.getId()));
// 查询第三方平台配置信息
ThirdPartySecretInfoVO thirdPartySecretInfoVO = getGuiZhouPlatformSecretInfo();
@@ -328,7 +343,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
SupStationInfo info = SupStationInfo.builder()
.stationID(stationId)
.operatorID(operatorId)
// .equipmentOwnerID()
.equipmentOwnerID(ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode()))
.stationName(pileStationInfo.getStationName())
.countryCode(pileStationInfo.getCountryCode())
// .areaCode()
@@ -360,8 +375,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
String subAreaCode = split[split.length - 1];
info.setAreaCode(subAreaCode);
info.setEquipmentOwnerID(Constants.OPERATORID_GUI_ZHOU);
// 容量
if (StringUtils.isNotBlank(String.valueOf(pileStationInfo.getCapacity()))) {
info.setCapacity(pileStationInfo.getCapacity().setScale(2, RoundingMode.HALF_UP));
@@ -377,10 +390,20 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
info.setRatedPower(stationRatedPower);
// areaCodeCountryside
GeoCodeInfo geoCode = TermRelationTreeCoordinate.completeGeoCode(pileStationInfo.getAddress());
if (geoCode != null) {
String areaCodeCountryside = geoCode.getCounty_code();
areaCodeCountryside = "123456789101";
info.setAreaCodeCountryside(areaCodeCountryside);
if (geoCode == null) {
// String areaCodeCountryside = geoCode.getCounty_code();
info.setAreaCodeCountryside("123456789101");
}else {
AreaCodeInfo areaCodeInfo = new AreaCodeInfo();
if (StringUtils.isNotBlank(geoCode.getTownName())) {
String townName = geoCode.getTownName();
areaCodeInfo.setName(townName);
}else {
String countyName = geoCode.getCountyName();
areaCodeInfo.setName(countyName);
}
List<AreaCodeInfo> areaCodeInfoList = areaCodeInfoService.selectAreaCodeInfoList(areaCodeInfo);
info.setAreaCodeCountryside(String.valueOf(areaCodeInfoList.get(0).getAreaCode()));
}
// 调用平台接口
@@ -422,14 +445,16 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
List<ConnectorInfoVO> voList = entry.getValue();
StationStatusInfo stationStatusInfo = new StationStatusInfo();
PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId);
stationStatusInfo.setOperatorId(Constants.OPERATORID_JIANG_SU);
stationStatusInfo.setEquipmentOwnerId(Constants.OPERATORID_GUI_ZHOU);
stationStatusInfo.setEquipmentOwnerId(ThirdPartyPlatformUtils.extractEquipmentOwnerID(stationInfo.getOrganizationCode()));
stationStatusInfo.setStationId(stationId);
ConnectorStatusInfo connectorStatusInfo;
for (ConnectorInfoVO connectorInfoVO : voList) {
connectorStatusInfo = ConnectorStatusInfo.builder()
.operatorId(Constants.OPERATORID_JIANG_SU)
.equipmentOwnerId(Constants.OPERATORID_GUI_ZHOU) // todo 测试
.equipmentOwnerId(ThirdPartyPlatformUtils.extractEquipmentOwnerID(stationInfo.getOrganizationCode()))
.stationId(connectorInfoVO.getStationId())
.equipmentId(connectorInfoVO.getPileSn())
.connectorID(connectorInfoVO.getPileConnectorCode())
@@ -577,7 +602,7 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
.build();
supEquipChargeStatusInfo.setEquipmentOwnerID(Constants.OPERATORID_GUI_ZHOU); // TODO 临时测试使用贵州测试数据
supEquipChargeStatusInfo.setEquipmentOwnerID(ThirdPartyPlatformUtils.extractEquipmentOwnerID(stationInfo.getOrganizationCode()));
String url = urlAddress + "supervise_notification_equip_charge_status";
// 调用平台接口
@@ -619,9 +644,8 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
// 拼装成平台所需格式对象
ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail);
orderInfo.setEquipmentOwnerID(Constants.OPERATORID_GUI_ZHOU); // TODO 临时测试
List<BillingPriceVO> billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId());
// List<BillingPriceVO> billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId());
// 先将list按照 尖、峰、平、谷 时段排序
// List<BillingPriceVO> collect = billingList.stream().sorted(Comparator.comparing(BillingPriceVO::getTimeType)).collect(Collectors.toList());
// 再循环该list拼装对应的充电价格、费率
@@ -664,7 +688,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
String url = urlAddress + "supervise_notification_charge_order_info_history";
ChargeOrderInfo orderInfo = transformChargeOrderInfo(orderBasicInfo, orderDetail);
orderInfo.setEquipmentOwnerID(Constants.OPERATORID_GUI_ZHOU); // todo 临时测试
List<BillingPriceVO> billingList = pileBillingTemplateService.queryBillingPrice(orderBasicInfo.getStationId());
// 先将list按照 尖、峰、平、谷 时段排序
@@ -808,7 +831,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
.stationTotalWarningNum(0)
.equipmentStatsInfos(equipmentStatsInfoList)
.build();
supStationStatsInfo.setEquipmentOwnerId(Constants.OPERATORID_GUI_ZHOU);
JSONObject json = new JSONObject();
List<SupStationStatsInfo> supStationStatsInfoList = new ArrayList<>();
@@ -863,7 +885,6 @@ public class GuiZhouPlatformServiceImpl implements ThirdPartyPlatformService {
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
supStationPowerInfo.setEquipmentOwnerID(ThirdPartyPlatformUtils.extractEquipmentOwnerID(organizationCode));
}
supStationPowerInfo.setEquipmentOwnerID(Constants.OPERATORID_GUI_ZHOU); // todo 临时测试
// 根据站点id查询桩信息
List<PileBasicInfo> pileList = pileBasicInfoService.getPileListByStationId(stationId);