Authored by wujiexiang

边界问题处理

... ... @@ -119,7 +119,7 @@ public class BuyerOrderChangeBusinessPostProcessor {
context.buyerOrder = buyerOrder;
context.bizCase = bizCase;
context.targetStatus = targetStatus;
//sql超时,会在listenerContainer层告警
//sql超时,会在listenerContainer层告警,最好是添加重试
context.activityBo = buyerOrderMetaMapperSupport.selectByMetaKey(buyerOrder.getUid(), buyerOrder.getOrderCode(), MetaKey.ACTIVITY_KEY, ActivityBo.class);
return context;
}
... ... @@ -161,19 +161,13 @@ public class BuyerOrderChangeBusinessPostProcessor {
void paySuccess(BusinessProcessorContext context);
}
//默认业务处理
private class DefaultBusinessProcessor implements BusinessProcessor {
/**
* adapter interface BusinessProcessor
*/
private class BusinessProcessorAdapter implements BusinessProcessor {
@Override
public void create(BusinessProcessorContext context) {
BuyerOrder buyerOrder = context.buyerOrder;
logger.debug("[{}] buyer order amount is {}", buyerOrder.getOrderCode(), buyerOrder.getAmount());
if (buyerOrder.getAmount().doubleValue() == 0) {
logger.warn("[{}] buyer order amount is zero", buyerOrder.getOrderCode());
//0元订单 告警一下
EventBusPublisher.publishEvent(
new SmsAlarmEvent("ufo.buyerOrder", "submit", buyerOrder.getOrderCode() + " amount is zero")
);
}
}
@Override
... ... @@ -187,12 +181,28 @@ public class BuyerOrderChangeBusinessPostProcessor {
}
}
//默认业务处理
private class DefaultBusinessProcessor extends BusinessProcessorAdapter {
@Override
public void create(BusinessProcessorContext context) {
BuyerOrder buyerOrder = context.buyerOrder;
logger.debug("[{}] buyer order amount is {}", buyerOrder.getOrderCode(), buyerOrder.getAmount());
if (buyerOrder.getAmount().doubleValue() == 0) {
logger.warn("[{}] buyer order amount is zero", buyerOrder.getOrderCode());
//0元订单 告警一下
EventBusPublisher.publishEvent(
new SmsAlarmEvent("ufo.buyerOrder", "submit", buyerOrder.getOrderCode() + " amount is zero")
);
}
}
}
//砍价业务
private class BargainBusinessProcessor implements BusinessProcessor {
@Override
public void create(BusinessProcessorContext context) {
//nothing
}
@Override
... ... @@ -217,12 +227,11 @@ public class BuyerOrderChangeBusinessPostProcessor {
if (!Objects.equals(buyerOrder.getActivityType(), ActivityTypeEnum.BARGAIN.getCode())) {
return false;
}
if (activityBo == null || activityBo.getUserActivityId() < 0) {
if (activityBo == null || activityBo.getUserActivityId() <= 0) {
logger.warn("[{}] has no userActivityId", buyerOrder.getOrderCode());
return false;
}
return true;
}
}
}
}
\ No newline at end of file
... ...