From 12795f689cec3618e43c7f3b7b6243724788d6f8 Mon Sep 17 00:00:00 2001 From: songguoqiang <765017469@qq.com> Date: Sun, 26 May 2024 13:13:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=87=E4=BB=B6=E5=8F=B0=E8=B4=A6=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E6=9B=B4=E6=8D=A2xml=20=E5=9B=A0=E4=B8=BA=E6=95=B0?= =?UTF-8?q?=E6=8D=AE=E9=87=8F=E5=A4=A7?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../itemaccounts/ItemAccountsController.java | 18 ++------ .../itemaccounts/vo/ItemAccountsExcelVO.java | 10 ++-- .../vo/ItemAccountsExportReqVO.java | 18 ++++++++ .../itemaccounts/ItemAccountsMapper.java | 2 + .../itemaccounts/ItemAccountsService.java | 2 + .../itemaccounts/ItemAccountsServiceImpl.java | 5 ++ .../itemaccounts/ItemAccountsMapper.xml | 46 +++++++++++++++++++ 7 files changed, 82 insertions(+), 19 deletions(-) diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java index eaca253..df52c73 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/ItemAccountsController.java @@ -139,21 +139,13 @@ public class ItemAccountsController { @OperateLog(type = EXPORT) public void exportItemAccountsExcel(@Valid ItemAccountsExportReqVO exportReqVO, HttpServletResponse response) throws IOException { - List list = itemAccountsService.getItemAccountsList(exportReqVO); + List list = itemAccountsService.getExportList(exportReqVO); // 导出 Excel - List datas = ItemAccountsConvert.INSTANCE.convertList02(list); - for(ItemAccountsExcelVO vo:datas){ - ItemDO itemDO = itemService.getByNumber(vo.getItemNumber()); - vo.setItemName(itemDO.getName()); - LocationDO locationDO = locationService.getByNumber(vo.getLocationNumber()); - vo.setLocationName(locationDO.getName()); - LocationAreaDO locationAreaDO = locationAreaService.getByNumber(vo.getAreaNumber()); - vo.setAreaName(locationAreaDO.getName()); - } + //List datas = ItemAccountsConvert.INSTANCE.convertList02(list); Map mapDropDown = new HashMap<>(); - String[] type = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.ITEM_ACCOUNT_LOCATION_TYPE); - mapDropDown.put(7, type); - ExcelUtils.write(response, "备件台账.xls", "数据", ItemAccountsExcelVO.class, datas,mapDropDown); +// String[] type = DictFrameworkUtils.dictTypeDictDataValue(DictTypeConstants.ITEM_ACCOUNT_LOCATION_TYPE); +// mapDropDown.put(7, type); + ExcelUtils.write(response, "备件台账.xls", "数据", ItemAccountsExcelVO.class, list,mapDropDown); } @GetMapping("/get-import-template") diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsExcelVO.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsExcelVO.java index f991516..a7affeb 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsExcelVO.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsExcelVO.java @@ -6,6 +6,8 @@ import com.win.framework.excel.core.annotations.DictFormat; import com.win.framework.excel.core.convert.DictConvert; import io.swagger.v3.oas.annotations.media.Schema; import lombok.Data; +import lombok.EqualsAndHashCode; +import lombok.ToString; import java.math.BigDecimal; import java.time.LocalDateTime; @@ -16,6 +18,7 @@ import java.time.LocalDateTime; * @author 超级管理员 */ @Data +@ToString(callSuper = true) public class ItemAccountsExcelVO { @ExcelProperty("备件编号") @@ -39,8 +42,7 @@ public class ItemAccountsExcelVO { @ExcelProperty("库存数量") private BigDecimal qty; - @DictFormat("item_account_location_type") // TODO 代码优化:建议设置到对应的 XXXDictTypeConstants 枚举类中 - @ExcelProperty(value = "库存类型", converter = DictConvert.class) + @ExcelProperty(value = "库存类型") private String type; @ExcelProperty("ABC分类") @@ -56,10 +58,6 @@ public class ItemAccountsExcelVO { private String project; - @ExcelProperty("创建时间") - private LocalDateTime createTime; - @ExcelIgnore - private String isInAccount; } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsExportReqVO.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsExportReqVO.java index dbbed2b..c46213b 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsExportReqVO.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/controller/itemaccounts/vo/ItemAccountsExportReqVO.java @@ -1,6 +1,9 @@ package com.win.module.eam.controller.itemaccounts.vo; +import com.alibaba.excel.annotation.ExcelProperty; import lombok.*; + +import java.math.BigDecimal; import java.util.*; import io.swagger.v3.oas.annotations.media.Schema; import com.win.framework.common.pojo.PageParam; @@ -12,4 +15,19 @@ public class ItemAccountsExportReqVO { @Schema(description = "备件编号") private String itemNumber; + + private String itemName; + + private String areaNumber; + + + private String locationNumber; + + + private String type; + + private String project; + + + } diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java index 8e748f4..67520ca 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/dal/mysql/itemaccounts/ItemAccountsMapper.java @@ -10,6 +10,7 @@ import com.win.framework.mybatis.core.mapper.BaseMapperX; import com.win.framework.mybatis.core.query.LambdaQueryWrapperX; import com.win.framework.mybatis.core.util.QueryWrapperUtils; import com.win.module.eam.controller.itemaccounts.vo.ItemAccountsCreateReqVO; +import com.win.module.eam.controller.itemaccounts.vo.ItemAccountsExcelVO; import com.win.module.eam.controller.itemaccounts.vo.ItemAccountsExportReqVO; import com.win.module.eam.controller.itemaccounts.vo.ItemAccountsPageReqVO; import com.win.module.eam.convert.itemaccounts.ItemAccountsConvert; @@ -285,6 +286,7 @@ public interface ItemAccountsMapper extends BaseMapperX { * @return */ IPage getAppPage(Page page, @Param("vo") ItemAccountsPageReqVO reqVO); + List getExportList(@Param("vo") ItemAccountsExportReqVO reqVO); /** * 获取所有模具列表包括维修中和正常的 diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsService.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsService.java index 7ebd0b8..1cbddac 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsService.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsService.java @@ -100,6 +100,8 @@ public interface ItemAccountsService { */ List getItemAccountsList(ItemAccountsExportReqVO exportReqVO); + List getExportList(ItemAccountsExportReqVO exportReqVO); + /** * 导入备件台账主信息 * diff --git a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java index 6c2b83b..8111341 100644 --- a/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java +++ b/win-module-eam/win-module-eam-biz/src/main/java/com/win/module/eam/service/itemaccounts/ItemAccountsServiceImpl.java @@ -340,6 +340,11 @@ public class ItemAccountsServiceImpl implements ItemAccountsService { return itemAccountsMapper.selectList(exportReqVO); } + @Override + public List getExportList(ItemAccountsExportReqVO exportReqVO) { + return itemAccountsMapper.getExportList(exportReqVO); + } + @Override @Transactional public List importItemAccountsList(List datas, Integer mode, boolean updatePart) { diff --git a/win-module-eam/win-module-eam-biz/src/main/resources/mapper/itemaccounts/ItemAccountsMapper.xml b/win-module-eam/win-module-eam-biz/src/main/resources/mapper/itemaccounts/ItemAccountsMapper.xml index cc349a3..4efd677 100644 --- a/win-module-eam/win-module-eam-biz/src/main/resources/mapper/itemaccounts/ItemAccountsMapper.xml +++ b/win-module-eam/win-module-eam-biz/src/main/resources/mapper/itemaccounts/ItemAccountsMapper.xml @@ -56,4 +56,50 @@ order by d.create_time + + +