fix: Merging dev

This commit is contained in:
lele0521 2024-01-16 11:29:03 +08:00
commit 7f9061cfc5
25 changed files with 625 additions and 21 deletions

View File

@ -21,4 +21,49 @@ CREATE TABLE `li_file_directory`
SET FOREIGN_KEY_CHECKS = 1;
ALTER TABLE li_file
ADD file_directory_id varchar(255) COMMENT '文件夹ID';
ADD file_directory_id varchar(255) COMMENT '文件夹ID';
/**
*/
CREATE TABLE `li_order_package` (
`id` bigint NOT NULL COMMENT 'ID',
`create_by` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '创建者',
`create_time` datetime(6) DEFAULT NULL COMMENT '创建时间',
`delete_flag` bit(1) DEFAULT NULL COMMENT '是否删除',
`update_by` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改者',
`update_time` datetime(6) DEFAULT NULL COMMENT '修改时间',
`package_no` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '包裹单号',
`order_sn` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '订单编号',
`logistics_no` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '发货单号',
`logistics_code` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '物流公司CODE',
`logistics_name` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '物流公司名称',
`consignee_mobile` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '收件人手机',
`status` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '状态',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC;
/**
*/
CREATE TABLE `li_order_package_item` (
`id` bigint NOT NULL COMMENT 'ID',
`create_by` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '创建者',
`create_time` datetime(6) DEFAULT NULL COMMENT '创建时间',
`delete_flag` bit(1) DEFAULT NULL COMMENT '是否删除',
`update_by` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '修改者',
`update_time` datetime(6) DEFAULT NULL COMMENT '修改时间',
`package_no` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '包裹单号',
`order_sn` varchar(255) CHARACTER SET utf8mb3 COLLATE utf8mb3_bin DEFAULT NULL COMMENT '订单编号',
`order_item_sn` varchar(255) COLLATE utf8mb3_bin DEFAULT NULL COMMENT '子订单编号',
`deliver_number` int DEFAULT NULL COMMENT '发货数量',
`logistics_time` datetime(6) DEFAULT NULL COMMENT '发货时间',
`goods_name` varchar(255) COLLATE utf8mb3_bin DEFAULT NULL,
`thumbnail` varchar(255) COLLATE utf8mb3_bin DEFAULT NULL,
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB DEFAULT CHARSET=utf8mb3 COLLATE=utf8mb3_bin ROW_FORMAT=DYNAMIC;
ALTER TABLE li_order_item ADD `deliver_number` int DEFAULT NULL COMMENT '发货数量';
ALTER TABLE li_goods_sku ADD `alert_quantity` int DEFAULT NULL COMMENT '预警库存';

View File

@ -9,11 +9,14 @@ import cn.lili.common.security.OperationalJudgment;
import cn.lili.common.security.context.UserContext;
import cn.lili.common.vo.ResultMessage;
import cn.lili.modules.order.order.entity.dos.Order;
import cn.lili.modules.order.order.entity.dos.OrderPackage;
import cn.lili.modules.order.order.entity.dto.OrderSearchParams;
import cn.lili.modules.order.order.entity.enums.OrderStatusEnum;
import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import cn.lili.modules.order.order.service.OrderPackageService;
import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.system.entity.vo.Traces;
import com.baomidou.mybatisplus.core.metadata.IPage;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiImplicitParam;
@ -44,6 +47,9 @@ public class OrderBuyerController {
@Autowired
private OrderService orderService;
@Autowired
private OrderPackageService orderPackageService;
@ApiOperation(value = "查询会员订单列表")
@GetMapping
public ResultMessage<IPage<OrderSimpleVO>> queryMineOrder(OrderSearchParams orderSearchParams) {
@ -138,4 +144,21 @@ public class OrderBuyerController {
return ResultUtil.data(orderService.invoice(orderSn));
}
@ApiOperation(value = "查询物流踪迹")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
})
@GetMapping(value = "/getTracesList/{orderSn}")
public ResultMessage<Object> getTracesList(@NotBlank(message = "订单编号不能为空") @PathVariable String orderSn) {
return ResultUtil.data(orderPackageService.getOrderPackageVOList(orderSn));
}
@ApiOperation(value = "查看包裹列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
})
@GetMapping(value = "/getPackage/{orderSn}")
public ResultMessage<Object> getPackage(@NotBlank(message = "订单编号不能为空") @PathVariable String orderSn) {
return ResultUtil.data(orderPackageService.getOrderPackageVOList(orderSn));
}
}

View File

@ -24,12 +24,12 @@ spring:
boot:
admin:
client:
url: http://192.168.0.108:8000
url: http://127.0.0.1:8000
cache:
type: redis
# Redis
redis:
host: 192.168.31.108
host: 192.168.31.100
port: 30379
password: lilishop
lettuce:
@ -60,7 +60,7 @@ spring:
default-datasource:
type: com.alibaba.druid.pool.DruidDataSource
driverClassName: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://192.168.31.108:30306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
url: jdbc:mysql://192.168.31.100:30306/lilishop?useUnicode=true&characterEncoding=utf-8&useSSL=false&rewriteBatchedStatements=true&allowPublicKeyRetrieval=true&serverTimezone=Asia/Shanghai
username: root
password: lilishop
maxActive: 50
@ -241,16 +241,16 @@ lili:
sk: zhNKVrJK6UPOhqIjn8AQvG37b9sz6
#域名
domain:
pc: http://192.168.0.108:8888
wap: http://192.168.0.108:8888
seller: http://192.168.0.108:8888
admin: http://192.168.0.108:8888
pc: http://127.0.0.1:8888
wap: http://127.0.0.1:8888
seller: http://127.0.0.1:8888
admin: http://127.0.0.1:8888
#api地址
api:
buyer: https://z171l91606.51mypc.cn
base: http://192.168.0.108:8888
manager: http://192.168.0.108:8888
seller: http://192.168.0.108:8888
base: http://127.0.0.1:8888
manager: http://127.0.0.1:8888
seller: http://127.0.0.1:8888
# jwt 细节设定
jwt-setting:
@ -269,7 +269,7 @@ lili:
data:
elasticsearch:
cluster-name: elasticsearch
cluster-nodes: 192.168.31.108:30920
cluster-nodes: 192.168.31.100:30920
index:
number-of-replicas: 0
number-of-shards: 3
@ -280,7 +280,7 @@ lili:
# password: LiLiShopES
logstash:
server: 127.0.0.1:4560
server: 192.168.31.100:30560
rocketmq:
promotion-topic: shop_lili_promotion_topic
promotion-group: shop_lili_promotion_group
@ -301,7 +301,7 @@ lili:
after-sale-topic: shop_lili_after_sale_topic
after-sale-group: shop_lili_after_sale_group
rocketmq:
name-server: 192.168.31.108:30876
name-server: 192.168.31.100:30876
isVIPChannel: false
producer:
group: lili_group
@ -310,7 +310,7 @@ rocketmq:
xxl:
job:
admin:
addresses: http://192.168.31.108:30001/xxl-job-admin
addresses: http://192.168.31.100:30001/xxl-job-admin
executor:
appname: xxl-job-executor-lilishop
address:

View File

@ -205,6 +205,7 @@ public enum ResultCode {
POINT_NOT_ENOUGH(31015, "当前会员积分不足购买当前积分商品!"),
ORDER_LABEL_ORDER_ERROR(31016, "订单不能打印电子面单"),
ORDER_PRICE_ERROR(31017,"订单金额不能小于等于0"),
ORDER_PACKAGE_NOT_EXIST(31017, "当前订单包裹不存在!"),
/**

View File

@ -7,6 +7,7 @@ import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import io.swagger.models.auth.In;
import lombok.Data;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;

View File

@ -536,6 +536,7 @@ public class GoodsSkuServiceImpl extends ServiceImpl<GoodsSkuMapper, GoodsSku> i
}
}
@Override
@Transactional(rollbackFor = Exception.class)
public void updateStock(String skuId, Integer quantity) {

View File

@ -125,6 +125,16 @@ public class OrderItem extends BaseEntity {
@ApiModelProperty(value = "退款金额")
private Double refundPrice;
@ApiModelProperty(value = "已发货数量")
private Integer deliverNumber;
public Integer getDeliverNumber() {
if(deliverNumber == null){
return 0;
}
return deliverNumber;
}
public OrderItem(CartSkuVO cartSkuVO, CartVO cartVO, TradeDTO tradeDTO) {
String oldId = this.getId();
BeanUtil.copyProperties(cartSkuVO.getGoodsSku(), this);

View File

@ -0,0 +1,39 @@
package cn.lili.modules.order.order.entity.dos;
import cn.lili.mybatis.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
@Data
@TableName("li_order_package")
@ApiModel(value = "订单包裹")
@NoArgsConstructor
@AllArgsConstructor
public class OrderPackage extends BaseEntity {
@ApiModelProperty(value = "包裹单号")
private String packageNo;
@ApiModelProperty(value = "订单编号")
private String orderSn;
@ApiModelProperty(value = "发货单号")
private String logisticsNo;
@ApiModelProperty(value = "物流公司CODE")
private String logisticsCode;
@ApiModelProperty(value = "物流公司名称")
private String logisticsName;
@ApiModelProperty(value = "收件人手机")
private String consigneeMobile;
@ApiModelProperty(value = "状态")
private String status;
}

View File

@ -0,0 +1,47 @@
package cn.lili.modules.order.order.entity.dos;
import cn.lili.mybatis.BaseEntity;
import com.baomidou.mybatisplus.annotation.TableName;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.Date;
/**
* @author chc
* @since 2022/6/2114:46
*/
@Data
@TableName("li_order_package_item")
@ApiModel(value = "订单分包裹详情")
@NoArgsConstructor
@AllArgsConstructor
public class OrderPackageItem extends BaseEntity {
@ApiModelProperty(value = "包裹单号")
private String packageNo;
@ApiModelProperty(value = "订单编号")
private String orderSn;
@ApiModelProperty(value = "子订单编号")
private String orderItemSn;
@ApiModelProperty(value = "商品名称")
private String goodsName;
@ApiModelProperty(value = "商品图片")
private String thumbnail;
@ApiModelProperty(value = "已发货数量")
private Integer deliverNumber;
@ApiModelProperty(value = "送货时间")
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
private Date logisticsTime;
}

View File

@ -0,0 +1,19 @@
package cn.lili.modules.order.order.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
/**
* 部分发货
*/
@Data
public class PartDeliveryDTO {
@ApiModelProperty(value = "订单货物Id")
private String orderItemId;
@ApiModelProperty(value = "发货数量")
private Integer deliveryNum;
}

View File

@ -0,0 +1,30 @@
package cn.lili.modules.order.order.entity.dto;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import java.util.List;
/**
* 部分发货参数封装
*
* @author liushuai(liushuai711 @ gmail.com)
* @version v4.0
* @Description:
* @since 2022/10/29 17:52
*/
@Data
public class PartDeliveryParamsDTO {
@ApiModelProperty(value = "订单号")
private String orderSn;
@ApiModelProperty(value = "发货单号")
private String logisticsNo;
@ApiModelProperty(value = "发货方式")
private String logisticsId;
@ApiModelProperty(value = "物流详细")
private List<PartDeliveryDTO> partDeliveryDTOList;
}

View File

@ -0,0 +1,65 @@
package cn.lili.modules.order.order.entity.vo;
import cn.lili.common.utils.BeanUtil;
import cn.lili.modules.order.order.entity.dos.OrderPackage;
import cn.lili.modules.order.order.entity.dos.OrderPackageItem;
import cn.lili.modules.system.entity.vo.Traces;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.springframework.format.annotation.DateTimeFormat;
import java.io.Serializable;
import java.util.Date;
import java.util.List;
/**
* 分包裹详情VO
*
* @author Chopper
* @since 2020-08-17 20:28
*/
@Data
@NoArgsConstructor
public class OrderPackageVO implements Serializable {
private static final long serialVersionUID = 1810890757303309436L;
@ApiModelProperty(value = "包裹单号")
private String packageNo;
@ApiModelProperty(value = "订单编号")
private String orderSn;
@ApiModelProperty(value = "发货单号")
private String logisticsNo;
@ApiModelProperty(value = "物流公司CODE")
private String logisticsCode;
@ApiModelProperty(value = "物流公司名称")
private String logisticsName;
@ApiModelProperty(value = "收件人手机")
private String consigneeMobile;
@ApiModelProperty(value = "状态")
private String status;
@JsonFormat(timezone = "GMT+8", pattern = "yyyy-MM-dd HH:mm:ss")
@DateTimeFormat(pattern = "yyyy-MM-dd HH:mm:ss")
@ApiModelProperty(value = "创建时间")
private Date createTime;
@ApiModelProperty(value = "子订单包裹详情列表")
private List<OrderPackageItem> orderPackageItemList;
@ApiModelProperty(value = "物流信息")
private Traces traces;
public OrderPackageVO(OrderPackage orderPackage) {
BeanUtil.copyProperties(orderPackage, this);
}
}

View File

@ -0,0 +1,14 @@
package cn.lili.modules.order.order.mapper;
import cn.lili.modules.order.order.entity.dos.OrderPackageItem;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 子订单包裹数据处理层
*
* @author Bulbasaur
* @since 2020/11/17 7:34 下午
*/
public interface OrderPackageItemMapper extends BaseMapper<OrderPackageItem> {
}

View File

@ -0,0 +1,14 @@
package cn.lili.modules.order.order.mapper;
import cn.lili.modules.order.order.entity.dos.OrderPackage;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
/**
* 订单包裹数据处理层
*
* @author Bulbasaur
* @since 2020/11/17 7:34 下午
*/
public interface OrderPackageMapper extends BaseMapper<OrderPackage> {
}

View File

@ -0,0 +1,31 @@
package cn.lili.modules.order.order.service;
import cn.lili.modules.order.order.entity.dos.OrderPackageItem;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 子订单业务层
*
* @author Chopper
* @since 2020/11/17 7:36 下午
*/
public interface OrderPackageItemService extends IService<OrderPackageItem> {
/**
* 根据订单编号获取订单包裹列表
* @param orderSn 订单编号
* @return 子订单包裹列表
*/
List<OrderPackageItem> getOrderPackageItemListByOrderSn(String orderSn);
/**
* 根据包裹编号获取子包裹列表
* @param packageNo 包裹编号
* @return 子包裹列表
*/
List<OrderPackageItem> getOrderPackageItemListByPno(String packageNo);
}

View File

@ -0,0 +1,31 @@
package cn.lili.modules.order.order.service;
import cn.lili.modules.order.order.entity.dos.OrderPackage;
import cn.lili.modules.order.order.entity.vo.OrderPackageVO;
import com.baomidou.mybatisplus.extension.service.IService;
import java.util.List;
/**
* 子订单业务层
*
* @author Chopper
* @since 2020/11/17 7:36 下午
*/
public interface OrderPackageService extends IService<OrderPackage> {
/**
* 根据订单编号获取订单包裹列表
* @param orderSn
* @return
*/
List<OrderPackage> orderPackageList(String orderSn);
/**
* 获取指定订单编号的所有包裹
* @param orderSn
* @return
*/
List<OrderPackageVO> getOrderPackageVOList(String orderSn);
}

View File

@ -6,6 +6,7 @@ import cn.lili.modules.order.order.entity.dos.Order;
import cn.lili.modules.order.order.entity.dto.OrderExportDTO;
import cn.lili.modules.order.order.entity.dto.OrderMessage;
import cn.lili.modules.order.order.entity.dto.OrderSearchParams;
import cn.lili.modules.order.order.entity.dto.PartDeliveryParamsDTO;
import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import cn.lili.modules.order.order.entity.vo.PaymentLog;
@ -311,4 +312,12 @@ public interface OrderService extends IService<Order> {
*/
boolean checkFictitiousOrder(String pintuanId, Integer requiredNum, Boolean fictitious);
/**
* 订单部分发货
*
* @param partDeliveryParamsDTO 参数
* @return 订单
*/
Order partDelivery(PartDeliveryParamsDTO partDeliveryParamsDTO);
}

View File

@ -0,0 +1,43 @@
package cn.lili.modules.order.order.serviceimpl;
import cn.lili.modules.order.order.entity.dos.OrderPackageItem;
import cn.lili.modules.order.order.mapper.OrderPackageItemMapper;
import cn.lili.modules.order.order.service.OrderPackageItemService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.List;
/**
* 订单包裹业务层实现
*
* @author Chopper
* @since 2020/11/17 7:38 下午
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class OrderPackageItemServiceImpl extends ServiceImpl<OrderPackageItemMapper, OrderPackageItem> implements OrderPackageItemService {
/**
* 根据订单编号获取订单包裹列表
* @param orderSn 订单编号
* @return 子订单包裹列表
*/
@Override
public List<OrderPackageItem> getOrderPackageItemListByOrderSn(String orderSn) {
return this.list(new LambdaQueryWrapper<OrderPackageItem>().eq(OrderPackageItem::getOrderSn, orderSn));
}
/**
* 根据包裹编号获取子包裹列表
* @param packageNo 包裹编号
* @return 子包裹列表
*/
@Override
public List<OrderPackageItem> getOrderPackageItemListByPno(String packageNo) {
return this.list(new LambdaQueryWrapper<OrderPackageItem>().eq(OrderPackageItem::getPackageNo, packageNo));
}
}

View File

@ -0,0 +1,64 @@
package cn.lili.modules.order.order.serviceimpl;
import cn.lili.common.enums.ResultCode;
import cn.lili.common.exception.ServiceException;
import cn.lili.modules.order.order.entity.dos.OrderPackage;
import cn.lili.modules.order.order.entity.dos.OrderPackageItem;
import cn.lili.modules.order.order.entity.vo.OrderPackageVO;
import cn.lili.modules.order.order.mapper.OrderPackageMapper;
import cn.lili.modules.order.order.service.OrderPackageItemService;
import cn.lili.modules.order.order.service.OrderPackageService;
import cn.lili.modules.system.entity.vo.Traces;
import cn.lili.modules.system.service.LogisticsService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import java.util.ArrayList;
import java.util.List;
/**
* 订单包裹业务层实现
*
* @author Chopper
* @since 2020/11/17 7:38 下午
*/
@Service
@Transactional(rollbackFor = Exception.class)
public class OrderPackageServiceImpl extends ServiceImpl<OrderPackageMapper, OrderPackage> implements OrderPackageService {
@Autowired
private OrderPackageItemService orderpackageItemService;
@Autowired
private LogisticsService logisticsService;
@Override
public List<OrderPackage> orderPackageList(String orderSn) {
return this.list(new LambdaQueryWrapper<OrderPackage>().eq(OrderPackage::getOrderSn, orderSn));
}
@Override
public List<OrderPackageVO> getOrderPackageVOList(String orderSn) {
List<OrderPackage> orderPackages = this.orderPackageList(orderSn);
if (orderPackages == null){
throw new ServiceException(ResultCode.ORDER_PACKAGE_NOT_EXIST);
}
List<OrderPackageVO> orderPackageVOS = new ArrayList<>();
orderPackages.forEach(orderPackage -> {
OrderPackageVO orderPackageVO = new OrderPackageVO(orderPackage);
// 获取子订单包裹详情
List<OrderPackageItem> orderPackageItemList = orderpackageItemService.getOrderPackageItemListByPno(orderPackage.getPackageNo());
orderPackageVO.setOrderPackageItemList(orderPackageItemList);
String str = orderPackage.getConsigneeMobile();
str = str.substring(str.length() - 4);
// Traces traces = logisticsService.getLogisticTrack(orderPackage.getLogisticsCode(), orderPackage.getLogisticsNo(), str);
// orderPackageVO.setTraces(traces);
orderPackageVOS.add(orderPackageVO);
});
return orderPackageVOS;
}
}

View File

@ -23,10 +23,7 @@ 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;
import cn.lili.modules.order.order.entity.dto.OrderExportDTO;
import cn.lili.modules.order.order.entity.dto.OrderMessage;
import cn.lili.modules.order.order.entity.dto.OrderSearchParams;
import cn.lili.modules.order.order.entity.dto.*;
import cn.lili.modules.order.order.entity.enums.*;
import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
@ -146,6 +143,17 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
@Autowired
private StoreDetailService storeDetailService;
/**
* 订单包裹
*/
@Autowired
private OrderPackageService orderPackageService;
/**
* 订单包裹货物
*/
@Autowired
private OrderPackageItemService orderPackageItemService;
@Override
@Transactional(rollbackFor = Exception.class)
public void intoDB(TradeDTO tradeDTO) {
@ -790,6 +798,74 @@ public class OrderServiceImpl extends ServiceImpl<OrderMapper, Order> implements
return false;
}
@Override
public Order partDelivery(PartDeliveryParamsDTO partDeliveryParamsDTO) {
String logisticsId = partDeliveryParamsDTO.getLogisticsId();
String orderSn = partDeliveryParamsDTO.getOrderSn();
String invoiceNumber = partDeliveryParamsDTO.getLogisticsNo();
//获取对应物流
Logistics logistics = logisticsService.getById(logisticsId);
if (logistics == null) {
throw new ServiceException(ResultCode.ORDER_LOGISTICS_ERROR);
}
Order order = OperationalJudgment.judgment(this.getBySn(orderSn));
List<OrderItem> orderItemList = orderItemService.getByOrderSn(orderSn);
OrderPackage orderPackage = new OrderPackage();
orderPackage.setPackageNo(SnowFlake.createStr("OP"));
orderPackage.setOrderSn(orderSn);
orderPackage.setLogisticsNo(invoiceNumber);
orderPackage.setLogisticsCode(logistics.getCode());
orderPackage.setLogisticsName(logistics.getName());
orderPackage.setStatus("1");
orderPackage.setConsigneeMobile(order.getConsigneeMobile());
orderPackageService.save(orderPackage);
List<OrderLog> orderLogList = new ArrayList<>();
for (PartDeliveryDTO partDeliveryDTO : partDeliveryParamsDTO.getPartDeliveryDTOList()) {
for (OrderItem orderItem : orderItemList) {
//寻找订单货物进行判断
if (partDeliveryDTO.getOrderItemId().equals(orderItem.getId())) {
if ((partDeliveryDTO.getDeliveryNum() + orderItem.getDeliverNumber()) > orderItem.getNum()) {
throw new ServiceException("发货数量不正确!");
}
orderItem.setDeliverNumber((partDeliveryDTO.getDeliveryNum() + orderItem.getDeliverNumber()));
// 记录分包裹中每个item子单的具体发货信息
OrderPackageItem orderPackageItem = new OrderPackageItem();
orderPackageItem.setOrderSn(orderSn);
orderPackageItem.setPackageNo(orderPackage.getPackageNo());
orderPackageItem.setOrderItemSn(orderItem.getSn());
orderPackageItem.setDeliverNumber(partDeliveryDTO.getDeliveryNum());
orderPackageItem.setLogisticsTime(new Date());
orderPackageItem.setGoodsName(orderItem.getGoodsName());
orderPackageItem.setThumbnail(orderItem.getImage());
orderPackageItemService.save(orderPackageItem);
OrderLog orderLog = new OrderLog(orderSn, UserContext.getCurrentUser().getId(), UserContext.getCurrentUser().getRole().getRole(), UserContext.getCurrentUser().getUsername(), "订单 [ " + orderSn + " ]商品 [ " + orderItem.getGoodsName() + " ]发货,发货数量: [ " + partDeliveryDTO.getDeliveryNum() + " ],发货单号[ " + invoiceNumber + " ]");
orderLogList.add(orderLog);
}
}
}
//修改订单货物
orderItemService.updateBatchById(orderItemList);
orderLogService.saveBatch(orderLogList);
//判断订单货物是否全部发货完毕
Boolean delivery = true;
for (OrderItem orderItem : orderItemList) {
if (orderItem.getDeliverNumber() < orderItem.getNum()) {
delivery = false;
break;
}
}
//是否全部发货
if (delivery) {
return delivery(orderSn, invoiceNumber, logisticsId);
}
return order;
}
/**
* 虚拟成团
*

View File

@ -50,5 +50,8 @@ public class StoreIndexStatisticsVO {
@ApiModelProperty(value = "待自提数量")
private Long selfPickNum;
@ApiModelProperty(value = "警告库存")
private Long alertQuantityNum;
}

View File

@ -21,7 +21,6 @@ public interface GoodsStatisticsService extends IService<Goods> {
* @return 所有的已上架的商品数量
*/
long goodsNum(GoodsStatusEnum goodsStatusEnum, GoodsAuthEnum goodsAuthEnum);
/**
* 获取今天的已上架的商品数量
*

View File

@ -9,11 +9,14 @@ import cn.lili.common.security.enums.UserEnums;
import cn.lili.modules.goods.entity.dos.Goods;
import cn.lili.modules.goods.entity.enums.GoodsAuthEnum;
import cn.lili.modules.goods.entity.enums.GoodsStatusEnum;
import cn.lili.modules.goods.service.GoodsSkuService;
import cn.lili.modules.statistics.mapper.GoodsStatisticsMapper;
import cn.lili.modules.statistics.service.GoodsStatisticsService;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.core.toolkit.Wrappers;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Objects;
@ -27,6 +30,9 @@ import java.util.Objects;
@Service
public class GoodsStatisticsServiceImpl extends ServiceImpl<GoodsStatisticsMapper, Goods> implements GoodsStatisticsService {
@Autowired
private GoodsSkuService goodsSkuService;
@Override
public long goodsNum(GoodsStatusEnum goodsStatusEnum, GoodsAuthEnum goodsAuthEnum) {
LambdaQueryWrapper<Goods> queryWrapper = Wrappers.lambdaQuery();

View File

@ -181,7 +181,6 @@ public class GoodsStoreController {
goodsSkuService.updateStocks(collect);
return ResultUtil.success();
}
@ApiOperation(value = "通过id获取商品信息")
@ApiImplicitParams({
@ApiImplicitParam(name = "goodsId", value = "商品ID", required = true, paramType = "path"),

View File

@ -13,8 +13,10 @@ import cn.lili.modules.member.entity.dto.MemberAddressDTO;
import cn.lili.modules.member.service.StoreLogisticsService;
import cn.lili.modules.order.order.entity.dto.OrderExportDTO;
import cn.lili.modules.order.order.entity.dto.OrderSearchParams;
import cn.lili.modules.order.order.entity.dto.PartDeliveryParamsDTO;
import cn.lili.modules.order.order.entity.vo.OrderDetailVO;
import cn.lili.modules.order.order.entity.vo.OrderSimpleVO;
import cn.lili.modules.order.order.service.OrderPackageService;
import cn.lili.modules.order.order.service.OrderPriceService;
import cn.lili.modules.order.order.service.OrderService;
import cn.lili.modules.system.service.LogisticsService;
@ -70,6 +72,9 @@ public class OrderStoreController {
@Autowired
private LogisticsService logisticsService;
@Autowired
private OrderPackageService orderPackageService;
@ApiOperation(value = "查询订单列表")
@GetMapping
@ -217,4 +222,33 @@ public class OrderStoreController {
@NotNull(message = "请选择物流公司") String logisticsId) {
return ResultUtil.data(logisticsService.labelOrder(orderSn, logisticsId));
}
@ApiOperation(value = "查看包裹列表")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
})
@GetMapping(value = "/getPackage/{orderSn}")
public ResultMessage<Object> getPackage(@NotBlank(message = "订单编号不能为空") @PathVariable String orderSn) {
return ResultUtil.data(orderPackageService.getOrderPackageVOList(orderSn));
}
@ApiOperation(value = "查询物流踪迹")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单编号", required = true, dataType = "String", paramType = "path")
})
@GetMapping(value = "/getTracesList/{orderSn}")
public ResultMessage<Object> getTracesList(@NotBlank(message = "订单编号不能为空") @PathVariable String orderSn) {
return ResultUtil.data(orderPackageService.getOrderPackageVOList(orderSn));
}
@ApiOperation(value = "订单包裹发货")
@ApiImplicitParams({
@ApiImplicitParam(name = "orderSn", value = "订单sn", required = true, dataType = "String", paramType = "path"),
@ApiImplicitParam(name = "logisticsNo", value = "发货单号", required = true, dataType = "String", paramType = "query"),
@ApiImplicitParam(name = "logisticsId", value = "物流公司", required = true, dataType = "String", paramType = "query")
})
@PostMapping(value = "/{orderSn}/partDelivery")
public ResultMessage<Object> delivery(@RequestBody PartDeliveryParamsDTO partDeliveryParamsDTO) {
return ResultUtil.data(orderService.partDelivery(partDeliveryParamsDTO));
}
}