Merge branch 'lili_self' of https://gitee.com/beijing_hongye_huicheng/lilishop into lili_self
This commit is contained in:
@@ -81,6 +81,19 @@ public class Swagger2Config {
|
||||
.securitySchemes(securitySchemes())
|
||||
.securityContexts(securityContexts());
|
||||
}
|
||||
@Bean
|
||||
public Docket orderRestApi() {
|
||||
return new Docket(DocumentationType.SWAGGER_2)
|
||||
.groupName("订单")
|
||||
.apiInfo(apiInfo()).select()
|
||||
//扫描所有有注解的api,用这种方式更灵活
|
||||
// .apis(RequestHandlerSelectors.withMethodAnnotation(ApiOperation.class))
|
||||
.apis(RequestHandlerSelectors.basePackage("cn.lili.controller.order"))
|
||||
.paths(PathSelectors.any())
|
||||
.build()
|
||||
.securitySchemes(securitySchemes())
|
||||
.securityContexts(securityContexts());
|
||||
}
|
||||
|
||||
@Bean
|
||||
public Docket memberRestApi() {
|
||||
|
||||
@@ -41,6 +41,7 @@ import cn.lili.modules.store.entity.enums.StoreStatusEnum;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
import cn.lili.mybatis.util.PageUtil;
|
||||
import cn.lili.rocketmq.tags.MemberTagsEnum;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper;
|
||||
@@ -183,7 +184,8 @@ public class MemberServiceImpl extends ServiceImpl<MemberMapper, Member> impleme
|
||||
@Override
|
||||
public Token usernameStoreLogin(String username, String password) {
|
||||
|
||||
Member member = this.findMember(username);
|
||||
// Member member = this.findMember(username);
|
||||
Member member = this.getOne(new LambdaQueryWrapper<Member>().eq(Member::getMobile,username));
|
||||
//判断用户是否存在
|
||||
if (member == null || !member.getDisabled()) {
|
||||
throw new ServiceException(ResultCode.USER_NOT_EXIST);
|
||||
|
||||
@@ -11,6 +11,7 @@ import cn.lili.modules.order.order.entity.vo.OrderVO;
|
||||
import cn.lili.modules.order.order.entity.vo.ReceiptVO;
|
||||
import cn.lili.modules.promotion.entity.dos.MemberCoupon;
|
||||
import cn.lili.modules.promotion.entity.vos.MemberCouponVO;
|
||||
import cn.lili.modules.store.entity.dos.StoreAddress;
|
||||
import io.swagger.annotations.ApiModelProperty;
|
||||
import lombok.Data;
|
||||
|
||||
@@ -106,6 +107,10 @@ public class TradeDTO implements Serializable {
|
||||
*/
|
||||
private MemberAddress memberAddress;
|
||||
|
||||
/**
|
||||
* 自提地址
|
||||
*/
|
||||
private StoreAddress storeAddress;
|
||||
|
||||
/**
|
||||
* 客户端类型
|
||||
|
||||
@@ -155,35 +155,37 @@ public class CheckDataRender implements CartRenderStep {
|
||||
private void groupStore(TradeDTO tradeDTO) {
|
||||
//渲染的购物车
|
||||
List<CartVO> cartList = new ArrayList<>();
|
||||
|
||||
//根据店铺分组
|
||||
Map<String, List<CartSkuVO>> storeCollect = tradeDTO.getSkuList().stream().collect(Collectors.groupingBy(CartSkuVO::getStoreId));
|
||||
for (Map.Entry<String, List<CartSkuVO>> storeCart : storeCollect.entrySet()) {
|
||||
if (!storeCart.getValue().isEmpty()) {
|
||||
CartVO cartVO = new CartVO(storeCart.getValue().get(0));
|
||||
if (CharSequenceUtil.isEmpty(cartVO.getDeliveryMethod())) {
|
||||
cartVO.setDeliveryMethod(DeliveryMethodEnum.LOGISTICS.name());
|
||||
}
|
||||
cartVO.setSkuList(storeCart.getValue());
|
||||
try {
|
||||
//筛选属于当前店铺的优惠券
|
||||
storeCart.getValue().forEach(i -> i.getPromotionMap().forEach((key, value) -> {
|
||||
if (key.contains(PromotionTypeEnum.COUPON.name())) {
|
||||
JSONObject promotionsObj = JSONUtil.parseObj(value);
|
||||
Coupon coupon = JSONUtil.toBean(promotionsObj, Coupon.class);
|
||||
if (key.contains(PromotionTypeEnum.COUPON.name()) && coupon.getStoreId().equals(storeCart.getKey())) {
|
||||
cartVO.getCanReceiveCoupon().add(new CouponVO(coupon));
|
||||
if(tradeDTO.getCartList() == null || tradeDTO.getCartList().size() == 0){
|
||||
//根据店铺分组
|
||||
Map<String, List<CartSkuVO>> storeCollect = tradeDTO.getSkuList().stream().collect(Collectors.groupingBy(CartSkuVO::getStoreId));
|
||||
for (Map.Entry<String, List<CartSkuVO>> storeCart : storeCollect.entrySet()) {
|
||||
if (!storeCart.getValue().isEmpty()) {
|
||||
CartVO cartVO = new CartVO(storeCart.getValue().get(0));
|
||||
if (CharSequenceUtil.isEmpty(cartVO.getDeliveryMethod())) {
|
||||
cartVO.setDeliveryMethod(DeliveryMethodEnum.LOGISTICS.name());
|
||||
}
|
||||
cartVO.setSkuList(storeCart.getValue());
|
||||
try {
|
||||
//筛选属于当前店铺的优惠券
|
||||
storeCart.getValue().forEach(i -> i.getPromotionMap().forEach((key, value) -> {
|
||||
if (key.contains(PromotionTypeEnum.COUPON.name())) {
|
||||
JSONObject promotionsObj = JSONUtil.parseObj(value);
|
||||
Coupon coupon = JSONUtil.toBean(promotionsObj, Coupon.class);
|
||||
if (key.contains(PromotionTypeEnum.COUPON.name()) && coupon.getStoreId().equals(storeCart.getKey())) {
|
||||
cartVO.getCanReceiveCoupon().add(new CouponVO(coupon));
|
||||
}
|
||||
}
|
||||
}
|
||||
}));
|
||||
} catch (Exception e) {
|
||||
log.error("筛选属于当前店铺的优惠券发生异常!", e);
|
||||
}));
|
||||
} catch (Exception e) {
|
||||
log.error("筛选属于当前店铺的优惠券发生异常!", e);
|
||||
}
|
||||
storeCart.getValue().stream().filter(i -> Boolean.TRUE.equals(i.getChecked())).findFirst().ifPresent(cartSkuVO -> cartVO.setChecked(true));
|
||||
cartList.add(cartVO);
|
||||
}
|
||||
storeCart.getValue().stream().filter(i -> Boolean.TRUE.equals(i.getChecked())).findFirst().ifPresent(cartSkuVO -> cartVO.setChecked(true));
|
||||
cartList.add(cartVO);
|
||||
}
|
||||
tradeDTO.setCartList(cartList);
|
||||
}
|
||||
tradeDTO.setCartList(cartList);
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -3,10 +3,12 @@ package cn.lili.modules.order.cart.render.impl;
|
||||
import cn.lili.common.utils.CurrencyUtil;
|
||||
import cn.lili.modules.member.entity.dos.MemberAddress;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum;
|
||||
import cn.lili.modules.order.cart.entity.enums.RenderStepEnums;
|
||||
import cn.lili.modules.order.cart.entity.vo.CartSkuVO;
|
||||
import cn.lili.modules.order.cart.render.CartRenderStep;
|
||||
import cn.lili.modules.store.entity.dos.FreightTemplateChild;
|
||||
import cn.lili.modules.store.entity.dos.StoreAddress;
|
||||
import cn.lili.modules.store.entity.dto.FreightTemplateChildDTO;
|
||||
import cn.lili.modules.store.entity.enums.FreightTemplateEnum;
|
||||
import cn.lili.modules.store.entity.vos.FreightTemplateVO;
|
||||
@@ -42,71 +44,77 @@ public class SkuFreightRender implements CartRenderStep {
|
||||
List<CartSkuVO> cartSkuVOS = tradeDTO.getCheckedSkuList();
|
||||
//会员收货地址问题处理
|
||||
MemberAddress memberAddress = tradeDTO.getMemberAddress();
|
||||
StoreAddress storeAddress = tradeDTO.getStoreAddress();
|
||||
//如果收货地址为空,则抛出异常
|
||||
if (memberAddress == null) {
|
||||
if (memberAddress == null && storeAddress == null) {
|
||||
return;
|
||||
}
|
||||
//运费分组信息
|
||||
Map<String, List<String>> freightGroups = freightTemplateGrouping(cartSkuVOS);
|
||||
//选择物流的时候计算价格
|
||||
if(DeliveryMethodEnum.LOGISTICS.name().equals(tradeDTO.getCartList().get(0).getDeliveryMethod())){
|
||||
if (memberAddress != null) {
|
||||
//运费分组信息
|
||||
Map<String, List<String>> freightGroups = freightTemplateGrouping(cartSkuVOS);
|
||||
|
||||
//循环运费模版
|
||||
for (Map.Entry<String, List<String>> freightTemplateGroup : freightGroups.entrySet()) {
|
||||
//循环运费模版
|
||||
for (Map.Entry<String, List<String>> freightTemplateGroup : freightGroups.entrySet()) {
|
||||
|
||||
//商品id列表
|
||||
List<String> skuIds = freightTemplateGroup.getValue();
|
||||
//商品id列表
|
||||
List<String> skuIds = freightTemplateGroup.getValue();
|
||||
|
||||
//当前购物车商品列表
|
||||
List<CartSkuVO> currentCartSkus = cartSkuVOS.stream().filter(item -> skuIds.contains(item.getGoodsSku().getId())).collect(Collectors.toList());
|
||||
//当前购物车商品列表
|
||||
List<CartSkuVO> currentCartSkus = cartSkuVOS.stream().filter(item -> skuIds.contains(item.getGoodsSku().getId())).collect(Collectors.toList());
|
||||
|
||||
//寻找对应对商品运费计算模版
|
||||
FreightTemplateVO freightTemplate = freightTemplateService.getFreightTemplate(freightTemplateGroup.getKey());
|
||||
if (freightTemplate != null
|
||||
&& freightTemplate.getFreightTemplateChildList() != null
|
||||
&& !freightTemplate.getFreightTemplateChildList().isEmpty()) {
|
||||
//店铺模版免运费则跳过
|
||||
if (freightTemplate.getPricingMethod().equals(FreightTemplateEnum.FREE.name())) {
|
||||
break;
|
||||
}
|
||||
//寻找对应对商品运费计算模版
|
||||
FreightTemplateVO freightTemplate = freightTemplateService.getFreightTemplate(freightTemplateGroup.getKey());
|
||||
if (freightTemplate != null
|
||||
&& freightTemplate.getFreightTemplateChildList() != null
|
||||
&& !freightTemplate.getFreightTemplateChildList().isEmpty()) {
|
||||
//店铺模版免运费则跳过
|
||||
if (freightTemplate.getPricingMethod().equals(FreightTemplateEnum.FREE.name())) {
|
||||
break;
|
||||
}
|
||||
|
||||
//运费模版
|
||||
FreightTemplateChild freightTemplateChild = null;
|
||||
//运费模版
|
||||
FreightTemplateChild freightTemplateChild = null;
|
||||
|
||||
//获取市级别id匹配运费模版
|
||||
String addressId = memberAddress.getConsigneeAddressIdPath().split(",")[1];
|
||||
for (FreightTemplateChild templateChild : freightTemplate.getFreightTemplateChildList()) {
|
||||
//模版匹配判定
|
||||
if (templateChild.getAreaId().contains(addressId)) {
|
||||
freightTemplateChild = templateChild;
|
||||
break;
|
||||
//获取市级别id匹配运费模版
|
||||
String addressId = memberAddress.getConsigneeAddressIdPath().split(",")[1];
|
||||
for (FreightTemplateChild templateChild : freightTemplate.getFreightTemplateChildList()) {
|
||||
//模版匹配判定
|
||||
if (templateChild.getAreaId().contains(addressId)) {
|
||||
freightTemplateChild = templateChild;
|
||||
break;
|
||||
}
|
||||
}
|
||||
//如果没有匹配到物流规则,则说明不支持配送
|
||||
if (freightTemplateChild == null) {
|
||||
if (tradeDTO.getNotSupportFreight() == null) {
|
||||
tradeDTO.setNotSupportFreight(new ArrayList<>());
|
||||
}
|
||||
tradeDTO.getNotSupportFreight().addAll(currentCartSkus);
|
||||
continue;
|
||||
}
|
||||
|
||||
//物流规则模型创立
|
||||
FreightTemplateChildDTO freightTemplateChildDTO = new FreightTemplateChildDTO(freightTemplateChild);
|
||||
//模型写入运费模版设置的计费方式
|
||||
freightTemplateChildDTO.setPricingMethod(freightTemplate.getPricingMethod());
|
||||
|
||||
//计算运费总数
|
||||
Double count = currentCartSkus.stream().mapToDouble(item ->
|
||||
// 根据计费规则 累加计费基数
|
||||
freightTemplateChildDTO.getPricingMethod().equals(FreightTemplateEnum.NUM.name()) ?
|
||||
item.getNum().doubleValue() :
|
||||
CurrencyUtil.mul(item.getNum(), item.getGoodsSku().getWeight())
|
||||
).sum();
|
||||
|
||||
//计算运费
|
||||
Double countFreight = countFreight(count, freightTemplateChildDTO);
|
||||
|
||||
//写入SKU运费
|
||||
resetFreightPrice(FreightTemplateEnum.valueOf(freightTemplateChildDTO.getPricingMethod()), count, countFreight, currentCartSkus);
|
||||
}
|
||||
}
|
||||
//如果没有匹配到物流规则,则说明不支持配送
|
||||
if (freightTemplateChild == null) {
|
||||
if (tradeDTO.getNotSupportFreight() == null) {
|
||||
tradeDTO.setNotSupportFreight(new ArrayList<>());
|
||||
}
|
||||
tradeDTO.getNotSupportFreight().addAll(currentCartSkus);
|
||||
continue;
|
||||
}
|
||||
|
||||
//物流规则模型创立
|
||||
FreightTemplateChildDTO freightTemplateChildDTO = new FreightTemplateChildDTO(freightTemplateChild);
|
||||
//模型写入运费模版设置的计费方式
|
||||
freightTemplateChildDTO.setPricingMethod(freightTemplate.getPricingMethod());
|
||||
|
||||
//计算运费总数
|
||||
Double count = currentCartSkus.stream().mapToDouble(item ->
|
||||
// 根据计费规则 累加计费基数
|
||||
freightTemplateChildDTO.getPricingMethod().equals(FreightTemplateEnum.NUM.name()) ?
|
||||
item.getNum().doubleValue() :
|
||||
CurrencyUtil.mul(item.getNum(), item.getGoodsSku().getWeight())
|
||||
).sum();
|
||||
|
||||
//计算运费
|
||||
Double countFreight = countFreight(count, freightTemplateChildDTO);
|
||||
|
||||
//写入SKU运费
|
||||
resetFreightPrice(FreightTemplateEnum.valueOf(freightTemplateChildDTO.getPricingMethod()), count, countFreight, currentCartSkus);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -7,6 +7,8 @@ import cn.lili.modules.order.cart.entity.vo.TradeParams;
|
||||
import cn.lili.modules.order.order.entity.dos.Trade;
|
||||
import cn.lili.modules.order.order.entity.vo.ReceiptVO;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* 购物车业务层
|
||||
*
|
||||
@@ -111,6 +113,14 @@ public interface CartService {
|
||||
*/
|
||||
void shippingAddress(String shippingAddressId, String way);
|
||||
|
||||
/**
|
||||
* 选择自提地址
|
||||
*
|
||||
* @param shopAddressId 收货地址id
|
||||
* @param way 购物车类型
|
||||
*/
|
||||
void shippingSelfAddress(String shopAddressId, String way);
|
||||
|
||||
/**
|
||||
* 选择发票
|
||||
*
|
||||
@@ -123,11 +133,10 @@ public interface CartService {
|
||||
/**
|
||||
* 选择配送方式
|
||||
*
|
||||
* @param storeId 店铺id
|
||||
* @param deliveryMethod 配送方式
|
||||
* @param way 购物车类型
|
||||
*/
|
||||
void shippingMethod(String storeId, String deliveryMethod, String way);
|
||||
void shippingMethod(String deliveryMethod, String way);
|
||||
|
||||
/**
|
||||
* 获取购物车商品数量
|
||||
@@ -160,4 +169,11 @@ public interface CartService {
|
||||
* @return 交易信息
|
||||
*/
|
||||
Trade createTrade(TradeParams tradeParams);
|
||||
|
||||
/***
|
||||
* 获取可使用的配送方式
|
||||
* @param way
|
||||
* @return
|
||||
*/
|
||||
List<String> shippingMethodList(String way);
|
||||
}
|
||||
|
||||
@@ -46,6 +46,10 @@ import cn.lili.modules.promotion.service.PointsGoodsService;
|
||||
import cn.lili.modules.promotion.service.PromotionGoodsService;
|
||||
import cn.lili.modules.search.entity.dos.EsGoodsIndex;
|
||||
import cn.lili.modules.search.service.EsGoodsSearchService;
|
||||
import cn.lili.modules.store.entity.dos.Store;
|
||||
import cn.lili.modules.store.entity.dos.StoreAddress;
|
||||
import cn.lili.modules.store.service.StoreAddressService;
|
||||
import cn.lili.modules.store.service.StoreService;
|
||||
import lombok.extern.slf4j.Slf4j;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.stereotype.Service;
|
||||
@@ -116,6 +120,12 @@ public class CartServiceImpl implements CartService {
|
||||
@Autowired
|
||||
private WholesaleService wholesaleService;
|
||||
|
||||
@Autowired
|
||||
private StoreService storeService;
|
||||
|
||||
@Autowired
|
||||
private StoreAddressService storeAddressService;
|
||||
|
||||
@Override
|
||||
public void add(String skuId, Integer num, String cartType, Boolean cover) {
|
||||
AuthUser currentUser = Objects.requireNonNull(UserContext.getCurrentUser());
|
||||
@@ -438,6 +448,20 @@ public class CartServiceImpl implements CartService {
|
||||
this.resetTradeDTO(tradeDTO);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void shippingSelfAddress(String shopAddressId, String way) {
|
||||
//默认购物车
|
||||
CartTypeEnum cartTypeEnum = CartTypeEnum.CART;
|
||||
if (CharSequenceUtil.isNotEmpty(way)) {
|
||||
cartTypeEnum = CartTypeEnum.valueOf(way);
|
||||
}
|
||||
|
||||
TradeDTO tradeDTO = this.readDTO(cartTypeEnum);
|
||||
StoreAddress storeAddress = storeAddressService.getById(shopAddressId);
|
||||
tradeDTO.setStoreAddress(storeAddress);
|
||||
this.resetTradeDTO(tradeDTO);
|
||||
}
|
||||
|
||||
/**
|
||||
* 选择发票
|
||||
*
|
||||
@@ -459,23 +483,21 @@ public class CartServiceImpl implements CartService {
|
||||
/**
|
||||
* 选择配送方式
|
||||
*
|
||||
* @param storeId 店铺id
|
||||
* @param deliveryMethod 配送方式
|
||||
* @param way 购物车类型
|
||||
*/
|
||||
@Override
|
||||
public void shippingMethod(String storeId, String deliveryMethod, String way) {
|
||||
public void shippingMethod(String deliveryMethod, String way) {
|
||||
CartTypeEnum cartTypeEnum = CartTypeEnum.CART;
|
||||
if (CharSequenceUtil.isNotEmpty(way)) {
|
||||
cartTypeEnum = CartTypeEnum.valueOf(way);
|
||||
}
|
||||
TradeDTO tradeDTO = this.readDTO(cartTypeEnum);
|
||||
TradeDTO tradeDTO = this.getCheckedTradeDTO(cartTypeEnum);
|
||||
for (CartVO cartVO : tradeDTO.getCartList()) {
|
||||
if (cartVO.getStoreId().equals(storeId)) {
|
||||
cartVO.setDeliveryMethod(DeliveryMethodEnum.valueOf(deliveryMethod).name());
|
||||
}
|
||||
cartVO.setDeliveryMethod(DeliveryMethodEnum.valueOf(deliveryMethod).name());
|
||||
}
|
||||
this.resetTradeDTO(tradeDTO);
|
||||
TradeDTO neTradeDTO = (TradeDTO) cache.get(this.getOriginKey(cartTypeEnum));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -547,8 +569,10 @@ public class CartServiceImpl implements CartService {
|
||||
tradeDTO.setStoreRemark(tradeParams.getRemark());
|
||||
tradeDTO.setParentOrderSn(tradeParams.getParentOrderSn());
|
||||
//订单无收货地址校验
|
||||
if (tradeDTO.getMemberAddress() == null) {
|
||||
throw new ServiceException(ResultCode.MEMBER_ADDRESS_NOT_EXIST);
|
||||
if(tradeDTO.getStoreAddress() == null){
|
||||
if (tradeDTO.getMemberAddress() == null) {
|
||||
throw new ServiceException(ResultCode.MEMBER_ADDRESS_NOT_EXIST);
|
||||
}
|
||||
}
|
||||
//构建交易
|
||||
Trade trade = tradeBuilder.createTrade(tradeDTO);
|
||||
@@ -556,6 +580,22 @@ public class CartServiceImpl implements CartService {
|
||||
return trade;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<String> shippingMethodList(String way) {
|
||||
List<String> list = new ArrayList<String>();
|
||||
list.add(DeliveryMethodEnum.LOGISTICS.name());
|
||||
TradeDTO tradeDTO = this.getCheckedTradeDTO(CartTypeEnum.valueOf(way));
|
||||
if(tradeDTO.getCartList().size()==1){
|
||||
for (CartVO cartVO : tradeDTO.getCartList()) {
|
||||
Store store = storeService.getById(cartVO.getStoreId());
|
||||
if(store.getSelfPickFlag() != null && store.getSelfPickFlag()){
|
||||
list.add(DeliveryMethodEnum.SELF_PICK_UP.name());
|
||||
}
|
||||
}
|
||||
}
|
||||
return list;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取购物车类型
|
||||
|
||||
@@ -210,6 +210,15 @@ public class Order extends BaseEntity {
|
||||
@ApiModelProperty(value = "qrCode 实物为提货码 虚拟货物为账号")
|
||||
private String qrCode;
|
||||
|
||||
@ApiModelProperty(value = "自提点地址")
|
||||
private String storeAddressPath;
|
||||
|
||||
@ApiModelProperty(value = "自提点电话")
|
||||
private String storeAddressMobile;
|
||||
|
||||
@ApiModelProperty(value = "自提点地址经纬度")
|
||||
private String storeAddressCenter;
|
||||
|
||||
/**
|
||||
* 构建订单
|
||||
*
|
||||
@@ -233,11 +242,19 @@ public class Order extends BaseEntity {
|
||||
this.setRemark(cartVO.getRemark());
|
||||
this.setFreightPrice(tradeDTO.getPriceDetailDTO().getFreightPrice());
|
||||
//会员收件信息
|
||||
this.setConsigneeAddressIdPath(tradeDTO.getMemberAddress().getConsigneeAddressIdPath());
|
||||
this.setConsigneeAddressPath(tradeDTO.getMemberAddress().getConsigneeAddressPath());
|
||||
this.setConsigneeDetail(tradeDTO.getMemberAddress().getDetail());
|
||||
this.setConsigneeMobile(tradeDTO.getMemberAddress().getMobile());
|
||||
this.setConsigneeName(tradeDTO.getMemberAddress().getName());
|
||||
if(DeliveryMethodEnum.LOGISTICS.name().equals(cartVO.getDeliveryMethod())){
|
||||
this.setConsigneeAddressIdPath(tradeDTO.getMemberAddress().getConsigneeAddressIdPath());
|
||||
this.setConsigneeAddressPath(tradeDTO.getMemberAddress().getConsigneeAddressPath());
|
||||
this.setConsigneeDetail(tradeDTO.getMemberAddress().getDetail());
|
||||
this.setConsigneeMobile(tradeDTO.getMemberAddress().getMobile());
|
||||
this.setConsigneeName(tradeDTO.getMemberAddress().getName());
|
||||
}
|
||||
//自提点信息
|
||||
if(DeliveryMethodEnum.SELF_PICK_UP.name().equals(cartVO.getDeliveryMethod())){
|
||||
this.setStoreAddressPath(tradeDTO.getStoreAddress().getAddress());
|
||||
this.setStoreAddressMobile(tradeDTO.getStoreAddress().getMobile());
|
||||
this.setStoreAddressCenter(tradeDTO.getStoreAddress().getCenter());
|
||||
}
|
||||
//平台优惠券判定
|
||||
if (tradeDTO.getPlatformCoupon() != null) {
|
||||
this.setUsePlatformMemberCouponId(tradeDTO.getPlatformCoupon().getMemberCoupon().getId());
|
||||
|
||||
@@ -16,6 +16,7 @@ public enum OrderStatusEnum {
|
||||
UNDELIVERED("待发货"),
|
||||
DELIVERED("已发货"),
|
||||
COMPLETED("已完成"),
|
||||
STAY_PICKED_UP("待自提"),
|
||||
/**
|
||||
* 虚拟订单需要核验商品
|
||||
*/
|
||||
|
||||
@@ -63,7 +63,7 @@ public class AllowOperation implements Serializable {
|
||||
}
|
||||
|
||||
//新订单
|
||||
if (CharSequenceUtil.equalsAny(status, OrderStatusEnum.UNPAID.name(), OrderStatusEnum.PAID.name(), OrderStatusEnum.UNDELIVERED.name())) {
|
||||
if (CharSequenceUtil.equalsAny(status, OrderStatusEnum.UNPAID.name(), OrderStatusEnum.PAID.name(), OrderStatusEnum.UNDELIVERED.name(), OrderStatusEnum.STAY_PICKED_UP.name())) {
|
||||
this.cancel = true;
|
||||
}
|
||||
//新订单,允许支付
|
||||
|
||||
@@ -183,6 +183,15 @@ public interface OrderService extends IService<Order> {
|
||||
*/
|
||||
Order take(String orderSn, String verificationCode);
|
||||
|
||||
|
||||
/**
|
||||
* 订单核验
|
||||
*
|
||||
* @param verificationCode 验证码
|
||||
* @return 订单
|
||||
*/
|
||||
Order take(String verificationCode);
|
||||
|
||||
/**
|
||||
* 根据核验码获取订单信息
|
||||
*
|
||||
|
||||
@@ -16,10 +16,12 @@ import cn.lili.common.properties.RocketmqCustomProperties;
|
||||
import cn.lili.common.security.OperationalJudgment;
|
||||
import cn.lili.common.security.context.UserContext;
|
||||
import cn.lili.common.security.enums.UserEnums;
|
||||
import cn.lili.common.utils.ObjectUtil;
|
||||
import cn.lili.common.utils.SnowFlake;
|
||||
import cn.lili.modules.goods.entity.dto.GoodsCompleteMessage;
|
||||
import cn.lili.modules.member.entity.dto.MemberAddressDTO;
|
||||
import cn.lili.modules.order.cart.entity.dto.TradeDTO;
|
||||
import cn.lili.modules.order.cart.entity.enums.DeliveryMethodEnum;
|
||||
import cn.lili.modules.order.order.aop.OrderLogPoint;
|
||||
import cn.lili.modules.order.order.entity.dos.*;
|
||||
import cn.lili.modules.order.order.entity.dto.OrderBatchDeliverDTO;
|
||||
@@ -290,12 +292,13 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
Order order = OperationalJudgment.judgment(this.getBySn(orderSn));
|
||||
//如果订单促销类型不为空&&订单是拼团订单,并且订单未成团,则抛出异常
|
||||
if (OrderPromotionTypeEnum.PINTUAN.name().equals(order.getOrderPromotionType())
|
||||
&& !order.getOrderStatus().equals(OrderStatusEnum.UNDELIVERED.name())) {
|
||||
&& !CharSequenceUtil.equalsAny(order.getOrderStatus(),OrderStatusEnum.UNDELIVERED.name(),OrderStatusEnum.STAY_PICKED_UP.name())) {
|
||||
throw new ServiceException(ResultCode.ORDER_CAN_NOT_CANCEL);
|
||||
}
|
||||
if (CharSequenceUtil.equalsAny(order.getOrderStatus(),
|
||||
OrderStatusEnum.UNDELIVERED.name(),
|
||||
OrderStatusEnum.UNPAID.name(),
|
||||
OrderStatusEnum.STAY_PICKED_UP.name(),
|
||||
OrderStatusEnum.PAID.name())) {
|
||||
|
||||
order.setOrderStatus(OrderStatusEnum.CANCELLED.name());
|
||||
@@ -472,11 +475,24 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
return order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order take(String verificationCode) {
|
||||
String storeId = OperationalJudgment.judgment(UserContext.getCurrentUser()).getStoreId();
|
||||
Order order = this.getOne(new LambdaQueryWrapper<Order>().eq(Order::getVerificationCode, verificationCode).eq(Order::getStoreId, storeId));
|
||||
if(order == null){
|
||||
throw new ServiceException(ResultCode.ORDER_NOT_EXIST);
|
||||
}
|
||||
order.setOrderStatus(OrderStatusEnum.COMPLETED.name());
|
||||
//订单完成
|
||||
this.complete(order.getSn());
|
||||
return order;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Order getOrderByVerificationCode(String verificationCode) {
|
||||
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
|
||||
return this.getOne(new LambdaQueryWrapper<Order>()
|
||||
.eq(Order::getOrderStatus, OrderStatusEnum.TAKE.name())
|
||||
.in(Order::getOrderStatus, OrderStatusEnum.TAKE.name(),OrderStatusEnum.STAY_PICKED_UP.name())
|
||||
.eq(Order::getStoreId, storeId)
|
||||
.eq(Order::getVerificationCode, verificationCode));
|
||||
}
|
||||
@@ -938,13 +954,20 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
|
||||
*/
|
||||
@Transactional(rollbackFor = Exception.class)
|
||||
public void normalOrderConfirm(String orderSn) {
|
||||
OrderStatusEnum orderStatusEnum = null;
|
||||
Order order = this.getBySn(orderSn);
|
||||
if(DeliveryMethodEnum.SELF_PICK_UP.name().equals(order.getDeliveryMethod())){
|
||||
orderStatusEnum = OrderStatusEnum.STAY_PICKED_UP;
|
||||
}else if (DeliveryMethodEnum.LOGISTICS.name().equals(order.getDeliveryMethod())){
|
||||
orderStatusEnum = OrderStatusEnum.UNDELIVERED;
|
||||
}
|
||||
//修改订单
|
||||
this.update(new LambdaUpdateWrapper<Order>()
|
||||
.eq(Order::getSn, orderSn)
|
||||
.set(Order::getOrderStatus, OrderStatusEnum.UNDELIVERED.name()));
|
||||
.set(Order::getOrderStatus, orderStatusEnum.name()));
|
||||
//修改订单
|
||||
OrderMessage orderMessage = new OrderMessage();
|
||||
orderMessage.setNewStatus(OrderStatusEnum.UNDELIVERED);
|
||||
orderMessage.setNewStatus(orderStatusEnum);
|
||||
orderMessage.setOrderSn(orderSn);
|
||||
this.sendUpdateStatusMessage(orderMessage);
|
||||
}
|
||||
|
||||
File diff suppressed because one or more lines are too long
@@ -47,5 +47,8 @@ public class StoreIndexStatisticsVO {
|
||||
@ApiModelProperty(value = "未对账结算单数量")
|
||||
private Long waitPayBill;
|
||||
|
||||
@ApiModelProperty(value = "待自提数量")
|
||||
private Long selfPickNum;
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -200,7 +200,8 @@ public class IndexStatisticsServiceImpl implements IndexStatisticsService {
|
||||
storeIndexStatisticsVO.setUnDeliveredOrder(orderStatisticsService.orderNum(OrderStatusEnum.UNDELIVERED.name()));
|
||||
//待收货订单数量
|
||||
storeIndexStatisticsVO.setDeliveredOrder(orderStatisticsService.orderNum(OrderStatusEnum.DELIVERED.name()));
|
||||
|
||||
//待自提数量
|
||||
storeIndexStatisticsVO.setSelfPickNum(orderStatisticsService.orderNum(OrderStatusEnum.STAY_PICKED_UP.name()));
|
||||
//待处理退货数量
|
||||
storeIndexStatisticsVO.setReturnGoods(afterSaleStatisticsService.applyNum(AfterSaleTypeEnum.RETURN_GOODS.name()));
|
||||
//待处理退款数量
|
||||
|
||||
@@ -103,6 +103,9 @@ public class Store extends BaseEntity {
|
||||
@ApiModelProperty(value = "默认页面是否开启")
|
||||
private Boolean pageShow;
|
||||
|
||||
@ApiModelProperty(value = "是否开启自提")
|
||||
private Boolean selfPickFlag;
|
||||
|
||||
public Store(Member member) {
|
||||
this.memberId = member.getId();
|
||||
this.memberName = member.getUsername();
|
||||
|
||||
@@ -36,4 +36,7 @@ public class StoreSettingDTO {
|
||||
@ApiModelProperty(value = "默认页面是否开启")
|
||||
private Boolean pageShow;
|
||||
|
||||
@ApiModelProperty(value = "是否开启自提")
|
||||
private Boolean selfPickFlag;
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user