diff --git a/src/main/java/com/bonus/gzgqj/business/plan/controller/ExportController.java b/src/main/java/com/bonus/gzgqj/business/plan/controller/ExportController.java index d7cbefb..299abb1 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/controller/ExportController.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/controller/ExportController.java @@ -161,7 +161,34 @@ public class ExportController { } } - + /** + * 数据 概览-导出 + * @param request + * @param response + * @param o + */ + @PostMapping("exportDataInfo") + public void exportDataInfo(HttpServletRequest request, HttpServletResponse response, ProNeedInfo o) { + try { + List list = service.getDataInfoByPage(o); + List exports=new ArrayList<>(); + list.forEach(vo->{ + ProNeedEXportInfo voo=new ProNeedEXportInfo(); + BeanUtils.copyProperties(vo, voo); + exports.add(voo); + }); + ExportParams exportParams = new ExportParams("发货统计", "发货统计", ExcelType.XSSF); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBean.class, exports); + response.setContentType("application/vnd.ms-excel"); + response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("发货统计" + ".xlsx", "UTF-8")); + ServletOutputStream outputStream = response.getOutputStream(); + workbook.write(outputStream); + outputStream.close(); + workbook.close(); + } catch (Exception e) { + log.error(e.toString(), e); + } + } /** * 导出 待发货-接口 * @param request @@ -178,11 +205,10 @@ public class ExportController { BeanUtils.copyProperties(vo, voo); exports.add(voo); }); - - ExportParams exportParams = new ExportParams("待发货", "待发货", ExcelType.XSSF); + ExportParams exportParams = new ExportParams("需求计划量", "需求计划量", ExcelType.XSSF); Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBean.class, exports); response.setContentType("application/vnd.ms-excel"); - response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("待发货" + ".xlsx", "UTF-8")); + response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("需求计划量" + ".xlsx", "UTF-8")); ServletOutputStream outputStream = response.getOutputStream(); workbook.write(outputStream); outputStream.close(); @@ -192,6 +218,34 @@ public class ExportController { } } + /** + * 来源,明细导出 + * @param request + * @param response + * @param o + */ + @PostMapping("exportDetails") + public void exportDetails(HttpServletRequest request, HttpServletResponse response, ProNeedInfo o) { + try { + List list = service.getDataPlanByPage(o); + List exports=new ArrayList<>(); + list.forEach(vo->{ + PlanApplyBeanExport voo=new PlanApplyBeanExport(); + BeanUtils.copyProperties(vo, voo); + exports.add(voo); + }); + ExportParams exportParams = new ExportParams("需求计划", "需求计划", ExcelType.XSSF); + Workbook workbook = ExcelExportUtil.exportExcel(exportParams, PlanApplyBean.class, exports); + response.setContentType("application/vnd.ms-excel"); + response.setHeader("content-disposition", "attachment;fileName=" + URLEncoder.encode("需求计划" + ".xlsx", "UTF-8")); + ServletOutputStream outputStream = response.getOutputStream(); + workbook.write(outputStream); + outputStream.close(); + workbook.close(); + } catch (Exception e) { + log.error(e.toString(), e); + } + } /** diff --git a/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanOutController.java b/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanOutController.java index 0644444..9e8a42a 100644 --- a/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanOutController.java +++ b/src/main/java/com/bonus/gzgqj/business/plan/controller/PlanOutController.java @@ -23,18 +23,10 @@ import org.springframework.beans.factory.annotation.Autowired; import org.springframework.http.*; import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; - -import javax.servlet.ServletOutputStream; import javax.servlet.http.HttpServletRequest; -import javax.servlet.http.HttpServletResponse; -import java.io.File; -import java.net.URLEncoder; -import java.util.ArrayList; + import java.util.List; -import org.springframework.core.io.Resource; -import org.springframework.http.ResponseEntity; -import org.springframework.web.bind.annotation.*; -import org.springframework.web.multipart.MultipartFile; + /** * 出库 控制层 * diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyBeanExport.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyBeanExport.java new file mode 100644 index 0000000..bff9238 --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/PlanApplyBeanExport.java @@ -0,0 +1,284 @@ +package com.bonus.gzgqj.business.plan.entity; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; + +import java.util.List; + +/** + *计划申请实体类 + * @author xj + */ +@Data +public class PlanApplyBeanExport { + + @Excel(name = "序号", width = 10.0, orderNum = "0") + private String id; + /** + * 计划编号 + */ + @Excel(name = "计划编号", width = 10.0,height = 20.0, orderNum = "1") + private String code; + /** + * 工程名称 + */ + @Excel(name = "工程名称", width = 10.0,height = 20.0, orderNum = "2") + private String proName; + + /** + * 需要时间 + */ + @Excel(name = "需用日期", width = 10.0,height = 20.0, orderNum = "3") + private String needTime; + + /** + * 创建人 + */ + @Excel(name = "申请人", width = 10.0,height = 20.0, orderNum = "4") + private String creator; + /** + * 创建时间 + */ + @Excel(name = "申请时间", width = 10.0,height = 20.0, orderNum = "5") + private String createTime; + + /** + * 工程id + */ + + private String proId; + + /** + * 项目的 + */ + private String projectId; + + /** + * 树妖数量 + */ + @Excel(name = "需要数量", width = 10.0,height = 20.0, orderNum = "6") + private String needNum; + + /** + * 项目部分 + */ + @Excel(name = "项目部分", width = 10.0,height = 20.0, orderNum = "7") + private String projectPart; + + /** + * 施工地点 + */ + @Excel(name = "施工地点", width = 10.0,height = 20.0, orderNum = "8") + private String projectContent; + + + /** + * 施工地点 + */ + @Excel(name = "备注", width = 10.0,height = 20.0, orderNum = "9") + private String remark; + + private String statusName; + + /** + * 状态 + */ + private String status; + /** + * 更新人 + */ + private String updater; + /** + * 更新时间 + */ + private String updateTime; + + + private String keyWord; + + + private String statusType; + + + private String moduleId; + + private String jsonData; + + private List details; + + + private List auditList; + + /** + * 审核状态 + */ + private String auditStatus; + + + + + public String getProId() { + return proId; + } + + public void setProId(String proId) { + this.proId = proId; + } + + public String getAuditStatus() { + return auditStatus; + } + + public void setAuditStatus(String auditStatus) { + this.auditStatus = auditStatus; + } + + public List getAuditList() { + return auditList; + } + + public void setAuditList(List auditList) { + this.auditList = auditList; + } + + public List getDetails() { + return details; + } + + public void setDetails(List details) { + this.details = details; + } + + public String getJsonData() { + return jsonData; + } + + public void setJsonData(String jsonData) { + this.jsonData = jsonData; + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getCode() { + return code; + } + + public void setCode(String code) { + this.code = code; + } + + public String getProjectId() { + return projectId; + } + + public void setProjectId(String projectId) { + this.projectId = projectId; + } + + public String getProjectPart() { + return projectPart; + } + + public void setProjectPart(String projectPart) { + this.projectPart = projectPart; + } + + public String getProjectContent() { + return projectContent; + } + + public void setProjectContent(String projectContent) { + this.projectContent = projectContent; + } + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + public String getNeedTime() { + return needTime; + } + + public void setNeedTime(String needTime) { + this.needTime = needTime; + } + + public String getCreator() { + return creator; + } + + public void setCreator(String creator) { + this.creator = creator; + } + + public String getCreateTime() { + return createTime; + } + + public void setCreateTime(String createTime) { + this.createTime = createTime; + } + + public String getStatus() { + return status; + } + + public void setStatus(String status) { + this.status = status; + } + + public String getUpdater() { + return updater; + } + + public void setUpdater(String updater) { + this.updater = updater; + } + + public String getUpdateTime() { + return updateTime; + } + + public void setUpdateTime(String updateTime) { + this.updateTime = updateTime; + } + + public String getKeyWord() { + return keyWord; + } + + public void setKeyWord(String keyWord) { + this.keyWord = keyWord; + } + + public String getStatusType() { + return statusType; + } + + public void setStatusType(String statusType) { + this.statusType = statusType; + } + + public String getProName() { + return proName; + } + + public void setProName(String proName) { + this.proName = proName; + } + + + + + + + +} diff --git a/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedEXportInfo.java b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedEXportInfo.java new file mode 100644 index 0000000..8f3d40c --- /dev/null +++ b/src/main/java/com/bonus/gzgqj/business/plan/entity/ProNeedEXportInfo.java @@ -0,0 +1,148 @@ +package com.bonus.gzgqj.business.plan.entity; + +import cn.afterturn.easypoi.excel.annotation.Excel; +import lombok.Data; +import lombok.EqualsAndHashCode; + +/** + * 工程需要数据 + * @author 黑子 + */ +@EqualsAndHashCode(callSuper = true) +@Data +public class ProNeedEXportInfo extends PageInfo { + /** + * 主键 + */ + @Excel(name = "序号", width = 10.0, orderNum = "0") + private String id; + /** + * 计划内外 + */ + + private String typeName; + /** + * 工程id + */ + private String proId; + + /** + * 工程id + */ + private String curryDay; + + /** + * 工程名称 + */ + private String proName; + /** + * 未发货量 + */ + private int wfhNum; + /** + * 库存量 + */ + private int kuNum; + /** + * 差量 + */ + private int clNum; + /** + * 类型 + */ + @Excel(name = "物机类型", width = 10.0,height = 20.0, orderNum = "3") + private String type; + /** + * 名称 + */ + @Excel(name = "物机名称", width = 10.0,height = 20.0, orderNum = "4") + private String name; + /** + * 规格型号 + */ + @Excel(name = "规格型号", width = 10.0,height = 20.0, orderNum = "5") + private String module; + + /** + * 单位 + */ + @Excel(name = "单位", width = 10.0,height = 20.0, orderNum = "6") + private String unit; + + /** + * 进度 + */ + + private String progress; + /** + * 规格id + */ + private String moduleId; + /** + * 需求类型 1计划 2新增 + */ + private String needType; + + + + /** + * 需要数量 + */ + @Excel(name = "需要量", width = 10.0,height = 20.0, orderNum = "8") + private int needNum; + /** + * 发货数量 + */ + @Excel(name = "已发货量", width = 10.0,height = 20.0, orderNum = "9") + private int fhNum; + /** + * 差额 + */ + @Excel(name = "待发货量", width = 10.0,height = 20.0, orderNum = "10") + private int diff; + /** + * 工程数量 + */ + @Excel(name = "工程数", width = 10.0,height = 20.0, orderNum = "11") + private String proNum; + + /** + * 计划数量 + */ + @Excel(name = "需求计划数", width = 10.0,height = 20.0, orderNum = "12") + private String planNum; + /** + * 调整量 + */ + + private int tzNum; + /** + * 备注 + */ + @Excel(name = "备注", width = 10.0,height = 20.0, orderNum = "13") + private String remarks; + + + /** + * 备注 + */ + private String outId; + + /** + * 数据源 1 计划 2 新增 + */ + private String dataType; + + + /** + * 调整数量 + */ + private int num; + + /** + * 类型 + */ + private String typeSource; + + +} diff --git a/src/main/resources/mappers/plan/PlanOutMapper.xml b/src/main/resources/mappers/plan/PlanOutMapper.xml index ed9131b..ac3e466 100644 --- a/src/main/resources/mappers/plan/PlanOutMapper.xml +++ b/src/main/resources/mappers/plan/PlanOutMapper.xml @@ -219,21 +219,21 @@ t_plan_apply plan left join bm_project pro on plan.project_id=pro.ID - plan.project_id=#{proId} and plan.status_type=1 - + plan.project_id=#{proId} and plan.status_type=1 + and ( - pro.name like concat('%',#{param.keyWord},'%') or - plan.creator like concat('%',#{param.keyWord},'%') or - plan.CODE like concat('%',#{param.keyWord},'%') or - plan.need_time like concat('%',#{param.keyWord},'%') or - plan.project_part like concat('%',#{param.keyWord},'%') or - plan.project_content like concat('%',#{param.keyWord},'%') or - plan.remark like concat('%',#{param.keyWord},'%') + pro.name like concat('%',#{keyWord},'%') or + plan.creator like concat('%',#{keyWord},'%') or + plan.CODE like concat('%',#{keyWord},'%') or + plan.need_time like concat('%',#{keyWord},'%') or + plan.project_part like concat('%',#{keyWord},'%') or + plan.project_content like concat('%',#{keyWord},'%') or + plan.remark like concat('%',#{keyWord},'%') ) - - and plan.STATUS=#{param.auditStatus} + + and plan.STATUS=#{auditStatus} order by plan.update_time DESC @@ -260,6 +260,12 @@ and pni.fh_num>0 + + and pni.`module` like concat('%',#{module},'%') + + + and pni.`name` like concat('%',#{name},'%') +