diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java index 5ebe4929..0bace43c 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerQuoteController.java @@ -370,4 +370,15 @@ public class SysCustomerQuoteController extends BaseController + /** + * 导出客户报价模板4 + * */ + @RequiresPermissions("system:customerQuote:exportCustomerQuoteFour") + @Log(title = "客户报价信息", businessType = BusinessType.EXPORT) + @GetMapping("/exportCustomerQuoteFour/{supplierCode}") + public void exportCustomerQuoteFour(@PathVariable("supplierCode") String supplierCode, HttpServletResponse response){ + sysCustomerQuoteService.exportCustomerQuoteFour(supplierCode,response); + } + + } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerQuoteService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerQuoteService.java index ec936408..36dd5669 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerQuoteService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerQuoteService.java @@ -101,4 +101,10 @@ public interface ISysCustomerQuoteService * 导出客户报价模板3 * */ void exportCustomerQuoteThree(String supplierCode, HttpServletResponse response); + + + /** + * 导出客户报价模板4 + * */ + void exportCustomerQuoteFour(String supplierCode, HttpServletResponse response); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteServiceImpl.java index 22a0e03c..a330b5e1 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerQuoteServiceImpl.java @@ -482,8 +482,6 @@ public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService { SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerByEnterpriseCode(customerCode); - List companyInformations = companyInformationMapper.selectSysCompanyInformationAllList(); - HashMap map = new HashMap<>(); String pricingDate = sysCustomerQuote.getPricingDate(); @@ -586,6 +584,70 @@ public class SysCustomerQuoteServiceImpl implements ISysCustomerQuoteService { } } + + /** + * 导出客户报价模板4 + * */ + @Override + public void exportCustomerQuoteFour(String supplierCode, HttpServletResponse response) { + String fileName = "客户报价4.xlsx"; + + FileDownloadUtils fileDownloadUtils = new FileDownloadUtils(); + try { + + String fileRelativePath = fileDownloadUtils.getFileRelativePath(fileName); + + String realFileName = supplierCode +"-" + fileName.substring(0, fileName.indexOf(".")) + ".xlsx"; + + response.setHeader("Content-Disposition", "attachment;filename=" + URLEncoder.encode(realFileName, "UTF-8")); + response.setContentType("application/octet-stream"); + + //to + SysCustomerQuote sysCustomerQuote = sysCustomerQuoteMapper.selectSysCustomerBySupplierCode(supplierCode); + if(sysCustomerQuote==null){ + log.warn("客户报价信息不存在:{}", supplierCode); + } + + + List sysCustomerQuoteChildren = sysCustomerQuoteChildMapper.selectSysCustomerQuoteChildByQuoteId(sysCustomerQuote.getSupplierCode()); + + + + String customerCode = sysCustomerQuote.getCustomerCode(); + SysCustomerVo sysCustomerVo = sysCustomerMapper.selectSysCustomerByEnterpriseCode(customerCode); + + + HashMap map = new HashMap<>(); + String pricingDate = sysCustomerQuote.getPricingDate(); + + map.put("supplierCode", sysCustomerQuote.getSupplierCode()); + map.put("pricingDate", pricingDate); + map.put("customerContact", sysCustomerVo.getCustomerContact()); + map.put("contactNumberTo", sysCustomerVo.getContactNumber()); + map.put("customerEmail", sysCustomerVo.getCustomerEmail()); + + List exportCustomerQuoteChildVos = new ArrayList<>(); + for (SysCustomerQuoteChild sysCustomerQuoteChild : sysCustomerQuoteChildren) { + ExportCustomerQuoteChildVo exportCustomerQuoteChildVo = new ExportCustomerQuoteChildVo(); + exportCustomerQuoteChildVo.setDescribe(sysCustomerQuoteChild.getDescribe()); + exportCustomerQuoteChildVo.setMaterialNum(sysCustomerQuoteChild.getMaterialNum()); + //区分币种 + setMaterialPrice(exportCustomerQuoteChildVo, sysCustomerVo, sysCustomerQuoteChild); + exportCustomerQuoteChildVos.add(exportCustomerQuoteChildVo); + } + + ExcelWriter workBook = EasyExcel.write(response.getOutputStream()).withTemplate(fileRelativePath).build(); + WriteSheet sheet = EasyExcel.writerSheet().build(); + FillConfig fillConfig = FillConfig.builder().forceNewRow(true).build(); + workBook.fill(map, sheet); + workBook.fill(exportCustomerQuoteChildVos, fillConfig, sheet); + workBook.finish(); + + } catch (IOException e) { + throw new RuntimeException("文件处理失败",e); + } + } + //区分不同币种的金额 private void setMaterialPrice(ExportCustomerQuoteChildVo vo, SysCustomerVo sysCustomerVo, SysCustomerQuoteChild child) { if (RMB.equals(sysCustomerVo.getCommonCurrency())) { diff --git a/ruoyi-admin/src/main/resources/static/attachments/客户报价1.xlsx b/ruoyi-admin/src/main/resources/static/attachments/客户报价1.xlsx index 6c81e448..b5154dbd 100644 Binary files a/ruoyi-admin/src/main/resources/static/attachments/客户报价1.xlsx and b/ruoyi-admin/src/main/resources/static/attachments/客户报价1.xlsx differ diff --git a/ruoyi-admin/src/main/resources/static/attachments/客户报价2.xlsx b/ruoyi-admin/src/main/resources/static/attachments/客户报价2.xlsx index e16ff182..0c3d31ed 100644 Binary files a/ruoyi-admin/src/main/resources/static/attachments/客户报价2.xlsx and b/ruoyi-admin/src/main/resources/static/attachments/客户报价2.xlsx differ diff --git a/ruoyi-admin/src/main/resources/static/attachments/客户报价3.xlsx b/ruoyi-admin/src/main/resources/static/attachments/客户报价3.xlsx index 42f48350..4fd9c8b7 100644 Binary files a/ruoyi-admin/src/main/resources/static/attachments/客户报价3.xlsx and b/ruoyi-admin/src/main/resources/static/attachments/客户报价3.xlsx differ diff --git a/ruoyi-admin/src/main/resources/static/attachments/客户报价4.xlsx b/ruoyi-admin/src/main/resources/static/attachments/客户报价4.xlsx new file mode 100644 index 00000000..6fdd93d9 Binary files /dev/null and b/ruoyi-admin/src/main/resources/static/attachments/客户报价4.xlsx differ diff --git a/ruoyi-admin/src/main/resources/templates/system/customerQuote/customerQuote.html b/ruoyi-admin/src/main/resources/templates/system/customerQuote/customerQuote.html index ab930475..b0a39343 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customerQuote/customerQuote.html +++ b/ruoyi-admin/src/main/resources/templates/system/customerQuote/customerQuote.html @@ -80,6 +80,9 @@ 导出客户报价3 + + 导出客户报价4 +
@@ -340,6 +343,44 @@ } } + // 导出客户报价模板4 + function exportCustomerQuoteFour(){ + const selectRows = $("#bootstrap-table").bootstrapTable('getSelections'); + // 定义状态码常量 + const AUDIT_STATUS_APPROVED = "1";//审核通过 + const DELETE_FLAG = "2"; //作废 + + if (selectRows.length === 1){ + const row = selectRows[0]; + // 检查是否已作废 + if (row.useStatus === DELETE_FLAG) { + showWarning("该订单已作废"); + + }else { + // 检查是否已审核 + if (row.auditStatus === AUDIT_STATUS_APPROVED) { + + if (row.commonCurrency === '2'){ + // 使用 $.modal.confirm 显示确认对话框 + $.modal.confirm("确定导出这条数据的客户报价吗?", function() { + // 如果用户点击确定,继续导出 + var supplierCode = row.supplierCode; + window.location.href = prefix + "/exportCustomerQuoteFour/" + supplierCode; + $('#bootstrap-table').bootstrapTable('refresh'); // 刷新表格 + }); + }else { + showWarning("请选择报价币种为美元的数据进行导出"); + } + } else { + showWarning("请先审核"); + } + } + + }else { + $.modal.alertWarning("请选择一条数据"); + return; + } + }