This commit is contained in:
Guoqs
2024-08-16 10:03:21 +08:00
8 changed files with 107 additions and 48 deletions

View File

@@ -93,6 +93,25 @@ public class ThirdPartyNotificationController extends BaseController {
return result; return result;
} }
/**
* 站点功率信息推送
*/
@PostMapping("/notificationStationPowerInfo")
public AjaxResult notificationStationPowerInfo(@RequestBody NotificationDTO dto) {
AjaxResult result;
try {
notificationService.notificationStationPowerInfo(dto);
result = AjaxResult.success();
} catch (BusinessException e) {
logger.error("站点功率信息推送失败", e);
result = AjaxResult.error(e.getMessage());
} catch (Exception e) {
logger.error("站点功率信息推送失败", e);
result = AjaxResult.error();
}
return result;
}
/** /**
* 站点费率变化推送 * 站点费率变化推送
*/ */

View File

@@ -1,5 +1,6 @@
package com.jsowell.thirdparty.common; package com.jsowell.thirdparty.common;
import com.google.common.collect.Lists;
import com.jsowell.common.enums.ykc.ReturnCodeEnum; import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException; import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.util.StringUtils; import com.jsowell.common.util.StringUtils;
@@ -116,15 +117,19 @@ public class NotificationService {
// 如果dto中的platformType不为空并且不等于secretInfoVO.getPlatformType()continue // 如果dto中的platformType不为空并且不等于secretInfoVO.getPlatformType()continue
continue; continue;
} }
// 根据平台类型获取Service
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
try { try {
// 根据平台类型获取Service
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
platformService.notificationConnectorChargeStatus(orderCode, secretInfoVO); platformService.notificationConnectorChargeStatus(orderCode, secretInfoVO);
platformService.notificationEquipChargeStatus(orderCode);
} catch (Exception e) { } catch (Exception e) {
logger.error("设备充电中状态变化推送error:", e); logger.error("设备充电中状态变化推送error:", e);
} }
try {
platformService.notificationEquipChargeStatus(orderCode);
}catch (Exception e){
logger.error("notification_equip_charge_status error", e);
}
} }
} }
@@ -160,6 +165,34 @@ public class NotificationService {
} }
} }
/**
* 站点功率信息推送
* notification_orderInfo/notification_charge_order_info
*/
public void notificationStationPowerInfo(NotificationDTO dto) {
String stationId = dto.getStationId();
String platformType = dto.getPlatformType();
// 通过stationId 查询该站点需要对接的平台配置
List<ThirdPartySecretInfoVO> secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);
if (CollectionUtils.isEmpty(secretInfoVOS)) {
return;
}
// 调用相应平台的处理方法
for (ThirdPartySecretInfoVO secretInfoVO : secretInfoVOS) {
if (StringUtils.isNotBlank(platformType) && !StringUtils.equals(platformType, secretInfoVO.getPlatformType())) {
// 如果dto中的platformType不为空并且不等于secretInfoVO.getPlatformType()continue
continue;
}
try {
// 根据平台类型获取Service
ThirdPartyPlatformService platformService = ThirdPartyPlatformFactory.getInvokeStrategy(secretInfoVO.getPlatformType());
platformService.notificationPowerInfo(Lists.newArrayList(stationId));
} catch (Exception e) {
logger.error("站点功率信息推送error", e);
}
}
}
/** /**
* 站点费率变化推送 * 站点费率变化推送
* notification_stationFee * notification_stationFee

File diff suppressed because one or more lines are too long

View File

@@ -104,12 +104,12 @@ public class SupConnectorStatusInfo {
* 描述: 最近一次状态变化的时间格式“yyyy-MM-ddHH:mm:ss” * 描述: 最近一次状态变化的时间格式“yyyy-MM-ddHH:mm:ss”
*/ */
@JSONField(name = "LastChangeTime") @JSONField(name = "LastChangeTime")
private String lastChangeTime = DateUtils.getDateTime(); private String lastChangeTime;
/** /**
* 状态更新时间 * 状态更新时间
* 本次状态变化的时间格式“yyyy-MM-dd HH:mm:ss” * 本次状态变化的时间格式“yyyy-MM-dd HH:mm:ss”
*/ */
@JSONField(name = "UpdateTime") @JSONField(name = "UpdateTime")
private String UpdateTime = DateUtils.getDateTime(); private String updateTime;
} }

View File

@@ -416,11 +416,10 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
// 调用联联平台接口 // 调用联联平台接口
String url = urlAddress + "supervise_notification_station_info"; String url = urlAddress + "supervise_notification_station_info";
String jsonStr = JSON.toJSONString(info);
JSONObject data = new JSONObject(); JSONObject data = new JSONObject();
data.put("StationInfo", jsonStr); data.put("SupStationInfo", info);
String jsonString = JSON.toJSONString(data); String jsonString = JSON.toJSONString(info);
// 获取令牌 // 获取令牌
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);
@@ -446,20 +445,20 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
} }
SupConnectorStatusInfo info = SupConnectorStatusInfo.builder() SupConnectorStatusInfo info = SupConnectorStatusInfo.builder()
.operatorID(Constants.JSOWELL_OPERATORID) .operatorID(Constants.OPERATORID_JIANG_SU)
.equipmentOwnerID(MerchantUtils.getOperatorID(merchantInfoVO.getOrganizationCode())) .equipmentOwnerID(MerchantUtils.getOperatorID(merchantInfoVO.getOrganizationCode()))
.stationID(connectorInfo.getStationId()) .stationID(connectorInfo.getStationId())
.equipmentID(connectorInfo.getPileSn()) .equipmentID(connectorInfo.getPileSn())
.connectorID(pileConnectorCode) .connectorID(pileConnectorCode)
.equipmentClassification(Constants.ONE)
.status(Integer.parseInt(status)) .status(Integer.parseInt(status))
.statusDesc(PileConnectorDataBaseStatusEnum.getStatusDescription(status)) .statusDesc(PileConnectorDataBaseStatusEnum.getStatusDescription(status))
.parkStatus(Constants.zero) .parkStatus(Constants.zero)
.lockStatus(Constants.zero) .lockStatus(Constants.zero)
.updateTime(DateUtils.getDateTime())
.build(); .build();
// 调用联联平台接口 // 调用联联平台接口
String operatorId = secretInfoVO.getTheirOperatorId(); String operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = secretInfoVO.getTheirOperatorSecret(); String operatorSecret = secretInfoVO.getTheirOperatorSecret();
String signSecret = secretInfoVO.getTheirSigSecret(); String signSecret = secretInfoVO.getTheirSigSecret();
String dataSecret = secretInfoVO.getTheirDataSecret(); String dataSecret = secretInfoVO.getTheirDataSecret();
@@ -547,11 +546,13 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); OrderBasicInfo orderInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
// 查询枪口状态 // 查询枪口状态
PileConnectorInfoVO info = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(orderInfo.getPileConnectorCode()); PileConnectorInfoVO info = pileConnectorInfoService.getPileConnectorInfoByConnectorCode(orderInfo.getPileConnectorCode());
BigDecimal current = info.getCurrent() == null ? BigDecimal.ZERO : info.getCurrent();
BigDecimal voltage = info.getVoltage() == null ? BigDecimal.ZERO : info.getVoltage();
String soc = info.getSOC() == null ? Constants.ZERO : info.getSOC();
// 查询相关配置信息 // 查询相关配置信息
ThirdPartySecretInfoVO zheJiangPlatformSecretInfo = getZheJiangPlatformSecretInfo(); ThirdPartySecretInfoVO zheJiangPlatformSecretInfo = getZheJiangPlatformSecretInfo();
String operatorId = zheJiangPlatformSecretInfo.getTheirOperatorId(); String operatorId = zheJiangPlatformSecretInfo.getOurOperatorId();
String operatorSecret = zheJiangPlatformSecretInfo.getTheirOperatorSecret(); String operatorSecret = zheJiangPlatformSecretInfo.getTheirOperatorSecret();
String signSecret = zheJiangPlatformSecretInfo.getTheirSigSecret(); String signSecret = zheJiangPlatformSecretInfo.getTheirSigSecret();
String dataSecret = zheJiangPlatformSecretInfo.getTheirDataSecret(); String dataSecret = zheJiangPlatformSecretInfo.getTheirDataSecret();
@@ -569,15 +570,15 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
.orderStatus(2) .orderStatus(2)
.pushTimeStamp(dateTime) .pushTimeStamp(dateTime)
.connectorStatus(info.getStatus()) // 3-充电中 .connectorStatus(info.getStatus()) // 3-充电中
.currentA(info.getCurrent().setScale(1, BigDecimal.ROUND_HALF_UP)) .currentA(current.setScale(1, BigDecimal.ROUND_HALF_UP))
.voltageA(info.getVoltage().setScale(1, BigDecimal.ROUND_HALF_UP)) .voltageA(voltage.setScale(1, BigDecimal.ROUND_HALF_UP))
.soc(new BigDecimal(info.getSOC())) .soc(new BigDecimal(soc))
.startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime())) .startTime(DateUtils.parseDateToStr(DateUtils.YYYY_MM_DD_HH_MM_SS, orderInfo.getChargeStartTime()))
.endTime(dateTime) .endTime(dateTime)
.totalPower(info.getChargingDegree()) .totalPower(info.getChargingDegree())
.eventTime(dateTime) .eventTime(dateTime)
.chargeVoltage(info.getVoltage().setScale(1, BigDecimal.ROUND_HALF_UP)) .chargeVoltage(voltage.setScale(1, BigDecimal.ROUND_HALF_UP))
.chargeCurrent(info.getCurrent().setScale(1, BigDecimal.ROUND_HALF_UP)) .chargeCurrent(current.setScale(1, BigDecimal.ROUND_HALF_UP))
.build(); .build();
// 查询运营商信息 // 查询运营商信息
@@ -588,7 +589,7 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
supEquipChargeStatusInfo.setEquipmentOwnerID(equipmentOwnerId); supEquipChargeStatusInfo.setEquipmentOwnerID(equipmentOwnerId);
} }
String url = urlAddress + BusinessInformationExchangeEnum.NOTIFICATION_EQUIP_CHARGE_STATUS.getValue(); String url = urlAddress + "supervise_notification_equip_charge_status";
// 调用平台接口 // 调用平台接口
String jsonString = JSON.toJSONString(supEquipChargeStatusInfo); String jsonString = JSON.toJSONString(supEquipChargeStatusInfo);
@@ -603,21 +604,19 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
* supervise_notification_charge_order_info * supervise_notification_charge_order_info
*/ */
@Override @Override
public String notificationChargeOrderInfo(String orderCode) { public String notificationChargeOrderInfo(String orderCode, ThirdPartySecretInfoVO secretInfoVO) {
// 根据订单号查询出信息 // 根据订单号查询出信息
OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode); OrderBasicInfo orderBasicInfo = orderBasicInfoService.getOrderInfoByOrderCode(orderCode);
if (orderBasicInfo == null) { if (orderBasicInfo == null) {
return null; return null;
} }
ThirdPartySecretInfoVO ningXiaSecretInfo = getZheJiangPlatformSecretInfo(); String operatorId = Constants.OPERATORID_JIANG_SU;
String operatorSecret = secretInfoVO.getTheirOperatorSecret();
String operatorId = ningXiaSecretInfo.getOurOperatorId(); String signSecret = secretInfoVO.getTheirSigSecret();
String operatorSecret = ningXiaSecretInfo.getTheirOperatorSecret(); String dataSecret = secretInfoVO.getTheirDataSecret();
String signSecret = ningXiaSecretInfo.getTheirSigSecret(); String dataSecretIv = secretInfoVO.getTheirDataSecretIv();
String dataSecret = ningXiaSecretInfo.getTheirDataSecret(); String urlAddress = secretInfoVO.getTheirUrlPrefix();
String dataSecretIv = ningXiaSecretInfo.getTheirDataSecretIv();
String urlAddress = ningXiaSecretInfo.getTheirUrlPrefix();
// 根据订单号查询订单详情 // 根据订单号查询订单详情
OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode); OrderDetail orderDetail = orderBasicInfoService.getOrderDetailByOrderCode(orderCode);
@@ -635,7 +634,13 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) { if (MerchantUtils.isXiXiaoMerchant(orderBasicInfo.getMerchantId())) {
equipmentOwnerID = Constants.OPERATORID_XI_XIAO; equipmentOwnerID = Constants.OPERATORID_XI_XIAO;
} else { } else {
equipmentOwnerID = Constants.OPERATORID_LIANLIAN; PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(orderInfo.getStationID());
String organizationCode = pileMerchantInfoVO.getOrganizationCode();
if (StringUtils.isNotBlank(organizationCode) && organizationCode.length() == 18) {
equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode());
}else {
equipmentOwnerID = Constants.OPERATORID_JIANG_SU;
}
} }
orderInfo.setEquipmentOwnerID(equipmentOwnerID); orderInfo.setEquipmentOwnerID(equipmentOwnerID);
@@ -654,7 +659,7 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
// 调用联联平台接口 // 调用联联平台接口
JSONObject json = new JSONObject(); JSONObject json = new JSONObject();
json.put("ChargeOrderInfo", orderInfo); json.put("ChargeOrderInfo", orderInfo);
String jsonString = JSON.toJSONString(json); String jsonString = JSON.toJSONString(orderInfo);
String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret); String result = HttpRequestUtil.sendPost(token, jsonString, url, dataSecret, dataSecretIv, operatorId, signSecret);
return result; return result;
} }
@@ -755,23 +760,25 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
List<SupStationPowerInfo> supStationPowerInfoList = new ArrayList<>(); List<SupStationPowerInfo> supStationPowerInfoList = new ArrayList<>();
stationIds.forEach(stationId -> { stationIds.forEach(stationId -> {
PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId); PileStationVO stationInfo = pileStationInfoService.getStationInfo(stationId);
String dateTimeNow = DateUtils.dateTimeNow(DateUtils.YYYY_MM_DD_HH_MM_SS); PileMerchantInfoVO pileMerchantInfoVO = pileMerchantInfoService.queryMerchantInfoByStationId(stationId);
String dateTimeNow = DateUtils.getDateTime();
SupStationPowerInfo supStationPowerInfo = new SupStationPowerInfo(); SupStationPowerInfo supStationPowerInfo = new SupStationPowerInfo();
// 根据站点id查询桩列表 // 根据站点id查询桩列表
List<PileBasicInfo> pileList = pileBasicInfoService.getPileListByStationId(stationId); List<PileBasicInfo> pileList = pileBasicInfoService.getPileListByStationId(stationId);
SupStationPowerInfo.EquipmentPowerInfo equipmentPowerInfo = null; SupStationPowerInfo.EquipmentPowerInfo equipmentPowerInfo = null;
List<SupStationPowerInfo.EquipmentPowerInfo> equipmentPowerInfoList = new ArrayList<>(); List<SupStationPowerInfo.EquipmentPowerInfo> equipmentPowerInfoList = new ArrayList<>();
BigDecimal stationInstantPower = BigDecimal.ZERO; BigDecimal stationInstantPower = BigDecimal.ZERO;
supStationPowerInfo.setOperatorId(Constants.OPERATORID_LIANLIAN); supStationPowerInfo.setOperatorId(Constants.OPERATORID_JIANG_SU);
supStationPowerInfo.setEquipmentOwnerID(stationInfo.getMerchantId()); String equipmentOwnerID = ThirdPartyPlatformUtils.extractEquipmentOwnerID(pileMerchantInfoVO.getOrganizationCode());
supStationPowerInfo.setEquipmentOwnerID(equipmentOwnerID);
supStationPowerInfo.setStationId(stationId); supStationPowerInfo.setStationId(stationId);
supStationPowerInfo.setStationClassification(1); // supStationPowerInfo.setStationClassification(1);
supStationPowerInfo.setDataTime(dateTimeNow); supStationPowerInfo.setDataTime(dateTimeNow);
for (PileBasicInfo pileBasicInfo : pileList) { for (PileBasicInfo pileBasicInfo : pileList) {
equipmentPowerInfo = new SupStationPowerInfo.EquipmentPowerInfo(); equipmentPowerInfo = new SupStationPowerInfo.EquipmentPowerInfo();
equipmentPowerInfo.setEquipmentID(pileBasicInfo.getSn()); equipmentPowerInfo.setEquipmentID(pileBasicInfo.getSn());
equipmentPowerInfo.setEquipmentClassification(1); // equipmentPowerInfo.setEquipmentClassification(1);
equipmentPowerInfo.setDataTime(dateTimeNow); equipmentPowerInfo.setDataTime(dateTimeNow);
// 根据桩sn查询枪口列表 // 根据桩sn查询枪口列表
@@ -793,7 +800,7 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
connectorPowerInfo = new SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo(); connectorPowerInfo = new SupStationPowerInfo.EquipmentPowerInfo.ConnectorPowerInfo();
connectorPowerInfo.setConnectorID(connectorInfo.getPileConnectorCode()); connectorPowerInfo.setConnectorID(connectorInfo.getPileConnectorCode());
connectorPowerInfo.setEquipmentClassification(1); // connectorPowerInfo.setEquipmentClassification(1);
connectorPowerInfo.setDataTime(dateTimeNow); connectorPowerInfo.setDataTime(dateTimeNow);
connectorPowerInfo.setConnectorRealTimePower(instantPower); connectorPowerInfo.setConnectorRealTimePower(instantPower);
@@ -813,14 +820,14 @@ public class ZheJiangPlatformServiceImpl implements ThirdPartyPlatformService {
supStationPowerInfoList.add(supStationPowerInfo); supStationPowerInfoList.add(supStationPowerInfo);
}); });
// 发送请求 // 发送请求
ThirdPartySecretInfoVO ningXiaSecretInfo = getZheJiangPlatformSecretInfo(); ThirdPartySecretInfoVO zheJiangPlatformSecretInfo = getZheJiangPlatformSecretInfo();
String operatorId = ningXiaSecretInfo.getOurOperatorId(); String operatorId = zheJiangPlatformSecretInfo.getOurOperatorId();
String operatorSecret = ningXiaSecretInfo.getTheirOperatorSecret(); String operatorSecret = zheJiangPlatformSecretInfo.getTheirOperatorSecret();
String signSecret = ningXiaSecretInfo.getTheirSigSecret(); String signSecret = zheJiangPlatformSecretInfo.getTheirSigSecret();
String dataSecret = ningXiaSecretInfo.getTheirDataSecret(); String dataSecret = zheJiangPlatformSecretInfo.getTheirDataSecret();
String dataSecretIv = ningXiaSecretInfo.getTheirDataSecretIv(); String dataSecretIv = zheJiangPlatformSecretInfo.getTheirDataSecretIv();
String urlAddress = ningXiaSecretInfo.getTheirUrlPrefix(); String urlAddress = zheJiangPlatformSecretInfo.getTheirUrlPrefix();
String url = urlAddress + "supervise_notification_realtime_power_info"; String url = urlAddress + "supervise_notification_realtime_power_info";
// 获取令牌 // 获取令牌
String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret); String token = getToken(urlAddress, operatorId, operatorSecret, dataSecretIv, signSecret, dataSecret);

View File

@@ -165,7 +165,7 @@ public class HttpRequestUtil {
// log.info("联联平台发送请求 返回数据map:{}", JSON.toJSONString(map)); // log.info("联联平台发送请求 返回数据map:{}", JSON.toJSONString(map));
int ret = (int) map.get("Ret"); int ret = Integer.parseInt(String.valueOf(map.get("Ret")));
String resultMsg = (String) map.get("Msg"); String resultMsg = (String) map.get("Msg");
if (ret != 0) { if (ret != 0) {
// 表示请求有异常 // 表示请求有异常

View File

@@ -11,7 +11,7 @@
<!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico" /> --> <!-- <link rel="icon" href="<%= BASE_URL %>favicon.ico" /> -->
<link rel="icon" href="#" /> <link rel="icon" href="#" />
<title><%= webpackConfig.name %></title> <title><%= webpackConfig.name %></title>
<script src="http://api.tianditu.gov.cn/api?v=4.0&tk=d1eaedfce9e50588c78a91bbbdc5d5bc" type="text/javascript"></script> <script src="https://api.tianditu.gov.cn/api?v=4.0&tk=d1eaedfce9e50588c78a91bbbdc5d5bc" type="text/javascript"></script>
<!--[if lt IE 11 <!--[if lt IE 11
]><script> ]><script>
window.location.href = "/html/ie.html"; window.location.href = "/html/ie.html";

View File

@@ -64,7 +64,7 @@ export default {
// console.log("搜索值", this.searchPlaceInput); // console.log("搜索值", this.searchPlaceInput);
// // 向表单 site-info传值 // // 向表单 site-info传值
// bus.$emit("inp", this.searchPlaceInput); // bus.$emit("inp", this.searchPlaceInput);
const url = `http://api.tianditu.gov.cn/geocoder?ds={"keyWord":"${this.inputObject.userInput}"}&tk=da94c475e0b4960e6f863d7f2947435c`; const url = `https://api.tianditu.gov.cn/geocoder?ds={"keyWord":"${this.inputObject.userInput}"}&tk=da94c475e0b4960e6f863d7f2947435c`;
axios axios
.get(url) .get(url)
.then((res) => { .then((res) => {
@@ -241,7 +241,7 @@ export default {
var marker = new T.Marker(new T.LngLat(lng, lat)); var marker = new T.Marker(new T.LngLat(lng, lat));
this.map.addOverLay(marker); this.map.addOverLay(marker);
const url = `http://api.tianditu.gov.cn/geocoder?postStr={lon:${lng},lat:${lat},ver:1}&type=geocode&tk=da94c475e0b4960e6f863d7f2947435c`; const url = `https://api.tianditu.gov.cn/geocoder?postStr={lon:${lng},lat:${lat},ver:1}&type=geocode&tk=da94c475e0b4960e6f863d7f2947435c`;
axios axios
.get(url) .get(url)
.then((res) => { .then((res) => {