From ab491d0682b72997c3801542ca1fbf67cabe9bae Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Tue, 6 Aug 2024 19:45:59 +0800 Subject: [PATCH] =?UTF-8?q?fix:=20=E8=B0=83=E6=8B=A8=E5=8D=95=E3=80=81?= =?UTF-8?q?=E5=B7=A5=E5=85=B7=E9=A2=86=E7=94=A8=E5=AF=BC=E5=87=BA=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../java/com/hnac/hzims/spare/vo/SpReceiveVO.java | 3 + .../spare/controller/SpAllocationController.java | 8 ++ .../spare/controller/SpReceiveController.java | 8 ++ .../hnac/hzims/spare/mapper/SpReceiveMapper.xml | 2 +- .../hzims/spare/service/ISpAllocationService.java | 9 ++ .../hzims/spare/service/ISpReceiveService.java | 5 + .../service/impl/SpAllocationServiceImpl.java | 93 ++++++++--------- .../spare/service/impl/SpReceiveServiceImpl.java | 116 +++++++++------------ .../java/com/hnac/hzims/spare/utils/ExcelUtil.java | 42 +++++++- .../hnac/hzims/spare/vo/SpAllocationExportVO.java | 43 ++++++++ .../com/hnac/hzims/spare/vo/SpReceiveExportVO.java | 36 +++++++ 11 files changed, 252 insertions(+), 113 deletions(-) create mode 100644 hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpAllocationExportVO.java create mode 100644 hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpReceiveExportVO.java diff --git a/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SpReceiveVO.java b/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SpReceiveVO.java index 8b551c0..49f4839 100644 --- a/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SpReceiveVO.java +++ b/hzims-service-api/assets-api/src/main/java/com/hnac/hzims/spare/vo/SpReceiveVO.java @@ -42,6 +42,9 @@ public class SpReceiveVO extends SpReceiveEntity { @ApiModelProperty(value = "结束时间") private String endDate; + @ApiModelProperty(value = "领用人ID") + private Long userId; + private Long sign; /** * 备品备件列表 diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java index d78fd2d..3c13b80 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpAllocationController.java @@ -23,6 +23,7 @@ import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; import springfox.documentation.annotations.ApiIgnore; +import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; @@ -80,6 +81,13 @@ public class SpAllocationController extends BladeController { return R.data(pages); } + @GetMapping("/export") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "导出", notes = "传入sp_allocation") + public void export(SpAllocationVO allocationVO, HttpServletResponse response) { + sp_allocationService.export(allocationVO,response); + } + /** * 新增 代码自定义代号 */ diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpReceiveController.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpReceiveController.java index 9a48d98..7749ed4 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpReceiveController.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/controller/SpReceiveController.java @@ -23,6 +23,7 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.utils.Func; import org.springframework.web.bind.annotation.*; +import javax.servlet.http.HttpServletResponse; import javax.validation.Valid; @@ -67,6 +68,13 @@ public class SpReceiveController extends BladeController { return R.data(pages); } + @GetMapping("/export") + @ApiOperationSupport(order = 3) + @ApiOperation(value = "导出", notes = "传入sp_receive") + public void export(HttpServletResponse response, SpReceiveVO receiveVO) { + sp_receiveService.export(response, receiveVO); + } + /** * 新增 代码自定义代号 */ diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceiveMapper.xml b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceiveMapper.xml index 33fad88..25e29b8 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceiveMapper.xml +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/mapper/SpReceiveMapper.xml @@ -61,7 +61,7 @@ and wr.CREATE_TIME #{params.endDate} - + and sw.AFFILIATED_UNIT in #{item} diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpAllocationService.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpAllocationService.java index 45c91a5..7e53d73 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpAllocationService.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpAllocationService.java @@ -6,6 +6,8 @@ import com.hnac.hzims.spare.entity.SpAllocationEntity; import com.hnac.hzims.spare.vo.SpAllocationVO; import org.springblade.core.mp.support.Query; +import javax.servlet.http.HttpServletResponse; + /** * 服务类 * @@ -34,6 +36,13 @@ public interface ISpAllocationService extends IService { IPage selectPageList(IPage page, SpAllocationVO allocationVO) ; /** + * 搭配调拨单 + * @param allocationVO 查询条件 + * @param response 响应 + */ + void export(SpAllocationVO allocationVO, HttpServletResponse response); + + /** * 修改状态 * @param bladeFlow * @return diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpReceiveService.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpReceiveService.java index 8882b1a..987e511 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpReceiveService.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/ISpReceiveService.java @@ -7,6 +7,8 @@ import com.hnac.hzims.spare.vo.SpReceiveVO; import org.springblade.core.mp.support.Query; +import javax.servlet.http.HttpServletResponse; + /** * 服务类 * @@ -34,6 +36,9 @@ public interface ISpReceiveService extends IService { * @return */ IPage selectPageList(IPage page, SpReceiveVO receiveVO) ; + + void export(HttpServletResponse response, SpReceiveVO receiveVO); + /** * 修改状态 * @param bladeFlow diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java index 048ca65..07b0258 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpAllocationServiceImpl.java @@ -1,8 +1,11 @@ package com.hnac.hzims.spare.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; +import com.google.common.collect.Lists; import com.hnac.hzims.spare.chche.AssetsNumCache; import com.hnac.hzims.spare.entity.*; import com.hnac.hzims.spare.enume.BusinessType; @@ -10,6 +13,8 @@ import com.hnac.hzims.spare.mapper.SpAllocationMapper; import com.hnac.hzims.spare.mapper.SpRecordMapper; import com.hnac.hzims.spare.mapper.WtSpWarehouseMapper; import com.hnac.hzims.spare.service.*; +import com.hnac.hzims.spare.utils.ExcelUtil; +import com.hnac.hzims.spare.vo.SpAllocationExportVO; import com.hnac.hzims.spare.vo.SpAllocationVO; import com.hnac.hzims.spare.vo.WtSpBasicVO; import lombok.AllArgsConstructor; @@ -21,23 +26,25 @@ import org.springblade.core.mp.support.Condition; import org.springblade.core.mp.support.Query; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; +import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.entity.Dept; import org.springblade.system.feign.IDictBizClient; import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.cache.UserCache; import org.springblade.system.user.entity.User; import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; import java.math.BigDecimal; import java.time.LocalDate; import java.time.format.DateTimeFormatter; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; +import java.util.stream.Collectors; /** * 服务实现类 @@ -202,55 +209,47 @@ public class SpAllocationServiceImpl extends ServiceImpl selectPageList(IPage page, SpAllocationVO allocationVO) { + return page.setRecords(this.selectList(page,allocationVO)); + } + + private List selectList(IPage page, SpAllocationVO allocationVO) { Map params = new HashMap<>(); - if(null !=allocationVO.getCode()){ - params.put("code",allocationVO.getCode()); - } - if(null !=allocationVO.getStatus()){ - params.put("status",allocationVO.getStatus()); - } - if(null !=allocationVO.getStartDate()){ - params.put("startDate",allocationVO.getStartDate()); - } - if(null !=allocationVO.getEndDate()){ - params.put("endDate",allocationVO.getEndDate()); - } - List longList = new ArrayList<>(); - if(null!=allocationVO.getDeptId()){ - R> deptList = sysClient.getDeptChild(allocationVO.getDeptId()); - for (int i = 0; i < deptList.getData().size(); i++) { - longList.add(deptList.getData().get(i).getId()); + params.put("code",allocationVO.getCode()); + params.put("status",allocationVO.getStatus()); + params.put("startDate",allocationVO.getStartDate()); + params.put("endDate",allocationVO.getEndDate()); + if(Func.isNotEmpty(allocationVO.getDeptId())){ + List deptIdList = new ArrayList<>(); + deptIdList.add(allocationVO.getDeptId()); + R> deptListR = sysClient.getDeptChild(allocationVO.getDeptId()); + if(deptListR.isSuccess() && CollectionUtil.isNotEmpty(deptListR.getData())) { + deptIdList.addAll(deptListR.getData().stream().map(Dept::getId).collect(Collectors.toList())); } - longList.add(allocationVO.getDeptId()); - }else{ -// longList = personClient.getShuiChangId(AuthUtil.getDeptId()); - } - if(longList.size()>0){ - params.put("deptList",longList); - } - if(null!=allocationVO.getOutWarehouseId()){ - params.put("outWarehouseId",allocationVO.getOutWarehouseId()); + params.put("deptList", deptIdList); } + params.put("outWarehouseId",allocationVO.getOutWarehouseId()); params.put("tenantId", AuthUtil.getTenantId()); List list = baseMapper.selectPageList(page,params); - List result = new ArrayList<>(); - for (int i = 0; i < list.size(); i++) { - SpAllocationVO entity = list.get(i); - if(null!=entity.getCreateUser()){ - R user = userClient.userInfoById(entity.getCreateUser()); - if(null!=user.getData()){ - entity.setUserName(user.getData().getName()); - } - } - WtSpWarehouseEntity inWarehouseEntity = warehouseMapper.selectById(entity.getInWarehouseId()); - if(ObjectUtil.isNotEmpty(inWarehouseEntity)&&StringUtil.isNotBlank(inWarehouseEntity.getName())){ - entity.setInWarehouseName(inWarehouseEntity.getName()); - }else { - entity.setInWarehouseName(""); - } - result.add(entity); + return list.stream().peek(this::fillWarehouseName).collect(Collectors.toList()); + } + + private void fillWarehouseName(SpAllocationVO entity) { + String userName = Optional.ofNullable(entity).map(SpAllocationVO::getCreateUser) + .map(UserCache::getUser).map(User::getName).orElse(null); + entity.setUserName(userName); + WtSpWarehouseEntity inWarehouseEntity = warehouseMapper.selectById(entity.getInWarehouseId()); + if(ObjectUtil.isNotEmpty(inWarehouseEntity)&&StringUtil.isNotBlank(inWarehouseEntity.getName())){ + entity.setInWarehouseName(inWarehouseEntity.getName()); + }else { + entity.setInWarehouseName(""); } - return page.setRecords(result); + } + + @Override + public void export(SpAllocationVO allocationVO, HttpServletResponse response) { + List allocationList = this.selectList(null, allocationVO); + List data = JSONArray.parseArray(JSON.toJSONString(allocationList), SpAllocationExportVO.class); + ExcelUtil.export(response, SpAllocationExportVO.class, data, "调拨单报表", "调拨单"); } public synchronized boolean updateStatus(SpAllocationEntity allocationEntity) { diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpReceiveServiceImpl.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpReceiveServiceImpl.java index a013be4..a79c870 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpReceiveServiceImpl.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/service/impl/SpReceiveServiceImpl.java @@ -1,5 +1,7 @@ package com.hnac.hzims.spare.service.impl; +import com.alibaba.fastjson.JSON; +import com.alibaba.fastjson.JSONArray; import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; import com.baomidou.mybatisplus.core.metadata.IPage; import com.baomidou.mybatisplus.extension.plugins.pagination.Page; @@ -11,8 +13,10 @@ import com.hnac.hzims.spare.mapper.SpReceiveMapper; import com.hnac.hzims.spare.mapper.SpRecordMapper; import com.hnac.hzims.spare.mapper.WtSpWarehouseMapper; import com.hnac.hzims.spare.service.*; +import com.hnac.hzims.spare.utils.ExcelUtil; import com.hnac.hzims.spare.vo.SpReceiveVO; import com.hnac.hzims.spare.vo.WtSpBasicVO; +import com.hnac.hzims.spare.vo.SpReceiveExportVO; import lombok.AllArgsConstructor; import org.slf4j.Logger; import org.slf4j.LoggerFactory; @@ -23,6 +27,7 @@ import org.springblade.core.mp.support.Query; import org.springblade.core.secure.BladeUser; import org.springblade.core.secure.utils.AuthUtil; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; import org.springblade.system.entity.Dept; import org.springblade.system.feign.IDictBizClient; @@ -33,9 +38,11 @@ import org.springblade.system.user.feign.IUserClient; import org.springframework.stereotype.Service; import org.springframework.transaction.annotation.Transactional; +import javax.servlet.http.HttpServletResponse; import java.time.LocalDate; import java.time.format.DateTimeFormatter; import java.util.*; +import java.util.stream.Collectors; /** * 服务实现类 @@ -191,76 +198,57 @@ public class SpReceiveServiceImpl extends ServiceImpl selectPageList(IPage page, SpReceiveVO receiveVO) { + return page.setRecords(this.selectList(page,receiveVO)); + } + + private List selectList(IPage page, SpReceiveVO receiveVO) { Map params = new HashMap<>(); - if(null !=receiveVO.getCode()){ - params.put("code",receiveVO.getCode()); - } - if(null !=receiveVO.getStatus()){ - params.put("status",receiveVO.getStatus()); - } - if(null !=receiveVO.getStartDate()){ - params.put("startDate",receiveVO.getStartDate()); - } - if(null !=receiveVO.getEndDate()){ - params.put("endDate",receiveVO.getEndDate()); - } - List longList = new ArrayList<>(); - if(null!=receiveVO.getDeptId()){ - R> deptList = sysClient.getDeptChild(receiveVO.getDeptId()); - for (int i = 0; i < deptList.getData().size(); i++) { - longList.add(deptList.getData().get(i).getId()); - } - longList.add(receiveVO.getDeptId()); - }else{ -// longList = personClient.getShuiChangId(AuthUtil.getDeptId()); - } - if(longList.size()>0){ - params.put("deptList",longList); - } - if(null!=receiveVO.getStorageRoom()){ - params.put("warehouseId",receiveVO.getStorageRoom()); - } - List result = new ArrayList<>(); - BladeUser bladeUser = AuthUtil.getUser(); - if(null!=receiveVO.getUserName()){ - R user = userClient.userByAccount(bladeUser.getTenantId(),receiveVO.getUserName()); - if(null!=user){ - if(null!=user.getData()){ - params.put("createUser",user.getData().getId()); - }else{ - return page.setRecords(result); - } + params.put("code",receiveVO.getCode()); + params.put("status",receiveVO.getStatus()); + params.put("startDate",receiveVO.getStartDate()); + params.put("endDate",receiveVO.getEndDate()); + List deptIdList = new ArrayList<>(); + if(Func.isNotEmpty(receiveVO.getDeptId())) { + deptIdList.add(receiveVO.getDeptId()); + R> deptListR = sysClient.getDeptChild(receiveVO.getDeptId()); + if(deptListR.isSuccess() && CollectionUtil.isNotEmpty(deptListR.getData())) { + deptIdList.addAll(deptListR.getData().stream().map(Dept::getId).collect(Collectors.toList())); } } + params.put("deptList",deptIdList); + params.put("warehouseId",receiveVO.getStorageRoom()); + params.put("createUser",receiveVO.getUserId()); params.put("tenantId", AuthUtil.getTenantId()); List list = baseMapper.selectPageList(page,params); - for (int i = 0; i < list.size(); i++) { - SpReceiveVO entity = list.get(i); - if(null!=entity.getCreateUser()){ - R user = userClient.userInfoById(entity.getCreateUser()); - if(null!=user.getData()){ - entity.setUserName(user.getData().getName()); - } - } - List k=new ArrayList<>(); - QueryWrapper queryWrapper = new QueryWrapper(); - queryWrapper.lambda().eq(SpReceivesEntity::getVeceiveId,entity.getId()); - queryWrapper.lambda().eq(SpReceivesEntity::getStatus,1); - List byId = iSpReceivesService.list(queryWrapper); - k.addAll(byId); - QueryWrapper queryWrappers = new QueryWrapper(); - queryWrappers.lambda().eq(SpReceivesEntity::getVeceiveId,entity.getId()); - queryWrappers.lambda().eq(SpReceivesEntity::getStatus,3); - List id = iSpReceivesService.list(queryWrappers); - k.addAll(id); - if (null==k||0==k.size()){ - entity.setSign(2L); - }else { - entity.setSign(1L); - } - result.add(entity); + return list.stream().peek(this::fillDetail).collect(Collectors.toList()); + } + + private void fillDetail(SpReceiveVO entity) { + String userName = Optional.ofNullable(entity.getCreateUser()).map(UserCache::getUser).map(User::getName).orElse(null); + entity.setUserName(userName); + List k=new ArrayList<>(); + QueryWrapper queryWrapper = new QueryWrapper(); + queryWrapper.lambda().eq(SpReceivesEntity::getVeceiveId,entity.getId()); + queryWrapper.lambda().eq(SpReceivesEntity::getStatus,1); + List byId = iSpReceivesService.list(queryWrapper); + k.addAll(byId); + QueryWrapper queryWrappers = new QueryWrapper(); + queryWrappers.lambda().eq(SpReceivesEntity::getVeceiveId,entity.getId()); + queryWrappers.lambda().eq(SpReceivesEntity::getStatus,3); + List id = iSpReceivesService.list(queryWrappers); + k.addAll(id); + if (null==k||0==k.size()){ + entity.setSign(2L); + }else { + entity.setSign(1L); } - return page.setRecords(result); + } + + @Override + public void export(HttpServletResponse response, SpReceiveVO receiveVO) { + List spReceiveVOS = this.selectList(null, receiveVO); + List data = JSONArray.parseArray(JSON.toJSONString(spReceiveVOS), SpReceiveExportVO.class); + ExcelUtil.export(response,SpReceiveExportVO.class,data,"工具领用报表","工具领用"); } public synchronized boolean updateStatus(SpReceiveEntity receiveEntity) { diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/utils/ExcelUtil.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/utils/ExcelUtil.java index 6e8989f..6219d30 100644 --- a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/utils/ExcelUtil.java +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/utils/ExcelUtil.java @@ -4,10 +4,18 @@ import com.alibaba.excel.EasyExcel; import com.alibaba.excel.EasyExcelFactory; import com.alibaba.excel.event.AnalysisEventListener; import com.alibaba.excel.write.handler.WriteHandler; +import com.alibaba.excel.write.metadata.style.WriteCellStyle; +import com.alibaba.excel.write.style.HorizontalCellStyleStrategy; +import com.hnac.hzims.spare.vo.WtSpToolBasicExportVO; import org.apache.poi.ss.formula.functions.T; +import org.apache.poi.ss.usermodel.BorderStyle; +import javax.servlet.http.HttpServletResponse; import java.io.File; +import java.io.IOException; import java.io.InputStream; +import java.io.UnsupportedEncodingException; +import java.net.URLEncoder; import java.util.List; import java.util.Map; import java.util.Set; @@ -343,5 +351,37 @@ public class ExcelUtil { EasyExcel.write(filePath, headClazz).excludeColumnFiledNames(excludeCols).sheet(sheetNo, sheetName).doWrite(data); } - + /** + * 导出excel模板 + * @param response + * @param clazz 导出对象class + * @param data 导出数据 + * @param fileName 文件名 + * @param sheetName sheet名称 + * @param 数据泛型类 + */ + public static void export(HttpServletResponse response, Class clazz, List data, String fileName, String sheetName) { + try { + fileName = URLEncoder.encode(fileName, "UTF-8"); + } catch (UnsupportedEncodingException e) { + throw new RuntimeException(e); + } + response.setHeader("Content-disposition", "attachment;filename=" + fileName + ".xlsx"); + response.setContentType("application/vnd.ms-excel"); + response.setCharacterEncoding("UTF-8"); + WriteCellStyle contentWriteCellStyle = new WriteCellStyle(); + contentWriteCellStyle.setBorderLeft(BorderStyle.THIN); + contentWriteCellStyle.setBorderTop(BorderStyle.THIN); + contentWriteCellStyle.setBorderRight(BorderStyle.THIN); + contentWriteCellStyle.setBorderBottom(BorderStyle.THIN); + contentWriteCellStyle.setWrapped(true); + try { + EasyExcel.write(response.getOutputStream(), clazz) + .registerWriteHandler(new HorizontalCellStyleStrategy(new WriteCellStyle(), contentWriteCellStyle)) + .autoCloseStream(Boolean.FALSE).sheet(sheetName) + .doWrite(data); + } catch (IOException e) { + throw new RuntimeException(e); + } + } } diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpAllocationExportVO.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpAllocationExportVO.java new file mode 100644 index 0000000..c76e6a2 --- /dev/null +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpAllocationExportVO.java @@ -0,0 +1,43 @@ +package com.hnac.hzims.spare.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import com.fasterxml.jackson.annotation.JsonFormat; +import io.swagger.annotations.ApiModelProperty; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tool.utils.DateUtil; +import org.springframework.format.annotation.DateTimeFormat; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author: huangxing + * @Date: 2024/08/06 14:21 + */ +@Data +@EqualsAndHashCode +public class SpAllocationExportVO implements Serializable { + + @ExcelProperty(value = "单据编码",index = 0) + @ColumnWidth(25) + private String code; + + @ExcelProperty(value = "拨入库房",index = 1) + @ColumnWidth(20) + private String inWarehouseName; + + @ExcelProperty(value = "拨出库房",index = 2) + @ColumnWidth(20) + private String outWarehouseName; + + @ExcelProperty(value = "申请人",index = 3) + @ColumnWidth(20) + private String userName; + + @ExcelProperty(value = "制单时间",index = 4, format = DateUtil.PATTERN_DATETIME) + @ColumnWidth(25) + private Date createTime; + +} diff --git a/hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpReceiveExportVO.java b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpReceiveExportVO.java new file mode 100644 index 0000000..5a6af18 --- /dev/null +++ b/hzims-service/assets/src/main/java/com/hnac/hzims/spare/vo/SpReceiveExportVO.java @@ -0,0 +1,36 @@ +package com.hnac.hzims.spare.vo; + +import com.alibaba.excel.annotation.ExcelProperty; +import com.alibaba.excel.annotation.write.style.ColumnWidth; +import lombok.Data; +import lombok.EqualsAndHashCode; +import org.springblade.core.tool.utils.DateUtil; + +import java.io.Serializable; +import java.util.Date; + +/** + * @Author: huangxing + * @Date: 2024/08/06 18:58 + */ +@Data +@EqualsAndHashCode +public class SpReceiveExportVO implements Serializable { + + @ExcelProperty(value = "单据编码",index = 0) + @ColumnWidth(30) + private String code; + + @ExcelProperty(value = "出库库房",index = 1) + @ColumnWidth(30) + private String warehouseName; + + @ExcelProperty(value = "领用人",index = 2) + @ColumnWidth(20) + private String userName; + + @ExcelProperty(value = "领用时间",index = 3, format = DateUtil.PATTERN_DATETIME) + @ColumnWidth(30) + private Date createTime; + +}