| | |
| | | import com.consum.base.pojo.response.FromTransferTemplateInfoVO; |
| | | import com.consum.base.pojo.response.LWHFromTransferExtendVO; |
| | | import com.consum.base.pojo.response.TransferInfoVO; |
| | | import com.consum.base.service.BaseGoodsModelsServiceImpl; |
| | | import com.consum.base.service.BaseWarehouseServiceImpl; |
| | | import com.consum.base.service.LWhFormTransferCoreService; |
| | | import com.consum.base.service.LWhFormTransferServiceImpl; |
| | |
| | | import java.lang.reflect.Field; |
| | | import java.net.URLEncoder; |
| | | import java.util.ArrayList; |
| | | import java.util.Comparator; |
| | | import java.util.HashMap; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | |
| | | private LWhProcureModelUserServiceImpl lWhProcureModelUserService; |
| | | @Autowired |
| | | private LWhProcureModelUserRecordServiceImpl lWhProcureModelUserRecordService; |
| | | @Autowired |
| | | private BaseGoodsModelsServiceImpl baseGoodsModelsService; |
| | | @Autowired |
| | | private BaseWarehouseServiceImpl baseWarehouseService; |
| | | |
| | |
| | | * @Author 卢庆阳 |
| | | * @Date 2023/10/31 |
| | | */ |
| | | @GetMapping("/export") |
| | | public void export(Long id, HttpServletResponse response) throws IOException { |
| | | @GetMapping("/list/export") |
| | | public void export(Long id, Integer type, HttpServletResponse response) throws IOException { |
| | | |
| | | TemplateExportParams params = new TemplateExportParams("import/调拨入库单.xlsx"); |
| | | Map<String, Object> map = this.lWhFormTransferService.export(id); |
| | | TemplateExportParams params; |
| | | if (type == 1) { |
| | | params = new TemplateExportParams("import/调拨入库单.xls"); |
| | | } else { |
| | | params = new TemplateExportParams("import/调拨出库单.xls"); |
| | | } |
| | | Map<String, Object> map = this.lWhFormTransferService.export(id, type); |
| | | |
| | | Workbook workbook = ExcelExportUtil.exportExcel(params, map); |
| | | try (OutputStream outputStream = response.getOutputStream()) { |
| | | response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet;charset=utf-8"); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("调拨入库单.xlsx", "utf-8")); |
| | | response.setHeader("Content-disposition", "attachment;filename=" + URLEncoder.encode("调拨入库单.xls", "utf-8")); |
| | | workbook.write(outputStream); |
| | | workbook.close(); |
| | | } |
| | |
| | | if (CollectionUtils.isEmpty(useRecordDTOList)) { |
| | | return ResponseValue.error("未查询到使用记录"); |
| | | } |
| | | List<GoodsUseRecordVO> result = Lists.newArrayList(); |
| | | List<GoodsUseRecordVO> goodsUseRecordList = Lists.newArrayList(); |
| | | //分组 |
| | | Map<Long, Map<Long, List<UseRecordDTO>>> collect = useRecordDTOList.stream() |
| | | .collect(Collectors.groupingBy(UseRecordDTO::getId, Collectors.groupingBy(UseRecordDTO::getBaseGoodsModelsId))); |
| | |
| | | useRecordSkuVO.setRecordUserInfos(recordUserInfoList); |
| | | useRecordSkuList.add(useRecordSkuVO); |
| | | goodsUseRecordVO.setRecordSkuDtoList(useRecordSkuList); |
| | | result.add(goodsUseRecordVO); |
| | | goodsUseRecordList.add(goodsUseRecordVO); |
| | | } |
| | | } |
| | | } |
| | | //分组之后重新排序 |
| | | List<GoodsUseRecordVO> result = goodsUseRecordList.stream() |
| | | .sorted(Comparator.comparing(GoodsUseRecordVO::getUpdateTime |
| | | , Comparator.nullsFirst(Long::compareTo)).reversed()) |
| | | .collect(Collectors.toList()); |
| | | return ResponseValue.success(result); |
| | | } |
| | | |