|
|
@@ -2,6 +2,7 @@ package com.trade.purchase.order.feign;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
|
import com.trade.purchase.order.entity.Order;
|
|
|
+import com.trade.purchase.order.entity.OrderItems;
|
|
|
import com.trade.purchase.order.enums.OrderTypeEnum;
|
|
|
import com.trade.purchase.order.service.IOrderService;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
@@ -10,11 +11,14 @@ import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tenant.annotation.NonDS;
|
|
|
import org.springblade.core.tool.api.R;
|
|
|
import org.springblade.core.tool.utils.Func;
|
|
|
-import org.springframework.transaction.annotation.Transactional;
|
|
|
import org.springframework.web.bind.annotation.GetMapping;
|
|
|
import org.springframework.web.bind.annotation.RestController;
|
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
+import java.math.BigDecimal;
|
|
|
+import java.util.List;
|
|
|
+import java.util.Objects;
|
|
|
+
|
|
|
@NonDS
|
|
|
@ApiIgnore()
|
|
|
@RestController
|
|
|
@@ -59,7 +63,7 @@ public class OrderDescClient implements IOrderDescClient {
|
|
|
|
|
|
|
|
|
@Override
|
|
|
- public int count(String type, String orderStartDate, String orderEndDate, String businessType) {
|
|
|
+ public int countOrder(String type, String orderStartDate, String orderEndDate, String businessType) {
|
|
|
if ("check".equals(businessType)) {
|
|
|
if (OrderTypeEnum.WAREHOUSING.getType().equals(type)) {
|
|
|
//入库待审核
|
|
|
@@ -107,7 +111,9 @@ public class OrderDescClient implements IOrderDescClient {
|
|
|
RkOrderLambdaQueryWrapper.eq(Order::getBillType, type);
|
|
|
RkOrderLambdaQueryWrapper.ge(Func.isNotEmpty(orderStartDate), Order::getStockTime, orderStartDate);//订单日期开始
|
|
|
RkOrderLambdaQueryWrapper.le(Func.isNotEmpty(orderEndDate), Order::getStockTime, orderEndDate);//订单日期结束
|
|
|
- return iOrderService.count(RkOrderLambdaQueryWrapper);
|
|
|
+ List<Order> orderList = iOrderService.list(RkOrderLambdaQueryWrapper);
|
|
|
+ BigDecimal amount = orderList.stream().map(Order::getStorageQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ return amount.intValue();
|
|
|
} else if (OrderTypeEnum.OUT_WAREHOUSING.getType().equals(type)) {
|
|
|
//出库
|
|
|
LambdaQueryWrapper<Order> CkOrderLambdaQueryWrapper = new LambdaQueryWrapper<>();
|
|
|
@@ -117,7 +123,9 @@ public class OrderDescClient implements IOrderDescClient {
|
|
|
CkOrderLambdaQueryWrapper.eq(Order::getBillType, type);
|
|
|
CkOrderLambdaQueryWrapper.ge(Func.isNotEmpty(orderStartDate), Order::getStockTime, orderStartDate);//订单日期开始
|
|
|
CkOrderLambdaQueryWrapper.le(Func.isNotEmpty(orderEndDate), Order::getStockTime, orderEndDate);//订单日期结束
|
|
|
- return iOrderService.count(CkOrderLambdaQueryWrapper);
|
|
|
+ List<Order> orderList = iOrderService.list(CkOrderLambdaQueryWrapper);
|
|
|
+ BigDecimal amount = orderList.stream().map(Order::getStorageQuantity).filter(Objects::nonNull).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ return amount.intValue();
|
|
|
} else {
|
|
|
return 0;
|
|
|
}
|