From 3dd86a12bfe1eaf78403eec084a5ca3df9f87fbf Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Thu, 17 Mar 2022 11:54:36 +0800 Subject: [PATCH] =?UTF-8?q?=E5=AF=BC=E5=87=BAExcel=E8=A1=A8=E6=A0=BC?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/controller/QcSourceController.java | 5 +- .../java/com/xkrs/model/qo/ExportExcelQo.java | 108 ++++++++++++++++++ .../com/xkrs/model/va/ExportExcelQoVa.java | 4 + .../com/xkrs/service/QcSourceService.java | 3 +- .../service/impl/QcSourceServiceImpl.java | 10 +- 5 files changed, 126 insertions(+), 4 deletions(-) create mode 100644 src/main/java/com/xkrs/model/qo/ExportExcelQo.java create mode 100644 src/main/java/com/xkrs/model/va/ExportExcelQoVa.java diff --git a/src/main/java/com/xkrs/controller/QcSourceController.java b/src/main/java/com/xkrs/controller/QcSourceController.java index e0e4231..44e24da 100644 --- a/src/main/java/com/xkrs/controller/QcSourceController.java +++ b/src/main/java/com/xkrs/controller/QcSourceController.java @@ -1,5 +1,6 @@ package com.xkrs.controller; +import com.xkrs.model.qo.ExportExcelQo; import com.xkrs.model.qo.QcSourceQoDelete; import com.xkrs.model.qo.QcSourceQoInsert; import com.xkrs.service.QcSourceService; @@ -42,8 +43,8 @@ public class QcSourceController { * 导出Excel表格 */ @GetMapping("/exportExcel") - public String exportExcel(@RequestParam(value = "host") String host, @RequestParam(required = false, value = "batchNo") String batchNo, @RequestParam(required = false, value = "machineNo") String machineNo, @RequestParam(required = false, value = "materialNo") String materialNo, @RequestParam(required = false, value = "mouldNo") String mouldNo, @RequestParam(required = false, value = "varietyNo") String varietyNo, @RequestParam(required = false, value = "craftItemNo") String craftItemNo) throws Exception { - return qcSourceService.exportExcel(host, batchNo, machineNo, materialNo, mouldNo, varietyNo, craftItemNo); + public String exportExcel(@RequestBody ExportExcelQo exportExcelQo) throws Exception { + return qcSourceService.exportExcel(exportExcelQo); } } diff --git a/src/main/java/com/xkrs/model/qo/ExportExcelQo.java b/src/main/java/com/xkrs/model/qo/ExportExcelQo.java new file mode 100644 index 0000000..c5b97c7 --- /dev/null +++ b/src/main/java/com/xkrs/model/qo/ExportExcelQo.java @@ -0,0 +1,108 @@ +package com.xkrs.model.qo; + +import com.xkrs.model.va.ExportExcelQoVa; + +import javax.validation.constraints.NotBlank; + +public class ExportExcelQo { + + /** + * IP端口 + */ + @NotBlank(message = "{QcSourceEntity.host.blank}", groups = {ExportExcelQoVa.class}) + private String host; + + /** + * 批次号 + */ + private String batchNo; + + /** + * 机器号 + */ + private String machineNo; + + /** + * 物料号 + */ + private String materialNo; + + /** + * 模具号 + */ + private String mouldNo; + + /** + * 机种号 + */ + private String varietyNo; + + /** + * 工艺项目编号 + */ + private String craftItemNo; + + public ExportExcelQo() { + } + + public String getHost() { + return host; + } + + public void setHost(String host) { + this.host = host; + } + + public String getBatchNo() { + return batchNo; + } + + public void setBatchNo(String batchNo) { + this.batchNo = batchNo; + } + + public String getMachineNo() { + return machineNo; + } + + public void setMachineNo(String machineNo) { + this.machineNo = machineNo; + } + + public String getMaterialNo() { + return materialNo; + } + + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; + } + + public String getMouldNo() { + return mouldNo; + } + + public void setMouldNo(String mouldNo) { + this.mouldNo = mouldNo; + } + + public String getVarietyNo() { + return varietyNo; + } + + public void setVarietyNo(String varietyNo) { + this.varietyNo = varietyNo; + } + + public String getCraftItemNo() { + return craftItemNo; + } + + public void setCraftItemNo(String craftItemNo) { + this.craftItemNo = craftItemNo; + } + + @Override + public String toString() { + return "ExportExcelQo{" + "host='" + host + '\'' + ", batchNo='" + batchNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", mouldNo='" + mouldNo + '\'' + ", varietyNo='" + varietyNo + '\'' + ", craftItemNo='" + craftItemNo + '\'' + '}'; + } +} diff --git a/src/main/java/com/xkrs/model/va/ExportExcelQoVa.java b/src/main/java/com/xkrs/model/va/ExportExcelQoVa.java new file mode 100644 index 0000000..90fb9db --- /dev/null +++ b/src/main/java/com/xkrs/model/va/ExportExcelQoVa.java @@ -0,0 +1,4 @@ +package com.xkrs.model.va; + +public interface ExportExcelQoVa { +} diff --git a/src/main/java/com/xkrs/service/QcSourceService.java b/src/main/java/com/xkrs/service/QcSourceService.java index c386f32..bf92211 100644 --- a/src/main/java/com/xkrs/service/QcSourceService.java +++ b/src/main/java/com/xkrs/service/QcSourceService.java @@ -1,5 +1,6 @@ package com.xkrs.service; +import com.xkrs.model.qo.ExportExcelQo; import com.xkrs.model.qo.QcSourceQoDelete; import com.xkrs.model.qo.QcSourceQoInsert; import org.springframework.web.multipart.MultipartFile; @@ -24,6 +25,6 @@ public interface QcSourceService { /** * 导出Excel表格 */ - String exportExcel(String host, String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo, String craftItemNo) throws Exception; + String exportExcel(ExportExcelQo exportExcelQo) throws Exception; } diff --git a/src/main/java/com/xkrs/service/impl/QcSourceServiceImpl.java b/src/main/java/com/xkrs/service/impl/QcSourceServiceImpl.java index cc9fcab..c947c03 100644 --- a/src/main/java/com/xkrs/service/impl/QcSourceServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/QcSourceServiceImpl.java @@ -9,6 +9,7 @@ import com.xkrs.model.entity.CraftItemEntity; import com.xkrs.model.entity.QcItemEntity; import com.xkrs.model.entity.QcSourceEntity; import com.xkrs.model.entity.QcSpecEntity; +import com.xkrs.model.qo.ExportExcelQo; import com.xkrs.model.qo.QcSourceQoDelete; import com.xkrs.model.qo.QcSourceQoInsert; import com.xkrs.service.QcSourceService; @@ -249,7 +250,14 @@ public class QcSourceServiceImpl implements QcSourceService { * 导出Excel表格 */ @Override - public String exportExcel(String host, String batchNo, String machineNo, String materialNo, String mouldNo, String varietyNo, String craftItemNo) throws Exception { + public String exportExcel(ExportExcelQo exportExcelQo) throws Exception { + String host = exportExcelQo.getHost(); + String batchNo = exportExcelQo.getBatchNo(); + String machineNo = exportExcelQo.getMachineNo(); + String materialNo = exportExcelQo.getMaterialNo(); + String mouldNo = exportExcelQo.getMouldNo(); + String varietyNo = exportExcelQo.getVarietyNo(); + String craftItemNo = exportExcelQo.getCraftItemNo(); List craftItemList = craftItemDao.findAll(); if (craftItemList.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "未添加工艺项目,请先添加工艺项目!", locale);