xuhy
2 天以前 72aaf45389cd09c206ee1b90f0c7f5bf59782930
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TSysGoodsController.java
@@ -97,7 +97,9 @@
                List<TSysGoodsExchange> list = sysGoodsExchangeService.list(new LambdaQueryWrapper<TSysGoodsExchange>().in(TSysGoodsExchange::getGoodsId, records.stream().map(TSysGoods::getId).collect(Collectors.toList())));
                records.forEach(item -> {
                    item.setExchangeQuantity(list.stream().filter(item1 -> item1.getGoodsId().equals(item.getId())).mapToInt(TSysGoodsExchange::getGoodsCount).sum());
                    item.setSurplusQuantity(item.getGoodsTotal() - item.getExchangeQuantity());
                    if (item.getGoodsTotal() != null) {
                        item.setSurplusQuantity(item.getGoodsTotal() - item.getExchangeQuantity());
                    }
                });
            }
            pageInfo.setRecords(records);
@@ -196,7 +198,10 @@
    @PostMapping(value = "/getExchangeRecord")
    public R<PageInfo<TSysGoodsExchange>> getExchangeRecord(@RequestBody @Valid TSysGoodsExchangeQuery query) {
        PageInfo<TSysGoodsExchange> page = new PageInfo<>(query.getPageNum(), query.getPageSize());
        LambdaQueryWrapper<TSysGoodsExchange> wrapper = new LambdaQueryWrapper<TSysGoodsExchange>().eq(TSysGoodsExchange::getGoodsId, query.getId());
        LambdaQueryWrapper<TSysGoodsExchange> wrapper = new LambdaQueryWrapper<TSysGoodsExchange>();
        if (query.getId() != null && !query.getId().isEmpty()) {
            wrapper.eq(TSysGoodsExchange::getGoodsId, query.getId());
        }
        if (query.getClinicName() != null && !query.getClinicName().isEmpty()) {
            wrapper.like(TSysGoodsExchange::getClinicName, query.getClinicName());
        }
@@ -220,7 +225,7 @@
            return R.fail("该订单已发货");
        }
        exchange1.setStatus(2);
        exchange1.setLogisticsNumber(exchange1.getLogisticsNumber());
        exchange1.setLogisticsNumber(exchange.getLogisticsNumber());
        sysGoodsExchangeService.updateById(exchange1);
        return R.ok();
    }
@@ -246,7 +251,9 @@
            List<TSysGoodsExchange> list = sysGoodsExchangeService.list(new LambdaQueryWrapper<TSysGoodsExchange>().in(TSysGoodsExchange::getGoodsId, records.stream().map(TSysGoods::getId).collect(Collectors.toList())));
            records.forEach(item -> {
                item.setExchangeQuantity(list.stream().filter(item1 -> item1.getGoodsId().equals(item.getId())).mapToInt(TSysGoodsExchange::getGoodsCount).sum());
                item.setSurplusQuantity(item.getGoodsTotal() - item.getExchangeQuantity());
                if (item.getGoodsTotal() != null) {
                    item.setSurplusQuantity(item.getGoodsTotal() - item.getExchangeQuantity());
                }
            });
        }
        pageInfo.setRecords(records);