浏览代码

fix:客户管理导出修改

ly 9 月之前
父节点
当前提交
56530968ce

+ 14 - 3
src/main/java/cn/ezhizao/project/business/company/controller/BizCompanyController.java

@@ -3,9 +3,7 @@ package cn.ezhizao.project.business.company.controller;
 import java.io.IOException;
 import java.lang.reflect.Field;
 import java.nio.charset.Charset;
-import java.util.ArrayList;
-import java.util.Arrays;
-import java.util.List;
+import java.util.*;
 import java.util.stream.Collectors;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletResponse;
@@ -107,6 +105,7 @@ public class BizCompanyController extends BaseController
         setTenantId(bizCompany);
         List<BizCompany> list = bizCompanyService.getList(bizCompany);
         for(BizCompany company:list){
+            company.setArea(join("-",company.getProvince(),company.getCity(),company.getDistrict()));
             if(company != null && company.getReferrerDataSource() != null) {
                 switch (company.getReferrerDataSource()) {
                     case "company":
@@ -134,6 +133,18 @@ public class BizCompanyController extends BaseController
         }
     }
 
+    public static String join(CharSequence delimiter, CharSequence... elements) {
+        Objects.requireNonNull(delimiter);
+        Objects.requireNonNull(elements);
+        // Number of elements not likely worth Arrays.stream overhead.
+        StringJoiner joiner = new StringJoiner(delimiter);
+        for (CharSequence cs: elements) {
+            if (cs != null && !cs.toString().isEmpty() && !cs.equals("0")) {
+                joiner.add(cs);
+            }
+        }
+        return joiner.toString();
+    }
     @Log(title = "客户管理", businessType = BusinessType.IMPORT)
     @PreAuthorize("@ss.hasPermi('business:company:add')")
     @PostMapping("/importData")

+ 10 - 4
src/main/java/cn/ezhizao/project/business/company/domain/BizCompany.java

@@ -32,9 +32,7 @@ public class BizCompany extends BaseEntity
     @ApiModelProperty(value = "合作伙伴分类:1、客户;2、供应商;3、外协商")
     private String category;
 
-    /** 客户编码 */
-    @ApiModelProperty(value = "客户编码")
-    private String code;
+
 
     /** 客户名称 */
     @Excel(name = "客户名称",width = 50)
@@ -42,6 +40,11 @@ public class BizCompany extends BaseEntity
     @Size(min = 0, max = 100)
     private String name;
 
+    /** 客户编码 */
+    @ApiModelProperty(value = "客户编码")
+    @Excel(name = "客户编码")
+    private String code;
+
     /** 客户简称 */
     @Excel(name = "客户简称")
     @ApiModelProperty(value = "客户简称")
@@ -149,7 +152,7 @@ public class BizCompany extends BaseEntity
     private String businessEndDate;
 
     /** 长期有效否 */
-    @Excel(name = "长期有效否")
+    @Excel(name = "长期有效否",readConverterExp = "0=否,1=是")
     @ApiModelProperty(value = "长期有效否")
     private Integer isPermanentlyEffective;
 
@@ -380,4 +383,7 @@ public class BizCompany extends BaseEntity
 
     @TableField(exist = false)
     private String principal;
+    @Excel(name = "所属区域",width = 30)
+    @TableField(exist = false)
+    private String area;
 }

+ 11 - 0
src/main/java/cn/ezhizao/project/business/company/domain/StringConcatenationAdapter.java

@@ -0,0 +1,11 @@
+package cn.ezhizao.project.business.company.domain;
+
+import cn.ezhizao.common.utils.poi.ExcelHandlerAdapter;
+
+public class StringConcatenationAdapter implements ExcelHandlerAdapter {
+    @Override
+    public Object format(Object value, String[] args) {
+
+        return null;
+    }
+}

+ 2 - 1
src/main/resources/mybatis/business/BizCompanyMapper.xml

@@ -20,7 +20,8 @@
 
     <select id="getList" parameterType="BizCompany" resultMap="BizCompanyResult">
         SELECT
-        c.*, s.nick_name as leader_name, a.nick_name as adviser_name,source.title as sourceName
+        c.*, s.nick_name as leader_name, a.nick_name as adviser_name,source.title as sourceName,
+        CONCAT_WS('-',c.province,c.city,c.district) AS area
         FROM biz_company c
         LEFT JOIN sys_user s ON c.leader_id=s.user_id
         left join biz_source `source` on c.source_id = `source`.id