update 江苏省平台接口

This commit is contained in:
Lemon
2023-10-23 08:33:49 +08:00
parent 5ec3609657
commit b6b5ae11cc
5 changed files with 112 additions and 11 deletions

View File

@@ -8,6 +8,7 @@ import com.jsowell.common.core.domain.AjaxResult;
import com.jsowell.common.core.page.TableDataInfo;
import com.jsowell.common.enums.BusinessType;
import com.jsowell.common.enums.DelFlagEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.exception.BusinessException;
import com.jsowell.common.response.RestApiResponse;
@@ -29,6 +30,7 @@ import com.jsowell.pile.service.IThirdPartySettingInfoService;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.service.PileService;
import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.nanrui.service.NRService;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.security.access.prepost.PreAuthorize;
@@ -61,6 +63,9 @@ public class PileStationInfoController extends BaseController {
@Autowired
private ZDLService zdlService;
@Autowired
private NRService nrService;
@Autowired
private IThirdPartyStationRelationService thirdPartyStationRelationService;
@@ -282,13 +287,18 @@ public class PileStationInfoController extends BaseController {
throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR);
}
String result = "";
// 推送联联
if (StringUtils.equals("1", dto.getThirdPartyType())) {
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) {
// 推送联联
result = lianLianService.pushStationInfo(dto);
} else if (StringUtils.equals("2", dto.getThirdPartyType())) {
}
if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), dto.getThirdPartyType())) {
// 中电联
result = zdlService.pushStationInfo(dto);
}
if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), dto.getThirdPartyType())) {
// 江苏省平台
result = nrService.pushStationInfo(dto);
}
response = new RestApiResponse<>(result);
}catch (BusinessException e) {
logger.error("推送第三方平台充电站信息 error",e);

View File

@@ -36,10 +36,10 @@ spring:
druid:
# 主库数据源
master:
url: jdbc:mysql://192.168.2.2:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: jsowell_dev
# url: jdbc:mysql://192.168.2.2:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: jsowell_prd_copy
# url: jdbc:mysql://192.168.2.2:3306/jsowell_dev?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
# username: jsowell_dev
url: jdbc:mysql://192.168.2.2:3306/jsowell_prd_copy?useUnicode=true&characterEncoding=utf8&zeroDateTimeBehavior=convertToNull&useSSL=true&serverTimezone=GMT%2B8
username: jsowell_prd_copy
password: 123456
# 从库数据源
slave:

View File

@@ -0,0 +1,57 @@
package com.jsowell.common.enums.thirdparty;
import com.jsowell.common.enums.ykc.ChargingFailedReasonEnum;
import com.jsowell.common.util.StringUtils;
/**
* 第三方对接平台 type
*
* @author Lemon
* @Date 2023/10/23 8:21:33
*/
public enum ThirdPlatformTypeEnum {
LIAN_LIAN_PLATFORM("1", "联联平台"),
ZHONG_DIAN_LIAN_PLATFORM("2", "中电联平台"),
JIANG_SU_PLATFORM("3", "江苏省平台"),
;
private String code;
private String label;
public String getCode() {
return code;
}
public void setCode(String code) {
this.code = code;
}
public String getLabel() {
return label;
}
public void setLabel(String label) {
this.label = label;
}
ThirdPlatformTypeEnum(String code, String label) {
this.code = code;
this.label = label;
}
/**
* 根据code获取停止原因描述
*
* @param code 编码
* @return 停止原因描述
*/
public static String getMsgByCode(String code) {
for (ThirdPlatformTypeEnum item : ThirdPlatformTypeEnum.values()) {
if (StringUtils.equals(item.getCode(), code)) {
return item.getLabel();
}
}
return null;
}
}

View File

@@ -8,6 +8,7 @@ import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.parkplatform.ParkingEnum;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.enums.ykc.ReturnCodeEnum;
import com.jsowell.common.enums.ykc.YKCChargingStopReasonEnum;
@@ -31,7 +32,9 @@ import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.pile.vo.web.PileStationVO;
import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.lutongyunting.service.LTYTService;
import com.jsowell.thirdparty.nanrui.service.NRService;
import com.jsowell.thirdparty.ruanjie.service.RJService;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
@@ -78,6 +81,12 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
@Autowired
private LianLianService lianLianService;
@Autowired
private ZDLService zdlService;
@Autowired
private NRService nrService;
@Autowired
private IThirdPartyStationRelationService thirdPartyStationRelationService;
@@ -639,17 +648,31 @@ public class TransactionRecordsRequestHandler extends AbstractHandler {
// 联联平台 推送订单信息 notification_orderInfo
try {
// 查询该站点是否推送联联平台
// 查询该站点是否推送第三方平台
ThirdPartyStationRelation relation = new ThirdPartyStationRelation();
relation.setStationId(Long.parseLong(orderBasicInfo.getStationId()));
ThirdPartyStationRelationVO relationInfo = thirdPartyStationRelationService.selectRelationInfo(relation);
// ThirdPartySettingInfo infoByStationId = thirdPartySettingInfoService.getInfoByStationId(Long.parseLong(stationId));
if (Objects.nonNull(relationInfo)) {
if (Objects.isNull(relationInfo)) {
return;
}
String thirdPartyType = relation.getThirdPartyType();
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) {
// 联联平台
// 推送订单信息
lianLianService.pushOrderInfo(orderBasicInfo.getOrderCode());
// 推送充电订单信息
lianLianService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
}
if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), thirdPartyType)) {
// 中电联
zdlService.pushChargeOrderInfo(orderBasicInfo.getOrderCode());
}
if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), thirdPartyType)) {
// 江苏平台
// 推送订单信息
nrService.pushOrderInfo(orderBasicInfo.getOrderCode());
}
// 调用相关接口
} catch (Exception e) {
log.error("联联平台 推送订单信息发生异常", e);

View File

@@ -8,6 +8,7 @@ import com.jsowell.common.core.domain.ykc.RealTimeMonitorData;
import com.jsowell.common.core.domain.ykc.YKCDataProtocol;
import com.jsowell.common.core.domain.ykc.YKCFrameTypeCode;
import com.jsowell.common.core.redis.RedisCache;
import com.jsowell.common.enums.thirdparty.ThirdPlatformTypeEnum;
import com.jsowell.common.enums.ykc.OrderStatusEnum;
import com.jsowell.common.enums.ykc.YKCPileFaultReasonEnum;
import com.jsowell.common.util.BytesUtil;
@@ -19,6 +20,7 @@ import com.jsowell.pile.domain.ThirdPartyStationRelation;
import com.jsowell.pile.service.*;
import com.jsowell.pile.vo.base.ThirdPartyStationRelationVO;
import com.jsowell.thirdparty.lianlian.service.LianLianService;
import com.jsowell.thirdparty.nanrui.service.NRService;
import com.jsowell.thirdparty.zhongdianlian.service.ZDLService;
import io.netty.channel.Channel;
import lombok.extern.slf4j.Slf4j;
@@ -69,6 +71,9 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
@Autowired
private ZDLService zdlService;
@Autowired
private NRService nrService;
@Override
public byte[] supplyProcess(YKCDataProtocol ykcDataProtocol, Channel channel) {
log.info("[===获取桩上传的实时监测数据===] param:{}, channel:{}", JSONObject.toJSONString(ykcDataProtocol), channel.toString());
@@ -318,7 +323,7 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
return null;
}
String pileConnectorCode = pileSn + connectorCode;
if (StringUtils.equals("1", relationInfo.getThirdPartyType())) {
if (StringUtils.equals(ThirdPlatformTypeEnum.LIAN_LIAN_PLATFORM.getCode(), relationInfo.getThirdPartyType())) {
// 联联
log.info("推送联联平台实时数据 params: orderBasicInfo:{}", JSON.toJSONString(orderInfo));
// 设备状态变化推送 notification_stationStatus
@@ -329,11 +334,17 @@ public class UploadRealTimeMonitorHandler extends AbstractHandler {
}
// 推送充电状态
lianLianService.pushChargeStatus(orderInfo.getOrderCode());
}else if (StringUtils.equals("2", relationInfo.getThirdPartyType())) {
}
if (StringUtils.equals(ThirdPlatformTypeEnum.ZHONG_DIAN_LIAN_PLATFORM.getCode(), relationInfo.getThirdPartyType())) {
// 中电联
log.info("推送中电联平台实时数据 params: orderBasicInfo:{}", JSON.toJSONString(orderInfo));
zdlService.notificationStationStatus(pileConnectorCode, connectorStatus);
}
if (StringUtils.equals(ThirdPlatformTypeEnum.JIANG_SU_PLATFORM.getCode(), relation.getThirdPartyType())) {
// 江苏省平台
String result = nrService.pushPileStatus(realTimeMonitorData);
log.info("推送江苏省平台实时数据 result:{}", result);
}
} catch (Exception e) {
log.error("推送第三方平台 实时数据 异常", e);
}