分包裹发货,库存预警

This commit is contained in:
chc
2024-01-11 13:33:13 +08:00
parent 6f0f8106e0
commit 6cea6af59b
29 changed files with 634 additions and 7 deletions

View File

@@ -93,7 +93,8 @@ public class GoodsStoreController {
StoreDetail storeDetail = OperationalJudgment.judgment(storeDetailService.getStoreDetail(storeId));
Integer stockWarnNum = storeDetail.getStockWarning();
goodsSearchParams.setStoreId(storeId);
goodsSearchParams.setLeQuantity(stockWarnNum);
// goodsSearchParams.setLeQuantity(stockWarnNum);
goodsSearchParams.setAlertQuantity(true);
goodsSearchParams.setMarketEnable(GoodsStatusEnum.UPPER.name());
IPage<GoodsSku> goodsSku = goodsSkuService.getGoodsSkuByPage(goodsSearchParams);
StockWarningVO stockWarning = new StockWarningVO(stockWarnNum, goodsSku);
@@ -182,6 +183,21 @@ public class GoodsStoreController {
return ResultUtil.success();
}
@ApiOperation(value = "修改商品预警库存")
@PutMapping(value = "/update/alert/stocks", consumes = "application/json")
public ResultMessage<Object> updateAlertQuantity(@RequestBody List<GoodsSkuStockDTO> updateStockList) {
String storeId = Objects.requireNonNull(UserContext.getCurrentUser()).getStoreId();
// 获取商品skuId集合
List<String> goodsSkuIds = updateStockList.stream().map(GoodsSkuStockDTO::getSkuId).collect(Collectors.toList());
// 根据skuId集合查询商品信息
List<GoodsSku> goodsSkuList = goodsSkuService.list(new LambdaQueryWrapper<GoodsSku>().in(GoodsSku::getId, goodsSkuIds).eq(GoodsSku::getStoreId, storeId));
// 过滤不符合当前店铺的商品
List<String> filterGoodsSkuIds = goodsSkuList.stream().map(GoodsSku::getId).collect(Collectors.toList());
List<GoodsSkuStockDTO> collect = updateStockList.stream().filter(i -> filterGoodsSkuIds.contains(i.getSkuId())).collect(Collectors.toList());
goodsSkuService.updateAlertQuantity(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));
}
}