From 2c815028fb0752e6e807c5fb4578a789dcc5f0d0 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Mon, 28 Feb 2022 20:24:37 +0800 Subject: [PATCH 01/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B4=A8=E6=A3=80?= =?UTF-8?q?=E9=A1=B9=E5=AD=97=E5=85=B8=E6=95=B0=E6=8D=AE=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xkrs/model/entity/DataDict.java | 54 ++++++++----------- 1 file changed, 23 insertions(+), 31 deletions(-) diff --git a/src/main/java/com/xkrs/model/entity/DataDict.java b/src/main/java/com/xkrs/model/entity/DataDict.java index 0758159..78a363c 100644 --- a/src/main/java/com/xkrs/model/entity/DataDict.java +++ b/src/main/java/com/xkrs/model/entity/DataDict.java @@ -7,37 +7,32 @@ import javax.persistence.*; * @Date: 2022/1/19 9:26 */ @Entity -@Table(name = "data_dict") +@Table(name = "qc_inspection_item_dict") public class DataDict { + /** - * 主键id + * 索引 */ @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "data_dict_seq_gen") - @SequenceGenerator(name = "data_dict_seq_gen", sequenceName = "data_dict_id_seq",allocationSize = 1) + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_item_dict_seq_gen") + @SequenceGenerator(name = "qc_inspection_item_dict_seq_gen", sequenceName = "qc_inspection_item_dict_id_seq", allocationSize = 1) private Integer id; /** - * 中文名称 - */ - @Column(length = 65, columnDefinition = "varchar(65)") - private String dictChineseName; - - /** - * 英文变量值 + * 质检项代码 */ @Column(length = 85, columnDefinition = "varchar(85)") - private String dictEnglishName; + private String inspectionItemCode; + + /** + * 质检项代码 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectionItemName; public DataDict() { } - public DataDict(Integer id, String dictChineseName, String dictEnglishName) { - this.id = id; - this.dictChineseName = dictChineseName; - this.dictEnglishName = dictEnglishName; - } - public Integer getId() { return id; } @@ -46,28 +41,25 @@ public class DataDict { this.id = id; } - public String getDictChineseName() { - return dictChineseName; + public String getInspectionItemCode() { + return inspectionItemCode; } - public void setDictChineseName(String dictChineseName) { - this.dictChineseName = dictChineseName; + public void setInspectionItemCode(String inspectionItemCode) { + this.inspectionItemCode = inspectionItemCode; } - public String getDictEnglishName() { - return dictEnglishName; + public String getInspectionItemName() { + return inspectionItemName; } - public void setDictEnglishName(String dictEnglishName) { - this.dictEnglishName = dictEnglishName; + public void setInspectionItemName(String inspectionItemName) { + this.inspectionItemName = inspectionItemName; } @Override public String toString() { - return "DataDict{" + - "id=" + id + - ", dictChineseName='" + dictChineseName + '\'' + - ", dictEnglishName='" + dictEnglishName + '\'' + - '}'; + return "DataDict{" + "id=" + id + ", inspectionItemCode='" + inspectionItemCode + '\'' + ", inspectionItemName='" + inspectionItemName + '\'' + '}'; } + } From 561aa12be63a8777d9732fd5e34b3be6d3e7fe59 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Mon, 28 Feb 2022 20:28:22 +0800 Subject: [PATCH 02/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=B4=A8=E6=A3=80?= =?UTF-8?q?=E9=87=87=E9=9B=86=E6=95=B0=E6=8D=AE=E6=BA=90=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/model/entity/DataSource.java | 158 ++++++++---------- 1 file changed, 73 insertions(+), 85 deletions(-) diff --git a/src/main/java/com/xkrs/model/entity/DataSource.java b/src/main/java/com/xkrs/model/entity/DataSource.java index 4ab1966..4562324 100644 --- a/src/main/java/com/xkrs/model/entity/DataSource.java +++ b/src/main/java/com/xkrs/model/entity/DataSource.java @@ -7,71 +7,68 @@ import javax.persistence.*; * @Date: 2022/1/19 14:08 */ @Entity -@Table(name = "data_source") +@Table(name = "qc_inspection_data_source") public class DataSource { + /** * 主键id */ @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "data_source_seq_gen") - @SequenceGenerator(name = "data_source_seq_gen", sequenceName = "data_source_id_seq",allocationSize = 1) + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_data_source_seq_gen") + @SequenceGenerator(name = "qc_inspection_data_source_seq_gen", sequenceName = "qc_inspection_data_source_id_seq", allocationSize = 1) private Integer id; /** - * 机种 - */ - @Column(length = 32, columnDefinition = "varchar(32)") - private String dataModelNumber; - - /** - * 成型批号 - */ - @Column(length = 32, columnDefinition = "varchar(32)") - private String dataBatchNumber; - - /** - * 机器 - */ - @Column(length = 32, columnDefinition = "varchar(32)") - private String dataMachineCode; - - /** - * 模具 - */ - @Column(length = 32, columnDefinition = "varchar(32)") - private String productNumber; - - /** - * 材料 - */ - private String material; - - /** - * 变量值 + * 批次号 */ @Column(length = 85, columnDefinition = "varchar(85)") - private String dataName; + private String lotNo; /** - * 监测的数值 + * 批次号 */ @Column(length = 85, columnDefinition = "varchar(85)") - private String numericalValue; + private String lotNo; + + /** + * 机器号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String machineNo; + + /** + * 物料号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String materialNo; + + /** + * 模具号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String modelNo; + + /** + * 零件号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String partNo; + + /** + * 检验项代码 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectionItemCode; + + /** + * 检验数值 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectValue; public DataSource() { } - public DataSource(Integer id, String dataModelNumber, String dataBatchNumber, String dataMachineCode, String productNumber, String material, String dataName, String numericalValue) { - this.id = id; - this.dataModelNumber = dataModelNumber; - this.dataBatchNumber = dataBatchNumber; - this.dataMachineCode = dataMachineCode; - this.productNumber = productNumber; - this.material = material; - this.dataName = dataName; - this.numericalValue = numericalValue; - } - public Integer getId() { return id; } @@ -80,73 +77,64 @@ public class DataSource { this.id = id; } - public String getDataModelNumber() { - return dataModelNumber; + public String getLotNo() { + return lotNo; } - public void setDataModelNumber(String dataModelNumber) { - this.dataModelNumber = dataModelNumber; + public void setLotNo(String lotNo) { + this.lotNo = lotNo; } - public String getDataBatchNumber() { - return dataBatchNumber; + public String getMachineNo() { + return machineNo; } - public void setDataBatchNumber(String dataBatchNumber) { - this.dataBatchNumber = dataBatchNumber; + public void setMachineNo(String machineNo) { + this.machineNo = machineNo; } - public String getDataMachineCode() { - return dataMachineCode; + public String getMaterialNo() { + return materialNo; } - public void setDataMachineCode(String dataMachineCode) { - this.dataMachineCode = dataMachineCode; + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; } - public String getProductNumber() { - return productNumber; + public String getModelNo() { + return modelNo; } - public void setProductNumber(String productNumber) { - this.productNumber = productNumber; + public void setModelNo(String modelNo) { + this.modelNo = modelNo; } - public String getMaterial() { - return material; + public String getPartNo() { + return partNo; } - public void setMaterial(String material) { - this.material = material; + public void setPartNo(String partNo) { + this.partNo = partNo; } - public String getDataName() { - return dataName; + public String getInspectionItemCode() { + return inspectionItemCode; } - public void setDataName(String dataName) { - this.dataName = dataName; + public void setInspectionItemCode(String inspectionItemCode) { + this.inspectionItemCode = inspectionItemCode; } - public String getNumericalValue() { - return numericalValue; + public String getInspectValue() { + return inspectValue; } - public void setNumericalValue(String numericalValue) { - this.numericalValue = numericalValue; + public void setInspectValue(String inspectValue) { + this.inspectValue = inspectValue; } @Override public String toString() { - return "DataSource{" + - "id=" + id + - ", dataModelNumber='" + dataModelNumber + '\'' + - ", dataBatchNumber='" + dataBatchNumber + '\'' + - ", dataMachineCode='" + dataMachineCode + '\'' + - ", productNumber='" + productNumber + '\'' + - ", material='" + material + '\'' + - ", dataName='" + dataName + '\'' + - ", numericalValue='" + numericalValue + '\'' + - '}'; + return "DataSource{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", partNo='" + partNo + '\'' + ", inspectionItemCode='" + inspectionItemCode + '\'' + ", inspectValue='" + inspectValue + '\'' + '}'; } } From bee89dd24afe7df994c41fc5c5bd684cfb311b06 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Mon, 28 Feb 2022 20:40:27 +0800 Subject: [PATCH 03/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=A1=A8Entity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/model/entity/DataSource.java | 8 +- .../com/xkrs/model/entity/FileEntity.java | 100 ++++++----- .../com/xkrs/model/entity/PictureEntity.java | 115 +++++++++++++ .../com/xkrs/model/entity/SpecEntity.java | 157 ++++++++++++++++++ 4 files changed, 322 insertions(+), 58 deletions(-) create mode 100644 src/main/java/com/xkrs/model/entity/PictureEntity.java create mode 100644 src/main/java/com/xkrs/model/entity/SpecEntity.java diff --git a/src/main/java/com/xkrs/model/entity/DataSource.java b/src/main/java/com/xkrs/model/entity/DataSource.java index 4562324..b9e6978 100644 --- a/src/main/java/com/xkrs/model/entity/DataSource.java +++ b/src/main/java/com/xkrs/model/entity/DataSource.java @@ -24,12 +24,6 @@ public class DataSource { @Column(length = 85, columnDefinition = "varchar(85)") private String lotNo; - /** - * 批次号 - */ - @Column(length = 85, columnDefinition = "varchar(85)") - private String lotNo; - /** * 机器号 */ @@ -135,6 +129,6 @@ public class DataSource { @Override public String toString() { - return "DataSource{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", partNo='" + partNo + '\'' + ", inspectionItemCode='" + inspectionItemCode + '\'' + ", inspectValue='" + inspectValue + '\'' + '}'; + return "DataSource{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", partNo='" + partNo + '\'' + ", inspectionItemCode='" + inspectionItemCode + '\'' + ", inspectValue='" + inspectValue + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/model/entity/FileEntity.java b/src/main/java/com/xkrs/model/entity/FileEntity.java index df3beb0..21273c3 100644 --- a/src/main/java/com/xkrs/model/entity/FileEntity.java +++ b/src/main/java/com/xkrs/model/entity/FileEntity.java @@ -7,63 +7,61 @@ import javax.persistence.*; * @Date: 2022/1/20 15:01 */ @Entity -@Table(name = "file") +@Table(name = "qc_inspection_file") public class FileEntity { /** * 主键id */ @Id - @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "file_seq_gen") - @SequenceGenerator(name = "file_seq_gen", sequenceName = "file_id_seq",allocationSize = 1) + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_file_seq_gen") + @SequenceGenerator(name = "qc_inspection_file_seq_gen", sequenceName = "qc_inspection_file_id_seq", allocationSize = 1) private Integer id; - /** - * 机种号 - */ - @Column(length = 32, columnDefinition = "varchar(32)") - private String fileModelNumber; - /** * 批次号 */ - @Column(length = 32, columnDefinition = "varchar(32)") - private String fileBatchNumber; + @Column(length = 85, columnDefinition = "varchar(85)") + private String lotNo; /** * 机器号 */ - @Column(length = 32, columnDefinition = "varchar(32)") - private String fileMachineCode; + @Column(length = 85, columnDefinition = "varchar(85)") + private String machineNo; /** - * 产品编号 + * 物料号 */ - @Column(length = 32, columnDefinition = "varchar(32)") - private String fileProductNumber; + @Column(length = 85, columnDefinition = "varchar(85)") + private String materialNo; + + /** + * 模具号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String modelNo; + + /** + * 零件号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String partNo; /** * 上传模板的路径 */ + @Column(length = 1024, columnDefinition = "varchar(1024)") private String fileUploadPath; /** * 下载路径 */ + @Column(length = 1024, columnDefinition = "varchar(1024)") private String fileDownloadPath; public FileEntity() { } - public FileEntity(Integer id, String fileModelNumber, String fileBatchNumber, String fileMachineCode, String fileProductNumber, String fileUploadPath, String fileDownloadPath) { - this.id = id; - this.fileModelNumber = fileModelNumber; - this.fileBatchNumber = fileBatchNumber; - this.fileMachineCode = fileMachineCode; - this.fileProductNumber = fileProductNumber; - this.fileUploadPath = fileUploadPath; - this.fileDownloadPath = fileDownloadPath; - } - public Integer getId() { return id; } @@ -72,36 +70,44 @@ public class FileEntity { this.id = id; } - public String getFileModelNumber() { - return fileModelNumber; + public String getLotNo() { + return lotNo; } - public void setFileModelNumber(String fileModelNumber) { - this.fileModelNumber = fileModelNumber; + public void setLotNo(String lotNo) { + this.lotNo = lotNo; } - public String getFileBatchNumber() { - return fileBatchNumber; + public String getMachineNo() { + return machineNo; } - public void setFileBatchNumber(String fileBatchNumber) { - this.fileBatchNumber = fileBatchNumber; + public void setMachineNo(String machineNo) { + this.machineNo = machineNo; } - public String getFileMachineCode() { - return fileMachineCode; + public String getMaterialNo() { + return materialNo; } - public void setFileMachineCode(String fileMachineCode) { - this.fileMachineCode = fileMachineCode; + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; } - public String getFileProductNumber() { - return fileProductNumber; + public String getModelNo() { + return modelNo; } - public void setFileProductNumber(String fileProductNumber) { - this.fileProductNumber = fileProductNumber; + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getPartNo() { + return partNo; + } + + public void setPartNo(String partNo) { + this.partNo = partNo; } public String getFileUploadPath() { @@ -122,14 +128,6 @@ public class FileEntity { @Override public String toString() { - return "FileEntity{" + - "id=" + id + - ", fileModelNumber='" + fileModelNumber + '\'' + - ", fileBatchNumber='" + fileBatchNumber + '\'' + - ", fileMachineCode='" + fileMachineCode + '\'' + - ", fileProductNumber='" + fileProductNumber + '\'' + - ", fileUploadPath='" + fileUploadPath + '\'' + - ", fileDownloadPath='" + fileDownloadPath + '\'' + - '}'; + return "FileEntity{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", partNo='" + partNo + '\'' + ", fileUploadPath='" + fileUploadPath + '\'' + ", fileDownloadPath='" + fileDownloadPath + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/model/entity/PictureEntity.java b/src/main/java/com/xkrs/model/entity/PictureEntity.java new file mode 100644 index 0000000..1db0cdc --- /dev/null +++ b/src/main/java/com/xkrs/model/entity/PictureEntity.java @@ -0,0 +1,115 @@ +package com.xkrs.model.entity; + +import javax.persistence.*; + +@Entity +@Table(name = "qc_inspection_picture") +public class PictureEntity { + /** + * 主键id + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_picture_seq_gen") + @SequenceGenerator(name = "qc_inspection_picture_seq_gen", sequenceName = "qc_inspection_picture_id_seq", allocationSize = 1) + private Integer id; + + /** + * 批次号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String lotNo; + + /** + * 机器号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String machineNo; + + /** + * 物料号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String materialNo; + + /** + * 模具号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String modelNo; + + /** + * 零件号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String partNo; + + /** + * 图片路径 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String picturePath; + + public PictureEntity() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getLotNo() { + return lotNo; + } + + public void setLotNo(String lotNo) { + this.lotNo = lotNo; + } + + 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 getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getPartNo() { + return partNo; + } + + public void setPartNo(String partNo) { + this.partNo = partNo; + } + + public String getPicturePath() { + return picturePath; + } + + public void setPicturePath(String picturePath) { + this.picturePath = picturePath; + } + + @Override + public String toString() { + return "PictureEntity{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", partNo='" + partNo + '\'' + ", picturePath='" + picturePath + '\'' + '}'; + } +} diff --git a/src/main/java/com/xkrs/model/entity/SpecEntity.java b/src/main/java/com/xkrs/model/entity/SpecEntity.java new file mode 100644 index 0000000..4e9837e --- /dev/null +++ b/src/main/java/com/xkrs/model/entity/SpecEntity.java @@ -0,0 +1,157 @@ +package com.xkrs.model.entity; + +import javax.persistence.*; + +@Entity +@Table(name = "qc_inspection_spec") +public class SpecEntity { + /** + * 主键id + */ + @Id + @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "qc_inspection_spec_seq_gen") + @SequenceGenerator(name = "qc_inspection_spec_seq_gen", sequenceName = "qc_inspection_spec_id_seq", allocationSize = 1) + private Integer id; + + /** + * 零件号 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String partNo; + + /** + * 检验项代码 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectionItemCode; + + /** + * 最大值 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String max; + + /** + * 平均值 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String mean; + + /** + * 最小值 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String min; + + /** + * 单位 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String unit; + + /** + * 检验方法 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectionMethod; + + /** + * 检验标准 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String inspectionStandard; + + /** + * 备注 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String remark; + + public SpecEntity() { + } + + public Integer getId() { + return id; + } + + public void setId(Integer id) { + this.id = id; + } + + public String getPartNo() { + return partNo; + } + + public void setPartNo(String partNo) { + this.partNo = partNo; + } + + public String getInspectionItemCode() { + return inspectionItemCode; + } + + public void setInspectionItemCode(String inspectionItemCode) { + this.inspectionItemCode = inspectionItemCode; + } + + public String getMax() { + return max; + } + + public void setMax(String max) { + this.max = max; + } + + public String getMean() { + return mean; + } + + public void setMean(String mean) { + this.mean = mean; + } + + public String getMin() { + return min; + } + + public void setMin(String min) { + this.min = min; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getInspectionMethod() { + return inspectionMethod; + } + + public void setInspectionMethod(String inspectionMethod) { + this.inspectionMethod = inspectionMethod; + } + + public String getInspectionStandard() { + return inspectionStandard; + } + + public void setInspectionStandard(String inspectionStandard) { + this.inspectionStandard = inspectionStandard; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } + + @Override + public String toString() { + return "SpecEntity{" + "id=" + id + ", partNo='" + partNo + '\'' + ", inspectionItemCode='" + inspectionItemCode + '\'' + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", inspectionMethod='" + inspectionMethod + '\'' + ", inspectionStandard='" + inspectionStandard + '\'' + ", remark='" + remark + '\'' + '}'; + } +} From 7e3f433e160ac588a2fa189ac8929daa9598413c Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Mon, 28 Feb 2022 21:01:46 +0800 Subject: [PATCH 04/20] =?UTF-8?q?=E3=80=82?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xkrs/model/entity/DataDict.java | 2 +- .../java/com/xkrs/model/qo/DataDictQo.java | 32 +++++++++++-------- .../com/xkrs/model/qo/DataDictUpdateQo.java | 17 ++++++---- 3 files changed, 29 insertions(+), 22 deletions(-) diff --git a/src/main/java/com/xkrs/model/entity/DataDict.java b/src/main/java/com/xkrs/model/entity/DataDict.java index 78a363c..049cf61 100644 --- a/src/main/java/com/xkrs/model/entity/DataDict.java +++ b/src/main/java/com/xkrs/model/entity/DataDict.java @@ -25,7 +25,7 @@ public class DataDict { private String inspectionItemCode; /** - * 质检项代码 + * 质检项名称 */ @Column(length = 85, columnDefinition = "varchar(85)") private String inspectionItemName; diff --git a/src/main/java/com/xkrs/model/qo/DataDictQo.java b/src/main/java/com/xkrs/model/qo/DataDictQo.java index e3b68a0..b3b2c67 100644 --- a/src/main/java/com/xkrs/model/qo/DataDictQo.java +++ b/src/main/java/com/xkrs/model/qo/DataDictQo.java @@ -1,6 +1,7 @@ package com.xkrs.model.qo; import com.xkrs.model.validation.DataDictQoInsert; + import javax.validation.constraints.NotBlank; /** @@ -10,30 +11,33 @@ import javax.validation.constraints.NotBlank; public class DataDictQo { /** - * 中文名称 + * 质检项代码 */ - @NotBlank(message = "{DataDict.dictChineseName.blank}",groups={DataDictQoInsert.class}) - private String dictChineseName; + @NotBlank(message = "{DataDict.inspectionItemCode.blank}", groups = {DataDictQoInsert.class}) + private String inspectionItemCode; /** - * 英文变量值 + * 质检项名称 */ - @NotBlank(message = "{DataDict.dictEnglishName.blank}",groups={DataDictQoInsert.class}) - private String dictEnglishName; + @NotBlank(message = "{DataDict.inspectionItemName.blank}", groups = {DataDictQoInsert.class}) + private String inspectionItemName; - public String getDictChineseName() { - return dictChineseName; + public DataDictQo() { } - public void setDictChineseName(String dictChineseName) { - this.dictChineseName = dictChineseName; + public String getInspectionItemCode() { + return inspectionItemCode; } - public String getDictEnglishName() { - return dictEnglishName; + public void setInspectionItemCode(String inspectionItemCode) { + this.inspectionItemCode = inspectionItemCode; } - public void setDictEnglishName(String dictEnglishName) { - this.dictEnglishName = dictEnglishName; + public String getInspectionItemName() { + return inspectionItemName; + } + + public void setInspectionItemName(String inspectionItemName) { + this.inspectionItemName = inspectionItemName; } } diff --git a/src/main/java/com/xkrs/model/qo/DataDictUpdateQo.java b/src/main/java/com/xkrs/model/qo/DataDictUpdateQo.java index a6ef452..f463eba 100644 --- a/src/main/java/com/xkrs/model/qo/DataDictUpdateQo.java +++ b/src/main/java/com/xkrs/model/qo/DataDictUpdateQo.java @@ -10,14 +10,17 @@ import javax.validation.constraints.NotBlank; */ public class DataDictUpdateQo { - @NotBlank(message = "{DataDict.id.blank}",groups={DataDictUpdateQoUpdate.class}) + @NotBlank(message = "{DataDict.id.blank}", groups = {DataDictUpdateQoUpdate.class}) private Integer id; /** * 中文名称 */ - @NotBlank(message = "{DataDict.dictChineseName.blank}",groups={DataDictUpdateQoUpdate.class}) - private String dictChineseName; + @NotBlank(message = "{DataDict.inspectionItemName.blank}", groups = {DataDictUpdateQoUpdate.class}) + private String inspectionItemName; + + public DataDictUpdateQo() { + } public Integer getId() { return id; @@ -27,11 +30,11 @@ public class DataDictUpdateQo { this.id = id; } - public String getDictChineseName() { - return dictChineseName; + public String getInspectionItemName() { + return inspectionItemName; } - public void setDictChineseName(String dictChineseName) { - this.dictChineseName = dictChineseName; + public void setInspectionItemName(String inspectionItemName) { + this.inspectionItemName = inspectionItemName; } } From 9d463735c6062de4cddf748d02713b04c0f9f497 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Mon, 28 Feb 2022 21:32:34 +0800 Subject: [PATCH 05/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=A1=A8Qo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/controller/DataDictController.java | 2 +- .../com/xkrs/model/qo/DataDictUpdateQo.java | 2 +- .../java/com/xkrs/model/qo/DataSourceQo.java | 103 +++++++++--------- src/main/java/com/xkrs/model/qo/FileQo.java | 78 ++++++++----- .../java/com/xkrs/model/qo/FileUpdateQo.java | 75 ++++++++----- .../service/impl/DataDictServiceImpl.java | 13 ++- .../service/impl/DataSourceServiceImpl.java | 21 ++-- .../xkrs/service/impl/FileServiceImpl.java | 12 +- 8 files changed, 170 insertions(+), 136 deletions(-) diff --git a/src/main/java/com/xkrs/controller/DataDictController.java b/src/main/java/com/xkrs/controller/DataDictController.java index f1df2d8..d4943c1 100644 --- a/src/main/java/com/xkrs/controller/DataDictController.java +++ b/src/main/java/com/xkrs/controller/DataDictController.java @@ -81,7 +81,7 @@ public class DataDictController { @Transactional(rollbackOn = Exception.class) public String updateDict(@RequestBody DataDictUpdateQo dataDictUpdateQo){ Locale locale = LocaleContextHolder.getLocale(); - dataDictDao.updateDict(dataDictUpdateQo.getId(),dataDictUpdateQo.getDictChineseName()); + dataDictDao.updateDict(dataDictUpdateQo.getId(),dataDictUpdateQo.getInspectionItemName()); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功!",locale); } } diff --git a/src/main/java/com/xkrs/model/qo/DataDictUpdateQo.java b/src/main/java/com/xkrs/model/qo/DataDictUpdateQo.java index f463eba..a81276b 100644 --- a/src/main/java/com/xkrs/model/qo/DataDictUpdateQo.java +++ b/src/main/java/com/xkrs/model/qo/DataDictUpdateQo.java @@ -14,7 +14,7 @@ public class DataDictUpdateQo { private Integer id; /** - * 中文名称 + * 质检项名称 */ @NotBlank(message = "{DataDict.inspectionItemName.blank}", groups = {DataDictUpdateQoUpdate.class}) private String inspectionItemName; diff --git a/src/main/java/com/xkrs/model/qo/DataSourceQo.java b/src/main/java/com/xkrs/model/qo/DataSourceQo.java index 6e34209..7c42c7f 100644 --- a/src/main/java/com/xkrs/model/qo/DataSourceQo.java +++ b/src/main/java/com/xkrs/model/qo/DataSourceQo.java @@ -1,9 +1,7 @@ package com.xkrs.model.qo; -import com.xkrs.model.validation.DataDictQoInsert; import com.xkrs.model.validation.DataSourceQoInsert; -import javax.persistence.Column; import javax.validation.constraints.NotBlank; /** @@ -11,100 +9,105 @@ import javax.validation.constraints.NotBlank; * @Date: 2022/1/19 16:37 */ public class DataSourceQo { - /** - * 机种号 - */ - @NotBlank(message = "{DataSource.dataModelNumber.blank}",groups={DataSourceQoInsert.class}) - private String dataModelNumber; /** * 批次号 */ - @NotBlank(message = "{DataSource.dataBatchNumber.blank}",groups={DataSourceQoInsert.class}) - private String dataBatchNumber; + @NotBlank(message = "{DataSource.lotNo.blank}", groups = {DataSourceQoInsert.class}) + private String lotNo; /** * 机器号 */ - @NotBlank(message = "{DataSource.dataMachineCode.blank}",groups={DataSourceQoInsert.class}) - private String dataMachineCode; + @NotBlank(message = "{DataSource.machineNo.blank}", groups = {DataSourceQoInsert.class}) + private String machineNo; /** - * 模具 + * 物料号 */ - @NotBlank(message = "{DataSource.productNumber.blank}",groups={DataSourceQoInsert.class}) - private String productNumber; + @NotBlank(message = "{DataSource.materialNo.blank}", groups = {DataSourceQoInsert.class}) + private String materialNo; /** - * 材料 + * 模具号 */ - private String material; + @NotBlank(message = "{DataSource.modelNo.blank}", groups = {DataSourceQoInsert.class}) + private String modelNo; /** - * 变量值 + * 零件号 */ - @NotBlank(message = "{DataSource.dataName.blank}",groups={DataSourceQoInsert.class}) - private String dataName; + @NotBlank(message = "{DataSource.partNo.blank}", groups = {DataSourceQoInsert.class}) + private String partNo; /** - * 监测的数值 + * 检验项代码 */ - @NotBlank(message = "{DataSource.numericalValue.blank}",groups={DataSourceQoInsert.class}) - private String numericalValue; + @NotBlank(message = "{DataSource.inspectionItemCode.blank}", groups = {DataSourceQoInsert.class}) + private String inspectionItemCode; - public String getDataModelNumber() { - return dataModelNumber; + /** + * 检验数值 + */ + @NotBlank(message = "{DataSource.inspectValue.blank}", groups = {DataSourceQoInsert.class}) + private String inspectValue; + + public DataSourceQo() { } - public void setDataModelNumber(String dataModelNumber) { - this.dataModelNumber = dataModelNumber; + public String getLotNo() { + return lotNo; } - public String getDataBatchNumber() { - return dataBatchNumber; + public void setLotNo(String lotNo) { + this.lotNo = lotNo; } - public void setDataBatchNumber(String dataBatchNumber) { - this.dataBatchNumber = dataBatchNumber; + public String getMachineNo() { + return machineNo; } - public String getDataMachineCode() { - return dataMachineCode; + public void setMachineNo(String machineNo) { + this.machineNo = machineNo; } - public void setDataMachineCode(String dataMachineCode) { - this.dataMachineCode = dataMachineCode; + public String getMaterialNo() { + return materialNo; } - public String getProductNumber() { - return productNumber; + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; } - public String getMaterial() { - return material; + public String getModelNo() { + return modelNo; } - public void setMaterial(String material) { - this.material = material; + public void setModelNo(String modelNo) { + this.modelNo = modelNo; } - public void setProductNumber(String productNumber) { - this.productNumber = productNumber; + public String getPartNo() { + return partNo; } - public String getDataName() { - return dataName; + public void setPartNo(String partNo) { + this.partNo = partNo; } - public void setDataName(String dataName) { - this.dataName = dataName; + public String getInspectionItemCode() { + return inspectionItemCode; } - public String getNumericalValue() { - return numericalValue; + public void setInspectionItemCode(String inspectionItemCode) { + this.inspectionItemCode = inspectionItemCode; } - public void setNumericalValue(String numericalValue) { - this.numericalValue = numericalValue; + public String getInspectValue() { + return inspectValue; + } + + public void setInspectValue(String inspectValue) { + this.inspectValue = inspectValue; } } diff --git a/src/main/java/com/xkrs/model/qo/FileQo.java b/src/main/java/com/xkrs/model/qo/FileQo.java index 88da44b..f1676d1 100644 --- a/src/main/java/com/xkrs/model/qo/FileQo.java +++ b/src/main/java/com/xkrs/model/qo/FileQo.java @@ -1,6 +1,7 @@ package com.xkrs.model.qo; import com.xkrs.model.validation.FileQoInsert; + import javax.validation.constraints.NotBlank; /** @@ -9,66 +10,83 @@ import javax.validation.constraints.NotBlank; */ public class FileQo { - /** - * 机种号 - */ - @NotBlank(message = "{FileEntity.fileModelNumber.blank}",groups={FileQoInsert.class}) - private String fileModelNumber; - /** * 批次号 */ - @NotBlank(message = "{FileEntity.fileBatchNumber.blank}",groups={FileQoInsert.class}) - private String fileBatchNumber; + @NotBlank(message = "{FileEntity.lotNo.blank}", groups = {FileQoInsert.class}) + private String lotNo; /** * 机器号 */ - @NotBlank(message = "{FileEntity.fileMachineCode.blank}",groups={FileQoInsert.class}) - private String fileMachineCode; + @NotBlank(message = "{FileEntity.machineNo.blank}", groups = {FileQoInsert.class}) + private String machineNo; /** - * 产品编号 + * 物料号 */ - @NotBlank(message = "{FileEntity.fileProductNumber.blank}",groups={FileQoInsert.class}) - private String fileProductNumber; + @NotBlank(message = "{FileEntity.materialNo.blank}", groups = {FileQoInsert.class}) + private String materialNo; + + /** + * 模具号 + */ + @NotBlank(message = "{FileEntity.modelNo.blank}", groups = {FileQoInsert.class}) + private String modelNo; + + /** + * 零件号 + */ + @NotBlank(message = "{FileEntity.partNo.blank}", groups = {FileQoInsert.class}) + private String partNo; /** * 上传模板的路径 */ - @NotBlank(message = "{FileEntity.fileUploadPath.blank}",groups={FileQoInsert.class}) + @NotBlank(message = "{FileEntity.fileUploadPath.blank}", groups = {FileQoInsert.class}) private String fileUploadPath; - public String getFileModelNumber() { - return fileModelNumber; + public FileQo() { } - public void setFileModelNumber(String fileModelNumber) { - this.fileModelNumber = fileModelNumber; + public String getLotNo() { + return lotNo; } - public String getFileBatchNumber() { - return fileBatchNumber; + public void setLotNo(String lotNo) { + this.lotNo = lotNo; } - public void setFileBatchNumber(String fileBatchNumber) { - this.fileBatchNumber = fileBatchNumber; + public String getMachineNo() { + return machineNo; } - public String getFileMachineCode() { - return fileMachineCode; + public void setMachineNo(String machineNo) { + this.machineNo = machineNo; } - public void setFileMachineCode(String fileMachineCode) { - this.fileMachineCode = fileMachineCode; + public String getMaterialNo() { + return materialNo; } - public String getFileProductNumber() { - return fileProductNumber; + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; } - public void setFileProductNumber(String fileProductNumber) { - this.fileProductNumber = fileProductNumber; + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getPartNo() { + return partNo; + } + + public void setPartNo(String partNo) { + this.partNo = partNo; } public String getFileUploadPath() { diff --git a/src/main/java/com/xkrs/model/qo/FileUpdateQo.java b/src/main/java/com/xkrs/model/qo/FileUpdateQo.java index 9a33ca4..d681616 100644 --- a/src/main/java/com/xkrs/model/qo/FileUpdateQo.java +++ b/src/main/java/com/xkrs/model/qo/FileUpdateQo.java @@ -11,59 +11,76 @@ import javax.validation.constraints.NotBlank; */ public class FileUpdateQo { - /** - * 机种号 - */ - @NotBlank(message = "{FileEntity.fileModelNumber.blank}",groups={FileUpdateQoUpdate.class}) - private String fileModelNumber; - /** * 批次号 */ - @NotBlank(message = "{FileEntity.fileBatchNumber.blank}",groups={FileUpdateQoUpdate.class}) - private String fileBatchNumber; + @NotBlank(message = "{FileEntity.lotNo.blank}", groups = {FileUpdateQoUpdate.class}) + private String lotNo; /** * 机器号 */ - @NotBlank(message = "{FileEntity.fileMachineCode.blank}",groups={FileUpdateQoUpdate.class}) - private String fileMachineCode; + @NotBlank(message = "{FileEntity.machineNo.blank}", groups = {FileUpdateQoUpdate.class}) + private String machineNo; /** - * 产品编号 + * 物料号 */ - @NotBlank(message = "{FileEntity.fileProductNumber.blank}",groups={FileUpdateQoUpdate.class}) - private String fileProductNumber; + @NotBlank(message = "{FileEntity.materialNo.blank}", groups = {FileUpdateQoUpdate.class}) + private String materialNo; - public String getFileModelNumber() { - return fileModelNumber; + /** + * 模具号 + */ + @NotBlank(message = "{FileEntity.modelNo.blank}", groups = {FileUpdateQoUpdate.class}) + private String modelNo; + + /** + * 零件号 + */ + @NotBlank(message = "{FileEntity.partNo.blank}", groups = {FileUpdateQoUpdate.class}) + private String partNo; + + public FileUpdateQo() { } - public void setFileModelNumber(String fileModelNumber) { - this.fileModelNumber = fileModelNumber; + public String getLotNo() { + return lotNo; } - public String getFileBatchNumber() { - return fileBatchNumber; + public void setLotNo(String lotNo) { + this.lotNo = lotNo; } - public void setFileBatchNumber(String fileBatchNumber) { - this.fileBatchNumber = fileBatchNumber; + public String getMachineNo() { + return machineNo; } - public String getFileMachineCode() { - return fileMachineCode; + public void setMachineNo(String machineNo) { + this.machineNo = machineNo; } - public void setFileMachineCode(String fileMachineCode) { - this.fileMachineCode = fileMachineCode; + public String getMaterialNo() { + return materialNo; } - public String getFileProductNumber() { - return fileProductNumber; + public void setMaterialNo(String materialNo) { + this.materialNo = materialNo; } - public void setFileProductNumber(String fileProductNumber) { - this.fileProductNumber = fileProductNumber; + public String getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getPartNo() { + return partNo; + } + + public void setPartNo(String partNo) { + this.partNo = partNo; } } diff --git a/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java b/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java index 6f22910..6d50b88 100644 --- a/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java @@ -25,6 +25,7 @@ public class DataDictServiceImpl implements DataDictService { /** * 添加字典数据 + * * @param dataDictQo * @return */ @@ -37,14 +38,14 @@ public class DataDictServiceImpl implements DataDictService { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该产品变量已存在,请勿重复添加!",locale); }*/ //DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName()); - DataDict englishName = dataDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName()); - if(englishName != null){ - return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该产品变量已存在,请勿重复添加!",locale); + DataDict englishName = dataDictDao.findByDictEnglishName(dataDictQo.getInspectionItemCode()); + if (englishName != null) { + return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该产品变量已存在,请勿重复添加!", locale); } DataDict dataDict = new DataDict(); - dataDict.setDictChineseName(dataDictQo.getDictChineseName()); - dataDict.setDictEnglishName(dataDictQo.getDictEnglishName()); + dataDict.setInspectionItemName(dataDictQo.getInspectionItemName()); + dataDict.setInspectionItemCode(dataDictQo.getInspectionItemCode()); dataDictDao.save(dataDict); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); } } diff --git a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java index f17a4d2..b776468 100644 --- a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java @@ -36,23 +36,18 @@ public class DataSourceServiceImpl implements DataSourceService { @Override public String insertDataSource(DataSourceQo dataSourceQo) { Locale locale = LocaleContextHolder.getLocale(); - DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataSourceQo.getDataName()); + DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataSourceQo.getInspectionItemCode()); if(byDictEnglishName == null){ - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"不存在该字典类型!",locale); } - /*DataSource byDataName = dataSourceDao.findByDataName(dataSourceQo.getDataName()); - if(byDataName != null){ - return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该字典类型数据已添加,请勿重复添加!",locale); - }*/ DataSource dataSource = new DataSource(); - dataSource.setDataModelNumber(dataSourceQo.getDataModelNumber()); - dataSource.setDataBatchNumber(dataSourceQo.getDataBatchNumber()); - dataSource.setDataMachineCode(dataSourceQo.getDataMachineCode()); - dataSource.setProductNumber(dataSourceQo.getProductNumber()); - dataSource.setMaterial(dataSourceQo.getMaterial()); - dataSource.setDataName(dataSourceQo.getDataName()); - dataSource.setNumericalValue(dataSourceQo.getNumericalValue()); + dataSource.setLotNo(dataSourceQo.getLotNo()); + dataSource.setMachineNo(dataSourceQo.getMachineNo()); + dataSource.setMaterialNo(dataSourceQo.getMaterialNo()); + dataSource.setModelNo(dataSourceQo.getModelNo()); + dataSource.setPartNo(dataSourceQo.getPartNo()); + dataSource.setInspectionItemCode(dataSourceQo.getInspectionItemCode()); + dataSource.setInspectValue(dataSourceQo.getInspectValue()); dataSourceDao.save(dataSource); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale); } diff --git a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java index f6705d3..a47f2d0 100644 --- a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java @@ -58,12 +58,12 @@ public class FileServiceImpl implements FileService { } String file = ExcelUploadUtil.memoryFile(fileExcel); FileEntity fileEntity1 = new FileEntity(); - fileEntity1.setFileModelNumber(fileQo.getFileModelNumber()); - fileEntity1.setFileBatchNumber(fileQo.getFileBatchNumber()); - fileEntity1.setFileMachineCode(fileQo.getFileMachineCode()); - fileEntity1.setFileProductNumber(fileQo.getFileProductNumber()); + fileEntity1.setLotNo(fileQo.getLotNo()); + fileEntity1.setMachineNo(fileQo.getMachineNo()); + fileEntity1.setMaterialNo(fileQo.getMaterialNo()); + fileEntity1.setModelNo(fileQo.getModelNo()); + fileEntity1.setPartNo(fileQo.getPartNo()); fileEntity1.setFileUploadPath(file); - fileDao.save(fileEntity1); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale); } @@ -86,7 +86,7 @@ public class FileServiceImpl implements FileService { if(maps == null || maps.size() == 0){ return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该产品的信息!",locale); } - Map map = new HashMap(); + Map map = new HashMap<>(); for(Map stringMap : maps){ map.put(stringMap.get("dataname"),stringMap.get("numericalvalue")); } From 480e505396820f14c4959db7767b970093acdd02 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 1 Mar 2022 09:12:50 +0800 Subject: [PATCH 06/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E6=95=B0=E6=8D=AE?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/controller/DataDictController.java | 3 +- .../xkrs/controller/DataSourceController.java | 41 +++++++------ .../com/xkrs/controller/FileController.java | 16 ++++-- src/main/java/com/xkrs/dao/DataDictDao.java | 16 ++---- src/main/java/com/xkrs/dao/DataSourceDao.java | 51 +++++------------ src/main/java/com/xkrs/dao/FileDao.java | 57 +++++++++++-------- .../service/impl/DataDictServiceImpl.java | 4 +- .../service/impl/DataSourceServiceImpl.java | 4 +- .../xkrs/service/impl/FileServiceImpl.java | 40 ++++++------- 9 files changed, 110 insertions(+), 122 deletions(-) diff --git a/src/main/java/com/xkrs/controller/DataDictController.java b/src/main/java/com/xkrs/controller/DataDictController.java index d4943c1..4744f1d 100644 --- a/src/main/java/com/xkrs/controller/DataDictController.java +++ b/src/main/java/com/xkrs/controller/DataDictController.java @@ -14,6 +14,7 @@ import javax.annotation.Resource; import javax.transaction.Transactional; import java.util.List; import java.util.Locale; +import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -68,7 +69,7 @@ public class DataDictController { @GetMapping("/selectDataDictById") public String selectDataDictById(@RequestParam("id") Integer id){ Locale locale = LocaleContextHolder.getLocale(); - DataDict dataDict = dataDictDao.findById(id); + DataDict dataDict = dataDictDao.findById(id).get(); return outputEncapsulationObject(PromptMessageEnum.SUCCESS,dataDict,locale); } diff --git a/src/main/java/com/xkrs/controller/DataSourceController.java b/src/main/java/com/xkrs/controller/DataSourceController.java index 4a36e25..a72e129 100644 --- a/src/main/java/com/xkrs/controller/DataSourceController.java +++ b/src/main/java/com/xkrs/controller/DataSourceController.java @@ -2,6 +2,7 @@ package com.xkrs.controller; import com.xkrs.dao.DataSourceDao; import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.DataSource; import com.xkrs.model.qo.DataSourceQo; import com.xkrs.service.DataSourceService; import org.springframework.context.i18n.LocaleContextHolder; @@ -29,46 +30,50 @@ public class DataSourceController { /** * 添加测量数据 + * * @param dataSourceQo * @return */ @PostMapping("/insertDataSource") - public String insertDataSource(@RequestBody DataSourceQo dataSourceQo){ + public String insertDataSource(@RequestBody DataSourceQo dataSourceQo) { return dataSourceService.insertDataSource(dataSourceQo); } /** * 查询某一产品的测量信息 - * @param dataModelNumber - * @param dataBatchNumber - * @param dataMachineCode - * @param productNumber + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param partNo 零件号 * @return */ @GetMapping("/selectDataSource") - public String selectDataSource(@RequestParam("dataModelNumber") String dataModelNumber, - @RequestParam("dataBatchNumber") String dataBatchNumber, - @RequestParam("dataMachineCode") String dataMachineCode, - @RequestParam("productNumber") String productNumber){ + public String selectDataSource(@RequestParam("lotNo") String lotNo, + @RequestParam("machineNo") String machineNo, + @RequestParam("materialNo") String materialNo, + @RequestParam("modelNo") String modelNo, + @RequestParam("partNo") String partNo) { Locale locale = LocaleContextHolder.getLocale(); - List> maps = dataSourceDao.selectDataSource(dataModelNumber, dataBatchNumber, dataMachineCode, productNumber); - if(maps == null || maps.size() == 0){ - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该产品的测量信息!",locale); + List dataSources = dataSourceDao.selectDataSource(lotNo, machineNo, materialNo, modelNo, partNo); + if (dataSources == null || dataSources.size() == 0) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale); } - return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataSources, locale); } /** * 查询全部的测量信息 + * * @return */ @GetMapping("/selectAllSource") - public String selectAllSource(){ + public String selectAllSource() { Locale locale = LocaleContextHolder.getLocale(); - List> maps = dataSourceDao.selectAllSource(); - if(maps == null || maps.size() == 0){ - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该产品的测量信息!",locale); + List dataSources = dataSourceDao.selectAllSource(); + if (dataSources == null || dataSources.size() == 0) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale); } - return outputEncapsulationObject(PromptMessageEnum.SUCCESS,maps,locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataSources, locale); } } diff --git a/src/main/java/com/xkrs/controller/FileController.java b/src/main/java/com/xkrs/controller/FileController.java index ff66370..88eda8f 100644 --- a/src/main/java/com/xkrs/controller/FileController.java +++ b/src/main/java/com/xkrs/controller/FileController.java @@ -8,11 +8,13 @@ import com.xkrs.service.FileService; import com.xkrs.util.ExcelUploadUtil; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.springframework.context.i18n.LocaleContextHolder; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; import javax.transaction.Transactional; import java.io.IOException; import java.util.Locale; @@ -34,6 +36,7 @@ public class FileController { /** * 上传模板信息 + * * @param fileQo * @param fileExcel * @return @@ -41,11 +44,12 @@ public class FileController { */ @PostMapping("/insertFileExcel") public String insertFileExcel(FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { - return fileService.insertFileExcel(fileQo,fileExcel); + return fileService.insertFileExcel(fileQo, fileExcel); } /** * 修改上传的模板信息 + * * @param fileUpdateQo * @param fileExcel * @return @@ -53,11 +57,11 @@ public class FileController { */ @PostMapping("/updateFileUploadPath") @Transactional(rollbackOn = Exception.class) - public String updateFileUploadPath(FileUpdateQo fileUpdateQo,@RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { + public String updateFileUploadPath(FileUpdateQo fileUpdateQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { Locale locale = LocaleContextHolder.getLocale(); String file = ExcelUploadUtil.memoryFile(fileExcel); - fileDao.updateFileUploadPath(fileUpdateQo.getFileModelNumber(),fileUpdateQo.getFileBatchNumber(),fileUpdateQo.getFileMachineCode(),fileUpdateQo.getFileProductNumber(),file); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功!",locale); + fileDao.updateFileUploadPath(fileUpdateQo.getLotNo(), fileUpdateQo.getMachineNo(), fileUpdateQo.getMaterialNo(), fileUpdateQo.getModelNo(), fileUpdateQo.getPartNo(), file); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale); } /** diff --git a/src/main/java/com/xkrs/dao/DataDictDao.java b/src/main/java/com/xkrs/dao/DataDictDao.java index e916427..3979fab 100644 --- a/src/main/java/com/xkrs/dao/DataDictDao.java +++ b/src/main/java/com/xkrs/dao/DataDictDao.java @@ -8,6 +8,7 @@ import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Component; import java.util.List; +import java.util.Optional; /** * @Author: XinYi Song @@ -17,25 +18,18 @@ import java.util.List; public interface DataDictDao extends JpaRepository, JpaSpecificationExecutor { /** - * 通过中文名称查询字典表数据 - * @param chineseName + * 通过质检项代码查询字典表的数据 + * @param inspectionItemCode * @return */ - DataDict findByDictChineseName(String chineseName); - - /** - * 通过英文变量查询字典表的数据 - * @param englishName - * @return - */ - DataDict findByDictEnglishName(String englishName); + Optional findByInspectionItemCode(String inspectionItemCode); /** * 根据id查询字典信息 * @param id * @return */ - DataDict findById(Integer id); + Optional findById(Integer id); /** * 根据id修改字典的信息 diff --git a/src/main/java/com/xkrs/dao/DataSourceDao.java b/src/main/java/com/xkrs/dao/DataSourceDao.java index eeec162..6fd175c 100644 --- a/src/main/java/com/xkrs/dao/DataSourceDao.java +++ b/src/main/java/com/xkrs/dao/DataSourceDao.java @@ -7,58 +7,33 @@ import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Component; import java.util.List; -import java.util.Map; +import java.util.Optional; /** * @Author: XinYi Song * @Date: 2022/1/19 16:41 */ @Component -public interface DataSourceDao extends JpaRepository, JpaSpecificationExecutor { +public interface DataSourceDao extends JpaRepository, JpaSpecificationExecutor { /** * 查询测量数据信息 - * @param dataModelNumber - * @param dataBatchNumber - * @param dataMachineCode - * @param productNumber + * + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param partNo 零件号 * @return */ - @Query(value = "select ds.data_model_number datamodelnumber, ds.data_batch_number databatchnumber, " + - "ds.data_machine_code datamachinecode, ds.product_number productnumber, ds.material material, dd.dict_chinese_name chinesename, " + - "ds.data_name dataname,ds.numerical_value numericalvalue " + - "from data_dict dd,data_source ds where ds.data_name = dd.dict_english_name and " + - "ds.data_model_number = :dataModelNumber and ds.data_batch_number = :dataBatchNumber and " + - "ds.data_machine_code = :dataMachineCode and ds.product_number = :productNumber",nativeQuery = true) - List> selectDataSource(String dataModelNumber, String dataBatchNumber, String dataMachineCode, String productNumber); - - /** - * 查询测量信息变量和测量值,用于模板的导入 - * @param dataModelNumber - * @param dataBatchNumber - * @param dataMachineCode - * @param productNumber - * @return - */ - @Query(value = "select data_name dataname,numerical_value numericalvalue from data_source " + - "where data_model_number = :dataModelNumber and data_batch_number = :dataBatchNumber " + - "and data_machine_code = :dataMachineCode and product_number = :productNumber",nativeQuery = true) - List> selectDataNameAndData(String dataModelNumber, String dataBatchNumber, String dataMachineCode, String productNumber); - - /** - * 通过英文变量查询信息 - * @param dataname - * @return - */ - DataSource findByDataName(String dataname); + @Query(value = "SELECT * FROM qc_inspection_data_source WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND part_no = ? ", nativeQuery = true) + List selectDataSource(String lotNo, String machineNo, String materialNo, String modelNo, String partNo); /** * 查询全部的测量信息 + * * @return */ - @Query(value = "select ds.data_model_number datamodelnumber, ds.data_batch_number databatchnumber, " + - "ds.data_machine_code datamachinecode, ds.product_number productnumber, ds.material material, dd.dict_chinese_name chinesename," + - "ds.data_name dataname,ds.numerical_value numericalvalue from data_dict dd,data_source ds " + - "where ds.data_name = dd.dict_english_name",nativeQuery = true) - List> selectAllSource(); + @Query(value = "SELECT * FROM qc_inspection_data_source", nativeQuery = true) + List selectAllSource(); } diff --git a/src/main/java/com/xkrs/dao/FileDao.java b/src/main/java/com/xkrs/dao/FileDao.java index 96ca8e3..d9fbca7 100644 --- a/src/main/java/com/xkrs/dao/FileDao.java +++ b/src/main/java/com/xkrs/dao/FileDao.java @@ -12,41 +12,48 @@ import org.springframework.stereotype.Component; * @Date: 2022/1/20 15:23 */ @Component -public interface FileDao extends JpaRepository, JpaSpecificationExecutor { +public interface FileDao extends JpaRepository, JpaSpecificationExecutor { /** - * 根据机种号,批次号,机器号,产品号查询文件信息 - * @param fileModelNumber - * @param fileBatchNumber - * @param fileMachineCode - * @param fileProductNumber + * 查询文件信息 + * + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param partNo 零件号 * @return */ - FileEntity findByFileModelNumberAndFileBatchNumberAndFileMachineCodeAndFileProductNumber(String fileModelNumber,String fileBatchNumber,String fileMachineCode,String fileProductNumber); + @Query(value = "SELECT * FROM qc_inspection_file WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND part_no = ? ", nativeQuery = true) + FileEntity selectFile(String lotNo, String machineNo, String materialNo, String modelNo, String partNo); /** - * 根据机种号,批次号,机器号,产品号修改模板上传信息 - * @param fileModelNumber - * @param fileBatchNumber - * @param fileMachineCode - * @param fileProductNumber - * @param fileUploadPath + * 修改模板上传信息 + * + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param partNo 零件号 + * @param fileUploadPath 模板路径 */ - @Modifying(clearAutomatically=true) - @Query(value = "update file set file_upload_path = ?5 where file_model_number = ?1 and file_batch_number = ?2 and file_machine_code = ?3 and file_product_number = ?4",nativeQuery = true) - void updateFileUploadPath(String fileModelNumber,String fileBatchNumber,String fileMachineCode,String fileProductNumber,String fileUploadPath); + @Modifying(clearAutomatically = true) + @Query(value = "UPDATE qc_inspection_file SET file_upload_path = ?6 WHERE lot_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND model_no = ?4 AND part_no = ?5 ", nativeQuery = true) + void updateFileUploadPath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String fileUploadPath); /** - * 根据机种号,批次号,机器号,产品号修改模板下载信息 - * @param fileModelNumber - * @param fileBatchNumber - * @param fileMachineCode - * @param fileProductNumber - * @param fileDownloadPath + * 修改文件下载信息 + * + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param partNo 零件号 + * @param fileDownloadPath 文件下载路径 */ - @Modifying(clearAutomatically=true) - @Query(value = "update file set file_download_path = ?5 where file_model_number = ?1 and file_batch_number = ?2 and file_machine_code = ?3 and file_product_number = ?4",nativeQuery = true) - void updateFileDownloadPath(String fileModelNumber,String fileBatchNumber,String fileMachineCode,String fileProductNumber,String fileDownloadPath); + @Modifying(clearAutomatically = true) + @Query(value = "UPDATE qc_inspection_file SET file_download_path = ?6 WHERE lot_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND model_no = ?4 AND part_no = ?5 ", nativeQuery = true) + void updateFileDownloadPath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String fileDownloadPath); } diff --git a/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java b/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java index 6d50b88..d16df05 100644 --- a/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java @@ -38,8 +38,8 @@ public class DataDictServiceImpl implements DataDictService { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该产品变量已存在,请勿重复添加!",locale); }*/ //DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName()); - DataDict englishName = dataDictDao.findByDictEnglishName(dataDictQo.getInspectionItemCode()); - if (englishName != null) { + DataDict dataDict1 = dataDictDao.findByInspectionItemCode(dataDictQo.getInspectionItemCode()).get(); + if (dataDict1 != null) { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该产品变量已存在,请勿重复添加!", locale); } DataDict dataDict = new DataDict(); diff --git a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java index b776468..e84a6f3 100644 --- a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java @@ -36,8 +36,8 @@ public class DataSourceServiceImpl implements DataSourceService { @Override public String insertDataSource(DataSourceQo dataSourceQo) { Locale locale = LocaleContextHolder.getLocale(); - DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataSourceQo.getInspectionItemCode()); - if(byDictEnglishName == null){ + DataDict dataDict = dataDictDao.findByInspectionItemCode(dataSourceQo.getInspectionItemCode()).get(); + if(dataDict == null){ return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"不存在该字典类型!",locale); } DataSource dataSource = new DataSource(); diff --git a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java index a47f2d0..6595dd1 100644 --- a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java @@ -4,6 +4,7 @@ import com.xkrs.dao.DataDictDao; import com.xkrs.dao.DataSourceDao; import com.xkrs.dao.FileDao; import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.DataSource; import com.xkrs.model.entity.FileEntity; import com.xkrs.model.qo.FileQo; import com.xkrs.service.FileService; @@ -15,7 +16,6 @@ import org.springframework.stereotype.Service; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; -import javax.servlet.http.HttpServletResponse; import javax.transaction.Transactional; import java.io.IOException; import java.util.HashMap; @@ -43,18 +43,19 @@ public class FileServiceImpl implements FileService { /** * 添加模板信息 + * * @param fileQo * @return */ @Override public String insertFileExcel(FileQo fileQo, MultipartFile fileExcel) throws IOException { Locale locale = LocaleContextHolder.getLocale(); - FileEntity fileEntity = fileDao.findByFileModelNumberAndFileBatchNumberAndFileMachineCodeAndFileProductNumber(fileQo.getFileModelNumber(), fileQo.getFileBatchNumber(), fileQo.getFileMachineCode(), fileQo.getFileProductNumber()); - if(fileEntity != null){ - return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"已存在该产品的模板!",locale); + FileEntity fileEntity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); + if (fileEntity != null) { + return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该产品的模板!", locale); } - if(fileExcel == null){ - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"模板不能为空!",locale); + if (fileExcel == null) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "模板不能为空!", locale); } String file = ExcelUploadUtil.memoryFile(fileExcel); FileEntity fileEntity1 = new FileEntity(); @@ -65,11 +66,12 @@ public class FileServiceImpl implements FileService { fileEntity1.setPartNo(fileQo.getPartNo()); fileEntity1.setFileUploadPath(file); fileDao.save(fileEntity1); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); } /** * 导出excel + * * @param fileQo * @return */ @@ -77,21 +79,21 @@ public class FileServiceImpl implements FileService { @Override public String exportExcel(FileQo fileQo) throws IOException, InvalidFormatException { Locale locale = LocaleContextHolder.getLocale(); - FileEntity entity = fileDao.findByFileModelNumberAndFileBatchNumberAndFileMachineCodeAndFileProductNumber(fileQo.getFileModelNumber(), fileQo.getFileBatchNumber(), fileQo.getFileMachineCode(), fileQo.getFileProductNumber()); - if(entity == null){ - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该产品的模板,请添加!",locale); + FileEntity entity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); + if (entity == null) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale); } String fileUploadPath = entity.getFileUploadPath(); - List> maps = dataSourceDao.selectDataNameAndData(fileQo.getFileModelNumber(), fileQo.getFileBatchNumber(), fileQo.getFileMachineCode(), fileQo.getFileProductNumber()); - if(maps == null || maps.size() == 0){ - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时没有该产品的信息!",locale); + List dataSources = dataSourceDao.selectDataSource(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); + if (dataSources == null || dataSources.size() == 0) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale); } - Map map = new HashMap<>(); - for(Map stringMap : maps){ - map.put(stringMap.get("dataname"),stringMap.get("numericalvalue")); + Map map = new HashMap<>(); + for (DataSource dataSource : dataSources) { + map.put(dataSource.getInspectionItemCode(), dataSource.getInspectValue()); } - String fill = ExportExcel.exportToProveExcel(map,fileUploadPath); - fileDao.updateFileDownloadPath(fileQo.getFileModelNumber(), fileQo.getFileBatchNumber(), fileQo.getFileMachineCode(), fileQo.getFileProductNumber(),fill); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS,fill,locale); + String fill = ExportExcel.exportToProveExcel(map, fileUploadPath); + fileDao.updateFileDownloadPath(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo(), fill); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fill, locale); } } From daf1d0a14c205bad33cdf3e2fe715e73ff3a3033 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 1 Mar 2022 09:36:56 +0800 Subject: [PATCH 07/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E8=A7=84=E6=A0=BC?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/controller/SpecController.java | 55 +++++++ src/main/java/com/xkrs/dao/SpecDao.java | 19 +++ src/main/java/com/xkrs/model/qo/SpecQo.java | 136 ++++++++++++++++++ .../xkrs/model/validation/SpecQoInsert.java | 8 ++ .../java/com/xkrs/service/SpecService.java | 19 +++ .../xkrs/service/impl/SpecServiceImpl.java | 42 ++++++ 6 files changed, 279 insertions(+) create mode 100644 src/main/java/com/xkrs/controller/SpecController.java create mode 100644 src/main/java/com/xkrs/dao/SpecDao.java create mode 100644 src/main/java/com/xkrs/model/qo/SpecQo.java create mode 100644 src/main/java/com/xkrs/model/validation/SpecQoInsert.java create mode 100644 src/main/java/com/xkrs/service/SpecService.java create mode 100644 src/main/java/com/xkrs/service/impl/SpecServiceImpl.java diff --git a/src/main/java/com/xkrs/controller/SpecController.java b/src/main/java/com/xkrs/controller/SpecController.java new file mode 100644 index 0000000..8a1b718 --- /dev/null +++ b/src/main/java/com/xkrs/controller/SpecController.java @@ -0,0 +1,55 @@ +package com.xkrs.controller; + +import com.xkrs.dao.SpecDao; +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.SpecEntity; +import com.xkrs.model.qo.SpecQo; +import com.xkrs.service.SpecService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RestController; + +import javax.annotation.Resource; +import java.util.Locale; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 16:01 + */ +@RestController +public class SpecController { + + @Resource + private SpecService specService; + + @Resource + private SpecDao specDao; + + /** + * 添加规格数据 + * + * @param specQo + */ + @PostMapping("/insertSpec") + public String insertSpec(SpecQo specQo) { + return specService.insertSpec(specQo); + } + + /** + * 查询规格信息 + */ + @PostMapping("/selectSpec") + public String selectSpec(@RequestBody SpecQo specQo) { + Locale locale = LocaleContextHolder.getLocale(); + String partNo = specQo.getPartNo(); + String inspectionItemCode = specQo.getInspectionItemCode(); + SpecEntity specEntity = specDao.findByPartNoAndInspectionItemCode(partNo, inspectionItemCode).get(); + if (specEntity == null) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, specEntity, locale); + } +} diff --git a/src/main/java/com/xkrs/dao/SpecDao.java b/src/main/java/com/xkrs/dao/SpecDao.java new file mode 100644 index 0000000..57638e7 --- /dev/null +++ b/src/main/java/com/xkrs/dao/SpecDao.java @@ -0,0 +1,19 @@ +package com.xkrs.dao; + +import com.xkrs.model.entity.SpecEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.stereotype.Component; + +import java.util.Optional; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 16:41 + */ +@Component +public interface SpecDao extends JpaRepository, JpaSpecificationExecutor { + + Optional findByPartNoAndInspectionItemCode(String partNo, String inspectionItemCode); + +} diff --git a/src/main/java/com/xkrs/model/qo/SpecQo.java b/src/main/java/com/xkrs/model/qo/SpecQo.java new file mode 100644 index 0000000..6984bc1 --- /dev/null +++ b/src/main/java/com/xkrs/model/qo/SpecQo.java @@ -0,0 +1,136 @@ +package com.xkrs.model.qo; + +import com.xkrs.model.validation.SpecQoInsert; + +import javax.validation.constraints.NotBlank; + +public class SpecQo { + + /** + * 零件号 + */ + @NotBlank(message = "{SpecEntity.partNo.blank}", groups = {SpecQoInsert.class}) + private String partNo; + + /** + * 检验项代码 + */ + @NotBlank(message = "{SpecEntity.inspectionItemCode.blank}", groups = {SpecQoInsert.class}) + private String inspectionItemCode; + + /** + * 最大值 + */ + @NotBlank(message = "{SpecEntity.max.blank}", groups = {SpecQoInsert.class}) + private String max; + + /** + * 平均值 + */ + @NotBlank(message = "{SpecEntity.mean.blank}", groups = {SpecQoInsert.class}) + private String mean; + + /** + * 最小值 + */ + @NotBlank(message = "{SpecEntity.min.blank}", groups = {SpecQoInsert.class}) + private String min; + + /** + * 单位 + */ + @NotBlank(message = "{SpecEntity.unit.blank}", groups = {SpecQoInsert.class}) + private String unit; + + /** + * 检验方法 + */ + @NotBlank(message = "{SpecEntity.inspectionMethod.blank}", groups = {SpecQoInsert.class}) + private String inspectionMethod; + + /** + * 检验标准 + */ + @NotBlank(message = "{SpecEntity.inspectionStandard.blank}", groups = {SpecQoInsert.class}) + private String inspectionStandard; + + /** + * 备注 + */ + private String remark; + + public SpecQo() { + } + + public String getPartNo() { + return partNo; + } + + public void setPartNo(String partNo) { + this.partNo = partNo; + } + + public String getInspectionItemCode() { + return inspectionItemCode; + } + + public void setInspectionItemCode(String inspectionItemCode) { + this.inspectionItemCode = inspectionItemCode; + } + + public String getMax() { + return max; + } + + public void setMax(String max) { + this.max = max; + } + + public String getMean() { + return mean; + } + + public void setMean(String mean) { + this.mean = mean; + } + + public String getMin() { + return min; + } + + public void setMin(String min) { + this.min = min; + } + + public String getUnit() { + return unit; + } + + public void setUnit(String unit) { + this.unit = unit; + } + + public String getInspectionMethod() { + return inspectionMethod; + } + + public void setInspectionMethod(String inspectionMethod) { + this.inspectionMethod = inspectionMethod; + } + + public String getInspectionStandard() { + return inspectionStandard; + } + + public void setInspectionStandard(String inspectionStandard) { + this.inspectionStandard = inspectionStandard; + } + + public String getRemark() { + return remark; + } + + public void setRemark(String remark) { + this.remark = remark; + } +} diff --git a/src/main/java/com/xkrs/model/validation/SpecQoInsert.java b/src/main/java/com/xkrs/model/validation/SpecQoInsert.java new file mode 100644 index 0000000..93f09aa --- /dev/null +++ b/src/main/java/com/xkrs/model/validation/SpecQoInsert.java @@ -0,0 +1,8 @@ +package com.xkrs.model.validation; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 10:22 + */ +public interface SpecQoInsert { +} diff --git a/src/main/java/com/xkrs/service/SpecService.java b/src/main/java/com/xkrs/service/SpecService.java new file mode 100644 index 0000000..d215ea4 --- /dev/null +++ b/src/main/java/com/xkrs/service/SpecService.java @@ -0,0 +1,19 @@ +package com.xkrs.service; + +import com.xkrs.model.qo.SpecQo; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 15:24 + */ +public interface SpecService { + + /** + * 添加规格数据 + * + * @param specQo + * @return + */ + String insertSpec(SpecQo specQo); + +} diff --git a/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java b/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java new file mode 100644 index 0000000..66fbb4b --- /dev/null +++ b/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java @@ -0,0 +1,42 @@ +package com.xkrs.service.impl; + +import com.xkrs.dao.SpecDao; +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.SpecEntity; +import com.xkrs.model.qo.SpecQo; +import com.xkrs.service.SpecService; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.stereotype.Service; + +import javax.annotation.Resource; +import java.util.Locale; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +@Service +public class SpecServiceImpl implements SpecService { + + @Resource + private SpecDao specDao; + + @Override + public String insertSpec(SpecQo specQo) { + Locale locale = LocaleContextHolder.getLocale(); + SpecEntity specEntity = specDao.findByPartNoAndInspectionItemCode(specQo.getPartNo(), specQo.getInspectionItemCode()).get(); + if (specEntity != null) { + return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该测量规格!", locale); + } + SpecEntity specEntity1 = new SpecEntity(); + specEntity1.setPartNo(specQo.getPartNo()); + specEntity1.setInspectionItemCode(specQo.getInspectionItemCode()); + specEntity1.setMax(specQo.getMax()); + specEntity1.setMean(specQo.getMean()); + specEntity1.setMin(specQo.getMin()); + specEntity1.setUnit(specQo.getUnit()); + specEntity1.setInspectionMethod(specQo.getInspectionMethod()); + specEntity1.setInspectionStandard(specQo.getInspectionStandard()); + specEntity1.setRemark(specQo.getRemark()); + specDao.save(specEntity1); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); + } +} From 9cf2698ec80f9702a02d65aecb96d7b2ed37b48c Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 1 Mar 2022 10:04:28 +0800 Subject: [PATCH 08/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=A1=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/controller/PictureController.java | 62 ++++++++++++++ src/main/java/com/xkrs/dao/PictureDao.java | 46 +++++++++++ .../java/com/xkrs/model/qo/PictureQo.java | 82 +++++++++++++++++++ .../model/validation/PictureQoInsert.java | 8 ++ .../java/com/xkrs/service/PictureService.java | 19 +++++ .../xkrs/service/impl/PictureServiceImpl.java | 48 +++++++++++ .../java/com/xkrs/util/ExcelUploadUtil.java | 3 +- 7 files changed, 267 insertions(+), 1 deletion(-) create mode 100644 src/main/java/com/xkrs/controller/PictureController.java create mode 100644 src/main/java/com/xkrs/dao/PictureDao.java create mode 100644 src/main/java/com/xkrs/model/qo/PictureQo.java create mode 100644 src/main/java/com/xkrs/model/validation/PictureQoInsert.java create mode 100644 src/main/java/com/xkrs/service/PictureService.java create mode 100644 src/main/java/com/xkrs/service/impl/PictureServiceImpl.java diff --git a/src/main/java/com/xkrs/controller/PictureController.java b/src/main/java/com/xkrs/controller/PictureController.java new file mode 100644 index 0000000..e9fb95d --- /dev/null +++ b/src/main/java/com/xkrs/controller/PictureController.java @@ -0,0 +1,62 @@ +package com.xkrs.controller; + +import com.xkrs.dao.PictureDao; +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.PictureEntity; +import com.xkrs.model.entity.SpecEntity; +import com.xkrs.model.qo.FileQo; +import com.xkrs.model.qo.PictureQo; +import com.xkrs.service.PictureService; +import org.apache.poi.openxml4j.exceptions.InvalidFormatException; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestBody; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.Locale; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 16:01 + */ +@RestController +public class PictureController { + + @Resource + private PictureService pictureService; + + @Resource + private PictureDao pictureDao; + + /** + * 上传图片 + */ + @PostMapping("/insertPicture") + public String insertPicture(PictureQo pictureQo, @RequestParam("filePicture") MultipartFile filePicture) throws IOException { + return pictureService.insertPicture(pictureQo, filePicture); + } + + /** + * 查询图片 + */ + @PostMapping("/selectPicture") + public String selectPicture(@RequestBody PictureQo pictureQo) throws IOException, InvalidFormatException { + Locale locale = LocaleContextHolder.getLocale(); + String lotNo = pictureQo.getLotNo(); + String machineNo = pictureQo.getMachineNo(); + String materialNo = pictureQo.getMaterialNo(); + String modelNo = pictureQo.getModelNo(); + String partNo = pictureQo.getPartNo(); + PictureEntity pictureEntity = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo).get(); + if (pictureEntity == null) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的图片!", locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntity, locale); + } +} diff --git a/src/main/java/com/xkrs/dao/PictureDao.java b/src/main/java/com/xkrs/dao/PictureDao.java new file mode 100644 index 0000000..5118456 --- /dev/null +++ b/src/main/java/com/xkrs/dao/PictureDao.java @@ -0,0 +1,46 @@ +package com.xkrs.dao; + +import com.xkrs.model.entity.PictureEntity; +import org.springframework.data.jpa.repository.JpaRepository; +import org.springframework.data.jpa.repository.JpaSpecificationExecutor; +import org.springframework.data.jpa.repository.Modifying; +import org.springframework.data.jpa.repository.Query; +import org.springframework.stereotype.Component; + +import java.util.List; +import java.util.Optional; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 16:41 + */ +@Component +public interface PictureDao extends JpaRepository, JpaSpecificationExecutor { + + /** + * 查询图片信息 + * + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param partNo 零件号 + * @return + */ + @Query(value = "SELECT * FROM qc_inspection_picture WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND part_no = ? ", nativeQuery = true) + Optional selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String partNo); + + /** + * 修改图片路径信息 + * + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param partNo 零件号 + * @param picturePath 图片路径 + */ + @Modifying(clearAutomatically = true) + @Query(value = "UPDATE qc_inspection_picture SET picture_path = ?6 where lot_no = ?1 and machine_no = ?2 and material_no = ?3 and model_no = ?4 and part_no = ?5",nativeQuery = true) + void updatePicturePath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String picturePath); +} diff --git a/src/main/java/com/xkrs/model/qo/PictureQo.java b/src/main/java/com/xkrs/model/qo/PictureQo.java new file mode 100644 index 0000000..ad7a310 --- /dev/null +++ b/src/main/java/com/xkrs/model/qo/PictureQo.java @@ -0,0 +1,82 @@ +package com.xkrs.model.qo; + +import com.xkrs.model.validation.PictureQoInsert; + +import javax.validation.constraints.NotBlank; + +public class PictureQo { + + /** + * 批次号 + */ + @NotBlank(message = "{PictureEntity.lotNo.blank}", groups = {PictureQoInsert.class}) + private String lotNo; + + /** + * 机器号 + */ + @NotBlank(message = "{PictureEntity.machineNo.blank}", groups = {PictureQoInsert.class}) + private String machineNo; + + /** + * 物料号 + */ + @NotBlank(message = "{PictureEntity.materialNo.blank}", groups = {PictureQoInsert.class}) + private String materialNo; + + /** + * 模具号 + */ + @NotBlank(message = "{PictureEntity.modelNo.blank}", groups = {PictureQoInsert.class}) + private String modelNo; + + /** + * 零件号 + */ + @NotBlank(message = "{PictureEntity.partNo.blank}", groups = {PictureQoInsert.class}) + private String partNo; + + public PictureQo() { + } + + public String getLotNo() { + return lotNo; + } + + public void setLotNo(String lotNo) { + this.lotNo = lotNo; + } + + 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 getModelNo() { + return modelNo; + } + + public void setModelNo(String modelNo) { + this.modelNo = modelNo; + } + + public String getPartNo() { + return partNo; + } + + public void setPartNo(String partNo) { + this.partNo = partNo; + } + +} diff --git a/src/main/java/com/xkrs/model/validation/PictureQoInsert.java b/src/main/java/com/xkrs/model/validation/PictureQoInsert.java new file mode 100644 index 0000000..7036491 --- /dev/null +++ b/src/main/java/com/xkrs/model/validation/PictureQoInsert.java @@ -0,0 +1,8 @@ +package com.xkrs.model.validation; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 15:26 + */ +public interface PictureQoInsert { +} diff --git a/src/main/java/com/xkrs/service/PictureService.java b/src/main/java/com/xkrs/service/PictureService.java new file mode 100644 index 0000000..50386e7 --- /dev/null +++ b/src/main/java/com/xkrs/service/PictureService.java @@ -0,0 +1,19 @@ +package com.xkrs.service; + +import com.xkrs.model.qo.PictureQo; +import org.springframework.web.multipart.MultipartFile; + +import java.io.IOException; + +/** + * @Author: XinYi Song + * @Date: 2022/1/20 15:24 + */ +public interface PictureService { + + /** + * 添加图片 + */ + String insertPicture(PictureQo pictureQo, MultipartFile pictureFile)throws IOException; + +} diff --git a/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java b/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java new file mode 100644 index 0000000..b4343e6 --- /dev/null +++ b/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java @@ -0,0 +1,48 @@ +package com.xkrs.service.impl; + +import com.xkrs.dao.PictureDao; +import com.xkrs.encapsulation.PromptMessageEnum; +import com.xkrs.model.entity.PictureEntity; +import com.xkrs.model.qo.PictureQo; +import com.xkrs.service.PictureService; +import com.xkrs.util.ExcelUploadUtil; +import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.stereotype.Service; +import org.springframework.web.multipart.MultipartFile; + +import javax.annotation.Resource; +import java.io.IOException; +import java.util.Locale; + +import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; + +@Service +public class PictureServiceImpl implements PictureService { + + @Resource + private PictureDao pictureDao; + + @Override + public String insertPicture(PictureQo pictureQo, MultipartFile pictureFile) throws IOException { + Locale locale = LocaleContextHolder.getLocale(); + String lotNo = pictureQo.getLotNo(); + String machineNo = pictureQo.getMachineNo(); + String materialNo = pictureQo.getMaterialNo(); + String modelNo = pictureQo.getModelNo(); + String partNo = pictureQo.getPartNo(); + PictureEntity pictureEntity = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo).get(); + if (pictureEntity != null) { + return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale); + } + String file = ExcelUploadUtil.memoryFile(pictureFile); + PictureEntity pictureEntity1 = new PictureEntity(); + pictureEntity1.setLotNo(lotNo); + pictureEntity1.setMachineNo(machineNo); + pictureEntity1.setMaterialNo(materialNo); + pictureEntity1.setModelNo(modelNo); + pictureEntity1.setPartNo(partNo); + pictureEntity1.setPicturePath(file); + pictureDao.save(pictureEntity1); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); + } +} diff --git a/src/main/java/com/xkrs/util/ExcelUploadUtil.java b/src/main/java/com/xkrs/util/ExcelUploadUtil.java index d0096d5..c498ddf 100644 --- a/src/main/java/com/xkrs/util/ExcelUploadUtil.java +++ b/src/main/java/com/xkrs/util/ExcelUploadUtil.java @@ -29,7 +29,8 @@ public class ExcelUploadUtil { */ public static String memoryFile(MultipartFile fileExcel) throws IOException { //String uploadPath = "http://139.199.98.175:2088/wfTaskImage/"; - String uploadPath = "http://192.168.2.9:2088/"; +// String uploadPath = "http://192.168.2.9:2088/"; + String uploadPath = "http://118.24.27.47:4096/"; //获取原始文件名 String originalFilename = fileExcel.getOriginalFilename(); if (originalFilename != null && !"".equals(originalFilename)) { From 5ef4df2d6f6c58e5889f767026dc5dc2ad01a151 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 1 Mar 2022 10:20:08 +0800 Subject: [PATCH 09/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0dao=E8=BF=94=E5=9B=9E?= =?UTF-8?q?=E5=80=BC=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/controller/DataDictController.java | 36 +++++++++++-------- .../xkrs/controller/PictureController.java | 25 ++++++------- src/main/java/com/xkrs/dao/FileDao.java | 4 ++- .../service/impl/DataDictServiceImpl.java | 11 ++---- .../service/impl/DataSourceServiceImpl.java | 10 +++--- .../xkrs/service/impl/FileServiceImpl.java | 15 ++++---- .../xkrs/service/impl/PictureServiceImpl.java | 5 +-- src/main/java/com/xkrs/util/Query.java | 12 +++---- 8 files changed, 59 insertions(+), 59 deletions(-) diff --git a/src/main/java/com/xkrs/controller/DataDictController.java b/src/main/java/com/xkrs/controller/DataDictController.java index 4744f1d..3e1cec4 100644 --- a/src/main/java/com/xkrs/controller/DataDictController.java +++ b/src/main/java/com/xkrs/controller/DataDictController.java @@ -36,53 +36,59 @@ public class DataDictController { /** * 添加字典变量数据 + * * @param dataDictQo * @return */ @PostMapping("/insertDataDict") - public String insertDataDict(@RequestBody DataDictQo dataDictQo){ + public String insertDataDict(@RequestBody DataDictQo dataDictQo) { return dataDictService.insertDataDict(dataDictQo); } /** * 动态多条件查询字典信息 - * @param dictChineseName - * @param dictEnglishName + * + * @param inspectionItemName + * @param inspectionItemCode * @return */ @GetMapping("/selectDataDict") - public String selectDataDict(@RequestParam("dictChineseName") String dictChineseName, - @RequestParam("dictEnglishName") String dictEnglishName){ + public String selectDataDict(@RequestParam("inspectionItemName") String inspectionItemName, @RequestParam("inspectionItemCode") String inspectionItemCode) { Locale locale = LocaleContextHolder.getLocale(); - List dataDict = query.selectDataDict(dictChineseName, dictEnglishName); - if(dataDict == null || dataDict.size() == 0){ - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"暂时还没有该型号类型的字典信息!",locale); + List dataDict = query.selectDataDict(inspectionItemName, inspectionItemCode); + if (dataDict == null || dataDict.size() == 0) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale); } - return outputEncapsulationObject(PromptMessageEnum.SUCCESS,dataDict,locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataDict, locale); } /** * 根据id查询字典信息,用于数据回显,方便进行修改操作 + * * @param id * @return */ @GetMapping("/selectDataDictById") - public String selectDataDictById(@RequestParam("id") Integer id){ + public String selectDataDictById(@RequestParam("id") Integer id) { Locale locale = LocaleContextHolder.getLocale(); - DataDict dataDict = dataDictDao.findById(id).get(); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS,dataDict,locale); + Optional byId = dataDictDao.findById(id); + if (byId.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale); + } + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byId.get(), locale); } /** * 根据id修改字典信息 + * * @param dataDictUpdateQo * @return */ @PostMapping("/updateDict") @Transactional(rollbackOn = Exception.class) - public String updateDict(@RequestBody DataDictUpdateQo dataDictUpdateQo){ + public String updateDict(@RequestBody DataDictUpdateQo dataDictUpdateQo) { Locale locale = LocaleContextHolder.getLocale(); - dataDictDao.updateDict(dataDictUpdateQo.getId(),dataDictUpdateQo.getInspectionItemName()); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"修改成功!",locale); + dataDictDao.updateDict(dataDictUpdateQo.getId(), dataDictUpdateQo.getInspectionItemName()); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale); } } diff --git a/src/main/java/com/xkrs/controller/PictureController.java b/src/main/java/com/xkrs/controller/PictureController.java index e9fb95d..030287a 100644 --- a/src/main/java/com/xkrs/controller/PictureController.java +++ b/src/main/java/com/xkrs/controller/PictureController.java @@ -3,14 +3,11 @@ package com.xkrs.controller; import com.xkrs.dao.PictureDao; import com.xkrs.encapsulation.PromptMessageEnum; import com.xkrs.model.entity.PictureEntity; -import com.xkrs.model.entity.SpecEntity; -import com.xkrs.model.qo.FileQo; import com.xkrs.model.qo.PictureQo; import com.xkrs.service.PictureService; -import org.apache.poi.openxml4j.exceptions.InvalidFormatException; import org.springframework.context.i18n.LocaleContextHolder; +import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; @@ -18,6 +15,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.IOException; import java.util.Locale; +import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -45,18 +43,17 @@ public class PictureController { /** * 查询图片 */ - @PostMapping("/selectPicture") - public String selectPicture(@RequestBody PictureQo pictureQo) throws IOException, InvalidFormatException { + @GetMapping("/selectPicture") + public String selectPicture(@RequestParam("lotNo") String lotNo, + @RequestParam("machineNo") String machineNo, + @RequestParam("materialNo") String materialNo, + @RequestParam("modelNo") String modelNo, + @RequestParam("partNo") String partNo) { Locale locale = LocaleContextHolder.getLocale(); - String lotNo = pictureQo.getLotNo(); - String machineNo = pictureQo.getMachineNo(); - String materialNo = pictureQo.getMaterialNo(); - String modelNo = pictureQo.getModelNo(); - String partNo = pictureQo.getPartNo(); - PictureEntity pictureEntity = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo).get(); - if (pictureEntity == null) { + Optional pictureEntity1 = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo); + if (pictureEntity1.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的图片!", locale); } - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntity, locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntity1.get(), locale); } } diff --git a/src/main/java/com/xkrs/dao/FileDao.java b/src/main/java/com/xkrs/dao/FileDao.java index d9fbca7..66d73c6 100644 --- a/src/main/java/com/xkrs/dao/FileDao.java +++ b/src/main/java/com/xkrs/dao/FileDao.java @@ -7,6 +7,8 @@ import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Component; +import java.util.Optional; + /** * @Author: XinYi Song * @Date: 2022/1/20 15:23 @@ -25,7 +27,7 @@ public interface FileDao extends JpaRepository, JpaSpecificati * @return */ @Query(value = "SELECT * FROM qc_inspection_file WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND part_no = ? ", nativeQuery = true) - FileEntity selectFile(String lotNo, String machineNo, String materialNo, String modelNo, String partNo); + Optional selectFile(String lotNo, String machineNo, String materialNo, String modelNo, String partNo); /** * 修改模板上传信息 diff --git a/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java b/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java index d16df05..4fa2227 100644 --- a/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/DataDictServiceImpl.java @@ -10,6 +10,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Locale; +import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -32,14 +33,8 @@ public class DataDictServiceImpl implements DataDictService { @Override public String insertDataDict(DataDictQo dataDictQo) { Locale locale = LocaleContextHolder.getLocale(); - //DataDict byDictChineseName = dataDictDao.findByDictChineseName(dataDictQo.getDictChineseName()); - /*DataDict chineseName = dataDictDao.findByModelNumberAndBatchNumberAndMachineCodeAndDictProductNumberAndDictChineseName(dataDictQo.getModelNumber(), dataDictQo.getBatchNumber(), dataDictQo.getMachineCode(), dataDictQo.getDictProductNumber(), dataDictQo.getDictChineseName()); - if(chineseName != null){ - return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT,"该产品变量已存在,请勿重复添加!",locale); - }*/ - //DataDict byDictEnglishName = dataDictDao.findByDictEnglishName(dataDictQo.getDictEnglishName()); - DataDict dataDict1 = dataDictDao.findByInspectionItemCode(dataDictQo.getInspectionItemCode()).get(); - if (dataDict1 != null) { + Optional byInspectionItemCode = dataDictDao.findByInspectionItemCode(dataDictQo.getInspectionItemCode()); + if (byInspectionItemCode.isPresent()) { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "该产品变量已存在,请勿重复添加!", locale); } DataDict dataDict = new DataDict(); diff --git a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java index e84a6f3..f482d86 100644 --- a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java @@ -12,6 +12,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Locale; +import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -30,15 +31,16 @@ public class DataSourceServiceImpl implements DataSourceService { /** * 添加测量数据 + * * @param dataSourceQo * @return */ @Override public String insertDataSource(DataSourceQo dataSourceQo) { Locale locale = LocaleContextHolder.getLocale(); - DataDict dataDict = dataDictDao.findByInspectionItemCode(dataSourceQo.getInspectionItemCode()).get(); - if(dataDict == null){ - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE,"不存在该字典类型!",locale); + Optional byInspectionItemCode = dataDictDao.findByInspectionItemCode(dataSourceQo.getInspectionItemCode()); + if (byInspectionItemCode.isPresent()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "已存在该字典类型!", locale); } DataSource dataSource = new DataSource(); dataSource.setLotNo(dataSourceQo.getLotNo()); @@ -49,6 +51,6 @@ public class DataSourceServiceImpl implements DataSourceService { dataSource.setInspectionItemCode(dataSourceQo.getInspectionItemCode()); dataSource.setInspectValue(dataSourceQo.getInspectValue()); dataSourceDao.save(dataSource); - return outputEncapsulationObject(PromptMessageEnum.SUCCESS,"添加成功!",locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); } } diff --git a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java index 6595dd1..fd1a470 100644 --- a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java @@ -18,10 +18,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.transaction.Transactional; import java.io.IOException; -import java.util.HashMap; -import java.util.List; -import java.util.Locale; -import java.util.Map; +import java.util.*; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -50,8 +47,8 @@ public class FileServiceImpl implements FileService { @Override public String insertFileExcel(FileQo fileQo, MultipartFile fileExcel) throws IOException { Locale locale = LocaleContextHolder.getLocale(); - FileEntity fileEntity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); - if (fileEntity != null) { + Optional fileEntity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); + if (fileEntity.isPresent()) { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该产品的模板!", locale); } if (fileExcel == null) { @@ -79,11 +76,11 @@ public class FileServiceImpl implements FileService { @Override public String exportExcel(FileQo fileQo) throws IOException, InvalidFormatException { Locale locale = LocaleContextHolder.getLocale(); - FileEntity entity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); - if (entity == null) { + Optional fileEntity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); + if (fileEntity.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale); } - String fileUploadPath = entity.getFileUploadPath(); + String fileUploadPath = fileEntity.get().getFileUploadPath(); List dataSources = dataSourceDao.selectDataSource(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); if (dataSources == null || dataSources.size() == 0) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale); diff --git a/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java b/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java index b4343e6..7e5ca48 100644 --- a/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java @@ -13,6 +13,7 @@ import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.IOException; import java.util.Locale; +import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -30,8 +31,8 @@ public class PictureServiceImpl implements PictureService { String materialNo = pictureQo.getMaterialNo(); String modelNo = pictureQo.getModelNo(); String partNo = pictureQo.getPartNo(); - PictureEntity pictureEntity = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo).get(); - if (pictureEntity != null) { + Optional pictureEntity2 = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo); + if (pictureEntity2.isPresent()) { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale); } String file = ExcelUploadUtil.memoryFile(pictureFile); diff --git a/src/main/java/com/xkrs/util/Query.java b/src/main/java/com/xkrs/util/Query.java index 4c777d9..08481ab 100644 --- a/src/main/java/com/xkrs/util/Query.java +++ b/src/main/java/com/xkrs/util/Query.java @@ -4,7 +4,6 @@ import com.xkrs.dao.DataDictDao; import com.xkrs.model.entity.DataDict; import org.springframework.data.jpa.domain.Specification; import org.springframework.stereotype.Component; -import org.springframework.web.bind.annotation.RequestParam; import javax.annotation.Resource; import javax.persistence.criteria.CriteriaBuilder; @@ -26,18 +25,19 @@ public class Query { /** * 动态多条件查询字典信息 + * * @return */ - public List selectDataDict(String dictChineseName,String dictEnglishName) { + public List selectDataDict(String inspectionItemName, String inspectionItemCode) { Specification specification = new Specification() { @Override public Predicate toPredicate(Root root, CriteriaQuery criteriaQuery, CriteriaBuilder criteriaBuilder) { List list = new ArrayList<>(); - if(dictChineseName != null && !"".equals(dictChineseName)){ - list.add(criteriaBuilder.equal(root.get("dictChineseName").as(String.class), dictChineseName)); + if (inspectionItemName != null && !"".equals(inspectionItemName)) { + list.add(criteriaBuilder.equal(root.get("inspectionItemName").as(String.class), inspectionItemName)); } - if(dictEnglishName != null && !"".equals(dictEnglishName)){ - list.add(criteriaBuilder.equal(root.get("dictEnglishName").as(String.class), dictEnglishName)); + if (inspectionItemCode != null && !"".equals(inspectionItemCode)) { + list.add(criteriaBuilder.equal(root.get("inspectionItemCode").as(String.class), inspectionItemCode)); } Predicate[] predicates = new Predicate[list.size()]; return criteriaBuilder.and(list.toArray(predicates)); From b0afd5f4aa964790c192f5ead0403a7d943e31bf Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 1 Mar 2022 11:59:54 +0800 Subject: [PATCH 10/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/controller/FileController.java | 4 ++-- .../xkrs/controller/PictureController.java | 5 +---- .../com/xkrs/controller/SpecController.java | 19 ++++++++----------- src/main/java/com/xkrs/dao/DataDictDao.java | 6 +++--- .../service/impl/DataSourceServiceImpl.java | 4 ++-- .../xkrs/service/impl/SpecServiceImpl.java | 5 +++-- .../java/com/xkrs/util/ExcelUploadUtil.java | 2 -- 7 files changed, 19 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/xkrs/controller/FileController.java b/src/main/java/com/xkrs/controller/FileController.java index 88eda8f..d47dfec 100644 --- a/src/main/java/com/xkrs/controller/FileController.java +++ b/src/main/java/com/xkrs/controller/FileController.java @@ -43,7 +43,7 @@ public class FileController { * @throws IOException */ @PostMapping("/insertFileExcel") - public String insertFileExcel(FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { + public String insertFileExcel(@RequestBody FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { return fileService.insertFileExcel(fileQo, fileExcel); } @@ -57,7 +57,7 @@ public class FileController { */ @PostMapping("/updateFileUploadPath") @Transactional(rollbackOn = Exception.class) - public String updateFileUploadPath(FileUpdateQo fileUpdateQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { + public String updateFileUploadPath(@RequestBody FileUpdateQo fileUpdateQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { Locale locale = LocaleContextHolder.getLocale(); String file = ExcelUploadUtil.memoryFile(fileExcel); fileDao.updateFileUploadPath(fileUpdateQo.getLotNo(), fileUpdateQo.getMachineNo(), fileUpdateQo.getMaterialNo(), fileUpdateQo.getModelNo(), fileUpdateQo.getPartNo(), file); diff --git a/src/main/java/com/xkrs/controller/PictureController.java b/src/main/java/com/xkrs/controller/PictureController.java index 030287a..2683a7e 100644 --- a/src/main/java/com/xkrs/controller/PictureController.java +++ b/src/main/java/com/xkrs/controller/PictureController.java @@ -6,10 +6,7 @@ import com.xkrs.model.entity.PictureEntity; import com.xkrs.model.qo.PictureQo; import com.xkrs.service.PictureService; import org.springframework.context.i18n.LocaleContextHolder; -import org.springframework.web.bind.annotation.GetMapping; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestParam; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; diff --git a/src/main/java/com/xkrs/controller/SpecController.java b/src/main/java/com/xkrs/controller/SpecController.java index 8a1b718..937d40a 100644 --- a/src/main/java/com/xkrs/controller/SpecController.java +++ b/src/main/java/com/xkrs/controller/SpecController.java @@ -6,12 +6,11 @@ import com.xkrs.model.entity.SpecEntity; import com.xkrs.model.qo.SpecQo; import com.xkrs.service.SpecService; import org.springframework.context.i18n.LocaleContextHolder; -import org.springframework.web.bind.annotation.PostMapping; -import org.springframework.web.bind.annotation.RequestBody; -import org.springframework.web.bind.annotation.RestController; +import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.Locale; +import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -34,22 +33,20 @@ public class SpecController { * @param specQo */ @PostMapping("/insertSpec") - public String insertSpec(SpecQo specQo) { + public String insertSpec(@RequestBody SpecQo specQo) { return specService.insertSpec(specQo); } /** * 查询规格信息 */ - @PostMapping("/selectSpec") - public String selectSpec(@RequestBody SpecQo specQo) { + @GetMapping("/selectSpec") + public String selectSpec(@RequestParam("partNo") String partNo, @RequestParam("inspectionItemCode") String inspectionItemCode) { Locale locale = LocaleContextHolder.getLocale(); - String partNo = specQo.getPartNo(); - String inspectionItemCode = specQo.getInspectionItemCode(); - SpecEntity specEntity = specDao.findByPartNoAndInspectionItemCode(partNo, inspectionItemCode).get(); - if (specEntity == null) { + Optional byPartNoAndInspectionItemCode = specDao.findByPartNoAndInspectionItemCode(partNo, inspectionItemCode); + if (byPartNoAndInspectionItemCode.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale); } - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, specEntity, locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byPartNoAndInspectionItemCode.get(), locale); } } diff --git a/src/main/java/com/xkrs/dao/DataDictDao.java b/src/main/java/com/xkrs/dao/DataDictDao.java index 3979fab..f59496a 100644 --- a/src/main/java/com/xkrs/dao/DataDictDao.java +++ b/src/main/java/com/xkrs/dao/DataDictDao.java @@ -34,9 +34,9 @@ public interface DataDictDao extends JpaRepository, JpaSpecificat /** * 根据id修改字典的信息 * @param id - * @param chineseName + * @param inspectionItemName */ @Modifying(clearAutomatically=true) - @Query(value = "update data_dict set dict_chinese_name = ?2 where id = ?1",nativeQuery = true) - void updateDict(Integer id, String chineseName); + @Query(value = "UPDATE qc_inspection_item_dict SET inspection_item_name = ?2 where id = ?1",nativeQuery = true) + void updateDict(Integer id, String inspectionItemName); } diff --git a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java index f482d86..9507998 100644 --- a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java @@ -39,8 +39,8 @@ public class DataSourceServiceImpl implements DataSourceService { public String insertDataSource(DataSourceQo dataSourceQo) { Locale locale = LocaleContextHolder.getLocale(); Optional byInspectionItemCode = dataDictDao.findByInspectionItemCode(dataSourceQo.getInspectionItemCode()); - if (byInspectionItemCode.isPresent()) { - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "已存在该字典类型!", locale); + if (byInspectionItemCode.isEmpty()) { + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "不存在该字典类型!", locale); } DataSource dataSource = new DataSource(); dataSource.setLotNo(dataSourceQo.getLotNo()); diff --git a/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java b/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java index 66fbb4b..f6e12a7 100644 --- a/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java @@ -10,6 +10,7 @@ import org.springframework.stereotype.Service; import javax.annotation.Resource; import java.util.Locale; +import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -22,8 +23,8 @@ public class SpecServiceImpl implements SpecService { @Override public String insertSpec(SpecQo specQo) { Locale locale = LocaleContextHolder.getLocale(); - SpecEntity specEntity = specDao.findByPartNoAndInspectionItemCode(specQo.getPartNo(), specQo.getInspectionItemCode()).get(); - if (specEntity != null) { + Optional inspectionItemCode = specDao.findByPartNoAndInspectionItemCode(specQo.getPartNo(), specQo.getInspectionItemCode()); + if (inspectionItemCode.isPresent()) { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该测量规格!", locale); } SpecEntity specEntity1 = new SpecEntity(); diff --git a/src/main/java/com/xkrs/util/ExcelUploadUtil.java b/src/main/java/com/xkrs/util/ExcelUploadUtil.java index c498ddf..4e863f6 100644 --- a/src/main/java/com/xkrs/util/ExcelUploadUtil.java +++ b/src/main/java/com/xkrs/util/ExcelUploadUtil.java @@ -52,8 +52,6 @@ public class ExcelUploadUtil { String uploadsImage = uploadPath + newName; //实现上传 fileExcel.transferTo(new File(path)); - - return path; } return null; From 266c46fe16e481df797d39dc33c0cbc10d6111a6 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 1 Mar 2022 14:39:41 +0800 Subject: [PATCH 11/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=82=E6=95=B0?= =?UTF-8?q?=E7=B1=BB=E5=9E=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/controller/FileController.java | 2 +- src/main/java/com/xkrs/dao/PictureDao.java | 3 +- .../xkrs/service/impl/FileServiceImpl.java | 2 +- .../xkrs/service/impl/PictureServiceImpl.java | 2 +- .../java/com/xkrs/util/ExcelUploadUtil.java | 46 ++++++++++--------- 5 files changed, 29 insertions(+), 26 deletions(-) diff --git a/src/main/java/com/xkrs/controller/FileController.java b/src/main/java/com/xkrs/controller/FileController.java index d47dfec..2e1ca5e 100644 --- a/src/main/java/com/xkrs/controller/FileController.java +++ b/src/main/java/com/xkrs/controller/FileController.java @@ -59,7 +59,7 @@ public class FileController { @Transactional(rollbackOn = Exception.class) public String updateFileUploadPath(@RequestBody FileUpdateQo fileUpdateQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { Locale locale = LocaleContextHolder.getLocale(); - String file = ExcelUploadUtil.memoryFile(fileExcel); + String file = ExcelUploadUtil.memoryFile(fileExcel,1); fileDao.updateFileUploadPath(fileUpdateQo.getLotNo(), fileUpdateQo.getMachineNo(), fileUpdateQo.getMaterialNo(), fileUpdateQo.getModelNo(), fileUpdateQo.getPartNo(), file); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale); } diff --git a/src/main/java/com/xkrs/dao/PictureDao.java b/src/main/java/com/xkrs/dao/PictureDao.java index 5118456..56f8661 100644 --- a/src/main/java/com/xkrs/dao/PictureDao.java +++ b/src/main/java/com/xkrs/dao/PictureDao.java @@ -7,7 +7,6 @@ import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Component; -import java.util.List; import java.util.Optional; /** @@ -41,6 +40,6 @@ public interface PictureDao extends JpaRepository, JpaSpeci * @param picturePath 图片路径 */ @Modifying(clearAutomatically = true) - @Query(value = "UPDATE qc_inspection_picture SET picture_path = ?6 where lot_no = ?1 and machine_no = ?2 and material_no = ?3 and model_no = ?4 and part_no = ?5",nativeQuery = true) + @Query(value = "UPDATE qc_inspection_picture SET picture_path = ?6 where lot_no = ?1 and machine_no = ?2 and material_no = ?3 and model_no = ?4 and part_no = ?5", nativeQuery = true) void updatePicturePath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String picturePath); } diff --git a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java index fd1a470..3a6319e 100644 --- a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java @@ -54,7 +54,7 @@ public class FileServiceImpl implements FileService { if (fileExcel == null) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "模板不能为空!", locale); } - String file = ExcelUploadUtil.memoryFile(fileExcel); + String file = ExcelUploadUtil.memoryFile(fileExcel,1); FileEntity fileEntity1 = new FileEntity(); fileEntity1.setLotNo(fileQo.getLotNo()); fileEntity1.setMachineNo(fileQo.getMachineNo()); diff --git a/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java b/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java index 7e5ca48..c992243 100644 --- a/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java @@ -35,7 +35,7 @@ public class PictureServiceImpl implements PictureService { if (pictureEntity2.isPresent()) { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale); } - String file = ExcelUploadUtil.memoryFile(pictureFile); + String file = ExcelUploadUtil.memoryFile(pictureFile, 2); PictureEntity pictureEntity1 = new PictureEntity(); pictureEntity1.setLotNo(lotNo); pictureEntity1.setMachineNo(machineNo); diff --git a/src/main/java/com/xkrs/util/ExcelUploadUtil.java b/src/main/java/com/xkrs/util/ExcelUploadUtil.java index 4e863f6..d98ca96 100644 --- a/src/main/java/com/xkrs/util/ExcelUploadUtil.java +++ b/src/main/java/com/xkrs/util/ExcelUploadUtil.java @@ -23,16 +23,18 @@ public class ExcelUploadUtil { /** * 上传单张图片 - * @param fileExcel + * + * @param fileInput * @return * @throws IOException */ - public static String memoryFile(MultipartFile fileExcel) throws IOException { + public static String memoryFile(MultipartFile fileInput, int subDirType) throws IOException { + String subDir = subDirType == 1 ? "excel/" : "picture/"; //String uploadPath = "http://139.199.98.175:2088/wfTaskImage/"; // String uploadPath = "http://192.168.2.9:2088/"; String uploadPath = "http://118.24.27.47:4096/"; //获取原始文件名 - String originalFilename = fileExcel.getOriginalFilename(); + String originalFilename = fileInput.getOriginalFilename(); if (originalFilename != null && !"".equals(originalFilename)) { //找到 . 的位置 int index = originalFilename.lastIndexOf("."); @@ -42,16 +44,16 @@ public class ExcelUploadUtil { String newName = UUID.randomUUID().toString() + suffix; //将图片保存到本地/usr/etc/images/Folder - //File file = new File("E:/shoptest/"); - File file = new File("/home/sxy/server/industrial_measurement/excel/"); +// File file = new File("/Users/liuchengqian/Desktop/DaJiang/"); + File file = new File("/home/sxy/server/industrial_measurement/" + subDir); if (!file.exists()) { file.mkdirs(); } - //String path = "E:/shoptest/" + newName; - String path = "/home/sxy/server/industrial_measurement/excel/" + newName; +// String path = "/Users/liuchengqian/Desktop/DaJiang/"+newName; + String path = "/home/sxy/server/industrial_measurement/" + subDir + newName; String uploadsImage = uploadPath + newName; //实现上传 - fileExcel.transferTo(new File(path)); + fileInput.transferTo(new File(path)); return path; } return null; @@ -99,27 +101,27 @@ public class ExcelUploadUtil { }*/ - /** * 删除本地或服务器储存的图片 + * * @param path * @return */ - public static String delFile(String path){ + public static String delFile(String path) { String resultInfo = null; int lastIndexOf = path.lastIndexOf("/"); - String imgPath = path.substring(lastIndexOf + 1,path.length()); + String imgPath = path.substring(lastIndexOf + 1, path.length()); System.out.println(imgPath); imgPath = "/usr/local/etc/images/" + imgPath; // img_path = "/usr/etc/images/Folder/" + img_path; File file = new File(imgPath); - if(file.exists()){ - if(file.delete()){ + if (file.exists()) { + if (file.delete()) { resultInfo = "删除成功!"; - }else { + } else { resultInfo = "删除失败!"; } - }else { + } else { resultInfo = "文件不存在"; } return resultInfo; @@ -127,6 +129,7 @@ public class ExcelUploadUtil { /** * 通过图片路径解析 ,上传保存 + * * @param listImgSrc * @return */ @@ -171,17 +174,18 @@ public class ExcelUploadUtil { /** * 删除本地文件夹图片 + * * @param url */ - public static void deleteImage(String url){ - File file=new File(url); + public static void deleteImage(String url) { + File file = new File(url); //判断file是否是文件目录 若是返回TRUE - if (file.isDirectory()){ + if (file.isDirectory()) { //name存储file文件夹中的文件名 - String[] name =file.list(); - for (int i=0; i Date: Tue, 1 Mar 2022 15:54:55 +0800 Subject: [PATCH 12/20] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E5=A4=9A=E6=9D=A1=E4=BB=B6=E6=9F=A5=E8=AF=A2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/controller/DataDictController.java | 6 +-- .../xkrs/controller/DataSourceController.java | 22 ++++---- .../xkrs/controller/PictureController.java | 17 +++--- .../com/xkrs/controller/SpecController.java | 16 +++--- src/main/java/com/xkrs/dao/DataSourceDao.java | 20 ------- src/main/java/com/xkrs/dao/SpecDao.java | 3 +- .../xkrs/service/impl/FileServiceImpl.java | 12 ++--- .../xkrs/service/impl/SpecServiceImpl.java | 10 ++-- .../java/com/xkrs/util/DataDictQuery.java | 45 ++++++++++++++++ .../java/com/xkrs/util/DataSourceQuery.java | 52 +++++++++++++++++++ .../java/com/xkrs/util/ExcelUploadUtil.java | 8 +-- src/main/java/com/xkrs/util/PictureQuery.java | 52 +++++++++++++++++++ src/main/java/com/xkrs/util/Query.java | 48 ----------------- src/main/java/com/xkrs/util/SpecQuery.java | 43 +++++++++++++++ 14 files changed, 243 insertions(+), 111 deletions(-) create mode 100644 src/main/java/com/xkrs/util/DataDictQuery.java create mode 100644 src/main/java/com/xkrs/util/DataSourceQuery.java create mode 100644 src/main/java/com/xkrs/util/PictureQuery.java delete mode 100644 src/main/java/com/xkrs/util/Query.java create mode 100644 src/main/java/com/xkrs/util/SpecQuery.java diff --git a/src/main/java/com/xkrs/controller/DataDictController.java b/src/main/java/com/xkrs/controller/DataDictController.java index 3e1cec4..e842041 100644 --- a/src/main/java/com/xkrs/controller/DataDictController.java +++ b/src/main/java/com/xkrs/controller/DataDictController.java @@ -6,7 +6,7 @@ import com.xkrs.model.entity.DataDict; import com.xkrs.model.qo.DataDictQo; import com.xkrs.model.qo.DataDictUpdateQo; import com.xkrs.service.DataDictService; -import com.xkrs.util.Query; +import com.xkrs.util.DataDictQuery; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.web.bind.annotation.*; @@ -32,7 +32,7 @@ public class DataDictController { private DataDictDao dataDictDao; @Resource - private Query query; + private DataDictQuery dataDictQuery; /** * 添加字典变量数据 @@ -55,7 +55,7 @@ public class DataDictController { @GetMapping("/selectDataDict") public String selectDataDict(@RequestParam("inspectionItemName") String inspectionItemName, @RequestParam("inspectionItemCode") String inspectionItemCode) { Locale locale = LocaleContextHolder.getLocale(); - List dataDict = query.selectDataDict(inspectionItemName, inspectionItemCode); + List dataDict = dataDictQuery.selectDataDict(inspectionItemName, inspectionItemCode); if (dataDict == null || dataDict.size() == 0) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时还没有该型号类型的字典信息!", locale); } diff --git a/src/main/java/com/xkrs/controller/DataSourceController.java b/src/main/java/com/xkrs/controller/DataSourceController.java index a72e129..7381f85 100644 --- a/src/main/java/com/xkrs/controller/DataSourceController.java +++ b/src/main/java/com/xkrs/controller/DataSourceController.java @@ -5,13 +5,13 @@ import com.xkrs.encapsulation.PromptMessageEnum; import com.xkrs.model.entity.DataSource; import com.xkrs.model.qo.DataSourceQo; import com.xkrs.service.DataSourceService; +import com.xkrs.util.DataSourceQuery; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; import java.util.List; import java.util.Locale; -import java.util.Map; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -25,6 +25,9 @@ public class DataSourceController { @Resource private DataSourceService dataSourceService; + @Resource + private DataSourceQuery dataSourceQuery; + @Resource private DataSourceDao dataSourceDao; @@ -41,6 +44,7 @@ public class DataSourceController { /** * 查询某一产品的测量信息 + * * @param lotNo 批次号 * @param machineNo 机器号 * @param materialNo 物料号 @@ -49,13 +53,13 @@ public class DataSourceController { * @return */ @GetMapping("/selectDataSource") - public String selectDataSource(@RequestParam("lotNo") String lotNo, - @RequestParam("machineNo") String machineNo, - @RequestParam("materialNo") String materialNo, - @RequestParam("modelNo") String modelNo, - @RequestParam("partNo") String partNo) { + public String selectDataSource(@RequestParam(required = false, value = "lotNo") String lotNo, + @RequestParam(required = false, value = "machineNo") String machineNo, + @RequestParam(required = false, value = "materialNo") String materialNo, + @RequestParam(required = false, value = "modelNo") String modelNo, + @RequestParam(required = false, value = "partNo") String partNo) { Locale locale = LocaleContextHolder.getLocale(); - List dataSources = dataSourceDao.selectDataSource(lotNo, machineNo, materialNo, modelNo, partNo); + List dataSources = dataSourceQuery.selectDataSource(lotNo, machineNo, materialNo, modelNo, partNo); if (dataSources == null || dataSources.size() == 0) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale); } @@ -70,8 +74,8 @@ public class DataSourceController { @GetMapping("/selectAllSource") public String selectAllSource() { Locale locale = LocaleContextHolder.getLocale(); - List dataSources = dataSourceDao.selectAllSource(); - if (dataSources == null || dataSources.size() == 0) { + List dataSources = dataSourceDao.findAll(); + if (dataSources.size() == 0) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale); } return outputEncapsulationObject(PromptMessageEnum.SUCCESS, dataSources, locale); diff --git a/src/main/java/com/xkrs/controller/PictureController.java b/src/main/java/com/xkrs/controller/PictureController.java index 2683a7e..b7480f7 100644 --- a/src/main/java/com/xkrs/controller/PictureController.java +++ b/src/main/java/com/xkrs/controller/PictureController.java @@ -1,18 +1,21 @@ package com.xkrs.controller; -import com.xkrs.dao.PictureDao; import com.xkrs.encapsulation.PromptMessageEnum; import com.xkrs.model.entity.PictureEntity; import com.xkrs.model.qo.PictureQo; import com.xkrs.service.PictureService; +import com.xkrs.util.PictureQuery; import org.springframework.context.i18n.LocaleContextHolder; -import org.springframework.web.bind.annotation.*; +import org.springframework.web.bind.annotation.GetMapping; +import org.springframework.web.bind.annotation.PostMapping; +import org.springframework.web.bind.annotation.RequestParam; +import org.springframework.web.bind.annotation.RestController; import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import java.io.IOException; +import java.util.List; import java.util.Locale; -import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -27,7 +30,7 @@ public class PictureController { private PictureService pictureService; @Resource - private PictureDao pictureDao; + private PictureQuery pictureQuery; /** * 上传图片 @@ -47,10 +50,10 @@ public class PictureController { @RequestParam("modelNo") String modelNo, @RequestParam("partNo") String partNo) { Locale locale = LocaleContextHolder.getLocale(); - Optional pictureEntity1 = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo); - if (pictureEntity1.isEmpty()) { + List pictureEntities = pictureQuery.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo); + if (pictureEntities.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的图片!", locale); } - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntity1.get(), locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntities.get(0), locale); } } diff --git a/src/main/java/com/xkrs/controller/SpecController.java b/src/main/java/com/xkrs/controller/SpecController.java index 937d40a..1ac5126 100644 --- a/src/main/java/com/xkrs/controller/SpecController.java +++ b/src/main/java/com/xkrs/controller/SpecController.java @@ -1,16 +1,16 @@ package com.xkrs.controller; -import com.xkrs.dao.SpecDao; import com.xkrs.encapsulation.PromptMessageEnum; import com.xkrs.model.entity.SpecEntity; import com.xkrs.model.qo.SpecQo; import com.xkrs.service.SpecService; +import com.xkrs.util.SpecQuery; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.web.bind.annotation.*; import javax.annotation.Resource; +import java.util.List; import java.util.Locale; -import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @@ -25,7 +25,7 @@ public class SpecController { private SpecService specService; @Resource - private SpecDao specDao; + private SpecQuery specQuery; /** * 添加规格数据 @@ -41,12 +41,14 @@ public class SpecController { * 查询规格信息 */ @GetMapping("/selectSpec") - public String selectSpec(@RequestParam("partNo") String partNo, @RequestParam("inspectionItemCode") String inspectionItemCode) { + public String selectSpec(@RequestParam(required = false, value = "partNo") String partNo, + @RequestParam(required = false, value = "inspectionItemCode") String inspectionItemCode) { Locale locale = LocaleContextHolder.getLocale(); - Optional byPartNoAndInspectionItemCode = specDao.findByPartNoAndInspectionItemCode(partNo, inspectionItemCode); - if (byPartNoAndInspectionItemCode.isEmpty()) { + List specEntities = specQuery.selectSpec(partNo, inspectionItemCode); + if (specEntities.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale); } - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, byPartNoAndInspectionItemCode.get(), locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, specEntities.get(0), locale); } + } diff --git a/src/main/java/com/xkrs/dao/DataSourceDao.java b/src/main/java/com/xkrs/dao/DataSourceDao.java index 6fd175c..23032d3 100644 --- a/src/main/java/com/xkrs/dao/DataSourceDao.java +++ b/src/main/java/com/xkrs/dao/DataSourceDao.java @@ -16,24 +16,4 @@ import java.util.Optional; @Component public interface DataSourceDao extends JpaRepository, JpaSpecificationExecutor { - /** - * 查询测量数据信息 - * - * @param lotNo 批次号 - * @param machineNo 机器号 - * @param materialNo 物料号 - * @param modelNo 模具号 - * @param partNo 零件号 - * @return - */ - @Query(value = "SELECT * FROM qc_inspection_data_source WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND part_no = ? ", nativeQuery = true) - List selectDataSource(String lotNo, String machineNo, String materialNo, String modelNo, String partNo); - - /** - * 查询全部的测量信息 - * - * @return - */ - @Query(value = "SELECT * FROM qc_inspection_data_source", nativeQuery = true) - List selectAllSource(); } diff --git a/src/main/java/com/xkrs/dao/SpecDao.java b/src/main/java/com/xkrs/dao/SpecDao.java index 57638e7..a81f3a0 100644 --- a/src/main/java/com/xkrs/dao/SpecDao.java +++ b/src/main/java/com/xkrs/dao/SpecDao.java @@ -5,6 +5,7 @@ import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; import org.springframework.stereotype.Component; +import java.util.List; import java.util.Optional; /** @@ -14,6 +15,4 @@ import java.util.Optional; @Component public interface SpecDao extends JpaRepository, JpaSpecificationExecutor { - Optional findByPartNoAndInspectionItemCode(String partNo, String inspectionItemCode); - } diff --git a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java index 3a6319e..2f877c0 100644 --- a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java @@ -1,13 +1,12 @@ package com.xkrs.service.impl; -import com.xkrs.dao.DataDictDao; -import com.xkrs.dao.DataSourceDao; import com.xkrs.dao.FileDao; import com.xkrs.encapsulation.PromptMessageEnum; import com.xkrs.model.entity.DataSource; import com.xkrs.model.entity.FileEntity; import com.xkrs.model.qo.FileQo; import com.xkrs.service.FileService; +import com.xkrs.util.DataSourceQuery; import com.xkrs.util.ExcelUploadUtil; import com.xkrs.util.ExportExcel; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; @@ -33,10 +32,7 @@ public class FileServiceImpl implements FileService { private FileDao fileDao; @Resource - private DataDictDao dataDictDao; - - @Resource - private DataSourceDao dataSourceDao; + private DataSourceQuery dataSourceQuery; /** * 添加模板信息 @@ -54,7 +50,7 @@ public class FileServiceImpl implements FileService { if (fileExcel == null) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "模板不能为空!", locale); } - String file = ExcelUploadUtil.memoryFile(fileExcel,1); + String file = ExcelUploadUtil.memoryFile(fileExcel, 1); FileEntity fileEntity1 = new FileEntity(); fileEntity1.setLotNo(fileQo.getLotNo()); fileEntity1.setMachineNo(fileQo.getMachineNo()); @@ -81,7 +77,7 @@ public class FileServiceImpl implements FileService { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale); } String fileUploadPath = fileEntity.get().getFileUploadPath(); - List dataSources = dataSourceDao.selectDataSource(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); + List dataSources = dataSourceQuery.selectDataSource(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); if (dataSources == null || dataSources.size() == 0) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale); } diff --git a/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java b/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java index f6e12a7..7c5322a 100644 --- a/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java @@ -5,26 +5,30 @@ import com.xkrs.encapsulation.PromptMessageEnum; import com.xkrs.model.entity.SpecEntity; import com.xkrs.model.qo.SpecQo; import com.xkrs.service.SpecService; +import com.xkrs.util.SpecQuery; import org.springframework.context.i18n.LocaleContextHolder; import org.springframework.stereotype.Service; import javax.annotation.Resource; +import java.util.List; import java.util.Locale; -import java.util.Optional; import static com.xkrs.encapsulation.OutputEncapsulation.outputEncapsulationObject; @Service public class SpecServiceImpl implements SpecService { + @Resource + private SpecQuery specQuery; + @Resource private SpecDao specDao; @Override public String insertSpec(SpecQo specQo) { Locale locale = LocaleContextHolder.getLocale(); - Optional inspectionItemCode = specDao.findByPartNoAndInspectionItemCode(specQo.getPartNo(), specQo.getInspectionItemCode()); - if (inspectionItemCode.isPresent()) { + List specEntities = specQuery.selectSpec(specQo.getPartNo(), specQo.getInspectionItemCode()); + if (!specEntities.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该测量规格!", locale); } SpecEntity specEntity1 = new SpecEntity(); diff --git a/src/main/java/com/xkrs/util/DataDictQuery.java b/src/main/java/com/xkrs/util/DataDictQuery.java new file mode 100644 index 0000000..4e5a544 --- /dev/null +++ b/src/main/java/com/xkrs/util/DataDictQuery.java @@ -0,0 +1,45 @@ +package com.xkrs.util; + +import com.xkrs.dao.DataDictDao; +import com.xkrs.model.entity.DataDict; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.persistence.criteria.CriteriaBuilder; +import javax.persistence.criteria.CriteriaQuery; +import javax.persistence.criteria.Predicate; +import javax.persistence.criteria.Root; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 13:56 + */ +@Component +public class DataDictQuery { + + @Resource + private DataDictDao dataDictDao; + + /** + * 动态多条件查询字典信息 + * + * @return + */ + public List selectDataDict(String inspectionItemName, String inspectionItemCode) { + Specification specification = (root, criteriaQuery, criteriaBuilder) -> { + List list = new ArrayList<>(); + if (inspectionItemName != null && !"".equals(inspectionItemName)) { + list.add(criteriaBuilder.equal(root.get("inspectionItemName").as(String.class), inspectionItemName)); + } + if (inspectionItemCode != null && !"".equals(inspectionItemCode)) { + list.add(criteriaBuilder.equal(root.get("inspectionItemCode").as(String.class), inspectionItemCode)); + } + Predicate[] predicates = new Predicate[list.size()]; + return criteriaBuilder.and(list.toArray(predicates)); + }; + return dataDictDao.findAll(specification); + } +} diff --git a/src/main/java/com/xkrs/util/DataSourceQuery.java b/src/main/java/com/xkrs/util/DataSourceQuery.java new file mode 100644 index 0000000..eea61ed --- /dev/null +++ b/src/main/java/com/xkrs/util/DataSourceQuery.java @@ -0,0 +1,52 @@ +package com.xkrs.util; + +import com.xkrs.dao.DataSourceDao; +import com.xkrs.model.entity.DataSource; +import org.apache.http.util.TextUtils; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.persistence.criteria.Predicate; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 13:56 + */ +@Component +public class DataSourceQuery { + + @Resource + private DataSourceDao dataSourceDao; + + /** + * 动态多条件查询采集数据信息 + * + * @return + */ + public List selectDataSource(String lotNo, String machineNo, String materialNo, String modelNo, String partNo) { + Specification specification = (root, criteriaQuery, criteriaBuilder) -> { + List list = new ArrayList<>(); + if (!TextUtils.isEmpty(lotNo)) { + list.add(criteriaBuilder.equal(root.get("lotNo").as(String.class), lotNo)); + } + if (!TextUtils.isEmpty(machineNo)) { + list.add(criteriaBuilder.equal(root.get("machineNo").as(String.class), machineNo)); + } + if (!TextUtils.isEmpty(materialNo)) { + list.add(criteriaBuilder.equal(root.get("materialNo").as(String.class), materialNo)); + } + if (!TextUtils.isEmpty(modelNo)) { + list.add(criteriaBuilder.equal(root.get("modelNo").as(String.class), modelNo)); + } + if (!TextUtils.isEmpty(partNo)) { + list.add(criteriaBuilder.equal(root.get("partNo").as(String.class), partNo)); + } + Predicate[] predicates = new Predicate[list.size()]; + return criteriaBuilder.and(list.toArray(predicates)); + }; + return dataSourceDao.findAll(specification); + } +} diff --git a/src/main/java/com/xkrs/util/ExcelUploadUtil.java b/src/main/java/com/xkrs/util/ExcelUploadUtil.java index d98ca96..918fddf 100644 --- a/src/main/java/com/xkrs/util/ExcelUploadUtil.java +++ b/src/main/java/com/xkrs/util/ExcelUploadUtil.java @@ -44,13 +44,13 @@ public class ExcelUploadUtil { String newName = UUID.randomUUID().toString() + suffix; //将图片保存到本地/usr/etc/images/Folder -// File file = new File("/Users/liuchengqian/Desktop/DaJiang/"); - File file = new File("/home/sxy/server/industrial_measurement/" + subDir); + File file = new File("/Users/liuchengqian/Desktop/DaJiang/"); +// File file = new File("/home/sxy/server/industrial_measurement/" + subDir); if (!file.exists()) { file.mkdirs(); } -// String path = "/Users/liuchengqian/Desktop/DaJiang/"+newName; - String path = "/home/sxy/server/industrial_measurement/" + subDir + newName; + String path = "/Users/liuchengqian/Desktop/DaJiang/"+newName; +// String path = "/home/sxy/server/industrial_measurement/" + subDir + newName; String uploadsImage = uploadPath + newName; //实现上传 fileInput.transferTo(new File(path)); diff --git a/src/main/java/com/xkrs/util/PictureQuery.java b/src/main/java/com/xkrs/util/PictureQuery.java new file mode 100644 index 0000000..79dc2e2 --- /dev/null +++ b/src/main/java/com/xkrs/util/PictureQuery.java @@ -0,0 +1,52 @@ +package com.xkrs.util; + +import com.xkrs.dao.PictureDao; +import com.xkrs.model.entity.PictureEntity; +import org.apache.http.util.TextUtils; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.persistence.criteria.Predicate; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 13:56 + */ +@Component +public class PictureQuery { + + @Resource + private PictureDao pictureDao; + + /** + * 动态多条件查询图片信息 + * + * @return + */ + public List selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String partNo) { + Specification specification = (root, criteriaQuery, criteriaBuilder) -> { + List list = new ArrayList<>(); + if (!TextUtils.isEmpty(lotNo)) { + list.add(criteriaBuilder.equal(root.get("lotNo").as(String.class), lotNo)); + } + if (!TextUtils.isEmpty(machineNo)) { + list.add(criteriaBuilder.equal(root.get("machineNo").as(String.class), machineNo)); + } + if (!TextUtils.isEmpty(materialNo)) { + list.add(criteriaBuilder.equal(root.get("materialNo").as(String.class), materialNo)); + } + if (!TextUtils.isEmpty(modelNo)) { + list.add(criteriaBuilder.equal(root.get("modelNo").as(String.class), modelNo)); + } + if (!TextUtils.isEmpty(partNo)) { + list.add(criteriaBuilder.equal(root.get("partNo").as(String.class), partNo)); + } + Predicate[] predicates = new Predicate[list.size()]; + return criteriaBuilder.and(list.toArray(predicates)); + }; + return pictureDao.findAll(specification); + } +} diff --git a/src/main/java/com/xkrs/util/Query.java b/src/main/java/com/xkrs/util/Query.java deleted file mode 100644 index 08481ab..0000000 --- a/src/main/java/com/xkrs/util/Query.java +++ /dev/null @@ -1,48 +0,0 @@ -package com.xkrs.util; - -import com.xkrs.dao.DataDictDao; -import com.xkrs.model.entity.DataDict; -import org.springframework.data.jpa.domain.Specification; -import org.springframework.stereotype.Component; - -import javax.annotation.Resource; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; -import java.util.ArrayList; -import java.util.List; - -/** - * @Author: XinYi Song - * @Date: 2022/1/19 13:56 - */ -@Component -public class Query { - - @Resource - private DataDictDao dataDictDao; - - /** - * 动态多条件查询字典信息 - * - * @return - */ - public List selectDataDict(String inspectionItemName, String inspectionItemCode) { - Specification specification = new Specification() { - @Override - public Predicate toPredicate(Root root, CriteriaQuery criteriaQuery, CriteriaBuilder criteriaBuilder) { - List list = new ArrayList<>(); - if (inspectionItemName != null && !"".equals(inspectionItemName)) { - list.add(criteriaBuilder.equal(root.get("inspectionItemName").as(String.class), inspectionItemName)); - } - if (inspectionItemCode != null && !"".equals(inspectionItemCode)) { - list.add(criteriaBuilder.equal(root.get("inspectionItemCode").as(String.class), inspectionItemCode)); - } - Predicate[] predicates = new Predicate[list.size()]; - return criteriaBuilder.and(list.toArray(predicates)); - } - }; - return dataDictDao.findAll(specification); - } -} diff --git a/src/main/java/com/xkrs/util/SpecQuery.java b/src/main/java/com/xkrs/util/SpecQuery.java new file mode 100644 index 0000000..17ae43f --- /dev/null +++ b/src/main/java/com/xkrs/util/SpecQuery.java @@ -0,0 +1,43 @@ +package com.xkrs.util; + +import com.xkrs.dao.SpecDao; +import com.xkrs.model.entity.SpecEntity; +import org.apache.http.util.TextUtils; +import org.springframework.data.jpa.domain.Specification; +import org.springframework.stereotype.Component; + +import javax.annotation.Resource; +import javax.persistence.criteria.Predicate; +import java.util.ArrayList; +import java.util.List; + +/** + * @Author: XinYi Song + * @Date: 2022/1/19 13:56 + */ +@Component +public class SpecQuery { + + @Resource + private SpecDao specDao; + + /** + * 动态多条件查询规格信息 + * + * @return + */ + public List selectSpec(String partNo, String inspectionItemCode) { + Specification specification = (root, criteriaQuery, criteriaBuilder) -> { + List list = new ArrayList<>(); + if (!TextUtils.isEmpty(partNo)) { + list.add(criteriaBuilder.equal(root.get("partNo").as(String.class), partNo)); + } + if (!TextUtils.isEmpty(inspectionItemCode)) { + list.add(criteriaBuilder.equal(root.get("inspectionItemCode").as(String.class), inspectionItemCode)); + } + Predicate[] predicates = new Predicate[list.size()]; + return criteriaBuilder.and(list.toArray(predicates)); + }; + return specDao.findAll(specification); + } +} From 2a362c326475dcd1584df4810e39107182b1098e Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Tue, 1 Mar 2022 19:24:15 +0800 Subject: [PATCH 13/20] =?UTF-8?q?=E5=AE=8C=E5=96=84=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=9C=8D=E5=8A=A1=E5=99=A8=E4=BC=A0=E8=BE=93?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xkrs/controller/PictureController.java | 2 +- .../java/com/xkrs/controller/SpecController.java | 2 +- src/main/java/com/xkrs/model/entity/FileEntity.java | 4 ++-- .../java/com/xkrs/model/entity/PictureEntity.java | 2 +- src/main/java/com/xkrs/util/ExcelUploadUtil.java | 12 ++++++------ 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/main/java/com/xkrs/controller/PictureController.java b/src/main/java/com/xkrs/controller/PictureController.java index b7480f7..b179102 100644 --- a/src/main/java/com/xkrs/controller/PictureController.java +++ b/src/main/java/com/xkrs/controller/PictureController.java @@ -54,6 +54,6 @@ public class PictureController { if (pictureEntities.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的图片!", locale); } - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntities.get(0), locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntities, locale); } } diff --git a/src/main/java/com/xkrs/controller/SpecController.java b/src/main/java/com/xkrs/controller/SpecController.java index 1ac5126..b441fba 100644 --- a/src/main/java/com/xkrs/controller/SpecController.java +++ b/src/main/java/com/xkrs/controller/SpecController.java @@ -48,7 +48,7 @@ public class SpecController { if (specEntities.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale); } - return outputEncapsulationObject(PromptMessageEnum.SUCCESS, specEntities.get(0), locale); + return outputEncapsulationObject(PromptMessageEnum.SUCCESS, specEntities, locale); } } diff --git a/src/main/java/com/xkrs/model/entity/FileEntity.java b/src/main/java/com/xkrs/model/entity/FileEntity.java index 21273c3..f89079a 100644 --- a/src/main/java/com/xkrs/model/entity/FileEntity.java +++ b/src/main/java/com/xkrs/model/entity/FileEntity.java @@ -50,13 +50,13 @@ public class FileEntity { /** * 上传模板的路径 */ - @Column(length = 1024, columnDefinition = "varchar(1024)") + @Column(length = 2048, columnDefinition = "varchar(2048)") private String fileUploadPath; /** * 下载路径 */ - @Column(length = 1024, columnDefinition = "varchar(1024)") + @Column(length = 2048, columnDefinition = "varchar(2048)") private String fileDownloadPath; public FileEntity() { diff --git a/src/main/java/com/xkrs/model/entity/PictureEntity.java b/src/main/java/com/xkrs/model/entity/PictureEntity.java index 1db0cdc..6ed0a8b 100644 --- a/src/main/java/com/xkrs/model/entity/PictureEntity.java +++ b/src/main/java/com/xkrs/model/entity/PictureEntity.java @@ -46,7 +46,7 @@ public class PictureEntity { /** * 图片路径 */ - @Column(length = 85, columnDefinition = "varchar(85)") + @Column(length = 2048, columnDefinition = "varchar(2048)") private String picturePath; public PictureEntity() { diff --git a/src/main/java/com/xkrs/util/ExcelUploadUtil.java b/src/main/java/com/xkrs/util/ExcelUploadUtil.java index 918fddf..d2c1bc8 100644 --- a/src/main/java/com/xkrs/util/ExcelUploadUtil.java +++ b/src/main/java/com/xkrs/util/ExcelUploadUtil.java @@ -29,7 +29,7 @@ public class ExcelUploadUtil { * @throws IOException */ public static String memoryFile(MultipartFile fileInput, int subDirType) throws IOException { - String subDir = subDirType == 1 ? "excel/" : "picture/"; + String subDir = subDirType == 1 ? "/excel/" : "/picture/"; //String uploadPath = "http://139.199.98.175:2088/wfTaskImage/"; // String uploadPath = "http://192.168.2.9:2088/"; String uploadPath = "http://118.24.27.47:4096/"; @@ -44,17 +44,17 @@ public class ExcelUploadUtil { String newName = UUID.randomUUID().toString() + suffix; //将图片保存到本地/usr/etc/images/Folder - File file = new File("/Users/liuchengqian/Desktop/DaJiang/"); -// File file = new File("/home/sxy/server/industrial_measurement/" + subDir); +// File file = new File("/Users/liuchengqian/Desktop/DaJiang/"); + File file = new File("/home/sxy/server/industrial_measurement" + subDir); if (!file.exists()) { file.mkdirs(); } - String path = "/Users/liuchengqian/Desktop/DaJiang/"+newName; -// String path = "/home/sxy/server/industrial_measurement/" + subDir + newName; +// String path = "/Users/liuchengqian/Desktop/DaJiang/"+newName; + String path = "/home/sxy/server/industrial_measurement" + subDir + newName; String uploadsImage = uploadPath + newName; //实现上传 fileInput.transferTo(new File(path)); - return path; + return subDir + newName; } return null; } From ed25c2b5fb5bc75afc84d0eb0f356d0dc7578b40 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Wed, 2 Mar 2022 11:59:09 +0800 Subject: [PATCH 14/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9entity=EF=BC=8CpartNo--?= =?UTF-8?q?>machineTypeNo,=E6=B7=BB=E5=8A=A0craftItemName?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xkrs/model/entity/DataDict.java | 7 +++- .../com/xkrs/model/entity/DataSource.java | 38 ++++++++++++++---- .../com/xkrs/model/entity/FileEntity.java | 23 +++++++---- .../com/xkrs/model/entity/PictureEntity.java | 37 +++++++++++++---- .../com/xkrs/model/entity/SpecEntity.java | 40 +++++++++++++++---- 5 files changed, 115 insertions(+), 30 deletions(-) diff --git a/src/main/java/com/xkrs/model/entity/DataDict.java b/src/main/java/com/xkrs/model/entity/DataDict.java index 049cf61..7c94805 100644 --- a/src/main/java/com/xkrs/model/entity/DataDict.java +++ b/src/main/java/com/xkrs/model/entity/DataDict.java @@ -59,7 +59,10 @@ public class DataDict { @Override public String toString() { - return "DataDict{" + "id=" + id + ", inspectionItemCode='" + inspectionItemCode + '\'' + ", inspectionItemName='" + inspectionItemName + '\'' + '}'; + return "DataDict{" + + "id=" + id + + ", inspectionItemCode='" + inspectionItemCode + '\'' + + ", inspectionItemName='" + inspectionItemName + '\'' + + '}'; } - } diff --git a/src/main/java/com/xkrs/model/entity/DataSource.java b/src/main/java/com/xkrs/model/entity/DataSource.java index b9e6978..07f6f0f 100644 --- a/src/main/java/com/xkrs/model/entity/DataSource.java +++ b/src/main/java/com/xkrs/model/entity/DataSource.java @@ -43,10 +43,10 @@ public class DataSource { private String modelNo; /** - * 零件号 + * 机种号 */ @Column(length = 85, columnDefinition = "varchar(85)") - private String partNo; + private String machineTypeNo; /** * 检验项代码 @@ -54,6 +54,12 @@ public class DataSource { @Column(length = 85, columnDefinition = "varchar(85)") private String inspectionItemCode; + /** + * 工艺项目名称 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String craftItemName; + /** * 检验数值 */ @@ -103,12 +109,12 @@ public class DataSource { this.modelNo = modelNo; } - public String getPartNo() { - return partNo; + public String getMachineTypeNo() { + return machineTypeNo; } - public void setPartNo(String partNo) { - this.partNo = partNo; + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; } public String getInspectionItemCode() { @@ -119,6 +125,14 @@ public class DataSource { this.inspectionItemCode = inspectionItemCode; } + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } + public String getInspectValue() { return inspectValue; } @@ -129,6 +143,16 @@ public class DataSource { @Override public String toString() { - return "DataSource{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", partNo='" + partNo + '\'' + ", inspectionItemCode='" + inspectionItemCode + '\'' + ", inspectValue='" + inspectValue + '\'' + '}'; + return "DataSource{" + + "id=" + id + + ", lotNo='" + lotNo + '\'' + + ", machineNo='" + machineNo + '\'' + + ", materialNo='" + materialNo + '\'' + + ", modelNo='" + modelNo + '\'' + + ", machineTypeNo='" + machineTypeNo + '\'' + + ", inspectionItemCode='" + inspectionItemCode + '\'' + + ", craftItemName='" + craftItemName + '\'' + + ", inspectValue='" + inspectValue + '\'' + + '}'; } } diff --git a/src/main/java/com/xkrs/model/entity/FileEntity.java b/src/main/java/com/xkrs/model/entity/FileEntity.java index f89079a..5f81038 100644 --- a/src/main/java/com/xkrs/model/entity/FileEntity.java +++ b/src/main/java/com/xkrs/model/entity/FileEntity.java @@ -42,10 +42,10 @@ public class FileEntity { private String modelNo; /** - * 零件号 + * 机种号 */ @Column(length = 85, columnDefinition = "varchar(85)") - private String partNo; + private String machineTypeNo; /** * 上传模板的路径 @@ -102,12 +102,12 @@ public class FileEntity { this.modelNo = modelNo; } - public String getPartNo() { - return partNo; + public String getMachineTypeNo() { + return machineTypeNo; } - public void setPartNo(String partNo) { - this.partNo = partNo; + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; } public String getFileUploadPath() { @@ -128,6 +128,15 @@ public class FileEntity { @Override public String toString() { - return "FileEntity{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", partNo='" + partNo + '\'' + ", fileUploadPath='" + fileUploadPath + '\'' + ", fileDownloadPath='" + fileDownloadPath + '\'' + '}'; + return "FileEntity{" + + "id=" + id + + ", lotNo='" + lotNo + '\'' + + ", machineNo='" + machineNo + '\'' + + ", materialNo='" + materialNo + '\'' + + ", modelNo='" + modelNo + '\'' + + ", machineTypeNo='" + machineTypeNo + '\'' + + ", fileUploadPath='" + fileUploadPath + '\'' + + ", fileDownloadPath='" + fileDownloadPath + '\'' + + '}'; } } diff --git a/src/main/java/com/xkrs/model/entity/PictureEntity.java b/src/main/java/com/xkrs/model/entity/PictureEntity.java index 6ed0a8b..9c1c866 100644 --- a/src/main/java/com/xkrs/model/entity/PictureEntity.java +++ b/src/main/java/com/xkrs/model/entity/PictureEntity.java @@ -38,10 +38,16 @@ public class PictureEntity { private String modelNo; /** - * 零件号 + * 机种号 */ @Column(length = 85, columnDefinition = "varchar(85)") - private String partNo; + private String machineTypeNo; + + /** + * 工艺项目名称 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String craftItemName; /** * 图片路径 @@ -92,12 +98,20 @@ public class PictureEntity { this.modelNo = modelNo; } - public String getPartNo() { - return partNo; + public String getMachineTypeNo() { + return machineTypeNo; } - public void setPartNo(String partNo) { - this.partNo = partNo; + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; + } + + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; } public String getPicturePath() { @@ -110,6 +124,15 @@ public class PictureEntity { @Override public String toString() { - return "PictureEntity{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", partNo='" + partNo + '\'' + ", picturePath='" + picturePath + '\'' + '}'; + return "PictureEntity{" + + "id=" + id + + ", lotNo='" + lotNo + '\'' + + ", machineNo='" + machineNo + '\'' + + ", materialNo='" + materialNo + '\'' + + ", modelNo='" + modelNo + '\'' + + ", machineTypeNo='" + machineTypeNo + '\'' + + ", craftItemName='" + craftItemName + '\'' + + ", picturePath='" + picturePath + '\'' + + '}'; } } diff --git a/src/main/java/com/xkrs/model/entity/SpecEntity.java b/src/main/java/com/xkrs/model/entity/SpecEntity.java index 4e9837e..d6bf18d 100644 --- a/src/main/java/com/xkrs/model/entity/SpecEntity.java +++ b/src/main/java/com/xkrs/model/entity/SpecEntity.java @@ -14,10 +14,10 @@ public class SpecEntity { private Integer id; /** - * 零件号 + * 机种号 */ @Column(length = 85, columnDefinition = "varchar(85)") - private String partNo; + private String machineTypeNo; /** * 检验项代码 @@ -25,6 +25,12 @@ public class SpecEntity { @Column(length = 85, columnDefinition = "varchar(85)") private String inspectionItemCode; + /** + * 工艺项目名称 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String craftItemName; + /** * 最大值 */ @@ -78,12 +84,12 @@ public class SpecEntity { this.id = id; } - public String getPartNo() { - return partNo; + public String getMachineTypeNo() { + return machineTypeNo; } - public void setPartNo(String partNo) { - this.partNo = partNo; + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; } public String getInspectionItemCode() { @@ -94,6 +100,14 @@ public class SpecEntity { this.inspectionItemCode = inspectionItemCode; } + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } + public String getMax() { return max; } @@ -152,6 +166,18 @@ public class SpecEntity { @Override public String toString() { - return "SpecEntity{" + "id=" + id + ", partNo='" + partNo + '\'' + ", inspectionItemCode='" + inspectionItemCode + '\'' + ", max='" + max + '\'' + ", mean='" + mean + '\'' + ", min='" + min + '\'' + ", unit='" + unit + '\'' + ", inspectionMethod='" + inspectionMethod + '\'' + ", inspectionStandard='" + inspectionStandard + '\'' + ", remark='" + remark + '\'' + '}'; + return "SpecEntity{" + + "id=" + id + + ", machineTypeNo='" + machineTypeNo + '\'' + + ", inspectionItemCode='" + inspectionItemCode + '\'' + + ", craftItemName='" + craftItemName + '\'' + + ", max='" + max + '\'' + + ", mean='" + mean + '\'' + + ", min='" + min + '\'' + + ", unit='" + unit + '\'' + + ", inspectionMethod='" + inspectionMethod + '\'' + + ", inspectionStandard='" + inspectionStandard + '\'' + + ", remark='" + remark + '\'' + + '}'; } } From 2f3a995359fd14e9450df2dc3fde05c0bf74e3af Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Wed, 2 Mar 2022 13:54:24 +0800 Subject: [PATCH 15/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9Qo?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xkrs/model/qo/DataSourceQo.java | 29 ++++++++++++++----- src/main/java/com/xkrs/model/qo/FileQo.java | 14 ++++----- .../java/com/xkrs/model/qo/FileUpdateQo.java | 14 ++++----- .../java/com/xkrs/model/qo/PictureQo.java | 27 ++++++++++++----- src/main/java/com/xkrs/model/qo/SpecQo.java | 28 +++++++++++++----- 5 files changed, 77 insertions(+), 35 deletions(-) diff --git a/src/main/java/com/xkrs/model/qo/DataSourceQo.java b/src/main/java/com/xkrs/model/qo/DataSourceQo.java index 7c42c7f..69727ed 100644 --- a/src/main/java/com/xkrs/model/qo/DataSourceQo.java +++ b/src/main/java/com/xkrs/model/qo/DataSourceQo.java @@ -35,10 +35,10 @@ public class DataSourceQo { private String modelNo; /** - * 零件号 + * 机种号 */ - @NotBlank(message = "{DataSource.partNo.blank}", groups = {DataSourceQoInsert.class}) - private String partNo; + @NotBlank(message = "{DataSource.machineTypeNo.blank}", groups = {DataSourceQoInsert.class}) + private String machineTypeNo; /** * 检验项代码 @@ -46,6 +46,12 @@ public class DataSourceQo { @NotBlank(message = "{DataSource.inspectionItemCode.blank}", groups = {DataSourceQoInsert.class}) private String inspectionItemCode; + /** + * 工艺项目名称 + */ + @NotBlank(message = "{DataSource.craftItemName.blank}", groups = {DataSourceQoInsert.class}) + private String craftItemName; + /** * 检验数值 */ @@ -87,12 +93,12 @@ public class DataSourceQo { this.modelNo = modelNo; } - public String getPartNo() { - return partNo; + public String getMachineTypeNo() { + return machineTypeNo; } - public void setPartNo(String partNo) { - this.partNo = partNo; + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; } public String getInspectionItemCode() { @@ -103,6 +109,14 @@ public class DataSourceQo { this.inspectionItemCode = inspectionItemCode; } + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } + public String getInspectValue() { return inspectValue; } @@ -110,4 +124,5 @@ public class DataSourceQo { public void setInspectValue(String inspectValue) { this.inspectValue = inspectValue; } + } diff --git a/src/main/java/com/xkrs/model/qo/FileQo.java b/src/main/java/com/xkrs/model/qo/FileQo.java index f1676d1..7f9e7d1 100644 --- a/src/main/java/com/xkrs/model/qo/FileQo.java +++ b/src/main/java/com/xkrs/model/qo/FileQo.java @@ -35,10 +35,10 @@ public class FileQo { private String modelNo; /** - * 零件号 + * 机种号 */ - @NotBlank(message = "{FileEntity.partNo.blank}", groups = {FileQoInsert.class}) - private String partNo; + @NotBlank(message = "{FileEntity.machineTypeNo.blank}", groups = {FileQoInsert.class}) + private String machineTypeNo; /** * 上传模板的路径 @@ -81,12 +81,12 @@ public class FileQo { this.modelNo = modelNo; } - public String getPartNo() { - return partNo; + public String getMachineTypeNo() { + return machineTypeNo; } - public void setPartNo(String partNo) { - this.partNo = partNo; + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; } public String getFileUploadPath() { diff --git a/src/main/java/com/xkrs/model/qo/FileUpdateQo.java b/src/main/java/com/xkrs/model/qo/FileUpdateQo.java index d681616..6a9840a 100644 --- a/src/main/java/com/xkrs/model/qo/FileUpdateQo.java +++ b/src/main/java/com/xkrs/model/qo/FileUpdateQo.java @@ -36,10 +36,10 @@ public class FileUpdateQo { private String modelNo; /** - * 零件号 + * 机种号 */ - @NotBlank(message = "{FileEntity.partNo.blank}", groups = {FileUpdateQoUpdate.class}) - private String partNo; + @NotBlank(message = "{FileEntity.machineTypeNo.blank}", groups = {FileUpdateQoUpdate.class}) + private String machineTypeNo; public FileUpdateQo() { } @@ -76,11 +76,11 @@ public class FileUpdateQo { this.modelNo = modelNo; } - public String getPartNo() { - return partNo; + public String getMachineTypeNo() { + return machineTypeNo; } - public void setPartNo(String partNo) { - this.partNo = partNo; + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; } } diff --git a/src/main/java/com/xkrs/model/qo/PictureQo.java b/src/main/java/com/xkrs/model/qo/PictureQo.java index ad7a310..c8efaa7 100644 --- a/src/main/java/com/xkrs/model/qo/PictureQo.java +++ b/src/main/java/com/xkrs/model/qo/PictureQo.java @@ -31,10 +31,16 @@ public class PictureQo { private String modelNo; /** - * 零件号 + * 机种号 */ - @NotBlank(message = "{PictureEntity.partNo.blank}", groups = {PictureQoInsert.class}) - private String partNo; + @NotBlank(message = "{PictureEntity.machineTypeNo.blank}", groups = {PictureQoInsert.class}) + private String machineTypeNo; + + /** + * 工艺项目名称 + */ + @NotBlank(message = "{PictureEntity.craftItemName.blank}", groups = {PictureQoInsert.class}) + private String craftItemName; public PictureQo() { } @@ -71,12 +77,19 @@ public class PictureQo { this.modelNo = modelNo; } - public String getPartNo() { - return partNo; + public String getMachineTypeNo() { + return machineTypeNo; } - public void setPartNo(String partNo) { - this.partNo = partNo; + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; } + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } } diff --git a/src/main/java/com/xkrs/model/qo/SpecQo.java b/src/main/java/com/xkrs/model/qo/SpecQo.java index 6984bc1..fe4ebdd 100644 --- a/src/main/java/com/xkrs/model/qo/SpecQo.java +++ b/src/main/java/com/xkrs/model/qo/SpecQo.java @@ -7,10 +7,10 @@ import javax.validation.constraints.NotBlank; public class SpecQo { /** - * 零件号 + * 机种号 */ - @NotBlank(message = "{SpecEntity.partNo.blank}", groups = {SpecQoInsert.class}) - private String partNo; + @NotBlank(message = "{SpecEntity.machineTypeNo.blank}", groups = {SpecQoInsert.class}) + private String machineTypeNo; /** * 检验项代码 @@ -18,6 +18,12 @@ public class SpecQo { @NotBlank(message = "{SpecEntity.inspectionItemCode.blank}", groups = {SpecQoInsert.class}) private String inspectionItemCode; + /** + * 工艺项目名称 + */ + @NotBlank(message = "{SpecEntity.craftItemName.blank}", groups = {SpecQoInsert.class}) + private String craftItemName; + /** * 最大值 */ @@ -62,12 +68,12 @@ public class SpecQo { public SpecQo() { } - public String getPartNo() { - return partNo; + public String getMachineTypeNo() { + return machineTypeNo; } - public void setPartNo(String partNo) { - this.partNo = partNo; + public void setMachineTypeNo(String machineTypeNo) { + this.machineTypeNo = machineTypeNo; } public String getInspectionItemCode() { @@ -78,6 +84,14 @@ public class SpecQo { this.inspectionItemCode = inspectionItemCode; } + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } + public String getMax() { return max; } From fd01a3a3d6f387591d4a4d0bbf54e4fe9e645d19 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Wed, 2 Mar 2022 14:51:32 +0800 Subject: [PATCH 16/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9Controller?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../xkrs/controller/DataDictController.java | 3 +- .../xkrs/controller/DataSourceController.java | 16 +++++----- .../com/xkrs/controller/FileController.java | 10 +++++-- .../xkrs/controller/PictureController.java | 13 +++++---- .../com/xkrs/controller/SpecController.java | 7 +++-- src/main/java/com/xkrs/dao/FileDao.java | 29 ++++++++++--------- src/main/java/com/xkrs/dao/PictureDao.java | 29 +++++-------------- .../com/xkrs/model/entity/FileEntity.java | 16 ++++++++++ src/main/java/com/xkrs/model/qo/FileQo.java | 14 +++++++++ .../java/com/xkrs/model/qo/FileUpdateQo.java | 15 ++++++++++ .../service/impl/DataSourceServiceImpl.java | 3 +- .../xkrs/service/impl/FileServiceImpl.java | 22 ++++++++++---- .../xkrs/service/impl/PictureServiceImpl.java | 8 +++-- .../xkrs/service/impl/SpecServiceImpl.java | 5 ++-- .../java/com/xkrs/util/DataDictQuery.java | 3 -- .../java/com/xkrs/util/DataSourceQuery.java | 9 ++++-- .../java/com/xkrs/util/ExcelUploadUtil.java | 8 ++--- src/main/java/com/xkrs/util/PictureQuery.java | 9 ++++-- src/main/java/com/xkrs/util/SpecQuery.java | 9 ++++-- 19 files changed, 148 insertions(+), 80 deletions(-) diff --git a/src/main/java/com/xkrs/controller/DataDictController.java b/src/main/java/com/xkrs/controller/DataDictController.java index e842041..341d2cd 100644 --- a/src/main/java/com/xkrs/controller/DataDictController.java +++ b/src/main/java/com/xkrs/controller/DataDictController.java @@ -53,7 +53,8 @@ public class DataDictController { * @return */ @GetMapping("/selectDataDict") - public String selectDataDict(@RequestParam("inspectionItemName") String inspectionItemName, @RequestParam("inspectionItemCode") String inspectionItemCode) { + public String selectDataDict(@RequestParam("inspectionItemName") String inspectionItemName, + @RequestParam("inspectionItemCode") String inspectionItemCode) { Locale locale = LocaleContextHolder.getLocale(); List dataDict = dataDictQuery.selectDataDict(inspectionItemName, inspectionItemCode); if (dataDict == null || dataDict.size() == 0) { diff --git a/src/main/java/com/xkrs/controller/DataSourceController.java b/src/main/java/com/xkrs/controller/DataSourceController.java index 7381f85..2963a15 100644 --- a/src/main/java/com/xkrs/controller/DataSourceController.java +++ b/src/main/java/com/xkrs/controller/DataSourceController.java @@ -45,11 +45,12 @@ public class DataSourceController { /** * 查询某一产品的测量信息 * - * @param lotNo 批次号 - * @param machineNo 机器号 - * @param materialNo 物料号 - * @param modelNo 模具号 - * @param partNo 零件号 + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param machineTypeNo 机种号 + * @param craftItemName 工艺项目名称 * @return */ @GetMapping("/selectDataSource") @@ -57,9 +58,10 @@ public class DataSourceController { @RequestParam(required = false, value = "machineNo") String machineNo, @RequestParam(required = false, value = "materialNo") String materialNo, @RequestParam(required = false, value = "modelNo") String modelNo, - @RequestParam(required = false, value = "partNo") String partNo) { + @RequestParam(required = false, value = "machineTypeNo") String machineTypeNo, + @RequestParam(required = false, value = "craftItemName") String craftItemName) { Locale locale = LocaleContextHolder.getLocale(); - List dataSources = dataSourceQuery.selectDataSource(lotNo, machineNo, materialNo, modelNo, partNo); + List dataSources = dataSourceQuery.selectDataSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName); if (dataSources == null || dataSources.size() == 0) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的测量信息!", locale); } diff --git a/src/main/java/com/xkrs/controller/FileController.java b/src/main/java/com/xkrs/controller/FileController.java index 2e1ca5e..36f5e1b 100644 --- a/src/main/java/com/xkrs/controller/FileController.java +++ b/src/main/java/com/xkrs/controller/FileController.java @@ -58,9 +58,15 @@ public class FileController { @PostMapping("/updateFileUploadPath") @Transactional(rollbackOn = Exception.class) public String updateFileUploadPath(@RequestBody FileUpdateQo fileUpdateQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { + String lotNo = fileUpdateQo.getLotNo(); + String machineNo = fileUpdateQo.getMachineNo(); + String materialNo = fileUpdateQo.getMaterialNo(); + String modelNo = fileUpdateQo.getModelNo(); + String machineTypeNo = fileUpdateQo.getMachineTypeNo(); + String craftItemName = fileUpdateQo.getCraftItemName(); Locale locale = LocaleContextHolder.getLocale(); - String file = ExcelUploadUtil.memoryFile(fileExcel,1); - fileDao.updateFileUploadPath(fileUpdateQo.getLotNo(), fileUpdateQo.getMachineNo(), fileUpdateQo.getMaterialNo(), fileUpdateQo.getModelNo(), fileUpdateQo.getPartNo(), file); + String file = ExcelUploadUtil.memoryFile(fileExcel, 1); + fileDao.updateFileUploadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, file); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "修改成功!", locale); } diff --git a/src/main/java/com/xkrs/controller/PictureController.java b/src/main/java/com/xkrs/controller/PictureController.java index b179102..2fce3fd 100644 --- a/src/main/java/com/xkrs/controller/PictureController.java +++ b/src/main/java/com/xkrs/controller/PictureController.java @@ -44,13 +44,14 @@ public class PictureController { * 查询图片 */ @GetMapping("/selectPicture") - public String selectPicture(@RequestParam("lotNo") String lotNo, - @RequestParam("machineNo") String machineNo, - @RequestParam("materialNo") String materialNo, - @RequestParam("modelNo") String modelNo, - @RequestParam("partNo") String partNo) { + public String selectPicture(@RequestParam(required = false, value = "lotNo") String lotNo, + @RequestParam(required = false, value = "machineNo") String machineNo, + @RequestParam(required = false, value = "materialNo") String materialNo, + @RequestParam(required = false, value = "modelNo") String modelNo, + @RequestParam(required = false, value = "machineTypeNo") String machineTypeNo, + @RequestParam(required = false, value = "craftItemName") String craftItemName) { Locale locale = LocaleContextHolder.getLocale(); - List pictureEntities = pictureQuery.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo); + List pictureEntities = pictureQuery.selectPicture(lotNo, machineNo, materialNo, modelNo, machineTypeNo,craftItemName); if (pictureEntities.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的图片!", locale); } diff --git a/src/main/java/com/xkrs/controller/SpecController.java b/src/main/java/com/xkrs/controller/SpecController.java index b441fba..37165b2 100644 --- a/src/main/java/com/xkrs/controller/SpecController.java +++ b/src/main/java/com/xkrs/controller/SpecController.java @@ -41,10 +41,11 @@ public class SpecController { * 查询规格信息 */ @GetMapping("/selectSpec") - public String selectSpec(@RequestParam(required = false, value = "partNo") String partNo, - @RequestParam(required = false, value = "inspectionItemCode") String inspectionItemCode) { + public String selectSpec(@RequestParam(required = false, value = "machineTypeNo") String machineTypeNo, + @RequestParam(required = false, value = "inspectionItemCode") String inspectionItemCode, + @RequestParam(required = false, value = "craftItemName") String craftItemName) { Locale locale = LocaleContextHolder.getLocale(); - List specEntities = specQuery.selectSpec(partNo, inspectionItemCode); + List specEntities = specQuery.selectSpec(machineTypeNo, inspectionItemCode, craftItemName); if (specEntities.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale); } diff --git a/src/main/java/com/xkrs/dao/FileDao.java b/src/main/java/com/xkrs/dao/FileDao.java index 66d73c6..eef603f 100644 --- a/src/main/java/com/xkrs/dao/FileDao.java +++ b/src/main/java/com/xkrs/dao/FileDao.java @@ -19,15 +19,16 @@ public interface FileDao extends JpaRepository, JpaSpecificati /** * 查询文件信息 * - * @param lotNo 批次号 - * @param machineNo 机器号 - * @param materialNo 物料号 - * @param modelNo 模具号 - * @param partNo 零件号 + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param machineTypeNo 机种号 + * @param craftItemName 工艺项目名称 * @return */ - @Query(value = "SELECT * FROM qc_inspection_file WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND part_no = ? ", nativeQuery = true) - Optional selectFile(String lotNo, String machineNo, String materialNo, String modelNo, String partNo); + @Query(value = "SELECT * FROM qc_inspection_file WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND machine_type_no = ? AND craft_item_name = ? ", nativeQuery = true) + Optional selectFile(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName); /** * 修改模板上传信息 @@ -36,12 +37,13 @@ public interface FileDao extends JpaRepository, JpaSpecificati * @param machineNo 机器号 * @param materialNo 物料号 * @param modelNo 模具号 - * @param partNo 零件号 + * @param machineTypeNo 机种号 + * @param craftItemName 工艺项目名称 * @param fileUploadPath 模板路径 */ @Modifying(clearAutomatically = true) - @Query(value = "UPDATE qc_inspection_file SET file_upload_path = ?6 WHERE lot_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND model_no = ?4 AND part_no = ?5 ", nativeQuery = true) - void updateFileUploadPath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String fileUploadPath); + @Query(value = "UPDATE qc_inspection_file SET file_upload_path = ?7 WHERE lot_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND model_no = ?4 AND machine_type_no = ?5 AND craft_item_name = ?6 ", nativeQuery = true) + void updateFileUploadPath(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName, String fileUploadPath); /** * 修改文件下载信息 @@ -50,12 +52,13 @@ public interface FileDao extends JpaRepository, JpaSpecificati * @param machineNo 机器号 * @param materialNo 物料号 * @param modelNo 模具号 - * @param partNo 零件号 + * @param machineTypeNo 机种号 + * @param craftItemName 工艺项目名称 * @param fileDownloadPath 文件下载路径 */ @Modifying(clearAutomatically = true) - @Query(value = "UPDATE qc_inspection_file SET file_download_path = ?6 WHERE lot_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND model_no = ?4 AND part_no = ?5 ", nativeQuery = true) - void updateFileDownloadPath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String fileDownloadPath); + @Query(value = "UPDATE qc_inspection_file SET file_download_path = ?7 WHERE lot_no = ?1 AND machine_no = ?2 AND material_no = ?3 AND model_no = ?4 AND machine_type_no = ?5 AND craft_item_name = ?6 ", nativeQuery = true) + void updateFileDownloadPath(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName, String fileDownloadPath); } diff --git a/src/main/java/com/xkrs/dao/PictureDao.java b/src/main/java/com/xkrs/dao/PictureDao.java index 56f8661..7102728 100644 --- a/src/main/java/com/xkrs/dao/PictureDao.java +++ b/src/main/java/com/xkrs/dao/PictureDao.java @@ -3,7 +3,6 @@ package com.xkrs.dao; import com.xkrs.model.entity.PictureEntity; import org.springframework.data.jpa.repository.JpaRepository; import org.springframework.data.jpa.repository.JpaSpecificationExecutor; -import org.springframework.data.jpa.repository.Modifying; import org.springframework.data.jpa.repository.Query; import org.springframework.stereotype.Component; @@ -19,27 +18,15 @@ public interface PictureDao extends JpaRepository, JpaSpeci /** * 查询图片信息 * - * @param lotNo 批次号 - * @param machineNo 机器号 - * @param materialNo 物料号 - * @param modelNo 模具号 - * @param partNo 零件号 + * @param lotNo 批次号 + * @param machineNo 机器号 + * @param materialNo 物料号 + * @param modelNo 模具号 + * @param machineTypeNo 机种号 + * @param craftItemName 工艺项目名称 * @return */ - @Query(value = "SELECT * FROM qc_inspection_picture WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND part_no = ? ", nativeQuery = true) - Optional selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String partNo); + @Query(value = "SELECT * FROM qc_inspection_picture WHERE lot_no = ? AND machine_no = ? AND material_no = ? AND model_no = ? AND machine_type_no = ? AND craft_item_name = ? ", nativeQuery = true) + Optional selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName); - /** - * 修改图片路径信息 - * - * @param lotNo 批次号 - * @param machineNo 机器号 - * @param materialNo 物料号 - * @param modelNo 模具号 - * @param partNo 零件号 - * @param picturePath 图片路径 - */ - @Modifying(clearAutomatically = true) - @Query(value = "UPDATE qc_inspection_picture SET picture_path = ?6 where lot_no = ?1 and machine_no = ?2 and material_no = ?3 and model_no = ?4 and part_no = ?5", nativeQuery = true) - void updatePicturePath(String lotNo, String machineNo, String materialNo, String modelNo, String partNo, String picturePath); } diff --git a/src/main/java/com/xkrs/model/entity/FileEntity.java b/src/main/java/com/xkrs/model/entity/FileEntity.java index 5f81038..d2965f3 100644 --- a/src/main/java/com/xkrs/model/entity/FileEntity.java +++ b/src/main/java/com/xkrs/model/entity/FileEntity.java @@ -47,6 +47,13 @@ public class FileEntity { @Column(length = 85, columnDefinition = "varchar(85)") private String machineTypeNo; + /** + * 工艺项目名称 + */ + @Column(length = 85, columnDefinition = "varchar(85)") + private String craftItemName; + + /** * 上传模板的路径 */ @@ -110,6 +117,14 @@ public class FileEntity { this.machineTypeNo = machineTypeNo; } + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } + public String getFileUploadPath() { return fileUploadPath; } @@ -135,6 +150,7 @@ public class FileEntity { ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", machineTypeNo='" + machineTypeNo + '\'' + + ", craftItemName='" + craftItemName + '\'' + ", fileUploadPath='" + fileUploadPath + '\'' + ", fileDownloadPath='" + fileDownloadPath + '\'' + '}'; diff --git a/src/main/java/com/xkrs/model/qo/FileQo.java b/src/main/java/com/xkrs/model/qo/FileQo.java index 7f9e7d1..da63156 100644 --- a/src/main/java/com/xkrs/model/qo/FileQo.java +++ b/src/main/java/com/xkrs/model/qo/FileQo.java @@ -40,6 +40,12 @@ public class FileQo { @NotBlank(message = "{FileEntity.machineTypeNo.blank}", groups = {FileQoInsert.class}) private String machineTypeNo; + /** + * 工艺项目名称 + */ + @NotBlank(message = "{FileEntity.craftItemName.blank}", groups = {FileQoInsert.class}) + private String craftItemName; + /** * 上传模板的路径 */ @@ -89,6 +95,14 @@ public class FileQo { this.machineTypeNo = machineTypeNo; } + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } + public String getFileUploadPath() { return fileUploadPath; } diff --git a/src/main/java/com/xkrs/model/qo/FileUpdateQo.java b/src/main/java/com/xkrs/model/qo/FileUpdateQo.java index 6a9840a..6ee00c9 100644 --- a/src/main/java/com/xkrs/model/qo/FileUpdateQo.java +++ b/src/main/java/com/xkrs/model/qo/FileUpdateQo.java @@ -1,6 +1,7 @@ package com.xkrs.model.qo; +import com.xkrs.model.validation.FileQoInsert; import com.xkrs.model.validation.FileUpdateQoUpdate; import javax.validation.constraints.NotBlank; @@ -41,6 +42,12 @@ public class FileUpdateQo { @NotBlank(message = "{FileEntity.machineTypeNo.blank}", groups = {FileUpdateQoUpdate.class}) private String machineTypeNo; + /** + * 工艺项目名称 + */ + @NotBlank(message = "{FileEntity.craftItemName.blank}", groups = {FileQoInsert.class}) + private String craftItemName; + public FileUpdateQo() { } @@ -83,4 +90,12 @@ public class FileUpdateQo { public void setMachineTypeNo(String machineTypeNo) { this.machineTypeNo = machineTypeNo; } + + public String getCraftItemName() { + return craftItemName; + } + + public void setCraftItemName(String craftItemName) { + this.craftItemName = craftItemName; + } } diff --git a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java index 9507998..4b2d1ca 100644 --- a/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/DataSourceServiceImpl.java @@ -47,7 +47,8 @@ public class DataSourceServiceImpl implements DataSourceService { dataSource.setMachineNo(dataSourceQo.getMachineNo()); dataSource.setMaterialNo(dataSourceQo.getMaterialNo()); dataSource.setModelNo(dataSourceQo.getModelNo()); - dataSource.setPartNo(dataSourceQo.getPartNo()); + dataSource.setMachineTypeNo(dataSourceQo.getMachineTypeNo()); + dataSource.setCraftItemName(dataSourceQo.getCraftItemName()); dataSource.setInspectionItemCode(dataSourceQo.getInspectionItemCode()); dataSource.setInspectValue(dataSourceQo.getInspectValue()); dataSourceDao.save(dataSource); diff --git a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java index 2f877c0..5488a3a 100644 --- a/src/main/java/com/xkrs/service/impl/FileServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/FileServiceImpl.java @@ -42,8 +42,14 @@ public class FileServiceImpl implements FileService { */ @Override public String insertFileExcel(FileQo fileQo, MultipartFile fileExcel) throws IOException { + String lotNo = fileQo.getLotNo(); + String machineNo = fileQo.getMachineNo(); + String materialNo = fileQo.getMaterialNo(); + String modelNo = fileQo.getModelNo(); + String machineTypeNo = fileQo.getMachineTypeNo(); + String craftItemName = fileQo.getCraftItemName(); Locale locale = LocaleContextHolder.getLocale(); - Optional fileEntity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); + Optional fileEntity = fileDao.selectFile(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName); if (fileEntity.isPresent()) { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该产品的模板!", locale); } @@ -56,7 +62,7 @@ public class FileServiceImpl implements FileService { fileEntity1.setMachineNo(fileQo.getMachineNo()); fileEntity1.setMaterialNo(fileQo.getMaterialNo()); fileEntity1.setModelNo(fileQo.getModelNo()); - fileEntity1.setPartNo(fileQo.getPartNo()); + fileEntity1.setMachineTypeNo(fileQo.getMachineTypeNo()); fileEntity1.setFileUploadPath(file); fileDao.save(fileEntity1); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); @@ -71,13 +77,19 @@ public class FileServiceImpl implements FileService { @Transactional(rollbackOn = Exception.class) @Override public String exportExcel(FileQo fileQo) throws IOException, InvalidFormatException { + String lotNo = fileQo.getLotNo(); + String machineNo = fileQo.getMachineNo(); + String materialNo = fileQo.getMaterialNo(); + String modelNo = fileQo.getModelNo(); + String machineTypeNo = fileQo.getMachineTypeNo(); + String craftItemName = fileQo.getCraftItemName(); Locale locale = LocaleContextHolder.getLocale(); - Optional fileEntity = fileDao.selectFile(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); + Optional fileEntity = fileDao.selectFile(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName); if (fileEntity.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的模板,请添加!", locale); } String fileUploadPath = fileEntity.get().getFileUploadPath(); - List dataSources = dataSourceQuery.selectDataSource(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo()); + List dataSources = dataSourceQuery.selectDataSource(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName); if (dataSources == null || dataSources.size() == 0) { return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该产品的信息!", locale); } @@ -86,7 +98,7 @@ public class FileServiceImpl implements FileService { map.put(dataSource.getInspectionItemCode(), dataSource.getInspectValue()); } String fill = ExportExcel.exportToProveExcel(map, fileUploadPath); - fileDao.updateFileDownloadPath(fileQo.getLotNo(), fileQo.getMachineNo(), fileQo.getMaterialNo(), fileQo.getModelNo(), fileQo.getPartNo(), fill); + fileDao.updateFileDownloadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, fill); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, fill, locale); } } diff --git a/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java b/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java index c992243..7e162ba 100644 --- a/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/PictureServiceImpl.java @@ -30,8 +30,9 @@ public class PictureServiceImpl implements PictureService { String machineNo = pictureQo.getMachineNo(); String materialNo = pictureQo.getMaterialNo(); String modelNo = pictureQo.getModelNo(); - String partNo = pictureQo.getPartNo(); - Optional pictureEntity2 = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, partNo); + String machineTypeNo = pictureQo.getMachineTypeNo(); + String craftItemName = pictureQo.getCraftItemName(); + Optional pictureEntity2 = pictureDao.selectPicture(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName); if (pictureEntity2.isPresent()) { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "请勿重复添加!", locale); } @@ -41,7 +42,8 @@ public class PictureServiceImpl implements PictureService { pictureEntity1.setMachineNo(machineNo); pictureEntity1.setMaterialNo(materialNo); pictureEntity1.setModelNo(modelNo); - pictureEntity1.setPartNo(partNo); + pictureEntity1.setMachineTypeNo(machineTypeNo); + pictureEntity1.setCraftItemName(craftItemName); pictureEntity1.setPicturePath(file); pictureDao.save(pictureEntity1); return outputEncapsulationObject(PromptMessageEnum.SUCCESS, "添加成功!", locale); diff --git a/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java b/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java index 7c5322a..ccac25e 100644 --- a/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java +++ b/src/main/java/com/xkrs/service/impl/SpecServiceImpl.java @@ -27,13 +27,14 @@ public class SpecServiceImpl implements SpecService { @Override public String insertSpec(SpecQo specQo) { Locale locale = LocaleContextHolder.getLocale(); - List specEntities = specQuery.selectSpec(specQo.getPartNo(), specQo.getInspectionItemCode()); + List specEntities = specQuery.selectSpec(specQo.getMachineTypeNo(), specQo.getInspectionItemCode(),specQo.getCraftItemName()); if (!specEntities.isEmpty()) { return outputEncapsulationObject(PromptMessageEnum.DATA_EXIT, "已存在该测量规格!", locale); } SpecEntity specEntity1 = new SpecEntity(); - specEntity1.setPartNo(specQo.getPartNo()); + specEntity1.setMachineTypeNo(specQo.getMachineTypeNo()); specEntity1.setInspectionItemCode(specQo.getInspectionItemCode()); + specEntity1.setCraftItemName(specQo.getCraftItemName()); specEntity1.setMax(specQo.getMax()); specEntity1.setMean(specQo.getMean()); specEntity1.setMin(specQo.getMin()); diff --git a/src/main/java/com/xkrs/util/DataDictQuery.java b/src/main/java/com/xkrs/util/DataDictQuery.java index 4e5a544..5d8e4a5 100644 --- a/src/main/java/com/xkrs/util/DataDictQuery.java +++ b/src/main/java/com/xkrs/util/DataDictQuery.java @@ -6,10 +6,7 @@ import org.springframework.data.jpa.domain.Specification; import org.springframework.stereotype.Component; import javax.annotation.Resource; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; import javax.persistence.criteria.Predicate; -import javax.persistence.criteria.Root; import java.util.ArrayList; import java.util.List; diff --git a/src/main/java/com/xkrs/util/DataSourceQuery.java b/src/main/java/com/xkrs/util/DataSourceQuery.java index eea61ed..18f5e4c 100644 --- a/src/main/java/com/xkrs/util/DataSourceQuery.java +++ b/src/main/java/com/xkrs/util/DataSourceQuery.java @@ -26,7 +26,7 @@ public class DataSourceQuery { * * @return */ - public List selectDataSource(String lotNo, String machineNo, String materialNo, String modelNo, String partNo) { + public List selectDataSource(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName) { Specification specification = (root, criteriaQuery, criteriaBuilder) -> { List list = new ArrayList<>(); if (!TextUtils.isEmpty(lotNo)) { @@ -41,8 +41,11 @@ public class DataSourceQuery { if (!TextUtils.isEmpty(modelNo)) { list.add(criteriaBuilder.equal(root.get("modelNo").as(String.class), modelNo)); } - if (!TextUtils.isEmpty(partNo)) { - list.add(criteriaBuilder.equal(root.get("partNo").as(String.class), partNo)); + if (!TextUtils.isEmpty(machineTypeNo)) { + list.add(criteriaBuilder.equal(root.get("machineTypeNo").as(String.class), machineTypeNo)); + } + if (!TextUtils.isEmpty(craftItemName)) { + list.add(criteriaBuilder.equal(root.get("craftItemName").as(String.class), craftItemName)); } Predicate[] predicates = new Predicate[list.size()]; return criteriaBuilder.and(list.toArray(predicates)); diff --git a/src/main/java/com/xkrs/util/ExcelUploadUtil.java b/src/main/java/com/xkrs/util/ExcelUploadUtil.java index d2c1bc8..7f4afb7 100644 --- a/src/main/java/com/xkrs/util/ExcelUploadUtil.java +++ b/src/main/java/com/xkrs/util/ExcelUploadUtil.java @@ -44,13 +44,13 @@ public class ExcelUploadUtil { String newName = UUID.randomUUID().toString() + suffix; //将图片保存到本地/usr/etc/images/Folder -// File file = new File("/Users/liuchengqian/Desktop/DaJiang/"); - File file = new File("/home/sxy/server/industrial_measurement" + subDir); + File file = new File("/Users/liuchengqian/Desktop/DaJiang/" + subDir); +// File file = new File("/home/sxy/server/industrial_measurement" + subDir); if (!file.exists()) { file.mkdirs(); } -// String path = "/Users/liuchengqian/Desktop/DaJiang/"+newName; - String path = "/home/sxy/server/industrial_measurement" + subDir + newName; + String path = "/Users/liuchengqian/Desktop/DaJiang/" + subDir + newName; +// String path = "/home/sxy/server/industrial_measurement" + subDir + newName; String uploadsImage = uploadPath + newName; //实现上传 fileInput.transferTo(new File(path)); diff --git a/src/main/java/com/xkrs/util/PictureQuery.java b/src/main/java/com/xkrs/util/PictureQuery.java index 79dc2e2..cd7ab46 100644 --- a/src/main/java/com/xkrs/util/PictureQuery.java +++ b/src/main/java/com/xkrs/util/PictureQuery.java @@ -26,7 +26,7 @@ public class PictureQuery { * * @return */ - public List selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String partNo) { + public List selectPicture(String lotNo, String machineNo, String materialNo, String modelNo, String machineTypeNo, String craftItemName) { Specification specification = (root, criteriaQuery, criteriaBuilder) -> { List list = new ArrayList<>(); if (!TextUtils.isEmpty(lotNo)) { @@ -41,8 +41,11 @@ public class PictureQuery { if (!TextUtils.isEmpty(modelNo)) { list.add(criteriaBuilder.equal(root.get("modelNo").as(String.class), modelNo)); } - if (!TextUtils.isEmpty(partNo)) { - list.add(criteriaBuilder.equal(root.get("partNo").as(String.class), partNo)); + if (!TextUtils.isEmpty(machineTypeNo)) { + list.add(criteriaBuilder.equal(root.get("machineTypeNo").as(String.class), machineTypeNo)); + } + if (!TextUtils.isEmpty(craftItemName)) { + list.add(criteriaBuilder.equal(root.get("craftItemName").as(String.class), craftItemName)); } Predicate[] predicates = new Predicate[list.size()]; return criteriaBuilder.and(list.toArray(predicates)); diff --git a/src/main/java/com/xkrs/util/SpecQuery.java b/src/main/java/com/xkrs/util/SpecQuery.java index 17ae43f..d744a90 100644 --- a/src/main/java/com/xkrs/util/SpecQuery.java +++ b/src/main/java/com/xkrs/util/SpecQuery.java @@ -26,15 +26,18 @@ public class SpecQuery { * * @return */ - public List selectSpec(String partNo, String inspectionItemCode) { + public List selectSpec(String machineTypeNo, String inspectionItemCode, String craftItemName) { Specification specification = (root, criteriaQuery, criteriaBuilder) -> { List list = new ArrayList<>(); - if (!TextUtils.isEmpty(partNo)) { - list.add(criteriaBuilder.equal(root.get("partNo").as(String.class), partNo)); + if (!TextUtils.isEmpty(machineTypeNo)) { + list.add(criteriaBuilder.equal(root.get("machineTypeNo").as(String.class), machineTypeNo)); } if (!TextUtils.isEmpty(inspectionItemCode)) { list.add(criteriaBuilder.equal(root.get("inspectionItemCode").as(String.class), inspectionItemCode)); } + if (!TextUtils.isEmpty(craftItemName)) { + list.add(criteriaBuilder.equal(root.get("craftItemName").as(String.class), craftItemName)); + } Predicate[] predicates = new Predicate[list.size()]; return criteriaBuilder.and(list.toArray(predicates)); }; From 641cfceb9f862e0526f37f7ab084f814852bca23 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Wed, 2 Mar 2022 15:17:40 +0800 Subject: [PATCH 17/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../com/xkrs/controller/FileController.java | 17 ++- src/main/java/com/xkrs/model/qo/FileQo.java | 14 --- .../java/com/xkrs/model/qo/FileUpdateQo.java | 101 ------------------ .../java/com/xkrs/util/ExcelUploadUtil.java | 16 +-- 4 files changed, 12 insertions(+), 136 deletions(-) delete mode 100644 src/main/java/com/xkrs/model/qo/FileUpdateQo.java diff --git a/src/main/java/com/xkrs/controller/FileController.java b/src/main/java/com/xkrs/controller/FileController.java index 36f5e1b..bfe69af 100644 --- a/src/main/java/com/xkrs/controller/FileController.java +++ b/src/main/java/com/xkrs/controller/FileController.java @@ -3,7 +3,6 @@ package com.xkrs.controller; import com.xkrs.dao.FileDao; import com.xkrs.encapsulation.PromptMessageEnum; import com.xkrs.model.qo.FileQo; -import com.xkrs.model.qo.FileUpdateQo; import com.xkrs.service.FileService; import com.xkrs.util.ExcelUploadUtil; import org.apache.poi.openxml4j.exceptions.InvalidFormatException; @@ -50,20 +49,20 @@ public class FileController { /** * 修改上传的模板信息 * - * @param fileUpdateQo + * @param fileQo * @param fileExcel * @return * @throws IOException */ @PostMapping("/updateFileUploadPath") @Transactional(rollbackOn = Exception.class) - public String updateFileUploadPath(@RequestBody FileUpdateQo fileUpdateQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { - String lotNo = fileUpdateQo.getLotNo(); - String machineNo = fileUpdateQo.getMachineNo(); - String materialNo = fileUpdateQo.getMaterialNo(); - String modelNo = fileUpdateQo.getModelNo(); - String machineTypeNo = fileUpdateQo.getMachineTypeNo(); - String craftItemName = fileUpdateQo.getCraftItemName(); + public String updateFileUploadPath(@RequestBody FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { + String lotNo = fileQo.getLotNo(); + String machineNo = fileQo.getMachineNo(); + String materialNo = fileQo.getMaterialNo(); + String modelNo = fileQo.getModelNo(); + String machineTypeNo = fileQo.getMachineTypeNo(); + String craftItemName = fileQo.getCraftItemName(); Locale locale = LocaleContextHolder.getLocale(); String file = ExcelUploadUtil.memoryFile(fileExcel, 1); fileDao.updateFileUploadPath(lotNo, machineNo, materialNo, modelNo, machineTypeNo, craftItemName, file); diff --git a/src/main/java/com/xkrs/model/qo/FileQo.java b/src/main/java/com/xkrs/model/qo/FileQo.java index da63156..08acc61 100644 --- a/src/main/java/com/xkrs/model/qo/FileQo.java +++ b/src/main/java/com/xkrs/model/qo/FileQo.java @@ -46,12 +46,6 @@ public class FileQo { @NotBlank(message = "{FileEntity.craftItemName.blank}", groups = {FileQoInsert.class}) private String craftItemName; - /** - * 上传模板的路径 - */ - @NotBlank(message = "{FileEntity.fileUploadPath.blank}", groups = {FileQoInsert.class}) - private String fileUploadPath; - public FileQo() { } @@ -102,12 +96,4 @@ public class FileQo { public void setCraftItemName(String craftItemName) { this.craftItemName = craftItemName; } - - public String getFileUploadPath() { - return fileUploadPath; - } - - public void setFileUploadPath(String fileUploadPath) { - this.fileUploadPath = fileUploadPath; - } } diff --git a/src/main/java/com/xkrs/model/qo/FileUpdateQo.java b/src/main/java/com/xkrs/model/qo/FileUpdateQo.java deleted file mode 100644 index 6ee00c9..0000000 --- a/src/main/java/com/xkrs/model/qo/FileUpdateQo.java +++ /dev/null @@ -1,101 +0,0 @@ -package com.xkrs.model.qo; - - -import com.xkrs.model.validation.FileQoInsert; -import com.xkrs.model.validation.FileUpdateQoUpdate; - -import javax.validation.constraints.NotBlank; - -/** - * @Author: XinYi Song - * @Date: 2022/1/20 16:20 - */ -public class FileUpdateQo { - - /** - * 批次号 - */ - @NotBlank(message = "{FileEntity.lotNo.blank}", groups = {FileUpdateQoUpdate.class}) - private String lotNo; - - /** - * 机器号 - */ - @NotBlank(message = "{FileEntity.machineNo.blank}", groups = {FileUpdateQoUpdate.class}) - private String machineNo; - - /** - * 物料号 - */ - @NotBlank(message = "{FileEntity.materialNo.blank}", groups = {FileUpdateQoUpdate.class}) - private String materialNo; - - /** - * 模具号 - */ - @NotBlank(message = "{FileEntity.modelNo.blank}", groups = {FileUpdateQoUpdate.class}) - private String modelNo; - - /** - * 机种号 - */ - @NotBlank(message = "{FileEntity.machineTypeNo.blank}", groups = {FileUpdateQoUpdate.class}) - private String machineTypeNo; - - /** - * 工艺项目名称 - */ - @NotBlank(message = "{FileEntity.craftItemName.blank}", groups = {FileQoInsert.class}) - private String craftItemName; - - public FileUpdateQo() { - } - - public String getLotNo() { - return lotNo; - } - - public void setLotNo(String lotNo) { - this.lotNo = lotNo; - } - - 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 getModelNo() { - return modelNo; - } - - public void setModelNo(String modelNo) { - this.modelNo = modelNo; - } - - public String getMachineTypeNo() { - return machineTypeNo; - } - - public void setMachineTypeNo(String machineTypeNo) { - this.machineTypeNo = machineTypeNo; - } - - public String getCraftItemName() { - return craftItemName; - } - - public void setCraftItemName(String craftItemName) { - this.craftItemName = craftItemName; - } -} diff --git a/src/main/java/com/xkrs/util/ExcelUploadUtil.java b/src/main/java/com/xkrs/util/ExcelUploadUtil.java index 7f4afb7..8db6ee8 100644 --- a/src/main/java/com/xkrs/util/ExcelUploadUtil.java +++ b/src/main/java/com/xkrs/util/ExcelUploadUtil.java @@ -29,10 +29,7 @@ public class ExcelUploadUtil { * @throws IOException */ public static String memoryFile(MultipartFile fileInput, int subDirType) throws IOException { - String subDir = subDirType == 1 ? "/excel/" : "/picture/"; - //String uploadPath = "http://139.199.98.175:2088/wfTaskImage/"; -// String uploadPath = "http://192.168.2.9:2088/"; - String uploadPath = "http://118.24.27.47:4096/"; + String subDir = subDirType == 1 ? "excel/" : "picture/"; //获取原始文件名 String originalFilename = fileInput.getOriginalFilename(); if (originalFilename != null && !"".equals(originalFilename)) { @@ -42,19 +39,14 @@ public class ExcelUploadUtil { String suffix = originalFilename.substring(index); //uuid生成新的文件名 String newName = UUID.randomUUID().toString() + suffix; - - //将图片保存到本地/usr/etc/images/Folder - File file = new File("/Users/liuchengqian/Desktop/DaJiang/" + subDir); -// File file = new File("/home/sxy/server/industrial_measurement" + subDir); + File file = new File("/home/sxy/server/industrial_measurement/" + subDir); if (!file.exists()) { file.mkdirs(); } - String path = "/Users/liuchengqian/Desktop/DaJiang/" + subDir + newName; -// String path = "/home/sxy/server/industrial_measurement" + subDir + newName; - String uploadsImage = uploadPath + newName; + String path = "/home/sxy/server/industrial_measurement/" + subDir + newName; //实现上传 fileInput.transferTo(new File(path)); - return subDir + newName; + return "http://118.24.27.47:2088/" + subDir + newName; } return null; } From 24e6545e01976a581fcd08dd701c7930ff50b07c Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Wed, 2 Mar 2022 16:36:33 +0800 Subject: [PATCH 18/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E5=9B=BE=E7=89=87?= =?UTF-8?q?=E8=B7=AF=E5=BE=84?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/xkrs/controller/PictureController.java | 2 +- .../java/com/xkrs/controller/SpecController.java | 2 +- src/main/java/com/xkrs/model/entity/DataSource.java | 12 +----------- src/main/java/com/xkrs/util/ExcelUploadUtil.java | 2 ++ 4 files changed, 5 insertions(+), 13 deletions(-) diff --git a/src/main/java/com/xkrs/controller/PictureController.java b/src/main/java/com/xkrs/controller/PictureController.java index 2fce3fd..98302a2 100644 --- a/src/main/java/com/xkrs/controller/PictureController.java +++ b/src/main/java/com/xkrs/controller/PictureController.java @@ -53,7 +53,7 @@ public class PictureController { Locale locale = LocaleContextHolder.getLocale(); List pictureEntities = pictureQuery.selectPicture(lotNo, machineNo, materialNo, modelNo, machineTypeNo,craftItemName); if (pictureEntities.isEmpty()) { - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的图片!", locale); + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该图片!", locale); } return outputEncapsulationObject(PromptMessageEnum.SUCCESS, pictureEntities, locale); } diff --git a/src/main/java/com/xkrs/controller/SpecController.java b/src/main/java/com/xkrs/controller/SpecController.java index 37165b2..645eefd 100644 --- a/src/main/java/com/xkrs/controller/SpecController.java +++ b/src/main/java/com/xkrs/controller/SpecController.java @@ -47,7 +47,7 @@ public class SpecController { Locale locale = LocaleContextHolder.getLocale(); List specEntities = specQuery.selectSpec(machineTypeNo, inspectionItemCode, craftItemName); if (specEntities.isEmpty()) { - return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该零件的规格信息!", locale); + return outputEncapsulationObject(PromptMessageEnum.DATA_NONE, "暂时没有该规格信息!", locale); } return outputEncapsulationObject(PromptMessageEnum.SUCCESS, specEntities, locale); } diff --git a/src/main/java/com/xkrs/model/entity/DataSource.java b/src/main/java/com/xkrs/model/entity/DataSource.java index 07f6f0f..8b17eb0 100644 --- a/src/main/java/com/xkrs/model/entity/DataSource.java +++ b/src/main/java/com/xkrs/model/entity/DataSource.java @@ -143,16 +143,6 @@ public class DataSource { @Override public String toString() { - return "DataSource{" + - "id=" + id + - ", lotNo='" + lotNo + '\'' + - ", machineNo='" + machineNo + '\'' + - ", materialNo='" + materialNo + '\'' + - ", modelNo='" + modelNo + '\'' + - ", machineTypeNo='" + machineTypeNo + '\'' + - ", inspectionItemCode='" + inspectionItemCode + '\'' + - ", craftItemName='" + craftItemName + '\'' + - ", inspectValue='" + inspectValue + '\'' + - '}'; + return "DataSource{" + "id=" + id + ", lotNo='" + lotNo + '\'' + ", machineNo='" + machineNo + '\'' + ", materialNo='" + materialNo + '\'' + ", modelNo='" + modelNo + '\'' + ", machineTypeNo='" + machineTypeNo + '\'' + ", inspectionItemCode='" + inspectionItemCode + '\'' + ", craftItemName='" + craftItemName + '\'' + ", inspectValue='" + inspectValue + '\'' + '}'; } } diff --git a/src/main/java/com/xkrs/util/ExcelUploadUtil.java b/src/main/java/com/xkrs/util/ExcelUploadUtil.java index 8db6ee8..c6f94a2 100644 --- a/src/main/java/com/xkrs/util/ExcelUploadUtil.java +++ b/src/main/java/com/xkrs/util/ExcelUploadUtil.java @@ -39,10 +39,12 @@ public class ExcelUploadUtil { String suffix = originalFilename.substring(index); //uuid生成新的文件名 String newName = UUID.randomUUID().toString() + suffix; +// File file = new File("/Users/liuchengqian/Desktop/DaJiang/" + subDir); File file = new File("/home/sxy/server/industrial_measurement/" + subDir); if (!file.exists()) { file.mkdirs(); } +// String path = "/Users/liuchengqian/Desktop/DaJiang/" + subDir + newName; String path = "/home/sxy/server/industrial_measurement/" + subDir + newName; //实现上传 fileInput.transferTo(new File(path)); From 3678e1369316e1f64c821a670f66dc1cdfc42de9 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Wed, 2 Mar 2022 17:10:20 +0800 Subject: [PATCH 19/20] =?UTF-8?q?=E4=BF=AE=E6=94=B9=E6=96=87=E4=BB=B6?= =?UTF-8?q?=E6=8E=A5=E6=94=B6=E6=96=B9=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/java/com/xkrs/controller/FileController.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/com/xkrs/controller/FileController.java b/src/main/java/com/xkrs/controller/FileController.java index bfe69af..cd82dc6 100644 --- a/src/main/java/com/xkrs/controller/FileController.java +++ b/src/main/java/com/xkrs/controller/FileController.java @@ -42,7 +42,7 @@ public class FileController { * @throws IOException */ @PostMapping("/insertFileExcel") - public String insertFileExcel(@RequestBody FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { + public String insertFileExcel(FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { return fileService.insertFileExcel(fileQo, fileExcel); } @@ -56,7 +56,7 @@ public class FileController { */ @PostMapping("/updateFileUploadPath") @Transactional(rollbackOn = Exception.class) - public String updateFileUploadPath(@RequestBody FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { + public String updateFileUploadPath(FileQo fileQo, @RequestParam("fileExcel") MultipartFile fileExcel) throws IOException { String lotNo = fileQo.getLotNo(); String machineNo = fileQo.getMachineNo(); String materialNo = fileQo.getMaterialNo(); From 1c9f149b39307ddf0f1b106d4cd80522f144d7f2 Mon Sep 17 00:00:00 2001 From: liuchengqian Date: Thu, 3 Mar 2022 15:39:41 +0800 Subject: [PATCH 20/20] . --- src/main/java/com/xkrs/WordAndExcelApplication.java | 1 + 1 file changed, 1 insertion(+) diff --git a/src/main/java/com/xkrs/WordAndExcelApplication.java b/src/main/java/com/xkrs/WordAndExcelApplication.java index a11963d..5bb80c3 100644 --- a/src/main/java/com/xkrs/WordAndExcelApplication.java +++ b/src/main/java/com/xkrs/WordAndExcelApplication.java @@ -7,6 +7,7 @@ import org.springframework.boot.autoconfigure.SpringBootApplication; public class WordAndExcelApplication { public static void main(String[] args) { + SpringApplication.run(WordAndExcelApplication.class, args); }