Merge remote-tracking branch 'origin/master'

This commit is contained in:
zhouhao 2020-09-26 12:18:47 +08:00
commit 38294f1517
2 changed files with 16 additions and 4 deletions

View File

@ -474,7 +474,11 @@ public class DeviceInstanceController implements
.converter(DeviceExcelInfo::toMap)
.writeBuffer(
service.query(parameter)
.map(entity -> FastBeanCopier.copy(entity, new DeviceExcelInfo()))
.map(entity -> {
DeviceExcelInfo exportEntity = FastBeanCopier.copy(entity, new DeviceExcelInfo(),"state");
exportEntity.setState(entity.getState().getText());
return exportEntity;
})
.buffer(200)
.flatMap(list -> {
Map<String, DeviceExcelInfo> importInfo = list
@ -509,8 +513,13 @@ public class DeviceInstanceController implements
.headers(DeviceExcelInfo.getExportHeaderMapping(Collections.emptyList(), Collections.emptyList()))
.converter(DeviceExcelInfo::toMap)
.writeBuffer(
service.query(parameter)
.map(entity -> FastBeanCopier.copy(entity, new DeviceExcelInfo()))
service
.query(parameter)
.map(entity -> {
DeviceExcelInfo exportEntity = FastBeanCopier.copy(entity, new DeviceExcelInfo(),"state");
exportEntity.setState(entity.getState().getText());
return exportEntity;
})
, 512 * 1024)//缓冲512k
.doOnError(err -> log.error(err.getMessage(), err))
.map(bufferFactory::wrap)

View File

@ -35,6 +35,8 @@ public class DeviceExcelInfo {
private long rowNumber;
private String state;
public void config(String key, Object value) {
if (value == null) {
return;
@ -101,7 +103,8 @@ public class DeviceExcelInfo {
new ExcelHeader("name", "设备名称", CellDataType.STRING),
new ExcelHeader("productName", "设备型号", CellDataType.STRING),
new ExcelHeader("orgName", "所属机构", CellDataType.STRING),
new ExcelHeader("parentId", "父设备ID", CellDataType.STRING)
new ExcelHeader("parentId", "父设备ID", CellDataType.STRING),
new ExcelHeader("state", "状态", CellDataType.STRING)
));
for (PropertyMetadata tag : tags) {
arr.add(new ExcelHeader(tag.getId(), StringUtils.isEmpty(tag.getName()) ? tag.getId() : tag.getName(), CellDataType.STRING));