From 466e0784360893b4213fde4d1fc6495341e35ce7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B7=BB=E7=A0=96-JAVA=5CAdministrator?= <591141169@qq.com> Date: Thu, 9 May 2024 10:03:17 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E7=A1=80=E6=95=B0=E6=8D=AE?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../excel/core/annotations/Colour.java | 21 ++++++ .../excel/core/annotations/ExcelValid.java | 17 +++++ .../eam/controller/item/ItemController.java | 22 +++++-- .../controller/item/vo/ItemImportErrorVO.java | 22 +++++++ .../controller/item/vo/ItemImportExcelVo.java | 60 +++++++++++++++++ .../eam/controller/item/vo/ItemImportVO.java | 65 +++++++++++++++++++ .../location/LocationController.java | 39 +++++++++-- .../location/vo/LocationImportErrorVO.java | 22 +++++++ .../location/vo/LocationImportExcelVo.java | 35 ++++++++++ .../location/vo/LocationImportVO.java | 40 ++++++++++++ .../locationarea/LocationAreaController.java | 47 +++++++++++--- .../vo/LocationAreaImportErrorVO.java | 22 +++++++ .../vo/LocationAreaImportExcelVO.java | 23 +++++++ .../locationarea/vo/LocationAreaImportVO.java | 34 ++++++++++ .../module/eam/convert/item/ItemConvert.java | 7 +- .../eam/convert/location/LocationConvert.java | 13 ++-- .../locationarea/LocationAreaConvert.java | 12 ++-- .../module/eam/service/item/ItemService.java | 4 +- .../eam/service/item/ItemServiceImpl.java | 57 +++++++++++----- .../eam/service/location/LocationService.java | 12 ++++ .../service/location/LocationServiceImpl.java | 58 +++++++++++++++-- .../locationarea/LocationAreaService.java | 12 ++++ .../locationarea/LocationAreaServiceImpl.java | 59 +++++++++++++++-- 23 files changed, 641 insertions(+), 62 deletions(-) create mode 100644 win-framework/win-spring-boot-starter-excel/src/main/java/com/win/framework/excel/core/annotations/Colour.java create mode 100644 win-framework/win-spring-boot-starter-excel/src/main/java/com/win/framework/excel/core/annotations/ExcelValid.java create mode 100644 win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemImportErrorVO.java create mode 100644 win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemImportExcelVo.java create mode 100644 win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemImportVO.java create mode 100644 win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/vo/LocationImportErrorVO.java create mode 100644 win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/vo/LocationImportExcelVo.java create mode 100644 win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/vo/LocationImportVO.java create mode 100644 win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/vo/LocationAreaImportErrorVO.java create mode 100644 win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/vo/LocationAreaImportExcelVO.java create mode 100644 win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/vo/LocationAreaImportVO.java diff --git a/win-framework/win-spring-boot-starter-excel/src/main/java/com/win/framework/excel/core/annotations/Colour.java b/win-framework/win-spring-boot-starter-excel/src/main/java/com/win/framework/excel/core/annotations/Colour.java new file mode 100644 index 0000000..376dfad --- /dev/null +++ b/win-framework/win-spring-boot-starter-excel/src/main/java/com/win/framework/excel/core/annotations/Colour.java @@ -0,0 +1,21 @@ +package com.win.framework.excel.core.annotations; + +import org.apache.poi.ss.usermodel.IndexedColors; + +import java.lang.annotation.*; + +/** + * 导出excel头部颜色设置 + */ +@Target({ElementType.FIELD}) +@Retention(RetentionPolicy.RUNTIME) +@Inherited +public @interface Colour { + + /** + * 颜色值 + * + * @return 颜色字典类型 + */ + IndexedColors value(); +} diff --git a/win-framework/win-spring-boot-starter-excel/src/main/java/com/win/framework/excel/core/annotations/ExcelValid.java b/win-framework/win-spring-boot-starter-excel/src/main/java/com/win/framework/excel/core/annotations/ExcelValid.java new file mode 100644 index 0000000..d00a804 --- /dev/null +++ b/win-framework/win-spring-boot-starter-excel/src/main/java/com/win/framework/excel/core/annotations/ExcelValid.java @@ -0,0 +1,17 @@ +package com.win.framework.excel.core.annotations; + +import java.lang.annotation.ElementType; +import java.lang.annotation.Retention; +import java.lang.annotation.RetentionPolicy; +import java.lang.annotation.Target; + +/** + * 导入必填字段 + */ +@Target(ElementType.FIELD) +@Retention(RetentionPolicy.RUNTIME) +public @interface ExcelValid { + + String message() default "导入有未填入的字段"; + +} \ No newline at end of file diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/ItemController.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/ItemController.java index f0017e5..057912c 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/ItemController.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/ItemController.java @@ -3,11 +3,13 @@ package com.win.module.eam.controller.item; import com.win.framework.common.pojo.CommonResult; import com.win.framework.common.pojo.CustomConditions; import com.win.framework.common.pojo.PageResult; +import com.win.framework.dict.core.util.DictFrameworkUtils; import com.win.framework.excel.core.util.ExcelUtils; import com.win.framework.operatelog.core.annotations.OperateLog; import com.win.module.eam.controller.item.vo.*; import com.win.module.eam.convert.item.ItemConvert; import com.win.module.eam.dal.dataobject.item.ItemDO; +import com.win.module.eam.enums.DictTypeConstants; import com.win.module.eam.service.item.ItemService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; @@ -24,10 +26,7 @@ import javax.validation.Valid; import java.io.IOException; import java.time.LocalDateTime; import java.time.ZoneOffset; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import static com.win.framework.common.pojo.CommonResult.success; import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @@ -183,6 +182,16 @@ public class ItemController { return success(ItemConvert.INSTANCE.convertList(pageResult)); } + @GetMapping("/get-import-template") + @Operation(summary = "获得导入采购订单模板") + public void importTemplate(HttpServletResponse response) throws IOException { + // 手动创建导出 demo + List list = new ArrayList<>(); + Map mapDropDown = new HashMap<>(); +// // 输出 + ExcelUtils.write(response, "备件导入模板.xlsx", "备件表", ItemImportVO.class, list, mapDropDown); + } + @PostMapping("/import") @Operation(summary = "导入备件基本信息") @Parameters({ @@ -196,9 +205,8 @@ public class ItemController { @RequestParam(value = "mode") Integer mode, @RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { - List list = ExcelUtils.read(file, ItemExcelVO.class); - List errorList = itemService.importItemList(list, mode, updatePart); - + List list = ExcelUtils.read(file, ItemImportExcelVo.class); + List errorList = itemService.importItemList(list, mode, updatePart); Map returnMap = new HashMap<>(); returnMap.put("errorCount", errorList.size()); if(!errorList.isEmpty()) { diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemImportErrorVO.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemImportErrorVO.java new file mode 100644 index 0000000..8e74547 --- /dev/null +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemImportErrorVO.java @@ -0,0 +1,22 @@ +package com.win.module.eam.controller.item.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.ToString; + +@Data +@Builder +@ToString(callSuper = true) +public class ItemImportErrorVO extends ItemImportExcelVo { + + + @ExcelProperty(value = "导入状态", index = 0) + private String importStatus; + + @ExcelProperty(value = "导入说明", index = 2) + private String importRemark; + + @ExcelProperty(value = "行号", index = 1) + private String rowNumber; +} diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemImportExcelVo.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemImportExcelVo.java new file mode 100644 index 0000000..cb1b181 --- /dev/null +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemImportExcelVo.java @@ -0,0 +1,60 @@ +package com.win.module.eam.controller.item.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.win.framework.excel.core.annotations.ExcelValid; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题 +public class ItemImportExcelVo { + + @ExcelProperty("零件编码") + @ExcelValid(message = "必填") + private String number; + + @ExcelProperty("零件名称") + private String name; + + @ExcelProperty("规格型号") + private String specifications; + + @ExcelProperty("单位") + private String uom; + + @ExcelProperty("供应商名称") + private String supplierName; + + @ExcelProperty("生产厂家(品牌)") + private String brand; + + @ExcelProperty("最高库存") + private Integer maxInventory; + + @ExcelProperty("最低库存") + private Integer minInventory; + + @ExcelProperty("采购周期(周)") + private Integer procurementCycle; + + @ExcelProperty("ABC分类") + private String classification; + + @ExcelProperty("使用地点") + private String usePlace; + + @ExcelProperty("项目") + private String project; + + @ExcelProperty("价格") + private BigDecimal price; + + @ExcelProperty("描述") + private String describes; +} diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemImportVO.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemImportVO.java new file mode 100644 index 0000000..85de342 --- /dev/null +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/item/vo/ItemImportVO.java @@ -0,0 +1,65 @@ +package com.win.module.eam.controller.item.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + + +/** + * 采购索赔申请子 Excel VO + * + * @author 超级管理员 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题 +public class ItemImportVO { + + @ExcelProperty("零件编码") + private String number; + + @ExcelProperty("零件名称") + private String name; + + @ExcelProperty("规格型号") + private String specifications; + + @ExcelProperty("单位") + private String uom; + + @ExcelProperty("供应商名称") + private String supplierName; + + @ExcelProperty("生产厂家(品牌)") + private String brand; + + @ExcelProperty("最高库存") + private Integer maxInventory; + + @ExcelProperty("最低库存") + private Integer minInventory; + + @ExcelProperty("采购周期(周)") + private Integer procurementCycle; + + @ExcelProperty("ABC分类") + private String classification; + + @ExcelProperty("使用地点") + private String usePlace; + + @ExcelProperty("项目") + private String project; + + @ExcelProperty("价格") + private BigDecimal price; + + @ExcelProperty("描述") + private String describes; + +} diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/LocationController.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/LocationController.java index 8076e65..614ce90 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/LocationController.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/LocationController.java @@ -6,7 +6,6 @@ import com.win.framework.common.pojo.PageResult; import com.win.framework.dict.core.util.DictFrameworkUtils; import com.win.framework.excel.core.util.ExcelUtils; import com.win.framework.operatelog.core.annotations.OperateLog; -import com.win.module.eam.controller.item.vo.ItemExcelVO; import com.win.module.eam.controller.location.vo.*; import com.win.module.eam.convert.location.LocationConvert; import com.win.module.eam.dal.dataobject.location.LocationDO; @@ -27,10 +26,7 @@ import javax.validation.Valid; import java.io.IOException; import java.time.LocalDateTime; import java.time.ZoneOffset; -import java.util.Collection; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import static com.win.framework.common.pojo.CommonResult.success; import static com.win.framework.operatelog.core.enums.OperateTypeEnum.EXPORT; @@ -161,7 +157,38 @@ public class LocationController { return success(LocationConvert.INSTANCE.convertList(locationDOS)); } + @GetMapping("/get-import-template") + @Operation(summary = "获得导入采购订单模板") + public void importTemplate(HttpServletResponse response) throws IOException { + // 手动创建导出 demo + List list = new ArrayList<>(); + Map mapDropDown = new HashMap<>(); +// // 输出 + ExcelUtils.write(response, "备件导入模板.xlsx", "备件表", LocationImportVO.class, list, mapDropDown); + } - + @PostMapping("/import") + @Operation(summary = "导入备件基本信息") + @Parameters({ + @Parameter(name = "file", description = "Excel 文件", required = true), + @Parameter(name = "mode", description = "导入模式1更新2追加3覆盖", example = "1"), + @Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true") + }) + @PreAuthorize("@ss.hasPermission('basic:location:import')") + public CommonResult> importExcel(HttpServletResponse response, + @RequestParam("file") MultipartFile file, + @RequestParam(value = "mode") Integer mode, + @RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { + List list = ExcelUtils.read(file, LocationImportExcelVo.class); + List errorList = locationService.importLocationList(list, mode, updatePart); + Map returnMap = new HashMap<>(); + returnMap.put("errorCount", errorList.size()); + if(!errorList.isEmpty()) { + String url = ExcelUtils.writeLocalFile("备件基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); + returnMap.put("errorFile", url); + } + + return success(returnMap); + } } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/vo/LocationImportErrorVO.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/vo/LocationImportErrorVO.java new file mode 100644 index 0000000..7bea30d --- /dev/null +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/vo/LocationImportErrorVO.java @@ -0,0 +1,22 @@ +package com.win.module.eam.controller.location.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.ToString; + +@Data +@Builder +@ToString(callSuper = true) +public class LocationImportErrorVO extends LocationImportExcelVo { + + + @ExcelProperty(value = "导入状态", index = 0) + private String importStatus; + + @ExcelProperty(value = "导入说明", index = 2) + private String importRemark; + + @ExcelProperty(value = "行号", index = 1) + private String rowNumber; +} diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/vo/LocationImportExcelVo.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/vo/LocationImportExcelVo.java new file mode 100644 index 0000000..56bdf13 --- /dev/null +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/vo/LocationImportExcelVo.java @@ -0,0 +1,35 @@ +package com.win.module.eam.controller.location.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.win.framework.excel.core.annotations.ExcelValid; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题 +public class LocationImportExcelVo { + + @ExcelProperty("库位编码") + @ExcelValid(message = "必填") + private String number; + + @ExcelProperty("库位名称") + @ColumnWidth(value = 20) + private String name; + + @ExcelProperty("库区编号") + @ColumnWidth(value = 20) + private String areaNumber; + + @ExcelProperty("描述") + @ColumnWidth(value = 30) + private String description; + +} diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/vo/LocationImportVO.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/vo/LocationImportVO.java new file mode 100644 index 0000000..6de72ce --- /dev/null +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/location/vo/LocationImportVO.java @@ -0,0 +1,40 @@ +package com.win.module.eam.controller.location.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +import java.math.BigDecimal; + + +/** + * 采购索赔申请子 Excel VO + * + * @author 超级管理员 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题 +public class LocationImportVO { + + @ExcelProperty("库位编号") + @ColumnWidth(value = 20) + private String number; + + @ExcelProperty("库位名称") + @ColumnWidth(value = 20) + private String name; + + @ExcelProperty("库区编号") + @ColumnWidth(value = 20) + private String areaNumber; + + @ExcelProperty("描述") + @ColumnWidth(value = 30) + private String description; + +} diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/LocationAreaController.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/LocationAreaController.java index a2bfdda..8c609c5 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/LocationAreaController.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/LocationAreaController.java @@ -13,15 +13,19 @@ import com.win.module.eam.enums.DictTypeConstants; import com.win.module.eam.service.locationarea.LocationAreaService; import io.swagger.v3.oas.annotations.Operation; import io.swagger.v3.oas.annotations.Parameter; +import io.swagger.v3.oas.annotations.Parameters; import io.swagger.v3.oas.annotations.tags.Tag; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.*; +import org.springframework.web.multipart.MultipartFile; import javax.annotation.Resource; import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; import java.io.IOException; +import java.time.LocalDateTime; +import java.time.ZoneOffset; import java.util.*; import static com.win.framework.common.pojo.CommonResult.success; @@ -108,14 +112,6 @@ public class LocationAreaController { return resultList; } - @GetMapping("/get-import-template") - @Operation(summary = "获得导入库区模板") - public void importTemplate(HttpServletResponse response) throws IOException { - List list = Arrays.asList(); - // 输出 - ExcelUtils.write(response, "库区基本信息导入模板.xls", "库区基本信息列表", LocationAreaExcelVO.class, list); - } - @PostMapping("/senior") @Operation(summary = "高级搜索获得库位分页") // @PreAuthorize("@ss.hasPermission('basic:locationArea:query')") @@ -124,5 +120,40 @@ public class LocationAreaController { PageResult result = LocationAreaConvert.INSTANCE.convertPage(pageResult); return success(result); } + @GetMapping("/get-import-template") + @Operation(summary = "获得导入采购订单模板") + public void importTemplate(HttpServletResponse response) throws IOException { + // 手动创建导出 demo + List list = new ArrayList<>(); + Map mapDropDown = new HashMap<>(); +// // 输出 + ExcelUtils.write(response, "备件导入模板.xlsx", "备件表", LocationAreaImportVO.class, list, mapDropDown); + } + + @PostMapping("/import") + @Operation(summary = "导入备件基本信息") + @Parameters({ + @Parameter(name = "file", description = "Excel 文件", required = true), + @Parameter(name = "mode", description = "导入模式1更新2追加3覆盖", example = "1"), + @Parameter(name = "updatePart", description = "部分更新,默认为 true", example = "true") + }) + @PreAuthorize("@ss.hasPermission('basic:locationArea:import')") + public CommonResult> importExcel(HttpServletResponse response, + @RequestParam("file") MultipartFile file, + @RequestParam(value = "mode") Integer mode, + @RequestParam(value = "updatePart", required = false, defaultValue = "false") Boolean updatePart) throws Exception { + + List list = ExcelUtils.read(file, LocationAreaImportExcelVO.class); + List errorList = locationAreaService.importLocationAreaList(list, mode, updatePart); + Map returnMap = new HashMap<>(); + returnMap.put("errorCount", errorList.size()); + if(!errorList.isEmpty()) { + String url = ExcelUtils.writeLocalFile("备件基本信息导入错误数据" + LocalDateTime.now().toEpochSecond(ZoneOffset.of("+8")) + ".xlsx", "错误列表", errorList); + returnMap.put("errorFile", url); + } + + return success(returnMap); + } + } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/vo/LocationAreaImportErrorVO.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/vo/LocationAreaImportErrorVO.java new file mode 100644 index 0000000..ed380d3 --- /dev/null +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/vo/LocationAreaImportErrorVO.java @@ -0,0 +1,22 @@ +package com.win.module.eam.controller.locationarea.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.Builder; +import lombok.Data; +import lombok.ToString; + +@Data +@Builder +@ToString(callSuper = true) +public class LocationAreaImportErrorVO extends LocationAreaImportExcelVO { + + + @ExcelProperty(value = "导入状态", index = 0) + private String importStatus; + + @ExcelProperty(value = "导入说明", index = 2) + private String importRemark; + + @ExcelProperty(value = "行号", index = 1) + private String rowNumber; +} diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/vo/LocationAreaImportExcelVO.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/vo/LocationAreaImportExcelVO.java new file mode 100644 index 0000000..0c3cae3 --- /dev/null +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/vo/LocationAreaImportExcelVO.java @@ -0,0 +1,23 @@ +package com.win.module.eam.controller.locationarea.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + +@Data +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题 +public class LocationAreaImportExcelVO { + + @ExcelProperty("库区编号") + private String number; + + @ExcelProperty("库区名称") + private String name; + + @ExcelProperty("描述") + private String description; +} diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/vo/LocationAreaImportVO.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/vo/LocationAreaImportVO.java new file mode 100644 index 0000000..c77048c --- /dev/null +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/locationarea/vo/LocationAreaImportVO.java @@ -0,0 +1,34 @@ +package com.win.module.eam.controller.locationarea.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.AllArgsConstructor; +import lombok.Data; +import lombok.NoArgsConstructor; +import lombok.experimental.Accessors; + + +/** + * 采购索赔申请子 Excel VO + * + * @author 超级管理员 + */ +@Data +@AllArgsConstructor +@NoArgsConstructor +@Accessors(chain = false) // 设置 chain = false,避免用户导入有问题 +public class LocationAreaImportVO { + + @ExcelProperty("库区编号") + @ColumnWidth(value = 20) + private String number; + + @ExcelProperty("库区名称") + @ColumnWidth(value = 20) + private String name; + + @ExcelProperty("描述") + @ColumnWidth(value = 30) + private String description; + +} diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/item/ItemConvert.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/item/ItemConvert.java index 1af72ed..26d2bcb 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/item/ItemConvert.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/item/ItemConvert.java @@ -1,10 +1,7 @@ package com.win.module.eam.convert.item; import com.win.framework.common.pojo.PageResult; -import com.win.module.eam.controller.item.vo.ItemCreateReqVO; -import com.win.module.eam.controller.item.vo.ItemExcelVO; -import com.win.module.eam.controller.item.vo.ItemRespVO; -import com.win.module.eam.controller.item.vo.ItemUpdateReqVO; +import com.win.module.eam.controller.item.vo.*; import com.win.module.eam.dal.dataobject.item.ItemDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -34,5 +31,7 @@ public interface ItemConvert { PageResult convertPage(PageResult page); List convertList02(List list); + ItemDO convert(ItemImportExcelVo bean); + ItemImportErrorVO convert2(ItemDO itemDO); } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/location/LocationConvert.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/location/LocationConvert.java index b450b6e..1137db5 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/location/LocationConvert.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/location/LocationConvert.java @@ -1,10 +1,10 @@ package com.win.module.eam.convert.location; import com.win.framework.common.pojo.PageResult; -import com.win.module.eam.controller.location.vo.LocationCreateReqVO; -import com.win.module.eam.controller.location.vo.LocationExcelVO; -import com.win.module.eam.controller.location.vo.LocationRespVO; -import com.win.module.eam.controller.location.vo.LocationUpdateReqVO; +import com.win.module.eam.controller.item.vo.ItemImportErrorVO; +import com.win.module.eam.controller.item.vo.ItemImportExcelVo; +import com.win.module.eam.controller.location.vo.*; +import com.win.module.eam.dal.dataobject.item.ItemDO; import com.win.module.eam.dal.dataobject.location.LocationDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -22,7 +22,7 @@ public interface LocationConvert { LocationConvert INSTANCE = Mappers.getMapper(LocationConvert.class); LocationDO convert(LocationCreateReqVO bean); - + LocationDO convert(LocationExcelVO bean); LocationDO convert(LocationUpdateReqVO bean); LocationRespVO convert(LocationDO bean); @@ -33,4 +33,7 @@ public interface LocationConvert { List convertList02(List list); + LocationDO convert(LocationImportExcelVo bean); + LocationImportErrorVO convert2(LocationDO locationDO); + } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/locationarea/LocationAreaConvert.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/locationarea/LocationAreaConvert.java index f32b675..6e75113 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/locationarea/LocationAreaConvert.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/convert/locationarea/LocationAreaConvert.java @@ -1,10 +1,10 @@ package com.win.module.eam.convert.locationarea; import com.win.framework.common.pojo.PageResult; -import com.win.module.eam.controller.locationarea.vo.LocationAreaCreateReqVO; -import com.win.module.eam.controller.locationarea.vo.LocationAreaExcelVO; -import com.win.module.eam.controller.locationarea.vo.LocationAreaRespVO; -import com.win.module.eam.controller.locationarea.vo.LocationAreaUpdateReqVO; +import com.win.module.eam.controller.location.vo.LocationImportErrorVO; +import com.win.module.eam.controller.location.vo.LocationImportExcelVo; +import com.win.module.eam.controller.locationarea.vo.*; +import com.win.module.eam.dal.dataobject.location.LocationDO; import com.win.module.eam.dal.dataobject.locationarea.LocationAreaDO; import org.mapstruct.Mapper; import org.mapstruct.factory.Mappers; @@ -22,7 +22,7 @@ public interface LocationAreaConvert { LocationAreaConvert INSTANCE = Mappers.getMapper(LocationAreaConvert.class); LocationAreaDO convert(LocationAreaCreateReqVO bean); - + LocationAreaDO convert(LocationAreaExcelVO bean); LocationAreaDO convert(LocationAreaUpdateReqVO bean); LocationAreaRespVO convert(LocationAreaDO bean); @@ -32,5 +32,7 @@ public interface LocationAreaConvert { PageResult convertPage(PageResult page); List convertList02(List list); + LocationAreaDO convert(LocationAreaImportExcelVO bean); + LocationAreaImportErrorVO convert2(LocationAreaDO locationAreaDO); } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemService.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemService.java index 414f941..776a28a 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemService.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemService.java @@ -130,10 +130,10 @@ public interface ItemService { /** * 导入备件主信息 * - * @param datas 导入备件主信息列表 + * @param importItembasics 导入备件主信息列表 * @param mode 导入模式1更新2追加3覆盖 * @param updatePart 是否支持更新 * @return 导入结果 */ - public List importItemList(List datas, Integer mode, boolean updatePart); + public List importItemList(List importItembasics, Integer mode, boolean updatePart); } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java index e60d9d8..642aa32 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/item/ItemServiceImpl.java @@ -4,6 +4,7 @@ import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; +import com.win.framework.common.exception.ServiceException; import com.win.framework.common.exception.util.ServiceExceptionUtil; import com.win.framework.common.pojo.CustomConditions; import com.win.framework.common.pojo.PageResult; @@ -257,28 +258,52 @@ public class ItemServiceImpl implements ItemService { } @Override - public List importItemList(List datas, Integer mode, boolean updatePart) { - if (CollUtil.isEmpty(datas)) { + public List importItemList(List importItembasics, Integer mode, boolean updatePart) { + if (CollUtil.isEmpty(importItembasics)) { throw exception(ITEM_NOT_EXISTS); } - List errorList = new ArrayList<>(); - datas.forEach(item -> { - if(errorList == null){ + List errorList = new ArrayList<>(); + for (int i = 0; i < importItembasics.size(); i++) { + ItemDO itemDO = ItemConvert.INSTANCE.convert(importItembasics.get(i)); + String massage = validateItembasicImport(itemDO); + boolean flag = true; + if (!massage.isEmpty()) { + ItemImportErrorVO importErrorVO = ItemConvert.INSTANCE.convert2(itemDO); + importErrorVO.setImportStatus("失败"); + importErrorVO.setImportRemark(massage.substring(0, massage.length() - 1)); + Integer rowNumber = i + 1; + importErrorVO.setRowNumber("第" + rowNumber + "行"); + errorList.add(importErrorVO); + flag = false; + } + if (flag) { // 判断如果不存在,在进行插入 QueryWrapper queryWrapper = new QueryWrapper<>(); - queryWrapper.eq("number", item.getNumber()); - ItemDO obj = itemMapper.selectOne(queryWrapper); - - if (obj == null&& mode != 3) { - itemMapper.insert(ItemConvert.INSTANCE.convert(item)); - } - else if (obj != null && mode != 2) {// 如果存在,判断是否允许更新 - ItemDO itemDO = ItemConvert.INSTANCE.convert(item); - itemDO.setId(obj.getId()); - itemMapper.updateById(obj); + queryWrapper.eq("number", itemDO.getNumber()); + ItemDO existItembasic = itemMapper.selectOne(queryWrapper); + if (existItembasic == null && mode != 3) { + itemMapper.insert(ItemConvert.INSTANCE.convert(importItembasics.get(i))); + } else if (existItembasic != null && mode != 2) {// 如果存在,判断是否允许更新 + itemDO.setId(existItembasic.getId()); + itemMapper.updateById(itemDO); + } else if (existItembasic != null && mode == 2) { + ItemImportErrorVO importErrorVO = ItemConvert.INSTANCE.convert2(existItembasic); + importErrorVO.setImportStatus("失败"); + importErrorVO.setImportRemark("物料号" + existItembasic.getNumber() + "该条数据已存在,请重新编辑备件编号并重新导入"); + errorList.add(importErrorVO); } } - }); + } return errorList; } + + private String validateItembasicImport(ItemDO itembasicDO) { + String massage = ""; + // 校验,判断是否有不符合的原因 + if(itembasicDO.getNumber().isEmpty()){ + massage += "物料号不能为空" + ","; + } + return massage.toString(); + } + } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationService.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationService.java index cb66c51..1453b40 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationService.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationService.java @@ -2,6 +2,8 @@ package com.win.module.eam.service.location; import com.win.framework.common.pojo.CustomConditions; import com.win.framework.common.pojo.PageResult; +import com.win.module.eam.controller.item.vo.ItemImportErrorVO; +import com.win.module.eam.controller.item.vo.ItemImportExcelVo; import com.win.module.eam.controller.location.vo.*; import com.win.module.eam.dal.dataobject.location.LocationDO; @@ -108,4 +110,14 @@ public interface LocationService { * @return 分页列表 */ PageResult getLocationSenior(CustomConditions conditions); + + /** + * 导入备件主信息 + * + * @param importItembasics 导入备件主信息列表 + * @param mode 导入模式1更新2追加3覆盖 + * @param updatePart 是否支持更新 + * @return 导入结果 + */ + List importLocationList(List importItembasics, Integer mode, boolean updatePart); } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationServiceImpl.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationServiceImpl.java index 922bdab..84efdb2 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationServiceImpl.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/location/LocationServiceImpl.java @@ -1,11 +1,16 @@ package com.win.module.eam.service.location; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.win.framework.common.exception.util.ServiceExceptionUtil; import com.win.framework.common.pojo.CustomConditions; import com.win.framework.common.pojo.PageResult; +import com.win.module.eam.controller.item.vo.ItemImportErrorVO; +import com.win.module.eam.controller.item.vo.ItemImportExcelVo; import com.win.module.eam.controller.location.vo.*; +import com.win.module.eam.convert.item.ItemConvert; import com.win.module.eam.convert.location.LocationConvert; +import com.win.module.eam.dal.dataobject.item.ItemDO; import com.win.module.eam.dal.dataobject.itemaccounts.ItemAccountsDO; import com.win.module.eam.dal.dataobject.itemapplyrequest.ItemApplyRequestDetailDO; import com.win.module.eam.dal.dataobject.location.LocationDO; @@ -20,10 +25,7 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.math.BigDecimal; import java.time.LocalDateTime; -import java.util.Collection; -import java.util.Collections; -import java.util.List; -import java.util.Map; +import java.util.*; import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.win.module.eam.enums.ErrorCodeConstants.*; @@ -211,5 +213,53 @@ public class LocationServiceImpl implements LocationService { return locationMapper.selectSenior(conditions); } + @Override + public List importLocationList(List importLocationbasics, Integer mode, boolean updatePart) { + if (CollUtil.isEmpty(importLocationbasics)) { + throw exception(ITEM_NOT_EXISTS); + } + List errorList = new ArrayList<>(); + for (int i = 0; i < importLocationbasics.size(); i++) { + LocationDO locationDO = LocationConvert.INSTANCE.convert(importLocationbasics.get(i)); + String massage = validateLocationbasicImport(locationDO); + boolean flag = true; + if (!massage.isEmpty()) { + LocationImportErrorVO importErrorVO = LocationConvert.INSTANCE.convert2(locationDO); + importErrorVO.setImportStatus("失败"); + importErrorVO.setImportRemark(massage.substring(0, massage.length() - 1)); + Integer rowNumber = i + 1; + importErrorVO.setRowNumber("第" + rowNumber + "行"); + errorList.add(importErrorVO); + flag = false; + } + if (flag) { + // 判断如果不存在,在进行插入 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("number", locationDO.getNumber()); + LocationDO existLocationbasic = locationMapper.selectOne(queryWrapper); + if (existLocationbasic == null && mode != 3) { + locationMapper.insert(LocationConvert.INSTANCE.convert(importLocationbasics.get(i))); + } else if (existLocationbasic != null && mode != 2) {// 如果存在,判断是否允许更新 + locationDO.setId(existLocationbasic.getId()); + locationMapper.updateById(locationDO); + } else if (existLocationbasic != null && mode == 2) { + LocationImportErrorVO importErrorVO = LocationConvert.INSTANCE.convert2(existLocationbasic); + importErrorVO.setImportStatus("失败"); + importErrorVO.setImportRemark("物料号" + existLocationbasic.getNumber() + "该条数据已存在,请重新编辑备件编号并重新导入"); + errorList.add(importErrorVO); + } + } + } + return errorList; + } + + private String validateLocationbasicImport( LocationDO locationDO) { + String massage = ""; + // 校验,判断是否有不符合的原因 + if(locationDO.getNumber().isEmpty()){ + massage += "库位编号号不能为空" + ","; + } + return massage.toString(); + } } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaService.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaService.java index ccd3bfa..1d96b31 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaService.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaService.java @@ -2,6 +2,8 @@ package com.win.module.eam.service.locationarea; import com.win.framework.common.pojo.CustomConditions; import com.win.framework.common.pojo.PageResult; +import com.win.module.eam.controller.item.vo.ItemImportErrorVO; +import com.win.module.eam.controller.item.vo.ItemImportExcelVo; import com.win.module.eam.controller.locationarea.vo.*; import com.win.module.eam.dal.dataobject.locationarea.LocationAreaDO; @@ -77,4 +79,14 @@ public interface LocationAreaService { * @return 分页列表 */ PageResult getLocationAreaSenior(CustomConditions conditions); + + /** + * 导入备件主信息 + * + * @param importLocationAreabasics 导入备件主信息列表 + * @param mode 导入模式1更新2追加3覆盖 + * @param updatePart 是否支持更新 + * @return 导入结果 + */ + public List importLocationAreaList(List importLocationAreabasics, Integer mode, boolean updatePart); } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaServiceImpl.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaServiceImpl.java index 02b0624..7c27ee9 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaServiceImpl.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/locationarea/LocationAreaServiceImpl.java @@ -1,13 +1,11 @@ package com.win.module.eam.service.locationarea; +import cn.hutool.core.collection.CollUtil; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.win.framework.common.exception.util.ServiceExceptionUtil; import com.win.framework.common.pojo.CustomConditions; import com.win.framework.common.pojo.PageResult; -import com.win.module.eam.controller.locationarea.vo.LocationAreaCreateReqVO; -import com.win.module.eam.controller.locationarea.vo.LocationAreaExportReqVO; -import com.win.module.eam.controller.locationarea.vo.LocationAreaPageReqVO; -import com.win.module.eam.controller.locationarea.vo.LocationAreaUpdateReqVO; +import com.win.module.eam.controller.locationarea.vo.*; import com.win.module.eam.convert.locationarea.LocationAreaConvert; import com.win.module.eam.dal.dataobject.location.LocationDO; import com.win.module.eam.dal.dataobject.locationarea.LocationAreaDO; @@ -20,9 +18,11 @@ import org.springframework.validation.annotation.Validated; import javax.annotation.Resource; import java.time.LocalDateTime; +import java.util.ArrayList; import java.util.Collection; import java.util.List; +import static com.win.framework.common.exception.util.ServiceExceptionUtil.exception; import static com.win.module.eam.enums.ErrorCodeConstants.LOCATION_AREA_HAVE_EXISTS; import static com.win.module.eam.enums.ErrorCodeConstants.LOCATION_CAN_NOT_DELETE; @@ -54,7 +54,7 @@ public class LocationAreaServiceImpl implements LocationAreaService { objectQueryWrapper.eq("deleted", 0); List locationAreaList = locationAreaMapper.selectList(objectQueryWrapper); if (locationAreaList.size() > 0) { - throw ServiceExceptionUtil.exception(LOCATION_AREA_HAVE_EXISTS); + throw exception(LOCATION_AREA_HAVE_EXISTS); } locationArea.setCreateTime(LocalDateTime.now()); locationAreaMapper.insert(locationArea); @@ -117,4 +117,53 @@ public class LocationAreaServiceImpl implements LocationAreaService { public PageResult getLocationAreaSenior(CustomConditions conditions) { return locationAreaMapper.selectSenior(conditions); } + + @Override + public List importLocationAreaList(List importLocationAreabasics, Integer mode, boolean updatePart) { + if (CollUtil.isEmpty(importLocationAreabasics)) { + throw exception(LOCATION_AREA_HAVE_EXISTS); + } + List errorList = new ArrayList<>(); + for (int i = 0; i < importLocationAreabasics.size(); i++) { + LocationAreaDO locationAreaDO = LocationAreaConvert.INSTANCE.convert(importLocationAreabasics.get(i)); + String massage = validateLocationAreabasicImport(locationAreaDO); + boolean flag = true; + if (!massage.isEmpty()) { + LocationAreaImportErrorVO importErrorVO = LocationAreaConvert.INSTANCE.convert2(locationAreaDO); + importErrorVO.setImportStatus("失败"); + importErrorVO.setImportRemark(massage.substring(0, massage.length() - 1)); + Integer rowNumber = i + 1; + importErrorVO.setRowNumber("第" + rowNumber + "行"); + errorList.add(importErrorVO); + flag = false; + } + if (flag) { + // 判断如果不存在,在进行插入 + QueryWrapper queryWrapper = new QueryWrapper<>(); + queryWrapper.eq("number", locationAreaDO.getNumber()); + LocationAreaDO existLocationAreabasic = locationAreaMapper.selectOne(queryWrapper); + if (existLocationAreabasic == null && mode != 3) { + locationAreaMapper.insert(LocationAreaConvert.INSTANCE.convert(importLocationAreabasics.get(i))); + } else if (existLocationAreabasic != null && mode != 2) {// 如果存在,判断是否允许更新 + locationAreaDO.setId(existLocationAreabasic.getId()); + locationAreaMapper.updateById(locationAreaDO); + } else if (existLocationAreabasic != null && mode == 2) { + LocationAreaImportErrorVO importErrorVO = LocationAreaConvert.INSTANCE.convert2(existLocationAreabasic); + importErrorVO.setImportStatus("失败"); + importErrorVO.setImportRemark("物料号" + existLocationAreabasic.getNumber() + "该条数据已存在,请重新编辑备件编号并重新导入"); + errorList.add(importErrorVO); + } + } + } + return errorList; + } + + private String validateLocationAreabasicImport(LocationAreaDO locationAreaDO) { + String massage = ""; + // 校验,判断是否有不符合的原因 + if(locationAreaDO.getNumber().isEmpty()){ + massage += "物料号不能为空" + ","; + } + return massage.toString(); + } }