瀏覽代碼

机构分析统计

huangzhiguo 2 年之前
父節點
當前提交
c62acc6306

+ 13 - 0
src/main/java/com/caimei/modules/user/entity/ClubStatistics.java

@@ -1,5 +1,7 @@
 package com.caimei.modules.user.entity;
 
+import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
+import com.alibaba.excel.annotation.ExcelProperty;
 import com.thinkgem.jeesite.common.persistence.DataEntity;
 
 /**
@@ -8,9 +10,11 @@ import com.thinkgem.jeesite.common.persistence.DataEntity;
  * @author : Charles
  * @date : 2023/2/23
  */
+@ExcelIgnoreUnannotated
 public class ClubStatistics extends DataEntity<ClubStatistics> {
 
     private Integer userID;
+    @ExcelProperty(value = "机构ID")
     private Integer clubID;
 
     private String registerStartTime;       //注册开始时间
@@ -58,6 +62,7 @@ public class ClubStatistics extends DataEntity<ClubStatistics> {
     private String firstClubType;  // 机构一级分类
     private String classify;  // 机构二级分类
     private String clubType;  // 机构类型
+    private Integer number;  // 资料完整度数值
     private String clubDataIntegrity;  // 资料完整度
     private String addTime;  // 注册时间
     private String svipUserFlag;  // vip类别
@@ -399,6 +404,14 @@ public class ClubStatistics extends DataEntity<ClubStatistics> {
         this.clubType = clubType;
     }
 
+    public Integer getNumber() {
+        return number;
+    }
+
+    public void setNumber(Integer number) {
+        this.number = number;
+    }
+
     public String getClubDataIntegrity() {
         return clubDataIntegrity;
     }

+ 123 - 5
src/main/java/com/caimei/modules/user/entity/easyExcel.java

@@ -7,6 +7,20 @@ import com.thinkgem.jeesite.common.utils.excel.annotation.ExcelField;
  * @author zzj
  */
 public class easyExcel {
+
+    private String firstClubType;  // 机构一级分类
+    private String classify;  // 机构二级分类
+    private String address;         //详细地址
+    private String businessLicenseImage;    //营业执照
+    private String userIdentity;    //用户身份
+    private String linkManIdentity;    //用户身份
+    private String sname;   //机构简称
+    private String contractEmail;   //联系邮箱
+    private String contractPhone;   //联系电话
+    private String fax;     //传真
+    private String headpic;     //门头照
+    private String socialCreditCode;    //统一社会信用代码 --- 营业执照编号
+    private String info;    //公司简介
     //机构ID
 
     @ExcelProperty(value = "机构Id",index = 0)
@@ -16,7 +30,7 @@ public class easyExcel {
     @ExcelProperty(value = "联系人",index = 2)
     private String linkMan; //联系人
     @ExcelProperty(value = "联系人身份",index = 3)
-    private String linkManIdentity; //联系人身份:1老板,2采购,3运营,4其他
+    private String linkManStatus; //联系人身份:1老板,2采购,3运营,4其他
     @ExcelProperty(value = "手机号",index = 4)
     private String contractMobile; //手机号
     @ExcelProperty(value = "协销人员",index = 5)
@@ -45,6 +59,110 @@ public class easyExcel {
     private String lastOrderTime; //最近下单时间
 
 
+    public String getFirstClubType() {
+        return firstClubType;
+    }
+
+    public void setFirstClubType(String firstClubType) {
+        this.firstClubType = firstClubType;
+    }
+
+    public String getClassify() {
+        return classify;
+    }
+
+    public void setClassify(String classify) {
+        this.classify = classify;
+    }
+
+    public String getAddress() {
+        return address;
+    }
+
+    public void setAddress(String address) {
+        this.address = address;
+    }
+
+    public String getBusinessLicenseImage() {
+        return businessLicenseImage;
+    }
+
+    public void setBusinessLicenseImage(String businessLicenseImage) {
+        this.businessLicenseImage = businessLicenseImage;
+    }
+
+    public String getUserIdentity() {
+        return userIdentity;
+    }
+
+    public void setUserIdentity(String userIdentity) {
+        this.userIdentity = userIdentity;
+    }
+
+    public String getLinkManIdentity() {
+        return linkManIdentity;
+    }
+
+    public void setLinkManIdentity(String linkManIdentity) {
+        this.linkManIdentity = linkManIdentity;
+    }
+
+    public String getSname() {
+        return sname;
+    }
+
+    public void setSname(String sname) {
+        this.sname = sname;
+    }
+
+    public String getContractEmail() {
+        return contractEmail;
+    }
+
+    public void setContractEmail(String contractEmail) {
+        this.contractEmail = contractEmail;
+    }
+
+    public String getContractPhone() {
+        return contractPhone;
+    }
+
+    public void setContractPhone(String contractPhone) {
+        this.contractPhone = contractPhone;
+    }
+
+    public String getFax() {
+        return fax;
+    }
+
+    public void setFax(String fax) {
+        this.fax = fax;
+    }
+
+    public String getHeadpic() {
+        return headpic;
+    }
+
+    public void setHeadpic(String headpic) {
+        this.headpic = headpic;
+    }
+
+    public String getSocialCreditCode() {
+        return socialCreditCode;
+    }
+
+    public void setSocialCreditCode(String socialCreditCode) {
+        this.socialCreditCode = socialCreditCode;
+    }
+
+    public String getInfo() {
+        return info;
+    }
+
+    public void setInfo(String info) {
+        this.info = info;
+    }
+
     public String getClubId() {
         return clubId;
     }
@@ -69,12 +187,12 @@ public class easyExcel {
         this.linkMan = linkMan;
     }
 
-    public String getLinkManIdentity() {
-        return linkManIdentity;
+    public String getLinkManStatus() {
+        return linkManStatus;
     }
 
-    public void setLinkManIdentity(String linkManIdentity) {
-        this.linkManIdentity = linkManIdentity;
+    public void setLinkManStatus(String linkManStatus) {
+        this.linkManStatus = linkManStatus;
     }
 
     public String getContractMobile() {

+ 37 - 37
src/main/java/com/caimei/modules/user/service/NewCmClubService.java

@@ -227,7 +227,7 @@ public class NewCmClubService extends CrudService<NewCmClubDao, NewCmClub> {
         // 获取近一个月、近一年结束时间
         calendar.add(Calendar.DAY_OF_MONTH, -1);
         Date time = calendar.getTime();
-        endTime = dateFormat.format(time);
+        endTime = dateFormat.format(date);
         statistics.setMonthEndTime(endTime);
         statistics.setYearEndTime(endTime);
         // 近一个月开始时间
@@ -255,12 +255,12 @@ public class NewCmClubService extends CrudService<NewCmClubDao, NewCmClub> {
         String type = "" ;
         for (easyExcel clubStatistics : selStatisticsList) {
             // 机构类型
-//            if (StringUtils.isNotBlank(clubStatistics.getFirstClubType())) {
-//                type += clubStatistics.getFirstClubType();
-//            }
-//            if (StringUtils.isNotBlank(clubStatistics.getClassify())) {
-//                type += "-" + clubStatistics.getClassify();
-//            }
+            if (StringUtils.isNotBlank(clubStatistics.getFirstClubType())) {
+                type += clubStatistics.getFirstClubType();
+            }
+            if (StringUtils.isNotBlank(clubStatistics.getClassify())) {
+                type += "-" + clubStatistics.getClassify();
+            }
             clubStatistics.setClubType(type);
             // 计算资料完整度
             if (StringUtils.isNotBlank(clubStatistics.getName())) {
@@ -275,36 +275,36 @@ public class NewCmClubService extends CrudService<NewCmClubDao, NewCmClub> {
             if (StringUtils.isNotBlank(clubStatistics.getLinkManIdentity())) {
                 number += 10;
             }
-//            if (StringUtils.isNotBlank(clubStatistics.getAddress())) {
-//                number += 10;
-//            }
-//            if (StringUtils.isNotBlank(clubStatistics.getBusinessLicenseImage())) {
-//                number += 10;
-//            }
-//            if (StringUtils.isNotBlank(clubStatistics.getUserIdentity())) {
-//                number += 10;
-//            }
-//            if (StringUtils.isNotBlank(clubStatistics.getSname())) {
-//                number += 3;
-//            }
-//            if (StringUtils.isNotBlank(clubStatistics.getContractEmail())) {
-//                number += 5;
-//            }
-//            if (StringUtils.isNotBlank(clubStatistics.getContractPhone())) {
-//                number += 4;
-//            }
-//            if (StringUtils.isNotBlank(clubStatistics.getFax())) {
-//                number += 3;
-//            }
-//            if (StringUtils.isNotBlank(clubStatistics.getHeadpic())) {
-//                number += 5;
-//            }
-//            if (StringUtils.isNotBlank(clubStatistics.getSocialCreditCode())) {
-//                number += 5;
-//            }
-//            if (StringUtils.isNotBlank(clubStatistics.getInfo())) {
-//                number += 5;
-//            }
+            if (StringUtils.isNotBlank(clubStatistics.getAddress())) {
+                number += 10;
+            }
+            if (StringUtils.isNotBlank(clubStatistics.getBusinessLicenseImage())) {
+                number += 10;
+            }
+            if (StringUtils.isNotBlank(clubStatistics.getUserIdentity())) {
+                number += 10;
+            }
+            if (StringUtils.isNotBlank(clubStatistics.getSname())) {
+                number += 3;
+            }
+            if (StringUtils.isNotBlank(clubStatistics.getContractEmail())) {
+                number += 5;
+            }
+            if (StringUtils.isNotBlank(clubStatistics.getContractPhone())) {
+                number += 4;
+            }
+            if (StringUtils.isNotBlank(clubStatistics.getFax())) {
+                number += 3;
+            }
+            if (StringUtils.isNotBlank(clubStatistics.getHeadpic())) {
+                number += 5;
+            }
+            if (StringUtils.isNotBlank(clubStatistics.getSocialCreditCode())) {
+                number += 5;
+            }
+            if (StringUtils.isNotBlank(clubStatistics.getInfo())) {
+                number += 5;
+            }
             clubStatistics.setClubDataIntegrity(number+"%");
             number=0;
             type = "";

+ 3 - 57
src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java

@@ -39,7 +39,6 @@ import com.thinkgem.jeesite.modules.sys.utils.UserUtils;
 import org.apache.commons.collections.CollectionUtils;
 import org.apache.commons.collections.map.HashedMap;
 import org.apache.poi.openxml4j.util.ZipSecureFile;
-import org.apache.poi.ss.usermodel.Workbook;
 import org.apache.shiro.authz.annotation.RequiresPermissions;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.beans.factory.annotation.Value;
@@ -1425,75 +1424,22 @@ public class AgencyController extends BaseController {
     @ResponseBody
     @RequestMapping(value = "/club/export")
     public void easyExcel(ClubStatistics statistics, HttpServletResponse response, RedirectAttributes redirectAttributes) {
-        String fileName = "club_Data.xlsx";
-        String template = Global.getConfig("export.template");
-        String templataFileName = template + "/club_analyse_tabulation.xlsx";
-        String name = "";
-        String path = "";
+        String name = "club_Data.xlsx";
         try {
 
-//            ServletOutputStream os = response.getOutputStream();
-//            FileSystemView view = FileSystemView.getFileSystemView();
-//            File homeDirectory = view.getHomeDirectory();
-//            name = System.currentTimeMillis()+fileName;
-//            path = homeDirectory+"\\";
-//            fileName = path+name;
-//
             List<easyExcel> statisticsList = newCmClubService.exportExcel(statistics);
-//            //得到模板文件路径(线上直接读取服务器位置文件)
-//            String config = Global.getConfig("cm.config");
-//            if(config.equals("dev")){
-//                templataFileName = FileUtils.class.getClassLoader().getResource(templataFileName).getPath();
-//            }
-//            ExcelWriter excel = EasyExcel.write(fileName).withTemplate(templataFileName).build();
-//            WriteSheet writeSheet = EasyExcel.writerSheet().build();
-//            excel.fill(statisticsList,writeSheet);
-//            excel.finish();
             response.setContentType("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet");
             response.setCharacterEncoding("utf-8");
             // 这里URLEncoder.encode可以防止中文乱码 当然和easyexcel没有关系
-            fileName = URLEncoder.encode("测试", "UTF-8").replaceAll("\\+", "%20");
+            String fileName = URLEncoder.encode(name, "UTF-8").replaceAll("\\+", "%20");
             response.setHeader("Content-disposition", "attachment;filename*=utf-8''" + fileName + ".xlsx");
             // 这里需要设置不关闭流
+//            EasyExcel.write(response.getOutputStream(),ClubStatistics.class).sheet().doWrite(statisticsList);
             EasyExcel.write(response.getOutputStream(), easyExcel.class).autoCloseStream(Boolean.FALSE).sheet("模板")
                     .doWrite(statisticsList);
-//            downLoadFile(fileName , response);
-            /*File file = new File(fileName);
-            file.delete();*/
-//            return "redirect:"+Global.getAdminPath()+"/new/user/agency/statisticsList?"+statistics;
         } catch (Exception e) {
             addMessage(redirectAttributes,"机构分析统计导出失败",e.getMessage());
             e.printStackTrace();
-//            return "redirect:"+Global.getAdminPath()+"/new/user/agency/statisticsList?"+statistics;
-        }
-//        return "redirect:"+Global.getAdminPath()+"/new/user/agency/statisticsList";
-    }
-    /**
-     * 文件流传输浏览器
-     * @param path
-     * @param response
-     */
-    private static void downLoadFile(String path, HttpServletResponse response) {
-        try {
-//            File file = new File("C:\\Users\\Administrator\\Desktop\\全量.xls");
-//            String filename = file.getName();
-//            // 以流的形式下载文件。
-//            InputStream fis = new BufferedInputStream(new FileInputStream("C:\\Users\\Administrator\\Desktop\\全量.xls"));
-//            byte[] buffer = new byte[fis.available()];
-//            fis.read(buffer);
-//            fis.close();
-//            // 清空response
-//            response.reset();
-//            response.setContentType("application/octet-stream;charset=UTF-8");
-//            String fileName = new String(filename.getBytes("gb2312"), "iso8859-1");
-//            response.setHeader("Content-disposition", "attachment;filename=" + fileName);
-//            OutputStream ouputStream = response.getOutputStream();
-//            ouputStream.write(buffer);
-//            ouputStream.flush();
-//            ouputStream.close();
-
-        } catch (Exception e) {
-            e.printStackTrace();
         }
     }
 

+ 0 - 3
src/main/resources/mappings/modules/user/NewCmClubMapper.xml

@@ -845,9 +845,6 @@
             <if test="linkManIdentity != null and linkManIdentity != ''">
                 AND c.linkManIdentity = #{linkManIdentity}
             </if>
-            <if test="clubDataIntegrity != null and clubDataIntegrity != ''">
-                AND c.status = #{clubDataIntegrity}
-            </if>
             <if test="payTotalMonth != null and payTotalMonth != ''">
                 <if test="payTotalMonth==1">
                     AND orderMonth.payTotalMonth <![CDATA[ < ]]> 10000