Commit d2b79caf by 王世昌

加挡板用于测试模拟核销券失败

parent 35a4cef3
...@@ -37,6 +37,7 @@ import com.freemud.application.sdk.api.service.EmailAlertService; ...@@ -37,6 +37,7 @@ import com.freemud.application.sdk.api.service.EmailAlertService;
import com.google.common.base.Throwables; import com.google.common.base.Throwables;
import org.apache.commons.lang.StringUtils; import org.apache.commons.lang.StringUtils;
import org.springframework.beans.factory.annotation.Autowired; import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service; import org.springframework.stereotype.Service;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -62,6 +63,9 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService ...@@ -62,6 +63,9 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
private static final String ORDER_RESOURCE_PUSH_LOG_EXCHANGE = "order-resource-push-log-exchange"; private static final String ORDER_RESOURCE_PUSH_LOG_EXCHANGE = "order-resource-push-log-exchange";
private static final String ORDER_RESOURCE_PUSH_LOG_ROUTING_KEY = "order-resource-push-log-routing-key"; private static final String ORDER_RESOURCE_PUSH_LOG_ROUTING_KEY = "order-resource-push-log-routing-key";
@Value("${baffleOpen.verification.coupon:false}")
private Boolean baffleOpen=false;
@Override @Override
public BaseResponse verificationCoupon(List<QueryOrdersResponseDto.DataBean.OrderBean.AccountBean> accountList, QueryOrdersResponseDto.DataBean.OrderBean orderBean, CouponReqType couponReqType) { public BaseResponse verificationCoupon(List<QueryOrdersResponseDto.DataBean.OrderBean.AccountBean> accountList, QueryOrdersResponseDto.DataBean.OrderBean orderBean, CouponReqType couponReqType) {
for (QueryOrdersResponseDto.DataBean.OrderBean.AccountBean accountBean : accountList) { for (QueryOrdersResponseDto.DataBean.OrderBean.AccountBean accountBean : accountList) {
...@@ -114,12 +118,12 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService ...@@ -114,12 +118,12 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
CouponCodeResponseDto couponCodeResponseDto = couponOfflineClient.verification(couponCodeVerificationDto); CouponCodeResponseDto couponCodeResponseDto = couponOfflineClient.verification(couponCodeVerificationDto);
LogUtil.info("核销券码返回==", JSON.toJSONString(couponCodeVerificationDto), null); LogUtil.info("核销券码返回==", JSON.toJSONString(couponCodeVerificationDto), null);
ThirdPartyLog.infoConvertJson(System.currentTimeMillis(), System.currentTimeMillis(), "/api", couponCodeVerificationDto, couponCodeResponseDto); ThirdPartyLog.infoConvertJson(System.currentTimeMillis(), System.currentTimeMillis(), "/api", couponCodeVerificationDto, couponCodeResponseDto);
if (Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode())) { if (Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode()) && !Objects.equals(baffleOpen,true)) {
LogUtil.info("CouponReverseServiceImpl", JSON.toJSONString(couponCodeVerificationDto), JSON.toJSONString(couponCodeResponseDto)); LogUtil.info("CouponReverseServiceImpl", JSON.toJSONString(couponCodeVerificationDto), JSON.toJSONString(couponCodeResponseDto));
break; break;
} }
if (!Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode())) { if (!Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode()) || Objects.equals(baffleOpen,true)) {
sendMessage(orderBean, LogThreadLocal.getTrackingNo(), couponCodeVerificationDto, couponCodeResponseDto); sendMessage(orderBean, LogThreadLocal.getTrackingNo(), couponCodeVerificationDto, Objects.equals(baffleOpen, true) ? "模拟券核销失败" : couponCodeResponseDto);
emailAlertService.sendEmailAlert("核销券码失败", String.format("request:%s \r\nresponse:%s", JSONObject.toJSONString(couponCodeVerificationDto), JSONObject.toJSONString(couponCodeResponseDto))); emailAlertService.sendEmailAlert("核销券码失败", String.format("request:%s \r\nresponse:%s", JSONObject.toJSONString(couponCodeVerificationDto), JSONObject.toJSONString(couponCodeResponseDto)));
return ResponseUtil.error(ResponseResult.COUPON_VERIFICATION_FAIL); return ResponseUtil.error(ResponseResult.COUPON_VERIFICATION_FAIL);
} }
...@@ -142,7 +146,7 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService ...@@ -142,7 +146,7 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
* *
* @param orderBean * @param orderBean
*/ */
private void sendMessage(QueryOrdersResponseDto.DataBean.OrderBean orderBean, String trackingNo, CouponCodeVerificationDto req, Object failObject) { private void sendMessage(QueryOrdersResponseDto.DataBean.OrderBean orderBean, String trackingNo, Object req, Object failObject) {
OrderResourcePushLogMsgDto dto = new OrderResourcePushLogMsgDto(); OrderResourcePushLogMsgDto dto = new OrderResourcePushLogMsgDto();
try { try {
String failureReasons; String failureReasons;
...@@ -170,7 +174,7 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService ...@@ -170,7 +174,7 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
MQMessage<OrderResourcePushLogMsgDto> message = new MQMessage<>(header, dto); MQMessage<OrderResourcePushLogMsgDto> message = new MQMessage<>(header, dto);
mqService.convertAndSend(ORDER_RESOURCE_PUSH_LOG_EXCHANGE, ORDER_RESOURCE_PUSH_LOG_ROUTING_KEY, message); mqService.convertAndSend(ORDER_RESOURCE_PUSH_LOG_EXCHANGE, ORDER_RESOURCE_PUSH_LOG_ROUTING_KEY, message);
} catch (Exception e) { } catch (Exception e) {
LogUtil.error(trackingNo, "sendMessage error!!! routingKey = order-resource-push-log-routing-key", JSONObject.toJSONString(dto), null, e); LogUtil.error(trackingNo, "sendMessage COUPON_VERIFICATION error!!! routingKey = order-resource-push-log-routing-key", JSONObject.toJSONString(dto), null, e);
} }
} }
} }
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment