From 43eb6fd9948263495378bac5ab612e6147d16a5d Mon Sep 17 00:00:00 2001 From: liuxiaoxu <1793812695@qq.com> Date: Fri, 13 Dec 2024 09:57:54 +0800 Subject: [PATCH] =?UTF-8?q?[feat]=E9=94=80=E5=94=AE=E7=AE=A1=E7=90=86=20?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF=E5=89=8D?= =?UTF-8?q?=E7=AB=AF=E9=A1=B5=E9=9D=A2=E6=96=B0=E5=A2=9E=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E6=8C=89=E9=92=AE=EF=BC=8C=E6=96=B0=E5=A2=9E=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=85=A8=E9=83=A8=E5=92=8C=E9=80=89=E6=8B=A9=E6=80=A7=E5=AF=BC?= =?UTF-8?q?=E5=87=BA=E6=96=B9=E6=B3=95=EF=BC=9B=20=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AFController=E5=B1=82?= =?UTF-8?q?=E6=96=B0=E5=A2=9E=20=E5=AF=BC=E5=87=BA=E9=80=89=E6=8B=A9?= =?UTF-8?q?=E7=9A=84=E5=AE=A2=E6=88=B7=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=88=97=E8=A1=A8=E6=8E=A5=E5=8F=A3=EF=BC=9B=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=20=E5=AF=BC=E5=87=BA=E6=89=80=E6=9C=89=E5=AE=A2=E6=88=B7?= =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF=E5=88=97=E8=A1=A8=E6=8E=A5?= =?UTF-8?q?=E5=8F=A3=EF=BC=9B=20=E5=AE=A2=E6=88=B7=E5=9F=BA=E6=9C=AC?= =?UTF-8?q?=E4=BF=A1=E6=81=AF=E6=96=B0=E5=A2=9E=20=E9=80=9A=E8=BF=87?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E7=BC=96=E5=8F=B7=E6=95=B0=E7=BB=84=E6=9F=A5?= =?UTF-8?q?=E8=AF=A2=E5=AE=A2=E6=88=B7=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E9=9B=86=E5=90=88=E6=96=B9=E6=B3=95=EF=BC=9B=E6=96=B0=E5=A2=9E?= =?UTF-8?q?=20=E7=AD=9B=E9=80=89=E6=9F=A5=E8=AF=A2=E5=AF=BC=E5=87=BA?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF=E9=9B=86?= =?UTF-8?q?=E5=90=88=E6=96=B9=E6=B3=95=EF=BC=9B=E5=90=8E=E7=AB=AF=E5=88=86?= =?UTF-8?q?=E9=A1=B5=E6=9F=A5=E8=AF=A2=E6=8E=A5=E5=8F=A3=E5=8A=A0=E4=B8=8A?= =?UTF-8?q?=E5=AE=A2=E6=88=B7=E6=A0=87=E8=AF=86=E5=AD=97=E6=AE=B5=EF=BC=9B?= =?UTF-8?q?=20=E5=AE=A2=E6=88=B7=E5=9F=BA=E6=9C=AC=E4=BF=A1=E6=81=AF?= =?UTF-8?q?=E5=AE=9E=E4=BD=93=E7=B1=BB=E5=AD=97=E5=85=B8=E5=AD=97=E6=AE=B5?= =?UTF-8?q?=E5=8A=A0=E4=B8=8A=E5=AD=97=E5=85=B8=E5=B1=9E=E6=80=A7=EF=BC=9B?= =?UTF-8?q?=20=E5=A4=84=E7=90=86=E4=B8=80=E4=BA=9B=E5=BF=85=E8=A6=81?= =?UTF-8?q?=E5=AD=97=E6=AE=B5=E5=92=8C=E4=B8=8D=E5=BF=85=E8=A6=81=E5=AD=97?= =?UTF-8?q?=E6=AE=B5=E7=9A=84@Excel=E6=B3=A8=E8=A7=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/SysCustomerController.java | 136 ++++++++++-------- .../com/ruoyi/system/domain/SysCustomer.java | 39 +++-- .../system/mapper/SysCustomerMapper.java | 10 ++ .../system/service/ISysCustomerService.java | 10 ++ .../service/impl/SysCustomerServiceImpl.java | 18 +++ .../mapper/system/SysCustomerMapper.xml | 28 +++- .../templates/system/customer/customer.html | 60 ++++++++ 7 files changed, 227 insertions(+), 74 deletions(-) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java index 280a5a33..3f85cf41 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/controller/SysCustomerController.java @@ -156,16 +156,32 @@ public class SysCustomerController extends BaseController /** - * 导出客户基本信息列表 + * 导出选择的客户基本信息列表 */ @RequiresPermissions("system:customer:export") @Log(title = "客户基本信息", businessType = BusinessType.EXPORT) @PostMapping("/export") @ResponseBody - public AjaxResult export(SysCustomerVo sysCustomer) + public AjaxResult export(@RequestBody String[] enterpriseCodes) { - List list = sysCustomerService.selectSysCustomerList(sysCustomer); + List list = sysCustomerService.selectSysCustomerListByEnterpriseCodes(enterpriseCodes); + ExcelUtil util = new ExcelUtil(SysCustomerVo.class); + return util.exportExcel(list, "客户基本信息数据"); + } + + + /** + * 导出所有客户基本信息列表 + */ + + @RequiresPermissions("system:customer:export") + @Log(title = "客户基本信息", businessType = BusinessType.EXPORT) + @PostMapping("/exportAll") + @ResponseBody + public AjaxResult exportAll(SysCustomerVo sysCustomer) + { + List list = sysCustomerService.selectExportSysCustomerList(sysCustomer); ExcelUtil util = new ExcelUtil(SysCustomerVo.class); return util.exportExcel(list, "客户基本信息数据"); } @@ -427,64 +443,62 @@ public class SysCustomerController extends BaseController List list = sysCustomerOperService.selectSysCustomerOperList(sysCustomerOper); return getDataTable(list); } - @RequiresPermissions("system:customer:export") - @Log(title = "客户基本信息", businessType = BusinessType.EXPORT) - @RequestMapping("/exportCustomerInfo") - @ResponseBody - public void exportCustomerInfo(@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), SysCustomerDto.class); - - - //获取发票基础信息 - SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(selectDataList.get(0).getId()); - SysCustomerDto sysCustomerDto = new SysCustomerDto(); - BeanUtils.copyProperties(sysCustomer,sysCustomerDto); - - //填充表格 - 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\\exportCustomerInfo.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("unifiedNumbering", sysCustomerDto.getUnifiedNumbering()); - map.put("enterpriseCode", sysCustomerDto.getEnterpriseCode()); - map.put("enterpriseName", sysCustomerDto.getEnterpriseName()); - map.put("englishName", sysCustomerDto.getEnglishName()); - map.put("customerAddress", sysCustomerDto.getCustomerAddress()); - map.put("postalCode", sysCustomerDto.getPostalCode()); - map.put("contactNumber", sysCustomerDto.getContactNumber()); - map.put("customerFax", sysCustomerDto.getCustomerFax()); - map.put("customerContact", sysCustomerDto.getCustomerContact()); - map.put("deliveryAddress", sysCustomerDto.getDeliveryAddress()); - map.put("paymentTerms", sysCustomerDto.getPaymentTerms()); - map.put("taxRate", sysCustomerDto.getTaxRate()); - - List exportSalesData = sysDictTypeService.selectDictDataByType("sys_export_sales"); - for (int i = 0;i commonCurrencyData = sysDictTypeService.selectDictDataByType("sys_common_currency"); - for (int i = 0;i selectDataList = JSONObject.parseArray(String.valueOf(jsonArray), SysCustomerDto.class); +// +// +// //获取发票基础信息 +// SysCustomer sysCustomer = sysCustomerService.selectSysCustomerById(selectDataList.get(0).getId()); +// SysCustomerDto sysCustomerDto = new SysCustomerDto(); +// BeanUtils.copyProperties(sysCustomer,sysCustomerDto); +// +// //填充表格 +// 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\\exportCustomerInfo.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("unifiedNumbering", sysCustomerDto.getUnifiedNumbering()); +// map.put("enterpriseCode", sysCustomerDto.getEnterpriseCode()); +// map.put("enterpriseName", sysCustomerDto.getEnterpriseName()); +// map.put("englishName", sysCustomerDto.getEnglishName()); +// map.put("customerAddress", sysCustomerDto.getCustomerAddress()); +// map.put("postalCode", sysCustomerDto.getPostalCode()); +// map.put("contactNumber", sysCustomerDto.getContactNumber()); +// map.put("customerFax", sysCustomerDto.getCustomerFax()); +// map.put("customerContact", sysCustomerDto.getCustomerContact()); +// map.put("deliveryAddress", sysCustomerDto.getDeliveryAddress()); +// map.put("paymentTerms", sysCustomerDto.getPaymentTerms()); +// map.put("taxRate", sysCustomerDto.getTaxRate()); +// +// List exportSalesData = sysDictTypeService.selectDictDataByType("sys_export_sales"); +// for (int i = 0;i commonCurrencyData = sysDictTypeService.selectDictDataByType("sys_common_currency"); +// for (int i = 0;i sysCustomerQuoteList; - @Excel(name = "客户审核状态表示") //0表示审核中,1标识审核通过,2表示审核拒绝 + @Excel(name = "审核状态",dictType = "auditStatus") //0表示审核中,1标识审核通过,2表示审核拒绝 private String auditStatus; - @Excel(name = "客户的状态") + @Excel(name = "使用状态",dictType = "useStatus") private String useStatus; //1表示潜在客户(仅报价) 2表示 客户(已下单) @@ -789,6 +794,16 @@ public class SysCustomer extends BaseEntity this.allowedCreators = allowedCreators; } + @Override + public Date getCreateTime() { + return createTime; + } + + @Override + public void setCreateTime(Date createTime) { + this.createTime = createTime; + } + @Override public String toString() { return new ToStringBuilder(this,ToStringStyle.MULTI_LINE_STYLE) diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerMapper.java b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerMapper.java index 6530d657..36e71526 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerMapper.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/mapper/SysCustomerMapper.java @@ -107,4 +107,14 @@ public interface SysCustomerMapper * 通过开票公司名称名称查询客户详情 * */ SysCustomerVo selectSysCustomerByInvoiceCompanyName(String invoicingCompanyName); + + /* + * 通过客户编号数组查询客户基本信息集合 + * */ + List selectSysCustomerListByEnterpriseCodes(String[] enterpriseCodes); + + /* + * 筛选查询导出客户基本信息集合 + * */ + List selectExportSysCustomerList(SysCustomerVo sysCustomer); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java index f8030bef..096759e9 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/ISysCustomerService.java @@ -132,4 +132,14 @@ public interface ISysCustomerService * 角色过滤数据 * */ Set getAllowedCreators(Set roleKeys); + + /** + * 根据客户编号数组查询客户信息集合 + * */ + List selectSysCustomerListByEnterpriseCodes(String[] enterpriseCodes); + + /** + * 筛选查询导出所有的客户基本信息 + * */ + List selectExportSysCustomerList(SysCustomerVo sysCustomer); } diff --git a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java index 52216da5..720fb9bd 100644 --- a/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java +++ b/ruoyi-admin/src/main/java/com/ruoyi/system/service/impl/SysCustomerServiceImpl.java @@ -215,6 +215,24 @@ public class SysCustomerServiceImpl implements ISysCustomerService } + /** + * 根据客户编号数组查询客户信息集合 + * */ + @Override + public List selectSysCustomerListByEnterpriseCodes(String[] enterpriseCodes) { + List list = sysCustomerMapper.selectSysCustomerListByEnterpriseCodes(enterpriseCodes); + return list; + } + + /** + * 筛选查询导出所有的客户基本信息 + * */ + @Override + public List selectExportSysCustomerList(SysCustomerVo sysCustomer) { + List list = sysCustomerMapper.selectExportSysCustomerList(sysCustomer); + return list; + } + /** * 角色过滤数据 * */ diff --git a/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml b/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml index bf12d201..1e548ede 100644 --- a/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml +++ b/ruoyi-admin/src/main/resources/mapper/system/SysCustomerMapper.xml @@ -72,7 +72,7 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" established_time,invoicing_customer_name,invoicing_company_name,invoice_code,deposit_bank,bank_account, common_currency,confirm_tax,tax_rate,integrity_rating,rmb_registered_capital,registered_capital,payment_terms,customs_code, customer_contact_id,customer_contact,customer_office,contact_number,customer_email,customer_fax, - delivery_address_id,delivery_customer_person,delivery_customer_phone, + delivery_address_id,delivery_customer_person,delivery_customer_phone,customer_sign, delivery_address,delivery_customer_postal,delivery_customer_fax,business_members, identifying_people,first_add_time,update_info_time, create_time ,audit_status,use_status,update_by, create_by,update_time,rmb_flag,usd_flag, cancel_remark, apply_user,apply_time , instance_id , instance_type from sys_customer @@ -382,4 +382,30 @@ PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" and enterprise_name like concat(#{prefix}, '%') escape '\\' + + + + \ No newline at end of file diff --git a/ruoyi-admin/src/main/resources/templates/system/customer/customer.html b/ruoyi-admin/src/main/resources/templates/system/customer/customer.html index 877ac10e..65f6a14a 100644 --- a/ruoyi-admin/src/main/resources/templates/system/customer/customer.html +++ b/ruoyi-admin/src/main/resources/templates/system/customer/customer.html @@ -84,6 +84,9 @@ 添加 + + 导出 + 添加其他联系人明细 @@ -871,6 +874,63 @@ } } function closeInvoice() {$('#invoiceModal').modal("hide");} + + //导出客户资料 + // 导出 + function exportExcel(formId) { + // $.table.set(); + var enterpriseCodeData = []; + var selections = $("#bootstrap-table").bootstrapTable("getSelections"); + if(selections.length === 0){ + $.modal.confirm("确定导出所有客户基本信息吗?", function() { + var currentId = $.common.isEmpty(formId) ? $('form').attr('id') : formId; + var params = $("#bootstrap-table").bootstrapTable('getOptions'); + var dataParam = $("#" + currentId).serializeArray(); + dataParam.push({ "name": "orderByColumn", "value": params.sortName }); + dataParam.push({ "name": "isAsc", "value": params.sortOrder }); + $.modal.loading("正在导出数据,请稍后..."); + $.post(prefix + '/exportAll', dataParam, function(result) { + if (result.code == web_status.SUCCESS) { + window.location.href = ctx + "common/download?fileName=" + encodeURI(result.msg) + "&delete=" + true; + } else if (result.code == web_status.WARNING) { + $.modal.alertWarning(result.msg) + } else { + $.modal.alertError(result.msg); + } + $.modal.closeLoading(); + }); + }); + }else { + $.modal.confirm("确定导出选中的所有客户基本信息吗?", function () { + //·拼接单号 + for(let i=0;i \ No newline at end of file