From 16a05e24366edc48a5a7f4cf33c49a827b9cc26e Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Thu, 21 Nov 2024 16:31:50 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E9=87=87=E8=B4=AD=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E6=8C=89=E7=85=A7=E5=A4=96=E6=9D=90=E8=A6=81=E6=B1=82=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E5=95=86=E5=89=8D=E7=AB=AF=E9=A1=B5=E9=9D=A2=E6=96=B0?= =?UTF-8?q?=E5=A2=9E=E5=AF=BC=E5=87=BA=E5=8A=9F=E8=83=BD=20=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E5=95=86=E5=AE=9E=E4=BD=93=E7=B1=BB=EF=BC=9A=E5=86=85?= =?UTF-8?q?=E5=A4=96=E9=94=80=E5=92=8C=E4=BC=81=E4=B8=9A=E6=80=A7=E8=B4=A8?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E5=AD=97=E5=85=B8=E5=B1=9E=E6=80=A7=20?= =?UTF-8?q?=E4=BE=9B=E5=BA=94=E5=95=86=E6=96=B0=E5=A2=9E=20=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E4=BE=9B=E5=BA=94=E5=95=86=E8=B5=84=E6=96=99=E5=88=97?= =?UTF-8?q?=E8=A1=A8=E5=90=8E=E7=AB=AF=E6=8E=A5=E5=8F=A3=20=E4=BE=9B?= =?UTF-8?q?=E5=BA=94=E5=95=86=E6=96=B0=E5=A2=9E=20=E4=BB=A5=E7=AD=9B?= =?UTF-8?q?=E9=80=89=E8=B5=84=E8=B4=A8=E5=92=8C=E7=B1=BB=E5=9E=8B=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E5=85=A8=E9=83=A8=E5=90=8E=E7=AB=AF=E6=96=B9=E6=B3=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SysSupplierController.java | 57 +++++-------------- .../com/ruoyi/system/domain/SysSupplier.java | 4 +- .../system/mapper/SysSupplierMapper.java | 7 +++ .../system/service/ISysSupplierService.java | 5 ++ .../service/impl/SysSupplierServiceImpl.java | 10 ++++ .../mapper/system/SysSupplierMapper.xml | 12 ++++ .../templates/system/supplier/supplier.html | 3 + 7 files changed, 54 insertions(+), 44 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSupplierController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSupplierController.java index 1c75a6c2..e25a9675 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSupplierController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysSupplierController.java @@ -16,6 +16,7 @@ import com.ruoyi.common.core.page.TableDataInfo; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.ShiroUtils; +import com.ruoyi.common.utils.poi.ExcelUtil; import com.ruoyi.process.general.service.IProcessService; import com.ruoyi.system.domain.*; import com.ruoyi.system.domain.Vo.SysSupplierVo; @@ -195,53 +196,25 @@ public class SysSupplierController extends BaseController } - //导出 + /** + * 导出供应商资料列表 + */ + @RequiresPermissions("system:supplier:export") @Log(title = "供应商资料", businessType = BusinessType.EXPORT) - @RequestMapping("/exportSupplierInfo") + @PostMapping("/export") @ResponseBody - public void exportSupplierInfo(@RequestBody String selectData, HttpServletResponse response) throws IOException { - - //数据处理 - JSONObject jsonObject = (JSONObject) JSONObject.parse(selectData); - JSONArray jsonArray = jsonObject.getJSONArray("selectData"); - List selectDataList = JSONObject.parseArray(String.valueOf(jsonArray), SysSupplierDto.class); - - - //获取发票基础信息 - SysSupplier sysSupplier = sysSupplierService.selectSysSupplierById(selectDataList.get(0).getSupplierId()); - SysSupplierDto sysSupplierDto = new SysSupplierDto(); - BeanUtils.copyProperties(sysSupplier,sysSupplierDto); - - //填充表格 - response.setCharacterEncoding("utf-8"); - String fileName = URLEncoder.encode("国税发票", "UTF-8").replaceAll("\\+", "%20"); - response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx"); - String templateFileName = "C:\\exportTemplates\\exportSupplierInfo.xlsx"; - try (ExcelWriter excelWriter = EasyExcel.write(response.getOutputStream()).withTemplate(templateFileName).build()) { - WriteSheet writeSheet = EasyExcel.writerSheet().build(); - Map map = MapUtils.newHashMap(); -// map.put("date", DateTimeFormatter.ofPattern("yyyy/MM/dd").format(LocalDateTime.now())); - map.put("enterpriseName", sysSupplierDto.getEnterpriseName()); - map.put("customerAddress", sysSupplierDto.getCustomerAddress()); - map.put("postalCode", sysSupplierDto.getPostalCode()); - map.put("contactNumber", sysSupplierDto.getContactNumber()); - map.put("customerFax", sysSupplierDto.getCustomerFax()); - map.put("customerContact", sysSupplierDto.getCustomerContact()); - map.put("paymentTerms", sysSupplierDto.getPaymentTerms()); - map.put("taxRate", sysSupplierDto.getTaxRate()); - - List exportSalesData = sysDictTypeService.selectDictDataByType("sys_export_sales"); - for (int i = 0;i list = sysSupplierService.exportSelectSupplierList(sysSupplier); + ExcelUtil util = new ExcelUtil(SysSupplier.class); -// System.out.println(exportSalesData); - excelWriter.fill(map, writeSheet); - } + return util.exportExcel(list, "供应商资料"); } + + + + @PostMapping("/getId") @ResponseBody public Result getId() throws Exception { diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java index 6dbf900b..162ab57c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/domain/SysSupplier.java @@ -45,7 +45,7 @@ public class SysSupplier extends BaseEntity /** 内外销 */ - @Excel(name = "内外销") + @Excel(name = "内外销",dictType = "sys_export_sales") private String exportSales; /** 企业名称 */ @@ -53,7 +53,7 @@ public class SysSupplier extends BaseEntity private String enterpriseName; /** 企业性质 */ - @Excel(name = "企业性质") + @Excel(name = "企业性质",dictType = "sys_enterprise_nature") private String enterpriseNature; /** 企业地址 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSupplierMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSupplierMapper.java index a35f95ee..bd7f0d7e 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSupplierMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysSupplierMapper.java @@ -61,6 +61,13 @@ public interface SysSupplierMapper */ public int deleteSysSupplierByIds(String[] supplierIds); + + /** + * 可以筛选资质和类型导出全部 + */ + public List exportSelectSupplierList(SysSupplier sysSupplier); + + public List selectSysSupplierBycode(); /** diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSupplierService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSupplierService.java index 38dd7fab..1be5df36 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSupplierService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysSupplierService.java @@ -67,6 +67,11 @@ public interface ISysSupplierService public List selectSysSupplierBycode(); + /** + * 可以筛选资质和类型导出全部 + */ + public List exportSelectSupplierList(SysSupplier sysSupplier); + /** * 新增物料信息的时候查关联应商信息 */ diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java index 3a2149b7..7ed6a01b 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysSupplierServiceImpl.java @@ -267,6 +267,16 @@ public class SysSupplierServiceImpl implements ISysSupplierService{ return sysSupplierMapper.selectSysSupplierBycode(); } + /** + * 可以筛选资质和类型导出全部 + */ + @Override + public List exportSelectSupplierList(SysSupplier sysSupplier) { + return sysSupplierMapper.exportSelectSupplierList(sysSupplier); + } + + + /** * 新增物料信息的时候查关联应商信息 */ diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml index 57ed74b6..2045cac0 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysSupplierMapper.xml @@ -165,6 +165,18 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" on sup.supplier_id = file.rel_id where sup.supplier_id = #{supplierId} + + + + + +