Browse Source

重点危化品企业导入

master
zxc 3 years ago
parent
commit
8695e8d9fe
  1. 41
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsImportListener.java
  2. 35
      epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsModel.java

41
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsImportListener.java

@ -18,6 +18,7 @@ import lombok.Data;
import lombok.extern.slf4j.Slf4j;
import org.apache.commons.collections4.CollectionUtils;
import org.apache.commons.collections4.MapUtils;
import org.apache.commons.lang3.StringUtils;
import java.util.ArrayList;
import java.util.HashMap;
@ -52,6 +53,46 @@ public class DangerousChemicalsImportListener extends AnalysisEventListener<Dang
@Override
public void invoke(DangerousChemicalsModel data, AnalysisContext context) {
Integer rowNum = context.readRowHolder().getRowIndex() + NumConstant.ONE;
if (StringUtils.isBlank(data.getName())){
DangerousChemicalsModel.RowRemarkMessage row = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
row.setRowNum(rowNum);
row.setErrorInfo("企业名称不能为空");
errorRows.add(row);
return;
}
if (StringUtils.isBlank(data.getCategoryName())){
DangerousChemicalsModel.RowRemarkMessage row = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
row.setRowNum(rowNum);
row.setErrorInfo("企业类型不能为空");
errorRows.add(row);
return;
}
if (StringUtils.isBlank(data.getAddress())){
DangerousChemicalsModel.RowRemarkMessage row = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
row.setRowNum(rowNum);
row.setErrorInfo("经营地址不能为空");
errorRows.add(row);
return;
}
if (data.getName().length() > NumConstant.FIFTY){
DangerousChemicalsModel.RowRemarkMessage row = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
row.setRowNum(rowNum);
row.setErrorInfo("企业名称长度超出50字限制");
errorRows.add(row);
}
if (data.getPrincipalMobile().length() > NumConstant.FIFTY){
DangerousChemicalsModel.RowRemarkMessage row = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
row.setRowNum(rowNum);
row.setErrorInfo("联系电话长度超出50字限制");
errorRows.add(row);
}
if (data.getName().length() > NumConstant.FIFTY){
DangerousChemicalsModel.RowRemarkMessage row = ConvertUtils.sourceToTarget(data, DangerousChemicalsModel.RowRemarkMessage.class);
row.setRowNum(rowNum);
row.setErrorInfo("经营地址长度超出50字限制");
errorRows.add(row);
}
IcDangerousChemicalsEntity e = ConvertUtils.sourceToTarget(data, IcDangerousChemicalsEntity.class);
e.setSourceType("import");
e.setAgencyId(agencyInfo.getId());

35
epmet-module/gov-org/gov-org-server/src/main/java/com/epmet/model/DangerousChemicalsModel.java

@ -48,6 +48,41 @@ public class DangerousChemicalsModel {
@Data
public static class RowRemarkMessage {
@ExcelProperty(value = "行号")
private Integer rowNum;
@ColumnWidth(20)
@ExcelProperty(value = "企业名称")
private String name;
@ColumnWidth(20)
@ExcelProperty(value = "企业类型")
private String categoryName;
@ColumnWidth(20)
@ExcelProperty(value = "周边安全间距(公里)")
private String safeDistance = NumConstant.ZERO_STR;
@ColumnWidth(20)
@ExcelProperty(value = "危化品种类")
private String dangerTypeName;
@ColumnWidth(20)
@ExcelProperty(value = "负责人")
private String principalName;
@ColumnWidth(20)
@ExcelProperty(value = "联系电话")
private String principalMobile;
@ColumnWidth(40)
@ExcelProperty(value = "经营地址")
private String address;
@ColumnWidth(60)
@ExcelProperty(value = "备注")
private String remark;
@ColumnWidth(60)
@ExcelProperty("错误信息")
private String errorInfo;

Loading…
Cancel
Save