订单增加配送方式参数
This commit is contained in:
parent
329fe7ff35
commit
20dd2005d3
|
|
@ -1,6 +1,8 @@
|
|||
package com.bonus.canteen.core.order.constants;
|
||||
|
||||
|
||||
import org.apache.commons.lang3.StringUtils;
|
||||
|
||||
public enum DeliveryTypeEnum {
|
||||
SELF_TAKE(1, "自取堂食"),
|
||||
MERCHANT(2, "商家配送"),
|
||||
|
|
@ -26,4 +28,22 @@ public enum DeliveryTypeEnum {
|
|||
public String getDesc() {
|
||||
return this.desc;
|
||||
}
|
||||
|
||||
public static boolean isValidKey(Integer key) {
|
||||
for (DeliveryTypeEnum type : DeliveryTypeEnum.values()) {
|
||||
if (type.getKey().equals(key)) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public static String getDescByKey(Integer key) {
|
||||
for (DeliveryTypeEnum deliveryTypeEnum : DeliveryTypeEnum.values()) {
|
||||
if (deliveryTypeEnum.getKey().equals(key)) {
|
||||
return deliveryTypeEnum.getDesc();
|
||||
}
|
||||
}
|
||||
return StringUtils.EMPTY;
|
||||
}
|
||||
}
|
||||
|
|
|
|||
|
|
@ -6,6 +6,7 @@ import com.bonus.canteen.core.order.domain.param.*;
|
|||
import com.bonus.canteen.core.pay.constants.PayChannelEnum;
|
||||
import com.bonus.canteen.core.pay.constants.PayStateEnum;
|
||||
import com.bonus.common.core.annotation.Excel;
|
||||
import com.bonus.common.core.exception.ServiceException;
|
||||
import com.bonus.common.core.utils.DateUtils;
|
||||
import com.bonus.common.core.web.domain.BaseEntity;
|
||||
import com.bonus.common.security.utils.SecurityUtils;
|
||||
|
|
@ -169,6 +170,8 @@ public class OrderInfo extends BaseEntity
|
|||
@Excel(name = "配送方式")
|
||||
private Integer deliveryType;
|
||||
|
||||
private String deliveryTypeName;
|
||||
|
||||
/** 评论状态 1 已评论 2 未评论 */
|
||||
@Excel(name = "评论状态 1 已评论 2 未评论")
|
||||
private Integer commentState;
|
||||
|
|
@ -220,7 +223,14 @@ public class OrderInfo extends BaseEntity
|
|||
orderInfo.setPayState(PayStateEnum.PAY_INPROCESS.getKey());
|
||||
orderInfo.setDeliveryAmount(BigDecimal.ZERO);
|
||||
orderInfo.setPackingAmount(BigDecimal.ZERO);
|
||||
if(Objects.isNull(param.getDeliveryType())) {
|
||||
orderInfo.setDeliveryType(DeliveryTypeEnum.SELF_TAKE.getKey());
|
||||
}else {
|
||||
if(!DeliveryTypeEnum.isValidKey(param.getDeliveryType())) {
|
||||
throw new ServiceException("配送方式参数错误");
|
||||
}
|
||||
orderInfo.setDeliveryType(param.getDeliveryType());
|
||||
}
|
||||
orderInfo.setCommentState(CommentStateEnum.UN_COMMENT.getKey());
|
||||
orderInfo.setOrderTime(DateUtils.getNowDate());
|
||||
orderInfo.setPayableAmount(BigDecimal.ZERO);
|
||||
|
|
|
|||
|
|
@ -35,6 +35,7 @@ public class OrderAddParam {
|
|||
private Integer sourceType;
|
||||
private Integer isOnline;
|
||||
private String remark;
|
||||
private Integer deliveryType;
|
||||
@Valid
|
||||
@NotNull(message = "订单列表不能为空")
|
||||
private List<OrderInfoAddParam> orderList;
|
||||
|
|
|
|||
|
|
@ -16,6 +16,7 @@ import com.bonus.canteen.core.basic.service.IBasicStallService;
|
|||
import com.bonus.canteen.core.common.utils.MqUtil;
|
||||
import com.bonus.canteen.core.common.utils.RedisUtil;
|
||||
import com.bonus.canteen.core.order.business.OrderBusiness;
|
||||
import com.bonus.canteen.core.order.constants.DeliveryTypeEnum;
|
||||
import com.bonus.canteen.core.order.constants.OrderDetailStateEnum;
|
||||
import com.bonus.canteen.core.order.constants.OrderRefundStateEnum;
|
||||
import com.bonus.canteen.core.order.constants.OrderStateEnum;
|
||||
|
|
@ -96,6 +97,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
|||
orderDetail.setOrderId(orderId);
|
||||
List<OrderDetail> orderDetailList = orderDetailService.selectOrderDetailList(orderDetail);
|
||||
orderInfo.setOrderDetailList(orderDetailList);
|
||||
orderInfo.setDeliveryTypeName(DeliveryTypeEnum.getDescByKey(orderInfo.getDeliveryType()));
|
||||
return orderInfo;
|
||||
}
|
||||
|
||||
|
|
@ -129,6 +131,7 @@ public class OrderInfoServiceImpl implements IOrderInfoService
|
|||
List<OrderDetail> orderDetailList = orderDetailService.selectOrderDetailList(orderDetail);
|
||||
order.setOrderDetailList(orderDetailList);
|
||||
order.setPhoneNumber(SM4EncryptUtils.sm4Decrypt(order.getPhoneNumber()));
|
||||
order.setDeliveryTypeName(DeliveryTypeEnum.getDescByKey(order.getDeliveryType()));
|
||||
});
|
||||
}
|
||||
return orderInfoList;
|
||||
|
|
|
|||
Loading…
Reference in New Issue