sync_pay_state
This commit is contained in:
parent
f921ed90d5
commit
bf458de8ef
|
|
@ -0,0 +1,11 @@
|
|||
package com.bonus.core.order.android.business;
|
||||
|
||||
import com.bonus.core.order.common.model.OrderInfo;
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
public interface OrderDishesAndroidBusiness {
|
||||
|
||||
void initOrderMealCode(OrderInfo orderInfo);
|
||||
|
||||
}
|
||||
|
|
@ -0,0 +1,67 @@
|
|||
package com.bonus.core.order.android.business.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.ListUtil;
|
||||
import cn.hutool.core.text.CharSequenceUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.bonus.core.allocation.canteen.model.AllocStall;
|
||||
import com.bonus.core.customer.constants.OrderTypeEnum;
|
||||
import com.bonus.core.order.android.business.OrderDishesAndroidBusiness;
|
||||
import com.bonus.core.order.common.model.OrderInfo;
|
||||
import com.bonus.core.order.custom.OrderCustomBusiness;
|
||||
import com.bonus.core.order.utils.LeNumUtil;
|
||||
import com.bonus.core.supermarket.model.SupermarketInfo;
|
||||
import org.redisson.api.RLock;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.context.annotation.Lazy;
|
||||
import org.springframework.stereotype.Service;
|
||||
import java.time.LocalDate;
|
||||
import java.time.LocalTime;
|
||||
import java.util.Comparator;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
import java.util.function.Function;
|
||||
import java.util.stream.Collectors;
|
||||
|
||||
@Service
|
||||
public class OrderDishesAndroidBusinessImpl implements OrderDishesAndroidBusiness {
|
||||
private static final Logger log = LoggerFactory.getLogger(OrderDishesAndroidBusinessImpl.class);
|
||||
|
||||
@Autowired
|
||||
@Lazy
|
||||
protected OrderCustomBusiness orderCustomBusiness;
|
||||
|
||||
public void initOrderMealCode(OrderInfo orderInfo) {
|
||||
if (!CharSequenceUtil.isNotEmpty(orderInfo.getMealCode())) {
|
||||
String mealCode = this.createMealCode(orderInfo.getOrderType(), orderInfo.getCanteenId(), orderInfo.getStallId(), orderInfo.getOrderDate(), orderInfo.getMealtimeType());
|
||||
orderInfo.setMealCode(mealCode);
|
||||
}
|
||||
}
|
||||
|
||||
public String createMealCode(Integer orderType, Long canteenId, Long stallId, LocalDate orderDate, Integer mealtimeType) {
|
||||
String mealCode = this.orderCustomBusiness.android().willCreateOrderMealCode(canteenId, stallId, orderDate, mealtimeType);
|
||||
if (CharSequenceUtil.isNotEmpty(mealCode)) {
|
||||
return this.orderCustomBusiness.android().didCreateOrderMealCode(canteenId, stallId, orderDate, mealtimeType, mealCode);
|
||||
} else {
|
||||
String prefix = null;
|
||||
if (OrderTypeEnum.isShopCategory(orderType)) {
|
||||
SupermarketInfo supermarketInfoById = this.supermarketApi.getSupermarketInfoById(canteenId);
|
||||
prefix = supermarketInfoById != null ? supermarketInfoById.getMealCode() : "";
|
||||
} else if (OrderTypeEnum.isCanteenCategory(orderType) && LeNumUtil.isValidId(stallId)) {
|
||||
AllocStall allocStall = this.allocStallApi.getAllocStall(stallId);
|
||||
if (allocStall != null) {
|
||||
prefix = OrderTypeEnum.isAndroidCategory(orderType) ? allocStall.getOffLineMealCodePrefix() : allocStall.getOnLineMealCodePrefix();
|
||||
}
|
||||
}
|
||||
|
||||
mealCode = this.numUtil.getMealCode(prefix, canteenId, stallId, orderDate, mealtimeType);
|
||||
log.info("创建叫号码:{}", mealCode);
|
||||
return this.orderCustomBusiness.android().didCreateOrderMealCode(canteenId, stallId, orderDate, mealtimeType, mealCode);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
@ -2,6 +2,7 @@ package com.bonus.core.order.common.business;
|
|||
|
||||
import com.bonus.core.marketing.coupon.model.MktCouponPayModel;
|
||||
import com.bonus.core.menu.model.AllocMealtimeModel;
|
||||
import com.bonus.core.order.common.dto.OrderDidPayInfoDTO;
|
||||
import com.bonus.core.order.common.model.*;
|
||||
import com.bonus.core.order.common.vo.OrderDeliveryResultVO;
|
||||
import com.bonus.core.order.mq.po.OrderSavePO;
|
||||
|
|
@ -64,7 +65,7 @@ public interface OrderPlaceBusiness {
|
|||
//
|
||||
List<OrderAmountDetail> calcOrderRealAmount(List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderAmountChange> orderAmountChangeList, BigDecimal payAmount, List<TradeChannelVO> channelDetailList);
|
||||
|
||||
// void updateOrderFieldAfterPay(OrderInfo orderInfo, OrderDidPayInfoDTO didPayInfoDTO);
|
||||
void updateOrderFieldAfterPay(OrderInfo orderInfo, OrderDidPayInfoDTO didPayInfoDTO);
|
||||
//
|
||||
// boolean ifUseCall(OrderInfo orderInfo);
|
||||
}
|
||||
|
|
|
|||
|
|
@ -7,6 +7,7 @@ import cn.hutool.core.util.NumberUtil;
|
|||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.constant.LeConstants;
|
||||
import com.bonus.constant.RetCodeEnum;
|
||||
import com.bonus.constant.SourceTypeEnum;
|
||||
import com.bonus.core.account.v3.api.AccTradeApi;
|
||||
import com.bonus.core.account.v3.api.vo.AccTradeOrderBalanceVO;
|
||||
import com.bonus.core.allocation.canteen.dto.AllocCanteenDeliveryDTO;
|
||||
|
|
@ -31,6 +32,7 @@ import com.bonus.core.menu.api.MenuRecipeApi;
|
|||
import com.bonus.core.menu.dto.MenuRecipeChangeSurplusNum;
|
||||
import com.bonus.core.menu.dto.OrderRecipeDishesDto;
|
||||
import com.bonus.core.menu.model.AllocMealtimeModel;
|
||||
import com.bonus.core.order.android.business.OrderDishesAndroidBusiness;
|
||||
import com.bonus.core.order.client.OrderModuleClient;
|
||||
import com.bonus.core.order.client.po.MealtimeCheckNowParam;
|
||||
import com.bonus.core.order.client.po.MealtimeQueryParam;
|
||||
|
|
@ -38,6 +40,7 @@ import com.bonus.core.order.client.po.MetaDataValueParam;
|
|||
import com.bonus.core.order.client.po.OrderConfigQueryParam;
|
||||
import com.bonus.core.order.common.business.OrderPlaceBusiness;
|
||||
import com.bonus.core.order.common.constants.*;
|
||||
import com.bonus.core.order.common.dto.OrderDidPayInfoDTO;
|
||||
import com.bonus.core.order.common.model.*;
|
||||
import com.bonus.core.order.common.service.*;
|
||||
import com.bonus.core.order.common.vo.OrderDeliveryResultVO;
|
||||
|
|
@ -86,9 +89,9 @@ public class OrderPlaceBusinessImpl implements OrderPlaceBusiness {
|
|||
@Autowired
|
||||
@Lazy
|
||||
protected OrderCustomBusiness orderCustomBusiness;
|
||||
// @Autowired
|
||||
// @Lazy
|
||||
// protected OrderDishesAndroidBusiness orderDishesAndroidBusiness;
|
||||
@Autowired
|
||||
@Lazy
|
||||
protected OrderDishesAndroidBusiness orderDishesAndroidBusiness;
|
||||
@Autowired
|
||||
@Lazy
|
||||
protected OrderInfoService orderInfoService;
|
||||
|
|
@ -931,54 +934,54 @@ public class OrderPlaceBusinessImpl implements OrderPlaceBusiness {
|
|||
}
|
||||
}
|
||||
|
||||
// public void updateOrderFieldAfterPay(OrderInfo orderInfo, OrderDidPayInfoDTO didPayInfoDTO) {
|
||||
// orderInfo.setPayState(didPayInfoDTO.getPayState());
|
||||
// orderInfo.setPayTime(didPayInfoDTO.getPayTime() != null ? didPayInfoDTO.getPayTime() : LocalDateTime.now());
|
||||
// orderInfo.setPayType(didPayInfoDTO.getPayType());
|
||||
// orderInfo.setPayChannel(didPayInfoDTO.getPayChannel());
|
||||
// this.orderDishesAndroidBusiness.initOrderMealCode(orderInfo);
|
||||
// boolean callFlag = this.ifUseCall(orderInfo);
|
||||
// OrderStateEnum orderStateEnum = OrderStateEnum.PLACE;
|
||||
// DishesStateEnum dishesStateEnum = DishesStateEnum.UN_MAKE;
|
||||
// if (OrderTypeEnum.isAndroidType(orderInfo.getOrderType())) {
|
||||
// if (this.ifMealtimeAfterCurrent(orderInfo)) {
|
||||
// log.info("[当餐点餐下单] 当前餐次之后的订单");
|
||||
// } else if (callFlag) {
|
||||
// dishesStateEnum = DishesStateEnum.MAKING;
|
||||
// } else if (DeliveryTypeEnum.isNeedDeliveryType(orderInfo.getDeliveryType())) {
|
||||
// dishesStateEnum = DishesStateEnum.WAIT_DELIVERY;
|
||||
// } else {
|
||||
// dishesStateEnum = DishesStateEnum.ALREADY_TAKE;
|
||||
// orderStateEnum = OrderStateEnum.FINISH;
|
||||
// }
|
||||
// } else if (OrderTypeEnum.isCurrMealType(orderInfo.getOrderType())) {
|
||||
// if (callFlag) {
|
||||
// dishesStateEnum = DishesStateEnum.MAKING;
|
||||
// } else if (DeliveryTypeEnum.isNeedDeliveryType(orderInfo.getDeliveryType())) {
|
||||
// dishesStateEnum = DishesStateEnum.WAIT_DELIVERY;
|
||||
// } else {
|
||||
// dishesStateEnum = DishesStateEnum.WAIT_TAKE;
|
||||
// }
|
||||
// } else if (OrderTypeEnum.isShopType(orderInfo.getOrderType())) {
|
||||
// if (SourceTypeEnum.getAppTypeList().contains(orderInfo.getSourceType())) {
|
||||
// dishesStateEnum = DishesStateEnum.WAIT_TAKE;
|
||||
// } else {
|
||||
// orderStateEnum = OrderStateEnum.FINISH;
|
||||
// dishesStateEnum = DishesStateEnum.ALREADY_TAKE;
|
||||
// }
|
||||
// } else if (OrderTypeEnum.isBuffetType(orderInfo.getOrderType()) || OrderTypeEnum.isRoomCategory(orderInfo.getOrderType()) || OrderTypeEnum.isMobileScanCategory(orderInfo.getOrderType())) {
|
||||
// orderStateEnum = OrderStateEnum.FINISH;
|
||||
// dishesStateEnum = DishesStateEnum.ALREADY_TAKE;
|
||||
// }
|
||||
//
|
||||
// if (!OrderStateEnum.isFinishState(orderInfo.getOrderState())) {
|
||||
// orderInfo.setOrderState(orderStateEnum.getKey());
|
||||
// orderInfo.setDishesState(dishesStateEnum.getKey());
|
||||
// }
|
||||
//
|
||||
// this.orderCustomBusiness.place().didUpdateOrderFieldAfterPay(orderInfo, didPayInfoDTO);
|
||||
// }
|
||||
//
|
||||
public void updateOrderFieldAfterPay(OrderInfo orderInfo, OrderDidPayInfoDTO didPayInfoDTO) {
|
||||
orderInfo.setPayState(didPayInfoDTO.getPayState());
|
||||
orderInfo.setPayTime(didPayInfoDTO.getPayTime() != null ? didPayInfoDTO.getPayTime() : LocalDateTime.now());
|
||||
orderInfo.setPayType(didPayInfoDTO.getPayType());
|
||||
orderInfo.setPayChannel(didPayInfoDTO.getPayChannel());
|
||||
this.orderDishesAndroidBusiness.initOrderMealCode(orderInfo);
|
||||
boolean callFlag = this.ifUseCall(orderInfo);
|
||||
OrderStateEnum orderStateEnum = OrderStateEnum.PLACE;
|
||||
DishesStateEnum dishesStateEnum = DishesStateEnum.UN_MAKE;
|
||||
if (OrderTypeEnum.isAndroidType(orderInfo.getOrderType())) {
|
||||
if (this.ifMealtimeAfterCurrent(orderInfo)) {
|
||||
log.info("[当餐点餐下单] 当前餐次之后的订单");
|
||||
} else if (callFlag) {
|
||||
dishesStateEnum = DishesStateEnum.MAKING;
|
||||
} else if (DeliveryTypeEnum.isNeedDeliveryType(orderInfo.getDeliveryType())) {
|
||||
dishesStateEnum = DishesStateEnum.WAIT_DELIVERY;
|
||||
} else {
|
||||
dishesStateEnum = DishesStateEnum.ALREADY_TAKE;
|
||||
orderStateEnum = OrderStateEnum.FINISH;
|
||||
}
|
||||
} else if (OrderTypeEnum.isCurrMealType(orderInfo.getOrderType())) {
|
||||
if (callFlag) {
|
||||
dishesStateEnum = DishesStateEnum.MAKING;
|
||||
} else if (DeliveryTypeEnum.isNeedDeliveryType(orderInfo.getDeliveryType())) {
|
||||
dishesStateEnum = DishesStateEnum.WAIT_DELIVERY;
|
||||
} else {
|
||||
dishesStateEnum = DishesStateEnum.WAIT_TAKE;
|
||||
}
|
||||
} else if (OrderTypeEnum.isShopType(orderInfo.getOrderType())) {
|
||||
if (SourceTypeEnum.getAppTypeList().contains(orderInfo.getSourceType())) {
|
||||
dishesStateEnum = DishesStateEnum.WAIT_TAKE;
|
||||
} else {
|
||||
orderStateEnum = OrderStateEnum.FINISH;
|
||||
dishesStateEnum = DishesStateEnum.ALREADY_TAKE;
|
||||
}
|
||||
} else if (OrderTypeEnum.isBuffetType(orderInfo.getOrderType()) || OrderTypeEnum.isRoomCategory(orderInfo.getOrderType()) || OrderTypeEnum.isMobileScanCategory(orderInfo.getOrderType())) {
|
||||
orderStateEnum = OrderStateEnum.FINISH;
|
||||
dishesStateEnum = DishesStateEnum.ALREADY_TAKE;
|
||||
}
|
||||
|
||||
if (!OrderStateEnum.isFinishState(orderInfo.getOrderState())) {
|
||||
orderInfo.setOrderState(orderStateEnum.getKey());
|
||||
orderInfo.setDishesState(dishesStateEnum.getKey());
|
||||
}
|
||||
|
||||
this.orderCustomBusiness.place().didUpdateOrderFieldAfterPay(orderInfo, didPayInfoDTO);
|
||||
}
|
||||
|
||||
// public boolean ifUseCall(OrderInfo orderInfo) {
|
||||
// if (LocalDate.now().isAfter(orderInfo.getOrderDate())) {
|
||||
// log.warn("[叫号] 今天之前的订单不叫号");
|
||||
|
|
|
|||
|
|
@ -0,0 +1,92 @@
|
|||
package com.bonus.core.order.custom;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import com.bonus.core.common.custom.business.CustomBusiness;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.time.LocalDate;
|
||||
import java.util.List;
|
||||
|
||||
@Service
|
||||
public class OrderCustomAndroidBusiness implements CustomBusiness {
|
||||
public String name() {
|
||||
return "订单(设备)";
|
||||
}
|
||||
|
||||
public List<CustomBusiness.Version> versions() {
|
||||
return CollUtil.newArrayList(new CustomBusiness.Version[]{CustomBusiness.Version.of("3.7.0", "初版"), CustomBusiness.Version.of("3.11.2", "叫号添加日期入参"), CustomBusiness.Version.of("3.11.4", "添加试算埋点"), CustomBusiness.Version.of("3.11.5", "叫号码改造")});
|
||||
}
|
||||
|
||||
// public boolean willPlaceParamCheck(OrderPayAndroidTotalDTO androidTotalDTO) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// public void didPlaceParamCheck(OrderPayAndroidTotalDTO androidTotalDTO) {
|
||||
// }
|
||||
//
|
||||
// public void didCreatePay(OrderPayAndroidTotalDTO androidTotalDTO, UnifyPayDTO unifyPayDTO) {
|
||||
// }
|
||||
//
|
||||
// public void didPackageOrderInfo(OrderPayAndroidTotalDTO androidTotalDTO, DeviceInfoVO deviceInfoVO, UnifyPayDTO unifyPayDTO, List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, List<OrderDelivery> orderDeliveryList) {
|
||||
// }
|
||||
//
|
||||
// public OrderPayAndroidVO didPayResultHandler(UnifyPayDTO payDTO, UnifyPayVO payVO, List<OrderInfo> orderInfoList, List<OrderDetail> orderDetailList, OrderPayAndroidVO orderPayAndroidVO) {
|
||||
// return orderPayAndroidVO;
|
||||
// }
|
||||
//
|
||||
// public OrderPayAndroidVO didTrialResultHandler(OrderSavePO orderSavePO, OrderPayAndroidVO orderPayAndroidVO) {
|
||||
// return orderPayAndroidVO;
|
||||
// }
|
||||
//
|
||||
// public OrderPayAndroidVO willOrderPay(OrderSavePO orderSavePO) {
|
||||
// return null;
|
||||
// }
|
||||
|
||||
public String willCreateOrderMealCode(Long canteenId, Long stallId, LocalDate orderDate, Integer mealtimeType) {
|
||||
return null;
|
||||
}
|
||||
|
||||
public String didCreateOrderMealCode(Long canteenId, Long stallId, LocalDate orderDate, Integer mealtimeType, String mealCode) {
|
||||
return mealCode;
|
||||
}
|
||||
|
||||
// public OrderAndroidSignInVO willSignIn(OrderInfo orderInfo, OrderSignInAndroidDTO param) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public OrderAndroidSignInVO didSignIn(OrderInfo orderInfo, OrderSignInAndroidDTO param, OrderAndroidSignInVO result) {
|
||||
// return result;
|
||||
// }
|
||||
//
|
||||
// public boolean willUpdateOrderDishesStateV2(OrderInfo orderInfo, OrderDishesUpdateDTO dishesUpdateDTO) {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// public void didUpdateOrderDishesStateV2(OrderInfo orderInfo, Integer dishesStateBeforeUpdated) {
|
||||
// }
|
||||
//
|
||||
// public OrderTakeAndroidVO willCustTakeMeal(OrderTakeAndroidDTO takeAndroidDTO) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public OrderTakeAndroidVO didCustTakeMeal(OrderTakeAndroidDTO takeAndroidDTO, OrderTakeAndroidVO takeAndroidVO) {
|
||||
// return takeAndroidVO;
|
||||
// }
|
||||
//
|
||||
// public void didQueryOrderCallPage(OrderCallQueryDTO queryDTO, PageVO<OrderCallListVO> pageVO) {
|
||||
// }
|
||||
//
|
||||
// public void didQueryOrderPage(OrderListAndroidQueryDTO queryDTO, PageVO<OrderListAndroidVO> pageVO) {
|
||||
// }
|
||||
//
|
||||
// public void didSaveOrderPhotoV2(List<OrderPhoto> orderPhotoList) {
|
||||
// }
|
||||
//
|
||||
// public OrderPayAndroidVO willQueryPayResult(String macOrderId) {
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// public OrderPayAndroidVO didQueryPayResult(String macOrderId, OrderPayAndroidVO orderPayAndroidVO) {
|
||||
// return orderPayAndroidVO;
|
||||
// }
|
||||
}
|
||||
|
|
@ -6,9 +6,9 @@ import org.springframework.stereotype.Service;
|
|||
|
||||
@Service
|
||||
public class OrderCustomBusiness {
|
||||
// @Autowired
|
||||
// @Lazy
|
||||
// protected OrderCustomAndroidBusiness orderCustomAndroidBusiness;
|
||||
@Autowired
|
||||
@Lazy
|
||||
protected OrderCustomAndroidBusiness orderCustomAndroidBusiness;
|
||||
@Autowired
|
||||
@Lazy
|
||||
protected OrderCustomMobileBusiness orderCustomMobileBusiness;
|
||||
|
|
@ -40,9 +40,9 @@ public class OrderCustomBusiness {
|
|||
// @Lazy
|
||||
// protected OrderCustomPrintBusiness orderCustomPrintBusiness;
|
||||
|
||||
// public OrderCustomAndroidBusiness android() {
|
||||
// return this.orderCustomAndroidBusiness;
|
||||
// }
|
||||
public OrderCustomAndroidBusiness android() {
|
||||
return this.orderCustomAndroidBusiness;
|
||||
}
|
||||
|
||||
public OrderCustomMobileBusiness mobile() {
|
||||
return this.orderCustomMobileBusiness;
|
||||
|
|
|
|||
Reference in New Issue