Browse Source

导出 立项依据说明

master
PoffyZhang 11 months ago
parent
commit
849f5de2b8
2 changed files with 17 additions and 2 deletions
  1. +1
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ExportOptionEnum.java
  2. +16
    -1
      pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java

+ 1
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/enumeration/ExportOptionEnum.java View File

@@ -69,7 +69,7 @@ public enum ExportOptionEnum {

projectIntroduction(24, "项目简介"),

baseBasisEstablish(25, "立项依据说明"),
baseBasis(25, "立项依据"),

buildLevel(26, "建设层级"),



+ 16
- 1
pmapi/src/main/java/com/ningdatech/pmapi/common/util/ExcelDownUtil.java View File

@@ -7,6 +7,7 @@ import com.alibaba.excel.write.metadata.WriteSheet;
import com.alibaba.fastjson.JSON;
import com.alibaba.fastjson.JSONObject;
import com.google.common.collect.Lists;
import com.google.common.collect.Maps;
import com.ningdatech.basic.exception.BizException;
import com.ningdatech.basic.model.ApiResponse;
import com.ningdatech.basic.util.CollUtils;
@@ -40,6 +41,12 @@ import java.util.function.BiConsumer;
@Slf4j
public class ExcelDownUtil {

public static Map<String,String> convertMap = Maps.newHashMap();

static {
convertMap.put("baseBasis","baseBasisEstablish");
}

public static String encodeName(String name) {
String fileName;
try {
@@ -199,6 +206,9 @@ public class ExcelDownUtil {
List<List<String>> rowList = Lists.newArrayList();
for (ExportOptionEnum column : columnList) {
List<String> columnValues = Lists.newArrayList();
if(Objects.isNull(column)){
continue;
}
String desc = column.getDesc();
if (Objects.nonNull(desc)) {
columnValues.add(desc);
@@ -217,7 +227,12 @@ public class ExcelDownUtil {
List<String> nameList = CollUtils.fieldList(fileArray, w -> w.getString(CommonConst.FILE_NAME));
columnValue = String.join(StrPool.COMMA, nameList);
} else {
columnValue = jsonObject.getString(column.toString());
//强转列
if(convertMap.containsKey(column.toString())){
columnValue = jsonObject.getString(convertMap.get(column.toString()));
}else{
columnValue = jsonObject.getString(column.toString());
}
}
if (CommonConst.NULL.equals(columnValue)) {
columnValue = "";


Loading…
Cancel
Save