| | |
| | | package com.fzzy.common; |
| | | |
| | | import com.fzzy.common.manager.ExportManager; |
| | | import com.fzzy.igds.*; |
| | | import com.fzzy.igds.CompanyPR; |
| | | import com.fzzy.igds.DepotPR; |
| | | import com.fzzy.igds.DeptPR; |
| | | import com.fzzy.igds.ReportInoutPR; |
| | | import com.fzzy.igds.constant.FoodVariety; |
| | | import com.fzzy.igds.data.*; |
| | | import com.fzzy.igds.domain.Company; |
| | |
| | | import org.springframework.web.bind.annotation.RequestMapping; |
| | | import org.springframework.web.bind.annotation.RequestParam; |
| | | import org.springframework.web.bind.annotation.ResponseBody; |
| | | |
| | | import javax.annotation.Resource; |
| | | import javax.servlet.http.HttpServletResponse; |
| | | import java.text.DecimalFormat; |
| | | import java.util.ArrayList; |
| | | import java.util.List; |
| | | import java.util.Map; |
| | | import java.util.Optional; |
| | | import java.util.*; |
| | | import java.util.stream.Collectors; |
| | | |
| | | /** |
| | |
| | | |
| | | /** |
| | | * 出入库报表导出 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/inout-excel") |
| | |
| | | if (null != subDept) { |
| | | deptName = subDept.getDeptName(); |
| | | } |
| | | String exportTimeDesc = ""; |
| | | String exportCreateUser = ""; |
| | | Date exportCreateTime = new Date(); |
| | | if (StringUtils.isNotEmpty(param.getTimeDesc())) { |
| | | exportTimeDesc = param.getTimeDesc(); |
| | | } |
| | | if (StringUtils.isNotEmpty(param.getCreateUser())) { |
| | | exportCreateUser = param.getCreateUser(); |
| | | } |
| | | if (param.getCreateTime() != null) { |
| | | exportCreateTime = param.getCreateTime(); |
| | | } |
| | | |
| | | //创建收储公司ID到名称的映射 |
| | | Map<String, String> companyMap = Optional.ofNullable(companyPR.getData()) |
| | | .orElse(new ArrayList<>()) |
| | |
| | | exportList.add(export); |
| | | } |
| | | ExcelUtil<InoutRecordInExport> util = new ExcelUtil<InoutRecordInExport>(InoutRecordInExport.class); |
| | | return util.exportExcel(exportList, sheetName, deptName); |
| | | return util.exportExcel(exportList, sheetName, deptName, exportTimeDesc, exportCreateUser, exportCreateTime); |
| | | } |
| | | |
| | | if (StringUtils.isNotEmpty(param.getType()) && "OUT".equals(param.getType())) { |
| | |
| | | exportList.add(export); |
| | | } |
| | | ExcelUtil<InoutRecordOutExport> util = new ExcelUtil<InoutRecordOutExport>(InoutRecordOutExport.class); |
| | | return util.exportExcel(exportList, sheetName, deptName); |
| | | return util.exportExcel(exportList, sheetName, deptName, exportTimeDesc, exportCreateUser, exportCreateTime); |
| | | } |
| | | |
| | | if (StringUtils.isNotEmpty(param.getType()) && "IN_DETAIL".equals(param.getType())) { |
| | |
| | | exportList.add(export); |
| | | } |
| | | ExcelUtil<InoutRecordDetailInExport> util = new ExcelUtil<InoutRecordDetailInExport>(InoutRecordDetailInExport.class); |
| | | return util.exportExcel(exportList, sheetName, deptName); |
| | | return util.exportExcel(exportList, sheetName, deptName, exportTimeDesc, exportCreateUser, exportCreateTime); |
| | | } |
| | | |
| | | if (StringUtils.isNotEmpty(param.getType()) && "OUT_DETAIL".equals(param.getType())) { |
| | |
| | | exportList.add(export); |
| | | } |
| | | ExcelUtil<InoutRecordDetailOutExport> util = new ExcelUtil<InoutRecordDetailOutExport>(InoutRecordDetailOutExport.class); |
| | | return util.exportExcel(exportList, sheetName, deptName); |
| | | return util.exportExcel(exportList, sheetName, deptName, exportTimeDesc, exportCreateUser, exportCreateTime); |
| | | } |
| | | return AjaxResult.error("参数错误"); |
| | | } |
| | | |
| | | /** |
| | | * 库存报表导出 |
| | | * |
| | | * @return |
| | | */ |
| | | @RequestMapping("/storage-excel") |
| | |
| | | SysDept subDept = sysDeptService.getCacheDept(null, ContextUtil.subDeptId(null)); |
| | | if (null != subDept) { |
| | | deptName = subDept.getDeptName(); |
| | | } |
| | | String exportTimeDesc = ""; |
| | | String exportCreateUser = ""; |
| | | Date exportCreateTime = new Date(); |
| | | if (StringUtils.isNotEmpty(param.getTimeDesc())) { |
| | | exportTimeDesc = param.getTimeDesc(); |
| | | } |
| | | if (StringUtils.isNotEmpty(param.getCreateUser())) { |
| | | exportCreateUser = param.getCreateUser(); |
| | | } |
| | | if (param.getCreateTime() != null) { |
| | | exportCreateTime = param.getCreateTime(); |
| | | } |
| | | List<SuperInventoryReportExport> exportList = new ArrayList<>(); |
| | | DecimalFormat df = new DecimalFormat("0.00"); |
| | |
| | | |
| | | //导出 |
| | | ExcelUtil<SuperInventoryReportExport> util = new ExcelUtil<SuperInventoryReportExport>(SuperInventoryReportExport.class); |
| | | return util.exportExcel(exportList, sheetName, deptName); |
| | | return util.exportExcel(exportList, sheetName, deptName, exportTimeDesc, exportCreateUser, exportCreateTime); |
| | | } |
| | | |
| | | } |