From 2a7db2bc898b05214702242ef952d59e2cd57692 Mon Sep 17 00:00:00 2001 From: xusd Date: Wed, 28 Aug 2024 16:55:13 +0800 Subject: [PATCH] =?UTF-8?q?=E5=9F=BA=E6=9C=AC=E6=95=B0=E6=8D=AE=E7=AE=A1?= =?UTF-8?q?=E7=90=86-=E6=9C=BA=E5=BA=8A=E5=AE=A2=E6=88=B7=E4=BF=A1?= =?UTF-8?q?=E6=81=AF=E4=BF=AE=E6=94=B9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../baseData/CustomerInfoController.java | 25 +++++++++++++------ 1 file changed, 17 insertions(+), 8 deletions(-) diff --git a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/CustomerInfoController.java b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/CustomerInfoController.java index 363d9da..2c5b307 100644 --- a/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/CustomerInfoController.java +++ b/imt-server/imt-module-system/imt-module-system-biz/src/main/java/com/inspur/module/system/controller/baseData/CustomerInfoController.java @@ -76,8 +76,8 @@ public class CustomerInfoController { public CommonResult getCustomerInfo(@RequestParam("id") String id) { CustomerInfoDO customerInfo = customerInfoService.getCustomerInfo(id); CustomerInfoRespVO bean = BeanUtils.toBean(customerInfo, CustomerInfoRespVO.class); - if (Objects.nonNull(bean.getDistrict())){ - Integer[] test = {bean.getProvinceCode(),bean.getCityCode(),bean.getDistrict()}; + if (Objects.nonNull(bean.getDistrict())) { + Integer[] test = {bean.getProvinceCode(), bean.getCityCode(), bean.getDistrict()}; bean.setDistrictArray(test); } return success(bean); @@ -90,12 +90,12 @@ public class CustomerInfoController { PageResult pageResult = customerInfoService.getCustomerInfoPage(pageReqVO); PageResult bean = BeanUtils.toBean(pageResult, CustomerInfoRespVO.class); List list = bean.getList(); - list.forEach(item->{ - if (Objects.nonNull(item.getDistrict())){ + list.forEach(item -> { + if (Objects.nonNull(item.getDistrict())) { String districtName = AreaUtils.getArea(item.getProvinceCode()).getName() + "-" + - AreaUtils.getArea(item.getCityCode()).getName() + "-" + - AreaUtils.getArea(item.getDistrict()).getName(); + AreaUtils.getArea(item.getCityCode()).getName() + "-" + + AreaUtils.getArea(item.getDistrict()).getName(); item.setDistrictName(districtName); } }); @@ -111,9 +111,18 @@ public class CustomerInfoController { HttpServletResponse response) throws IOException { pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); List list = customerInfoService.getCustomerInfoPage(pageReqVO).getList(); + List bean = BeanUtils.toBean(list, CustomerInfoRespVO.class); + bean.forEach(item -> { + if (Objects.nonNull(item.getDistrict())) { + String districtName = + AreaUtils.getArea(item.getProvinceCode()).getName() + "-" + + AreaUtils.getArea(item.getCityCode()).getName() + "-" + + AreaUtils.getArea(item.getDistrict()).getName(); + item.setDistrictName(districtName); + } + }); // 导出 Excel - ExcelUtils.write(response, "机床客户信息.xls", "数据", CustomerInfoRespVO.class, - BeanUtils.toBean(list, CustomerInfoRespVO.class)); + ExcelUtils.write(response, "机床客户信息.xls", "数据", CustomerInfoRespVO.class, bean); } } \ No newline at end of file