浏览代码

导出功能修改

wang-hai-cheng 5 年之前
父节点
当前提交
2758b83c89

+ 14 - 22
lift-enterprise-service/src/main/java/cn/com/ty/lift/enterprise/custom/service/impl/PropertyCompanyServiceImpl.java

@@ -1,6 +1,5 @@
 package cn.com.ty.lift.enterprise.custom.service.impl;
 
-import cn.com.ty.lift.common.export.ExportUtils;
 import cn.com.ty.lift.enterprise.custom.dao.entity.PropertyCompany;
 import cn.com.ty.lift.enterprise.custom.dao.entity.model.PropertyCompanyAndPropertyContactReq;
 import cn.com.ty.lift.enterprise.custom.dao.entity.model.PropertyCompanyReq;
@@ -8,8 +7,6 @@ import cn.com.ty.lift.enterprise.custom.dao.mapper.PropertyCompanyMapper;
 import cn.com.ty.lift.enterprise.custom.service.PropertyCompanyService;
 import cn.com.xwy.boot.web.dto.RestResponse;
 import cn.hutool.core.collection.CollUtil;
-import cn.hutool.core.io.IoUtil;
-import cn.hutool.poi.excel.BigExcelWriter;
 import cn.hutool.poi.excel.ExcelUtil;
 import cn.hutool.poi.excel.ExcelWriter;
 import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
@@ -23,11 +20,9 @@ import org.springframework.transaction.annotation.Transactional;
 
 import javax.servlet.ServletOutputStream;
 import javax.servlet.http.HttpServletResponse;
-import java.io.*;
+import java.io.IOException;
 import java.time.LocalDate;
 import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.HashMap;
 import java.util.List;
 
 /**
@@ -43,22 +38,19 @@ import java.util.List;
 public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMapper, PropertyCompany> implements PropertyCompanyService {
     private final PropertyContactServiceImpl propertyContactService;
 
-    public RestResponse propertyCompanies(PropertyCompanyReq req) {
-        Page<PropertyCompany> page = new Page<>(req.getPageNum(), req.getPageSize());
+    public RestResponse propertyCompanies(PropertyCompanyReq request) {
+        Page<PropertyCompany> page = new Page<>(request.getPageNum(), request.getPageSize());
         //根据请求参数查询客户列表
         IPage<PropertyCompany> records = this
                 .page(page, new QueryWrapper<PropertyCompany>()
                         .select("id", "mt_company_id", "name", "mailing_address", "status")
-                        .eq(req.getMtCompanyId() != null, "mt_company_id", req.getMtCompanyId())
+                        .eq(request.getMtCompanyId() != null, "mt_company_id", request.getMtCompanyId())
                         .ne("status", 0)
-                        .and(req.getInfo() != null, c ->
-                                c
-                                        .like("name", req.getInfo())
-                                        .or()
-                                        .like("address", req.getInfo())
-                                        .or()
-                                        .like("mailing_address", req.getInfo())
-                        ));
+                        .and(request.getInfo() != null, companyQueryWrapper ->
+                                companyQueryWrapper
+                                        .like("name", request.getInfo())
+                                        .or().like("address", request.getInfo())
+                                        .or().like("mailing_address", request.getInfo())));
         if (records.getRecords().isEmpty()) {
             return RestResponse.success();
         }
@@ -106,12 +98,12 @@ public class PropertyCompanyServiceImpl extends ServiceImpl<PropertyCompanyMappe
         List<List<?>> rows = new ArrayList<>();
         //设置列头
         rows.add(CollUtil.newArrayList("甲方公司id", "名称", "通讯地址", "状态"));
-        companies.forEach(c -> {
+        companies.forEach(company -> {
             List<?> row = CollUtil.newArrayList(
-                    c.getId().toString()
-                    , c.getName()
-                    , null != c.getMailingAddress() ? c.getMailingAddress() : "无"
-                    , c.getStatus().equals(1) ? "无关联项目" : "有关联项目");
+                    company.getId()
+                    , company.getName()
+                    , null != company.getMailingAddress() ? company.getMailingAddress() : "无"
+                    , company.getStatus() == 1 ? "无关联项目" : "有关联项目");
             rows.add(row);
         });