diff --git a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ThirdPartyNotificationController.java b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ThirdPartyNotificationController.java index 362d394bd..ee20da2b4 100644 --- a/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ThirdPartyNotificationController.java +++ b/jsowell-admin/src/main/java/com/jsowell/web/controller/thirdparty/ThirdPartyNotificationController.java @@ -2,6 +2,7 @@ package com.jsowell.web.controller.thirdparty; import com.jsowell.common.core.controller.BaseController; import com.jsowell.common.core.domain.AjaxResult; +import com.jsowell.common.exception.BusinessException; import com.jsowell.thirdparty.common.NotificationDTO; import com.jsowell.thirdparty.common.NotificationService; import org.springframework.beans.factory.annotation.Autowired; @@ -25,6 +26,9 @@ public class ThirdPartyNotificationController extends BaseController { try { notificationService.notificationStationInfo(dto); result = AjaxResult.success(); + } catch (BusinessException e) { + logger.error("充电站信息变化推送失败", e); + result = AjaxResult.error(e.getMessage()); } catch (Exception e) { logger.error("充电站信息变化推送失败", e); result = AjaxResult.error(); @@ -41,6 +45,9 @@ public class ThirdPartyNotificationController extends BaseController { try { notificationService.notificationStationStatus(dto); result = AjaxResult.success(); + } catch (BusinessException e) { + logger.error("设备状态变化推送失败", e); + result = AjaxResult.error(e.getMessage()); } catch (Exception e) { logger.error("设备状态变化推送失败", e); result = AjaxResult.error(); @@ -57,6 +64,9 @@ public class ThirdPartyNotificationController extends BaseController { try { notificationService.notificationConnectorChargeStatus(dto); result = AjaxResult.success(); + } catch (BusinessException e) { + logger.error("设备充电中状态变化推送失败", e); + result = AjaxResult.error(e.getMessage()); } catch (Exception e) { logger.error("设备充电中状态变化推送失败", e); result = AjaxResult.error(); @@ -73,6 +83,9 @@ public class ThirdPartyNotificationController extends BaseController { try { notificationService.notificationChargeOrderInfo(dto); result = AjaxResult.success(); + } catch (BusinessException e) { + logger.error("充电订单信息推送失败", e); + result = AjaxResult.error(e.getMessage()); } catch (Exception e) { logger.error("充电订单信息推送失败", e); result = AjaxResult.error(); @@ -89,6 +102,9 @@ public class ThirdPartyNotificationController extends BaseController { try { notificationService.notificationStationFee(dto); result = AjaxResult.success(); + } catch (BusinessException e) { + logger.error("站点费率变化推送失败", e); + result = AjaxResult.error(e.getMessage()); } catch (Exception e) { logger.error("站点费率变化推送失败", e); result = AjaxResult.error(); diff --git a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java index 41b03929e..fa45af6f3 100644 --- a/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java +++ b/jsowell-thirdparty/src/main/java/com/jsowell/thirdparty/common/NotificationService.java @@ -1,5 +1,7 @@ package com.jsowell.thirdparty.common; +import com.jsowell.common.enums.ykc.ReturnCodeEnum; +import com.jsowell.common.exception.BusinessException; import com.jsowell.common.util.StringUtils; import com.jsowell.pile.vo.ThirdPartySecretInfoVO; import com.jsowell.thirdparty.platform.ThirdPartyPlatformService; @@ -31,6 +33,9 @@ public class NotificationService { * notification_stationInfo */ public void notificationStationInfo(NotificationDTO dto) { + if (StringUtils.isBlank(dto.getStationId())) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } String stationId = dto.getStationId(); // 通过stationId 查询该站点需要对接的平台配置 List secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId); @@ -58,6 +63,9 @@ public class NotificationService { * notification_stationStatus */ public void notificationStationStatus(NotificationDTO dto) { + if (StringUtils.isBlank(dto.getStationId()) || StringUtils.isBlank(dto.getPileConnectorCode()) || StringUtils.isBlank(dto.getStatus())) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } String stationId = dto.getStationId(); String pileConnectorCode = dto.getPileConnectorCode(); String status = dto.getStatus(); @@ -88,6 +96,9 @@ public class NotificationService { * notification_equip_charge_status */ public void notificationConnectorChargeStatus(NotificationDTO dto) { + if (StringUtils.isBlank(dto.getStationId()) || StringUtils.isBlank(dto.getOrderCode())) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } String stationId = dto.getStationId(); String orderCode = dto.getOrderCode(); // 通过stationId 查询该站点需要对接的平台配置 @@ -116,6 +127,9 @@ public class NotificationService { * notification_orderInfo/notification_charge_order_info */ public void notificationChargeOrderInfo(NotificationDTO dto) { + if (StringUtils.isBlank(dto.getStationId()) || StringUtils.isBlank(dto.getOrderCode())) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } String stationId = dto.getStationId(); String orderCode = dto.getOrderCode(); // 通过stationId 查询该站点需要对接的平台配置 @@ -144,6 +158,9 @@ public class NotificationService { * notification_stationFee */ public void notificationStationFee(NotificationDTO dto) { + if (StringUtils.isBlank(dto.getStationId())) { + throw new BusinessException(ReturnCodeEnum.CODE_PARAM_NOT_NULL_ERROR); + } String stationId = dto.getStationId(); // 通过stationId 查询该站点需要对接的平台配置 List secretInfoVOS = thirdpartySecretInfoService.queryStationToPlatformList(stationId);