Commit 5f07845b by 王世昌

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

parent d2b79caf
...@@ -111,28 +111,33 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService ...@@ -111,28 +111,33 @@ public class PlatformCouponRelationServiceImpl implements CouponRelationService
couponCodeVerificationDto.setOrderDiscountAmount(orderBean.getOriginalAmount().longValue() - orderBean.getAmount()); couponCodeVerificationDto.setOrderDiscountAmount(orderBean.getOriginalAmount().longValue() - orderBean.getAmount());
// 核销券新增参数:组织机构ID // 核销券新增参数:组织机构ID
couponCodeVerificationDto.setChannel_codes(storeService.getOrgIdsArr(orderBean.getCompanyId(), orderBean.getShopId())); couponCodeVerificationDto.setChannel_codes(storeService.getOrgIdsArr(orderBean.getCompanyId(), orderBean.getShopId()));
boolean ok = false;
Exception lastException = null;
CouponCodeResponseDto couponCodeResponseDto = null;
try { try {
//71.券核销 //71.券核销
// todo 这循环有啥用-.-
for (int i = 2; i >= 0; i--) { for (int i = 2; i >= 0; i--) {
LogUtil.info("核销券码开始==", JSON.toJSONString(couponCodeVerificationDto), null); LogUtil.info("核销券码开始==", JSON.toJSONString(couponCodeVerificationDto), null);
CouponCodeResponseDto couponCodeResponseDto = couponOfflineClient.verification(couponCodeVerificationDto); 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()) && !Objects.equals(baffleOpen,true)) { if (Objects.nonNull(couponCodeResponseDto) && Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode())) {
ok = true;
LogUtil.info("CouponReverseServiceImpl", JSON.toJSONString(couponCodeVerificationDto), JSON.toJSONString(couponCodeResponseDto)); LogUtil.info("CouponReverseServiceImpl", JSON.toJSONString(couponCodeVerificationDto), JSON.toJSONString(couponCodeResponseDto));
break;
}
if (!Objects.equals(couponCodeResponseDto.getStatusCode(), ResponseResult.SUCCESS.getCode()) || Objects.equals(baffleOpen,true)) {
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)));
return ResponseUtil.error(ResponseResult.COUPON_VERIFICATION_FAIL);
} }
break;
} }
} catch (Exception ex) { } catch (Exception ex) {
sendMessage(orderBean, LogThreadLocal.getTrackingNo(), couponCodeVerificationDto, ex); lastException = ex;
emailAlertService.sendEmailAlert("核销券码异常", String.format("request:%s \r\nexception:%s", JSONObject.toJSONString(couponCodeVerificationDto), Throwables.getStackTraceAsString(ex)));
ErrorLog.printErrorLog("verification_error", "/api", couponCodeVerificationDto, ex); ErrorLog.printErrorLog("verification_error", "/api", couponCodeVerificationDto, ex);
}
if (!ok || Objects.equals(baffleOpen,true)){
sendMessage(orderBean, LogThreadLocal.getTrackingNo(), couponCodeVerificationDto, Objects.equals(baffleOpen, true) ? "模拟券核销失败" : couponCodeResponseDto);
}
if (!ok){
emailAlertService.sendEmailAlert("核销券码失败", String.format("request:%s \r\nresponse:%s", JSONObject.toJSONString(couponCodeVerificationDto), JSONObject.toJSONString(lastException == null ? couponCodeResponseDto : lastException)));
return ResponseUtil.error(ResponseResult.COUPON_VERIFICATION_FAIL); return ResponseUtil.error(ResponseResult.COUPON_VERIFICATION_FAIL);
} }
} }
......
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