导出Excel表格

This commit is contained in:
liuchengqian 2022-03-17 11:54:36 +08:00
parent 6e62f0de5a
commit 3dd86a12bf
5 changed files with 126 additions and 4 deletions

View File

@ -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);
}
}

View File

@ -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 + '\'' + '}';
}
}

View File

@ -0,0 +1,4 @@
package com.xkrs.model.va;
public interface ExportExcelQoVa {
}

View File

@ -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;
}

View File

@ -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<CraftItemEntity> craftItemList = craftItemDao.findAll();
if (craftItemList.isEmpty()) {
return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "未添加工艺项目,请先添加工艺项目!", locale);