|
@ -12,7 +12,6 @@ import com.epmet.commons.tools.validator.ValidatorUtils; |
|
|
import com.epmet.entity.IcEnterpriseEntity; |
|
|
import com.epmet.entity.IcEnterpriseEntity; |
|
|
import com.epmet.excel.EnterpriseImportExcelDTO; |
|
|
import com.epmet.excel.EnterpriseImportExcelDTO; |
|
|
import com.epmet.service.impl.IcEnterpriseServiceImpl; |
|
|
import com.epmet.service.impl.IcEnterpriseServiceImpl; |
|
|
import lombok.Data; |
|
|
|
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
import lombok.extern.slf4j.Slf4j; |
|
|
|
|
|
|
|
|
import java.util.ArrayList; |
|
|
import java.util.ArrayList; |
|
@ -57,19 +56,20 @@ public class IcEnterpriseExcelImportListener implements ReadListener<EnterpriseI |
|
|
public void invoke(EnterpriseImportExcelDTO data, AnalysisContext context) { |
|
|
public void invoke(EnterpriseImportExcelDTO data, AnalysisContext context) { |
|
|
|
|
|
|
|
|
try { |
|
|
try { |
|
|
|
|
|
// log.warn("有数据吗?"+JSON.toJSONString(data));
|
|
|
// 不能为空先校验数据
|
|
|
// 不能为空先校验数据
|
|
|
ValidatorUtils.validateEntity(data); |
|
|
ValidatorUtils.validateEntity(data); |
|
|
// 去除空格
|
|
|
// 去除空格
|
|
|
ObjectUtil.objectToTrim(data); |
|
|
ObjectUtil.objectToTrim(data); |
|
|
// 根据网格名是否能找到网格id
|
|
|
// 根据网格名是否能找到网格id
|
|
|
if (!gridMap.containsKey(data.getGridName())) { |
|
|
if (!gridMap.containsKey(data.getGridName())) { |
|
|
throw new ValidateException(String.format("您所在的组织,%s不存在", data.getGridName())); |
|
|
throw new ValidateException(String.format("您所在的组织,不存在【%s】", data.getGridName())); |
|
|
} |
|
|
} |
|
|
if(!placeTypeMap.containsKey(data.getPlaceTypeName())){ |
|
|
if(!placeTypeMap.containsKey(data.getPlaceTypeName())){ |
|
|
throw new ValidateException(String.format("%s场所类型不存在",data.getPlaceTypeName())); |
|
|
throw new ValidateException(String.format("【%s】场所类型不存在",data.getPlaceTypeName())); |
|
|
} |
|
|
} |
|
|
if(!scaleMap.containsKey(data.getScaleName())){ |
|
|
if(!scaleMap.containsKey(data.getScaleName())){ |
|
|
throw new ValidateException(String.format("%s规模不存在",data.getScaleName())); |
|
|
throw new ValidateException(String.format("【%s】规模不存在",data.getScaleName())); |
|
|
} |
|
|
} |
|
|
IcEnterpriseEntity enterpriseEntity = ConvertUtils.sourceToTarget(data, IcEnterpriseEntity.class); |
|
|
IcEnterpriseEntity enterpriseEntity = ConvertUtils.sourceToTarget(data, IcEnterpriseEntity.class); |
|
|
enterpriseEntity.setCustomerId(currentCustomerId); |
|
|
enterpriseEntity.setCustomerId(currentCustomerId); |
|
|