提交 97b26795 作者: zhangqiliang

仓库导出

父级 900b2f1f
...@@ -63,9 +63,9 @@ public class Contants { ...@@ -63,9 +63,9 @@ public class Contants {
public static final String export_warrantyOrder_field = "no,orderId,userName,userPhone,wallboxNo,startTimeStr,endTimeStr"; public static final String export_warrantyOrder_field = "no,orderId,userName,userPhone,wallboxNo,startTimeStr,endTimeStr";
public static final String export_wareHouse_title = "仓库名称,仓库级别,所属区域,仓库归属,所属服务商,描述"; public static final String export_wareHouse_title = "仓库ID,仓库名称,仓库等级ID,仓库归属,区域,安装服务商";
public static final String export_wareHouse_field = "name,pathName,areaName,attributionName,providerName,msg"; public static final String export_wareHouse_field = "id,name,warehouseLevenId,warehouseAttribution,area,serviceProvider";
public static final String export_single_title = "调拨单号,创建时间,创建人,说明,调拨类型,调入仓库,调出仓库"; public static final String export_single_title = "调拨单号,创建时间,创建人,说明,调拨类型,调入仓库,调出仓库";
......
...@@ -107,9 +107,11 @@ public class ExportController { ...@@ -107,9 +107,11 @@ public class ExportController {
String fieldStr = field.get(contants).toString(); String fieldStr = field.get(contants).toString();
Field title = Contants.class.getDeclaredField("export_" + serviceName + "_title"); Field title = Contants.class.getDeclaredField("export_" + serviceName + "_title");
String titleStr = title.get(contants).toString(); String titleStr = title.get(contants).toString();
String[][] titleArray;
String scoreSupplier = "score_supplier"; // String[] titleArray = "score_supplier".equals(serviceName) ? scoreConfigService.getExcelTitles() :
if (scoreSupplier.equals(serviceName)) { // titleStr.split(",");
String[][] titleArray = null;
if ("score_supplier".equals(serviceName)) {
String[] excelTitles = scoreConfigService.getExcelTitles(); String[] excelTitles = scoreConfigService.getExcelTitles();
titleArray = new String[2][excelTitles.length]; titleArray = new String[2][excelTitles.length];
titleArray[0] = excelTitles; titleArray[0] = excelTitles;
...@@ -117,10 +119,10 @@ public class ExportController { ...@@ -117,10 +119,10 @@ public class ExportController {
newArr[5] = "总分"; newArr[5] = "总分";
titleArray[1] = newArr; titleArray[1] = newArr;
} else { } else {
titleArray = new String[][]{titleStr.split(CamsConstant.COMMA)}; titleArray = new String[][]{titleStr.split(",")};
} }
String[] fieldStrArray = fieldStr.split(CamsConstant.COMMA); String[] fieldStrArray = fieldStr.split(",");
List<?> exportList = export.getExportList(searchJson); List<?> exportList = export.getExportList(searchJson);
PoiUtil.exportExcelToWebsite(response, fileName, titleArray, fieldStrArray, exportList); PoiUtil.exportExcelToWebsite(response, fileName, titleArray, fieldStrArray, exportList);
......
...@@ -21,42 +21,21 @@ import java.util.Map; ...@@ -21,42 +21,21 @@ import java.util.Map;
* @version [版本号, 2020年10月28日] * @version [版本号, 2020年10月28日]
*/ */
@Service("WareHouseExport") @Service("WareHouseExport")
public class WarehouseExport implements Export<Map<String, Object>> { public class WarehouseExport implements Export<WarehouseDTO2> {
@Autowired @Autowired
private WarehouseService warehouseService; private WarehouseService warehouseService;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
@Override @Override
public List<Map<String, Object>> getExportList(String json) throws Exception { public List<WarehouseDTO2> getExportList(String json) throws Exception {
ObjectMapper mapper = new ObjectMapper(); ObjectMapper mapper = new ObjectMapper();
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false); mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
WarehouseQuery2 warehouseQuery = mapper.readValue(json, WarehouseQuery2.class); WarehouseQuery2 condition = mapper.readValue(json, WarehouseQuery2.class);
List<WarehouseDTO2> list = new ArrayList<>(); condition.setIsWarehousePage(2);
int page = 1; List<WarehouseDTO2> list = warehouseService.qryWarehouseDetailList(condition);
int pagecount = 10; return list;
while (true) {
warehouseQuery.setPage(page);
warehouseQuery.setPagecount(pagecount);
List<WarehouseDTO2> list1 = warehouseService.qryWarehouseDetailList(warehouseQuery);
if (list1 == null || list1.isEmpty()) {
break;
}
list.addAll(list1);
if (list1.size() < pagecount) {
break;
}
page++;
}
List<Map<String, Object>> returnList = new ArrayList<>(8);
for (WarehouseDTO2 dto : list) {
Map<String, Object> map = mapper.readValue(mapper.writeValueAsString(dto), Map.class);
if (!StringUtils.isEmpty(dto.getWarehouseAttribution())) {
map.put("attributionName", dto.getWarehouseAttribution().equals("1") ? "CAMS仓库" : "安装服务商仓库");
}
returnList.add(map);
}
return returnList;
} }
} }
Markdown 格式
0%
您添加了 0 到此讨论。请谨慎行事。
请先完成此评论的编辑!
注册 或者 后发表评论