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