|
|
|
@ -134,7 +134,7 @@ public class InvWarehouseController {
|
|
|
|
|
InvWarehouseExportResponse invWarehouseExportResponse = new InvWarehouseExportResponse();
|
|
|
|
|
invWarehouseExportResponse.setInvWarehouseEntities(invWarehouseEntities);
|
|
|
|
|
String json = JSONObject.toJSON(invWarehouseExportResponse).toString();
|
|
|
|
|
String fileName = "仓库信息导出_" + DateUtil.getDate() + ".json";
|
|
|
|
|
String fileName = "仓库信息导出_" + DateUtil.getDate() + ".udi";
|
|
|
|
|
res.setHeader("Content-disposition", "attachment;fileName=" + fileName);
|
|
|
|
|
res.setContentType("text/plain;charset=UTF-8");
|
|
|
|
|
try {
|
|
|
|
@ -154,23 +154,24 @@ public class InvWarehouseController {
|
|
|
|
|
if (file.isEmpty()) {
|
|
|
|
|
return ResultVOUtils.error(500, "上传第" + (i++) + "个文件失败");
|
|
|
|
|
}
|
|
|
|
|
String filename = file.getOriginalFilename();
|
|
|
|
|
String fileType = filename.substring(filename.lastIndexOf("."));
|
|
|
|
|
if (!".udi".equals(fileType)) {
|
|
|
|
|
return ResultVOUtils.error(500, "请上传udi格式文件!");
|
|
|
|
|
}
|
|
|
|
|
try {
|
|
|
|
|
InputStream inputStream = file.getInputStream();
|
|
|
|
|
String json = FileUtils.readStream(inputStream);
|
|
|
|
|
InvWarehouseExportResponse invWarehouseExportResponse = (InvWarehouseExportResponse) JSON.parseObject(json, InvWarehouseExportResponse.class);
|
|
|
|
|
List<InvWarehouseEntity> invWarehouseEntities = invWarehouseExportResponse.getInvWarehouseEntities();
|
|
|
|
|
if (invWarehouseEntities != null) {
|
|
|
|
|
for (InvWarehouseEntity invWarehouseEntity : invWarehouseEntities) {
|
|
|
|
|
invWarehouseService.insertInvWarehouse(invWarehouseEntity);
|
|
|
|
|
}
|
|
|
|
|
invWarehouseService.importInvWarehouse(invWarehouseEntities);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
} catch (IOException e) {
|
|
|
|
|
e.printStackTrace();
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
return ResultVOUtils.success("后台正在生成导入生成订单,请稍后查看!");
|
|
|
|
|
return ResultVOUtils.success("后台正在导入仓库信息,请稍后查看!");
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|