|
|
@@ -1,8 +1,10 @@
|
|
|
package org.springblade.stock.feign;
|
|
|
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.baomidou.mybatisplus.core.toolkit.CollectionUtils;
|
|
|
import lombok.AllArgsConstructor;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
+import org.apache.poi.ss.formula.functions.T;
|
|
|
import org.springblade.core.mp.support.Condition;
|
|
|
import org.springblade.core.secure.utils.SecureUtil;
|
|
|
import org.springblade.core.tenant.annotation.NonDS;
|
|
|
@@ -17,6 +19,7 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
import springfox.documentation.annotations.ApiIgnore;
|
|
|
|
|
|
import javax.validation.Valid;
|
|
|
+import java.math.BigDecimal;
|
|
|
import java.util.List;
|
|
|
|
|
|
@Slf4j
|
|
|
@@ -64,10 +67,20 @@ public class StockGoodsClient implements IStockGoodsClient{
|
|
|
*/
|
|
|
@Override
|
|
|
@GetMapping(GET_STOCK)
|
|
|
- public R<List<StockGoods>> getStock(StockGoods stockGoods) {
|
|
|
+ public R<? extends Object> getStock(StockGoods stockGoods) {
|
|
|
stockGoods.setTenantId(SecureUtil.getTenantId());
|
|
|
stockGoods.setIsDeleted(0);
|
|
|
- return R.data(stockGoodsService.list(new QueryWrapper<StockGoods>().setEntity(stockGoods)));
|
|
|
+ List<StockGoods> list = stockGoodsService.list(new QueryWrapper<StockGoods>().setEntity(stockGoods));
|
|
|
+ BigDecimal reduce=null;
|
|
|
+ if(CollectionUtils.isNotEmpty(list))
|
|
|
+ {
|
|
|
+ reduce = list.stream().filter(e -> e.getSurplusRouteQuantity() != null).map(StockGoods::getSurplusRouteQuantity).reduce(BigDecimal.ZERO, BigDecimal::add);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ reduce=new BigDecimal("0");
|
|
|
+ }
|
|
|
+ return R.data(reduce);
|
|
|
}
|
|
|
|
|
|
/**
|