|
|
@ -5,6 +5,8 @@ import com.alibaba.excel.read.listener.ReadListener; |
|
|
|
import com.epmet.commons.tools.constant.NumConstant; |
|
|
|
import com.epmet.commons.tools.constant.StrConstant; |
|
|
|
import com.epmet.commons.tools.dto.result.CustomerStaffInfoCacheResult; |
|
|
|
import com.epmet.commons.tools.exception.EpmetErrorCode; |
|
|
|
import com.epmet.commons.tools.exception.EpmetException; |
|
|
|
import com.epmet.commons.tools.exception.ExceptionUtils; |
|
|
|
import com.epmet.commons.tools.exception.ValidateException; |
|
|
|
import com.epmet.commons.tools.utils.ConvertUtils; |
|
|
@ -67,6 +69,11 @@ public class IcEnterpriseExcelImportListener implements ReadListener<EnterpriseI |
|
|
|
// log.warn("有数据吗?"+JSON.toJSONString(data));
|
|
|
|
// 不能为空先校验数据
|
|
|
|
ValidatorUtils.validateEntity(data); |
|
|
|
try { |
|
|
|
Integer.parseInt(data.getScaleTotal()); |
|
|
|
} catch (NumberFormatException e) { |
|
|
|
throw new EpmetException(EpmetErrorCode.EPMET_COMMON_OPERATION_FAIL.getCode(), "", "规模请填写数字"); |
|
|
|
} |
|
|
|
// 去除空格
|
|
|
|
ObjectUtil.objectToTrim(data); |
|
|
|
// 根据网格名是否能找到网格id
|
|
|
@ -92,7 +99,7 @@ public class IcEnterpriseExcelImportListener implements ReadListener<EnterpriseI |
|
|
|
enterpriseEntity.setLatitude(StrConstant.EPMETY_STR); |
|
|
|
//规模
|
|
|
|
// enterpriseEntity.setScale(scaleMap.get(data.getScaleName()));
|
|
|
|
enterpriseEntity.setScaleTotal(data.getScaleTotal()); |
|
|
|
enterpriseEntity.setScaleTotal(Integer.valueOf(data.getScaleTotal())); |
|
|
|
enterpriseEntity.setPlaceCategory("九小场所".equals(data.getPlaceCategoryName()) ? "0" : "1"); |
|
|
|
|
|
|
|
//网格id+场所名称
|
|
|
@ -118,6 +125,8 @@ public class IcEnterpriseExcelImportListener implements ReadListener<EnterpriseI |
|
|
|
String errorMsg = null; |
|
|
|
if (e instanceof ValidateException) { |
|
|
|
errorMsg = ((ValidateException) e).getMsg(); |
|
|
|
}else if(e instanceof EpmetException){ |
|
|
|
errorMsg=((EpmetException) e).getMsg(); |
|
|
|
}else { |
|
|
|
errorMsg = "未知错误"; |
|
|
|
log.error("【企事业单位导入】出错:{}", ExceptionUtils.getErrorStackTrace(e)); |
|
|
|