| | |
| | | |
| | | @Override |
| | | public void exportStockInventory(HttpServletResponse response, StockInventoryDto stockInventoryDto) { |
| | | |
| | | List<StockInventoryExportData> list = stockInventoryMapper.listStockInventoryExportData(stockInventoryDto); |
| | | ExcelUtil<StockInventoryExportData> util = new ExcelUtil<>(StockInventoryExportData.class); |
| | | util.exportExcel(response, list, "库存信息"); |
| | |
| | | |
| | | @Override |
| | | public IPage<StockInRecordDto> stockInventoryPage(StockInventoryDto stockInventoryDto, Page page) { |
| | | return stockInventoryMapper.stockInventoryPage(stockInventoryDto, page); |
| | | IPage<StockInRecordDto> result = stockInventoryMapper.stockInventoryPage(stockInventoryDto, page); |
| | | formatCurrentStock(result.getRecords()); |
| | | return result; |
| | | } |
| | | |
| | | @Override |
| | | public void exportStockInventoryPage(HttpServletResponse response, StockInventoryDto stockInventoryDto) { |
| | | List<StockInRecordDto> list = stockInventoryMapper.stockInventoryPage(stockInventoryDto,new Page(-1,-1)).getRecords(); |
| | | formatCurrentStock(list); |
| | | ExcelUtil<StockInRecordDto> util = new ExcelUtil<>(StockInRecordDto.class); |
| | | util.exportExcel(response, list, "库存报表导出"); |
| | | } |
| | | |
| | | /** |
| | | * 格式化现存量 |
| | | */ |
| | | private void formatCurrentStock(List<StockInRecordDto> list) { |
| | | if (list == null || list.isEmpty()) { |
| | | return; |
| | | } |
| | | for (StockInRecordDto record : list) { |
| | | String currentStock = record.getCurrentStock(); |
| | | if (StringUtils.isEmpty(currentStock)) { |
| | | continue; |
| | | } |
| | | try { |
| | | record.setCurrentStock(new BigDecimal(currentStock).stripTrailingZeros().toPlainString()); |
| | | } catch (NumberFormatException ignored) { |
| | | } |
| | | } |
| | | } |
| | | |
| | | @Override |
| | |
| | | } |
| | | |
| | | @Override |
| | | public List<StockInventory> getByModelId(Long modelId) { |
| | | public List<StockInventoryDto> getByModelId(Long modelId) { |
| | | return stockInventoryMapper.getByModelId(modelId); |
| | | } |
| | | |