|
|
@@ -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 = ""; |
|
|
|