From 206e5f8d20857f1948fcf983072a32e97b3d2a26 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B1=AA=E4=BA=91=E6=98=8A?= Date: Fri, 13 Nov 2020 11:00:03 +0800 Subject: [PATCH] =?UTF-8?q?feat(form):=E6=94=AF=E6=8C=81=E5=AF=BC=E5=85=A5?= =?UTF-8?q?=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../cn/estsh/i3plus/pojo/form/bean/BfElement.java | 6 ++ .../i3plus/pojo/form/bean/BfElementProperty.java | 13 +++++ .../i3plus/pojo/model/mes/ExcelImportModel.java | 19 ++++++- .../i3plus/pojo/model/mes/ImportErrorModel.java | 64 ++++++++++++++++++++++ 4 files changed, 99 insertions(+), 3 deletions(-) diff --git a/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfElement.java b/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfElement.java index 3dcf892..5eec86d 100644 --- a/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfElement.java +++ b/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfElement.java @@ -8,6 +8,7 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiParam; import lombok.Data; import lombok.EqualsAndHashCode; +import org.hibernate.annotations.ColumnDefault; import org.hibernate.annotations.DynamicInsert; import org.hibernate.annotations.DynamicUpdate; @@ -140,6 +141,11 @@ public class BfElement extends BaseBean { @ApiParam(value = "是否导出") private Integer isObjectExport; + @ColumnDefault("2") + @Column(name = "IS_OBJECT_IMPORT") + @ApiParam(value = "是否导入") + private Integer isObjectImport; + @Column(name="ELEMENT_SORT_ATTR_ID") @ApiParam(value ="默认排序属性") @JsonSerialize(using = ToStringSerializer.class) diff --git a/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfElementProperty.java b/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfElementProperty.java index 33d1bef..864ad93 100644 --- a/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfElementProperty.java +++ b/modules/i3plus-pojo-form/src/main/java/cn/estsh/i3plus/pojo/form/bean/BfElementProperty.java @@ -3,6 +3,7 @@ package cn.estsh.i3plus.pojo.form.bean; import cn.estsh.i3plus.pojo.base.annotation.AnnoOutputColumn; import cn.estsh.i3plus.pojo.base.bean.BaseBean; import cn.estsh.i3plus.pojo.base.enumutil.BlockFormEnumUtil; +import cn.estsh.i3plus.pojo.base.enumutil.CommonEnumUtil; import com.fasterxml.jackson.databind.annotation.JsonSerialize; import com.fasterxml.jackson.databind.ser.std.ToStringSerializer; import io.swagger.annotations.Api; @@ -87,6 +88,10 @@ public class BfElementProperty extends BaseBean { @ApiParam(value = "是否必填") private Integer propertyValueNotNull; + public boolean isPropValNotNull() { + return propertyValueNotNull == null || propertyValueNotNull == CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(); + } + @Column(name = "PROPERTY_IS_FIND") @ApiParam(value = "是否查询条件") private Integer propertyIsFind; @@ -123,6 +128,14 @@ public class BfElementProperty extends BaseBean { @ApiParam(value = "显示顺序") private Integer propertySort; + @Column(name = "IS_SUPPORT_IMPORT") + @ApiParam(value = "是否支持导入") + private Integer isSupportImport; + + public boolean isSupportImport() { + return isSupportImport != null && isSupportImport == CommonEnumUtil.TRUE_OR_FALSE.TRUE.getValue(); + } + @Column(name = "PROPERTY_CONTROL_TYPE") @ApiParam(value = "控件类型") private Integer propertyControlType; diff --git a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/mes/ExcelImportModel.java b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/mes/ExcelImportModel.java index a4d0580..d49ea8c 100644 --- a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/mes/ExcelImportModel.java +++ b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/mes/ExcelImportModel.java @@ -5,9 +5,9 @@ import io.swagger.annotations.Api; import io.swagger.annotations.ApiParam; import lombok.AllArgsConstructor; import lombok.Data; -import lombok.NoArgsConstructor; import java.io.Serializable; +import java.util.ArrayList; import java.util.List; /** @@ -16,12 +16,12 @@ import java.util.List; * @Description: **/ @Data -@NoArgsConstructor @AllArgsConstructor @Api("mes导入结果model") public class ExcelImportModel implements Serializable { private static final long serialVersionUID = 3075276018074690913L; + @ApiParam("结果") private boolean result; @@ -32,7 +32,7 @@ public class ExcelImportModel implements Serializable { private int failRowNum; @ApiParam("错误信息集合") - private List ImportErrorModels; + private List importErrorModels; @ApiParam("错误的行号") private String errorRows; @@ -46,4 +46,17 @@ public class ExcelImportModel implements Serializable { @ApiParam("Sheet名称") private String sheetName; + + public ExcelImportModel() { + result = true; + } + + public void addErrorMsg(ImportErrorModel errorModel) { + if (importErrorModels == null) { + importErrorModels = new ArrayList<>(); + } + importErrorModels.add(errorModel); + result = false; + } + } diff --git a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/mes/ImportErrorModel.java b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/mes/ImportErrorModel.java index c644a49..4a135a5 100644 --- a/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/mes/ImportErrorModel.java +++ b/modules/i3plus-pojo-model/src/main/java/cn/estsh/i3plus/pojo/model/mes/ImportErrorModel.java @@ -21,9 +21,19 @@ import java.io.Serializable; public class ImportErrorModel implements Serializable { private static final long serialVersionUID = 1212013821950324792L; + + @ApiParam("sheet名称") + private String sheetName; + @ApiParam("错误的行号") private int rowNum; + @ApiParam("错误的列号") + private int colNum; + + @ApiParam("错误的列名") + private String colName; + @ApiParam("错误数量") private int errorNum; @@ -33,4 +43,58 @@ public class ImportErrorModel implements Serializable { @ApiParam("错误描述") private String errorInfo; + public static final class Builder { + private String sheetName; + private int rowNum; + private int colNum; + private String colName; + private String errorInfo; + + private Builder() { + } + + public static Builder newBuilder() { + return new Builder(); + } + + public Builder withSheetName(String sheetName) { + this.sheetName = sheetName; + return this; + } + + public Builder withRowNum(int rowNum) { + this.rowNum = rowNum; + return this; + } + + public Builder withColNum(int colNum) { + this.colNum = colNum; + return this; + } + + public Builder withColName(String colName) { + this.colName = colName; + return this; + } + + public Builder withErrorInfo(String errorInfo) { + this.errorInfo = errorInfo; + return this; + } + + public ImportErrorModel build() { + ImportErrorModel importErrorModel = new ImportErrorModel(); + importErrorModel.setSheetName(sheetName); + importErrorModel.setRowNum(rowNum); + importErrorModel.setColNum(colNum); + importErrorModel.setColName(colName); + if(errorInfo== null){ + importErrorModel.setErrorInfo("SHEET【" + sheetName + "】中第【" + rowNum + "】行,第【" + colNum + "】列 " + + colName + " 数据为空"); + }else { + importErrorModel.setErrorInfo(errorInfo); + } + return importErrorModel; + } + } }