Browse Source

固定表头

master
jianjun 4 years ago
parent
commit
0202dfe555
  1. 17
      epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java

17
epmet-user/epmet-user-server/src/main/java/com/epmet/service/impl/IcResiUserExportServiceImpl.java

@ -129,8 +129,9 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
WriteCellStyle contentWriteCellStyle = new WriteCellStyle();
contentWriteCellStyle.setVerticalAlignment(VerticalAlignment.CENTER);
HorizontalCellStyleStrategy horizontalCellStyleStrategy = new HorizontalCellStyleStrategy(headWriteCellStyle, contentWriteCellStyle);
//todo 表头固定不正确
FreezeAndFilter writeHandler = new FreezeAndFilter();
//从第几行开始冻结
writeHandler.rowSplit = exportConfigData.getHeaderRow();
excelWriter = EasyExcel.write(ExcelUtils.getOutputStreamForExcel("居民基本信息.xlsx", response))
.registerWriteHandler(new ExcelFillCellMergeStrategy(mergeRowIndex, mergeColumnIndex))
.registerWriteHandler(horizontalCellStyleStrategy)
@ -194,7 +195,6 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
resultData.add(singleResult);
});
excelWriter.write(resultData, writeSheet);
//todo
break;
} while (mapListPage.getResult().size() == searchForm.getPageSize());
} catch (IOException e) {
@ -305,17 +305,18 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
}
}
private String putOptionValue(FormItemResult e, String vauleStr) {
private String putOptionValue(FormItemResult e, String valueStr) {
if (e == null) {
return vauleStr;
return valueStr;
}
FormItemTypeEnum itemTypeEnum = FormItemTypeEnum.getEnum(e.getItemType());
switch (itemTypeEnum) {
case CHECKBOX:
//如果是多选 则返回顿号隔开
if (e.getMultiSelect()) {
List<String> valueList = new ArrayList<>();
e.getOptions().forEach(option -> {
if (vauleStr.contains(option.getValue())) {
if (valueStr.contains(option.getValue())) {
valueList.add(option.getLabel());
}
});
@ -323,20 +324,20 @@ public class IcResiUserExportServiceImpl implements IcResiUserExportService {
}
for (OptionDTO dto : e.getOptions()) {
return vauleStr.contains(dto.getValue()) ? StrConstant.YES : StrConstant.NO;
return valueStr.contains(dto.getValue()) ? StrConstant.YES : StrConstant.NO;
}
break;
case SELECT:
case RADIO:
for (OptionDTO optionDTO : e.getOptions()) {
if (optionDTO.getValue().equals(vauleStr)) {
if (optionDTO.getValue().equals(valueStr)) {
return optionDTO.getLabel();
}
}
break;
default:
}
return vauleStr;
return valueStr;
}
/**

Loading…
Cancel
Save