| | |
| | | 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); |
| | |
| | | @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()); |
| | | } |
| | |
| | | return R.fail("该订单已发货"); |
| | | } |
| | | exchange1.setStatus(2); |
| | | exchange1.setLogisticsNumber(exchange1.getLogisticsNumber()); |
| | | exchange1.setLogisticsNumber(exchange.getLogisticsNumber()); |
| | | sysGoodsExchangeService.updateById(exchange1); |
| | | return R.ok(); |
| | | } |
| | |
| | | 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); |