基本数据管理-机床客户信息修改

This commit is contained in:
xusd 2024-08-28 16:55:13 +08:00
parent 6c28600ebc
commit 2a7db2bc89

View File

@ -76,8 +76,8 @@ public class CustomerInfoController {
public CommonResult<CustomerInfoRespVO> getCustomerInfo(@RequestParam("id") String id) { public CommonResult<CustomerInfoRespVO> getCustomerInfo(@RequestParam("id") String id) {
CustomerInfoDO customerInfo = customerInfoService.getCustomerInfo(id); CustomerInfoDO customerInfo = customerInfoService.getCustomerInfo(id);
CustomerInfoRespVO bean = BeanUtils.toBean(customerInfo, CustomerInfoRespVO.class); CustomerInfoRespVO bean = BeanUtils.toBean(customerInfo, CustomerInfoRespVO.class);
if (Objects.nonNull(bean.getDistrict())){ if (Objects.nonNull(bean.getDistrict())) {
Integer[] test = {bean.getProvinceCode(),bean.getCityCode(),bean.getDistrict()}; Integer[] test = {bean.getProvinceCode(), bean.getCityCode(), bean.getDistrict()};
bean.setDistrictArray(test); bean.setDistrictArray(test);
} }
return success(bean); return success(bean);
@ -90,12 +90,12 @@ public class CustomerInfoController {
PageResult<CustomerInfoDO> pageResult = customerInfoService.getCustomerInfoPage(pageReqVO); PageResult<CustomerInfoDO> pageResult = customerInfoService.getCustomerInfoPage(pageReqVO);
PageResult<CustomerInfoRespVO> bean = BeanUtils.toBean(pageResult, CustomerInfoRespVO.class); PageResult<CustomerInfoRespVO> bean = BeanUtils.toBean(pageResult, CustomerInfoRespVO.class);
List<CustomerInfoRespVO> list = bean.getList(); List<CustomerInfoRespVO> list = bean.getList();
list.forEach(item->{ list.forEach(item -> {
if (Objects.nonNull(item.getDistrict())){ if (Objects.nonNull(item.getDistrict())) {
String districtName = String districtName =
AreaUtils.getArea(item.getProvinceCode()).getName() + "-" + AreaUtils.getArea(item.getProvinceCode()).getName() + "-" +
AreaUtils.getArea(item.getCityCode()).getName() + "-" + AreaUtils.getArea(item.getCityCode()).getName() + "-" +
AreaUtils.getArea(item.getDistrict()).getName(); AreaUtils.getArea(item.getDistrict()).getName();
item.setDistrictName(districtName); item.setDistrictName(districtName);
} }
}); });
@ -111,9 +111,18 @@ public class CustomerInfoController {
HttpServletResponse response) throws IOException { HttpServletResponse response) throws IOException {
pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE); pageReqVO.setPageSize(PageParam.PAGE_SIZE_NONE);
List<CustomerInfoDO> list = customerInfoService.getCustomerInfoPage(pageReqVO).getList(); List<CustomerInfoDO> list = customerInfoService.getCustomerInfoPage(pageReqVO).getList();
List<CustomerInfoRespVO> 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 // 导出 Excel
ExcelUtils.write(response, "机床客户信息.xls", "数据", CustomerInfoRespVO.class, ExcelUtils.write(response, "机床客户信息.xls", "数据", CustomerInfoRespVO.class, bean);
BeanUtils.toBean(list, CustomerInfoRespVO.class));
} }
} }