Commit 54a09edf authored by 刘林's avatar 刘林

fix(jg):西安电梯历史数据导入接口添加错误记录

parent 803a5bdc
package com.yeejoin.amos.boot.module.common.api.dao;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelImportErrorLogDto;
import org.springframework.data.repository.PagingAndSortingRepository;
import org.springframework.stereotype.Repository;
/**
* @author Administrator
*/
@Repository
public interface ExcelImportErrorLogDao extends PagingAndSortingRepository<ExcelImportErrorLogDto, String> {
}
package com.yeejoin.amos.boot.module.common.api.dto;
import lombok.Data;
import lombok.experimental.Accessors;
import org.springframework.data.annotation.Id;
import org.springframework.data.elasticsearch.annotations.Document;
import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
/**
* @author Administrator
* Excel导入错误日志
*/
@Data
@Accessors(chain = true)
@Document(indexName = "excel_import_error_log", shards = 2)
public class ExcelImportErrorLogDto {
@Id
private Long sequenceNbr;
@Field(type = FieldType.Text)
private String xaSerial;
@Field(type = FieldType.Text)
private String record;
@Field(type = FieldType.Text)
private String errorInfo;
}
......@@ -21,7 +21,9 @@ import com.yeejoin.amos.boot.biz.common.utils.RedisKey;
import com.yeejoin.amos.boot.biz.common.utils.RedisUtils;
import com.yeejoin.amos.boot.biz.common.utils.SnowflakeIdUtil;
import com.yeejoin.amos.boot.module.common.api.dao.ESEquipmentCategory;
import com.yeejoin.amos.boot.module.common.api.dao.ExcelImportErrorLogDao;
import com.yeejoin.amos.boot.module.common.api.dto.ESEquipmentCategoryDto;
import com.yeejoin.amos.boot.module.common.api.dto.ExcelImportErrorLogDto;
import com.yeejoin.amos.boot.module.jg.api.converter.DictParamsConverter;
import com.yeejoin.amos.boot.module.jg.api.converter.EquCategoryConverter;
import com.yeejoin.amos.boot.module.jg.api.converter.EquDefineConverter;
......@@ -130,6 +132,7 @@ public class DataDockServiceImpl {
private static final String DEFINITION_KEY = "useRegistration";
private final JgVehicleInformationMapper jgVehicleInformationMapper;
private final IdxBizJgRegisterInfoMapper idxBizJgRegisterInfoMapper;
private final ExcelImportErrorLogDao excelImportErrorLogDao;
/**
* 西安数据对接-保存设备信息
......@@ -2215,7 +2218,11 @@ public class DataDockServiceImpl {
} catch (Exception e) {
esEquipmentCategory.deleteById(record);
superviseInfoMapper.deleteDataAll(Collections.singletonList(record));
ExcelImportErrorLogDto errorLogDto = JSON.parseObject(toJSONString(equ), ExcelImportErrorLogDto.class);
errorLogDto.setErrorInfo(e.getMessage());
excelImportErrorLogDao.save(errorLogDto);
log.error("{}数据:保存时出现异常,对应数据:{}", dataSource, JSONObject.toJSONString(equ), e);
log.error("==========================西安电梯数据:保存时出现异常,对应数据:{}==========================",record);
throw new RuntimeException("保存电梯数据失败", e);
}
}
......@@ -2364,7 +2371,7 @@ public class DataDockServiceImpl {
} catch (Exception e) {
log.error(e.getMessage(), e);
this.rollBackForDelRedisData();
throw new BadRequest("保存失败!");
throw new BadRequest(e.getMessage());
} finally {
FlowingEquipRedisContext.clean();
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment