Ver código fonte

机构画像

huangzhiguo 1 ano atrás
pai
commit
b8d7268c9f

+ 6 - 1
src/main/java/com/caimei/modules/newhome/dao/NewPageHomeimageDao.java

@@ -1,10 +1,13 @@
 package com.caimei.modules.newhome.dao;
 
+import com.caimei.modules.newhome.entity.cmStatisticsType;
 import com.thinkgem.jeesite.common.persistence.CrudDao;
 import com.thinkgem.jeesite.common.persistence.annotation.MyBatisDao;
 import com.caimei.modules.newhome.entity.NewPageHomeimage;
 import org.apache.ibatis.annotations.Param;
 
+import java.util.List;
+
 /**
  * 新首页轮播图DAO接口
  * @author ye.qin
@@ -17,5 +20,7 @@ public interface NewPageHomeimageDao extends CrudDao<NewPageHomeimage> {
 
     void updateSort(@Param("id") String id, @Param("sort") String sort);
 
+    List<cmStatisticsType> getBannerStatistics();
+
     String findBigSort();
-}
+}

+ 10 - 1
src/main/java/com/caimei/modules/newhome/entity/NewPageHomeimage.java

@@ -21,6 +21,7 @@ public class NewPageHomeimage extends DataEntity<NewPageHomeimage> {
 	private String sort;		// 排序
 	private String wwwEnabledStatus;		// www端状态 0停用 1启用
 	private String crmEnabledStatus;		// CRM端状态 0停用 1启用
+	private Integer count;	// 点击次数
 
 	public NewPageHomeimage() {
 		super();
@@ -106,4 +107,12 @@ public class NewPageHomeimage extends DataEntity<NewPageHomeimage> {
 	public void setCrmTitle(String crmTitle) {
 		this.crmTitle = crmTitle;
 	}
-}
+
+	public Integer getCount() {
+		return count;
+	}
+
+	public void setCount(Integer count) {
+		this.count = count;
+	}
+}

+ 72 - 0
src/main/java/com/caimei/modules/newhome/entity/cmStatisticsType.java

@@ -0,0 +1,72 @@
+package com.caimei.modules.newhome.entity;
+
+import java.util.Date;
+
+/**
+ * Description
+ *
+ * @author : Charles
+ * @date : 2023/9/4
+ */
+public class cmStatisticsType {
+    /**
+     * Id
+     */
+    private Integer statisticsId;
+    /**
+     * 类型{ 1:首页banner;2:直播模块;3:最新活动;4:热门文章;5:新品橱窗;6:活动列表 }
+     */
+    private Integer typeId;
+    /**
+     * bannerId
+     */
+    private Integer bannerId;
+    /**
+     * 点击时间
+     */
+    private Date clickTime;
+    /**
+     * 次数
+     */
+    private Integer count;
+
+    public Integer getStatisticsId() {
+        return statisticsId;
+    }
+
+    public void setStatisticsId(Integer statisticsId) {
+        this.statisticsId = statisticsId;
+    }
+
+    public Integer getTypeId() {
+        return typeId;
+    }
+
+    public void setTypeId(Integer typeId) {
+        this.typeId = typeId;
+    }
+
+    public Integer getBannerId() {
+        return bannerId;
+    }
+
+    public void setBannerId(Integer bannerId) {
+        this.bannerId = bannerId;
+    }
+
+    public Date getClickTime() {
+        return clickTime;
+    }
+
+    public void setClickTime(Date clickTime) {
+        this.clickTime = clickTime;
+    }
+
+    public Integer getCount() {
+        return count;
+    }
+
+    public void setCount(Integer count) {
+        this.count = count;
+    }
+}

+ 14 - 0
src/main/java/com/caimei/modules/newhome/web/NewPageHomeimageController.java

@@ -1,7 +1,9 @@
 package com.caimei.modules.newhome.web;
 
 import com.caimei.constants.common.RedisKeyUtil;
+import com.caimei.modules.newhome.dao.NewPageHomeimageDao;
 import com.caimei.modules.newhome.entity.NewPageHomeimage;
+import com.caimei.modules.newhome.entity.cmStatisticsType;
 import com.caimei.modules.newhome.service.NewPageHomeimageService;
 import com.caimei.modules.opensearch.GenerateUtils;
 import com.caimei.redis.RedisService;
@@ -24,7 +26,9 @@ import org.springframework.web.servlet.mvc.support.RedirectAttributes;
 import javax.annotation.Resource;
 import javax.servlet.http.HttpServletRequest;
 import javax.servlet.http.HttpServletResponse;
+import java.util.List;
 import java.util.Map;
+import java.util.stream.Collectors;
 
 /**
  * 新首页轮播图Controller
@@ -41,6 +45,8 @@ public class NewPageHomeimageController extends BaseController {
     @Resource
     private NewPageHomeimageService newPageHomeimageService;
     @Resource
+    private NewPageHomeimageDao newPageHomeimageDao;
+    @Resource
     private GenerateUtils generateUtils;
 
 
@@ -61,6 +67,14 @@ public class NewPageHomeimageController extends BaseController {
     @RequestMapping(value = {"list", ""})
     public String list(NewPageHomeimage newPageHomeimage, HttpServletRequest request, HttpServletResponse response, Model model) {
         Page<NewPageHomeimage> page = newPageHomeimageService.findPage(new Page<NewPageHomeimage>(request, response), newPageHomeimage);
+        // 点击次数
+        List<cmStatisticsType> bannerStatistics = newPageHomeimageDao.getBannerStatistics();
+        if (bannerStatistics.size() > 0) {
+            for (NewPageHomeimage homeimage : page.getList()) {
+                List<cmStatisticsType> collect = bannerStatistics.stream().filter(b -> homeimage.getId().equals(b.getBannerId().toString())).collect(Collectors.toList());
+                homeimage.setCount(collect.size());
+            }
+        }
         model.addAttribute("page", page);
         return "modules/newhome/newPageHomeimageList";
     }

+ 6 - 0
src/main/java/com/caimei/modules/user/dao/CmPortraitDao.java

@@ -22,8 +22,14 @@ public interface CmPortraitDao extends CrudDao<CmPortrait> {
 
     CmPortrait selTotal(CmPortrait cmPortrait);
 
+    List<String> getClubRemarks(Integer clubId, String startTime, String endTime);
+
+    List<String> getClubBehavior(Integer clubId, String startTime, String endTime);
+
     ClubStatistics selClubData(@Param("clubID") Integer ClubID);
 
+    CmClubRemarks getClubRemarksInfo(@Param("clubID") Integer ClubID);
+
     List<NewOrder> selOrderList(CmPortrait cmPortrait);
 
     List<CmBehaviorRecord> selBehaviorList(CmPortrait cmPortrait);

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

@@ -4,6 +4,8 @@ import com.alibaba.excel.annotation.ExcelIgnoreUnannotated;
 import com.alibaba.excel.annotation.ExcelProperty;
 import com.thinkgem.jeesite.common.persistence.DataEntity;
 
+import java.util.List;
+
 /**
  * Description
  *
@@ -46,6 +48,8 @@ public class ClubStatistics extends DataEntity<ClubStatistics> {
     private String city;
     private String town;
 
+    private Integer sex;    //性别
+    private Integer age;    // 年龄
     private String name;    // 机构名称
     private String linkMan; //联系人
     private String contractMobile;  //联系手机
@@ -78,6 +82,14 @@ public class ClubStatistics extends DataEntity<ClubStatistics> {
     private String payTotal;  // 总购买额
     private String pageLabel;   //最常搜索词
     private String lastOrderTime;  // 最近下单时间
+    private String activeState;     // 活跃状态
+    private String customerValues;   // 客户价值
+    private String registerTime;    // 注册时间
+    private Integer customerSource;    // 客户来源 0 公众号 1 小红书 2 微博 3 搜狐 4 其他
+    private Integer groupAddition;    // 入群状态 0 以加群 1 未加群
+    private Integer wxReach;        // 微信触达 0 触达 1 未触达
+    private Integer mobileReach;    // 电话触达 0 触达 1 未触达
+    private String fillTime;    // 填写时间
 
 
     public Integer getUserID() {
@@ -288,6 +300,22 @@ public class ClubStatistics extends DataEntity<ClubStatistics> {
         this.name = name;
     }
 
+    public Integer getSex() {
+        return sex;
+    }
+
+    public void setSex(Integer sex) {
+        this.sex = sex;
+    }
+
+    public Integer getAge() {
+        return age;
+    }
+
+    public void setAge(Integer age) {
+        this.age = age;
+    }
+
     public String getLinkMan() {
         return linkMan;
     }
@@ -535,4 +563,68 @@ public class ClubStatistics extends DataEntity<ClubStatistics> {
     public void setLastOrderTime(String lastOrderTime) {
         this.lastOrderTime = lastOrderTime;
     }
+
+    public String getActiveState() {
+        return activeState;
+    }
+
+    public void setActiveState(String activeState) {
+        this.activeState = activeState;
+    }
+
+    public String getCustomerValues() {
+        return customerValues;
+    }
+
+    public void setCustomerValues(String customerValues) {
+        this.customerValues = customerValues;
+    }
+
+    public String getRegisterTime() {
+        return registerTime;
+    }
+
+    public void setRegisterTime(String registerTime) {
+        this.registerTime = registerTime;
+    }
+
+    public Integer getCustomerSource() {
+        return customerSource;
+    }
+
+    public void setCustomerSource(Integer customerSource) {
+        this.customerSource = customerSource;
+    }
+
+    public Integer getGroupAddition() {
+        return groupAddition;
+    }
+
+    public void setGroupAddition(Integer groupAddition) {
+        this.groupAddition = groupAddition;
+    }
+
+    public Integer getWxReach() {
+        return wxReach;
+    }
+
+    public void setWxReach(Integer wxReach) {
+        this.wxReach = wxReach;
+    }
+
+    public Integer getMobileReach() {
+        return mobileReach;
+    }
+
+    public void setMobileReach(Integer mobileReach) {
+        this.mobileReach = mobileReach;
+    }
+
+    public String getFillTime() {
+        return fillTime;
+    }
+
+    public void setFillTime(String fillTime) {
+        this.fillTime = fillTime;
+    }
 }

+ 60 - 0
src/main/java/com/caimei/modules/user/entity/CmClubRemarks.java

@@ -151,6 +151,18 @@ public class CmClubRemarks extends DataEntity<CmClubRemarks> {
     private Integer number;
 
     private Integer numbers;
+    // 沟通情况 0 已沟通 1联系不上
+    private Integer communicationSituation;
+    // 沟通方式 0:电话,微信 1:电话 2:微信
+    private Integer communicationMethods;
+    // 客户来源 0 公众号 1 小红书 2 微博 3 搜狐 4 其他
+    private Integer customerSource;
+    // 客户性别 0 男 1 女
+    private Integer customerGender;
+    // 客户年龄
+    private Integer customerAge;
+    // 加群情况 0 以加群 1 未加群
+    private Integer groupAddition;
 
 
     public Integer getReportID() {
@@ -458,4 +470,52 @@ public class CmClubRemarks extends DataEntity<CmClubRemarks> {
     public void setNumbers(Integer numbers) {
         this.numbers = numbers;
     }
+
+    public Integer getCommunicationSituation() {
+        return communicationSituation;
+    }
+
+    public void setCommunicationSituation(Integer communicationSituation) {
+        this.communicationSituation = communicationSituation;
+    }
+
+    public Integer getCommunicationMethods() {
+        return communicationMethods;
+    }
+
+    public void setCommunicationMethods(Integer communicationMethods) {
+        this.communicationMethods = communicationMethods;
+    }
+
+    public Integer getCustomerSource() {
+        return customerSource;
+    }
+
+    public void setCustomerSource(Integer customerSource) {
+        this.customerSource = customerSource;
+    }
+
+    public Integer getCustomerGender() {
+        return customerGender;
+    }
+
+    public void setCustomerGender(Integer customerGender) {
+        this.customerGender = customerGender;
+    }
+
+    public Integer getCustomerAge() {
+        return customerAge;
+    }
+
+    public void setCustomerAge(Integer customerAge) {
+        this.customerAge = customerAge;
+    }
+
+    public Integer getGroupAddition() {
+        return groupAddition;
+    }
+
+    public void setGroupAddition(Integer groupAddition) {
+        this.groupAddition = groupAddition;
+    }
 }

+ 20 - 0
src/main/java/com/caimei/modules/user/entity/CmPortrait.java

@@ -50,6 +50,10 @@ public class CmPortrait extends DataEntity<CmPortrait> {
     private Integer remarksTotal;
     // 当前咨询记录范围总量
     private Integer remarksScopeNum;
+    // 访问记录总量
+    private Integer visitTotal;
+    // 当前访问记录总量
+    private Integer visitNum;
     // 咨询记录数
     private ArrayList<Integer> remarksValue;
     // 咨询记录关键词
@@ -203,6 +207,22 @@ public class CmPortrait extends DataEntity<CmPortrait> {
         this.remarksScopeNum = remarksScopeNum;
     }
 
+    public Integer getVisitTotal() {
+        return visitTotal;
+    }
+
+    public void setVisitTotal(Integer visitTotal) {
+        this.visitTotal = visitTotal;
+    }
+
+    public Integer getVisitNum() {
+        return visitNum;
+    }
+
+    public void setVisitNum(Integer visitNum) {
+        this.visitNum = visitNum;
+    }
+
     public ArrayList<Integer> getRemarksValue() {
         return remarksValue;
     }

+ 156 - 4
src/main/java/com/caimei/modules/user/service/ClubPortraitService.java

@@ -11,10 +11,7 @@ import org.springframework.stereotype.Service;
 import javax.annotation.Resource;
 import java.text.NumberFormat;
 import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Calendar;
-import java.util.Date;
-import java.util.List;
+import java.util.*;
 
 /**
  * Description
@@ -50,10 +47,109 @@ public class ClubPortraitService {
                 type += "-" + clubStatistics.getClassify();
             }
             clubStatistics.setClubType(type);
+            setClubNum(clubStatistics);
+            // 设置机构信息
+            CmClubRemarks clubRemarksInfo = cmPortraitDao.getClubRemarksInfo(clubID);
+            if (null != clubRemarksInfo) {
+                clubStatistics.setCustomerSource(clubRemarksInfo.getCustomerSource() != null ? clubRemarksInfo.getCustomerSource() : 4);
+                clubStatistics.setGroupAddition(clubRemarksInfo.getGroupAddition() != null ? clubRemarksInfo.getGroupAddition() : 1);
+                clubStatistics.setWxReach(1);
+                if (null != clubRemarksInfo.getCommunicationMethods() && (0 == clubRemarksInfo.getCommunicationMethods() || 2 == clubRemarksInfo.getCommunicationMethods())) {
+                    clubStatistics.setWxReach(0);
+                }
+                clubStatistics.setMobileReach(1);
+                if (null != clubRemarksInfo.getCommunicationMethods() && (0 == clubRemarksInfo.getCommunicationMethods() || 1 == clubRemarksInfo.getCommunicationMethods())) {
+                    clubStatistics.setMobileReach(0);
+                }
+                clubStatistics.setSex(clubRemarksInfo.getCustomerGender() != null ? clubRemarksInfo.getGroupAddition() : null);
+                clubStatistics.setAge(clubRemarksInfo.getCustomerGender() != null ? clubRemarksInfo.getGroupAddition() : null);
+                clubStatistics.setFillTime(clubRemarksInfo.getAddTime().toString());
+            }
         }
         return clubStatistics;
     }
 
+    public Map<String, Object> getDemand(Integer clubId, Integer dataType, String demandStart, String demandEnd) {
+        SimpleDateFormat dateFormat = new SimpleDateFormat("yyyy-MM-dd");
+        Date date = new Date();
+        String endTime = "";
+        Calendar calendar = Calendar.getInstance();
+        calendar.setTime(date);
+        calendar.add(Calendar.DAY_OF_MONTH, -1);
+        Date time = calendar.getTime();
+        calendar.setTime(time);
+        boolean expty = ObjectUtils.isEmpty(demandStart) && ObjectUtils.isEmpty(demandEnd);
+        if (expty) {
+            Date start = null;
+            String startTime = "";
+            demandEnd = endTime;
+            // 日期参数为    日
+            if (1 == dataType || 1 == dataType) {
+                demandStart = endTime;
+            }
+            if (2 == dataType) {
+                calendar.setTime(time);
+                calendar.add(Calendar.MONTH, -1);
+                start = calendar.getTime();
+                startTime = dateFormat.format(start);
+                demandStart = startTime;
+            }
+            if (3 == dataType) {
+                calendar.setTime(time);
+                calendar.add(Calendar.MONTH, -6);
+                start = calendar.getTime();
+                startTime = dateFormat.format(start);
+                demandStart = startTime;
+            }
+            if (4 == dataType) {
+                calendar.setTime(time);
+                calendar.add(Calendar.YEAR, -1);
+                start = calendar.getTime();
+                startTime = dateFormat.format(start);
+                demandStart = startTime;
+            }
+        }
+        List<String> demandList = new ArrayList<>();
+        List<String> clubRemarks = cmPortraitDao.getClubRemarks(clubId, demandStart, demandEnd);
+        if (clubRemarks.size() > 0) {
+            for (String clubRemark : clubRemarks) {
+                if (clubRemark.contains(",")) {
+                    String[] split = clubRemark.split(",");
+                    for (String s : split) {
+                        if (demandList.size() <= 10) {
+                            demandList.add(s);
+                        }
+                    }
+                } else {
+                    if (demandList.size() <= 10) {
+                        demandList.add(clubRemark);
+                    }
+                }
+            }
+        }
+        List<String> clubBehaviors = cmPortraitDao.getClubBehavior(clubId, demandStart, demandEnd);
+        if (clubBehaviors.size() > 0) {
+            for (String clubBehavior : clubBehaviors) {
+                if (clubBehavior.contains(",")) {
+                    String[] split = clubBehavior.split(",");
+                    for (String s : split) {
+                        if (demandList.size() <= 10) {
+                            demandList.add(s);
+                        }
+                    }
+                } else {
+                    if (demandList.size() <= 10) {
+                        demandList.add(clubBehavior);
+                    }
+                }
+            }
+        }
+        Map<String, Object> map = new HashMap<>();
+        map.put("startTime", demandStart);
+        map.put("endTime", demandEnd);
+        map.put("demandList", demandList);
+        return map;
+    }
     /**
      * 查询机构画像数据
      *
@@ -325,6 +421,7 @@ public class ClubPortraitService {
                 }
                 cmPortrait.setPageTypeValue(integers);
                 cmPortrait.setPageType(strings);
+                cmPortrait.setVisitNum(pageTypeList.size());
             }
         }
         if (!expty) {
@@ -336,4 +433,59 @@ public class ClubPortraitService {
         }
         return cmPortrait;
     }
+
+    /**
+     * 设置机构资料完整度
+     * @param clubStatistics
+     */
+    public void setClubNum(ClubStatistics clubStatistics) {
+        Integer number = 0;
+        if (null != clubStatistics) {
+            // 计算资料完整度
+            if (StringUtils.isNotBlank(clubStatistics.getName())) {
+                number += 10;
+            }
+            if (StringUtils.isNotBlank(clubStatistics.getLinkMan())) {
+                number += 10;
+            }
+            if (StringUtils.isNotBlank(clubStatistics.getContractMobile())) {
+                number += 10;
+            }
+            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;
+            }
+        }
+        clubStatistics.setNumber(number);
+        clubStatistics.setClubDataIntegrity(number + "%");
+    }
 }

+ 24 - 0
src/main/java/com/caimei/modules/user/web/newUser/AgencyController.java

@@ -1705,6 +1705,12 @@ public class AgencyController extends BaseController {
         }
     }
 
+    /**
+     * 机构画像
+     * @param cmPortrait
+     * @param model
+     * @return
+     */
     @RequestMapping("/clubPortrait")
     public String clubPortrait(CmPortrait cmPortrait, Model model) {
         CmPortrait portrait = portraitService.dataTotal(cmPortrait);
@@ -1715,6 +1721,24 @@ public class AgencyController extends BaseController {
         return "modules/userNew/cmClubPortrait";
     }
 
+    /**
+     * 客户需求
+     * @param clubId
+     * @param dataType
+     * @param demandStart
+     * @param demandEnd
+     * @return
+     */
+    @RequestMapping("/getDemandData")
+    public Map<String, Object> getDemandData(Integer clubId, Integer dataType, String demandStart, String demandEnd) {
+        return portraitService.getDemand(clubId, dataType, demandStart, demandEnd);
+    }
+
+    /**
+     * 机构画像图表数据
+     * @param cmPortrait
+     * @return
+     */
     @RequestMapping("/selPortraitData")
     @ResponseBody
     public Map<String, Object> selPortraitData(CmPortrait cmPortrait) {

+ 4 - 1
src/main/resources/mappings/modules/newhome/NewPageHomeimageMapper.xml

@@ -49,6 +49,9 @@
         </where>
         ORDER BY a.sort desc,a.createDate desc
     </select>
+    <select id="getBannerStatistics" resultType="com.caimei.modules.newhome.entity.cmStatisticsType">
+        SELECT COUNT(statisticsId) as count, ifnull(bannerId, 0) as bannerId  FROM cm_statistics_type WHERE typeId = 1 GROUP BY bannerId
+    </select>
 
     <select id="findAllList" resultType="NewPageHomeimage">
         SELECT
@@ -154,4 +157,4 @@
         set sort=#{sort}
         where id = #{id}
     </update>
-</mapper>
+</mapper>

+ 54 - 7
src/main/resources/mappings/modules/user/CmPortraitMapper.xml

@@ -7,14 +7,51 @@
                 (SELECT COUNT(shopOrderId) FROM cm_shop_order WHERE clubID = #{clubID} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotal,
                 (SELECT IFNULL(SUM(totalAmount), 0) FROM cm_shop_order WHERE clubID = #{clubID} AND shopStatus != 4 AND shopStatus != 5 AND refundStatus != 2 AND orderTime <![CDATA[ < ]]> NOW()) AS orderTotalAmount,
                 (SELECT COUNT(cbr.recordID) FROM cm_behavior_record cbr LEFT JOIN club c ON cbr.userID = c.userID WHERE cbr.pageType IN (8, 9) AND c.clubID = #{clubID} AND cbr.accessDate <![CDATA[ < ]]> now()) AS totalkeywords ,
-                (SELECT COUNT(remarks) FROM cm_club_remarks WHERE clubID = #{clubID} AND addTime <![CDATA[ < ]]> now()) AS remarksTotal
+                (SELECT COUNT(remarks) FROM cm_club_remarks WHERE clubID = #{clubID} AND addTime <![CDATA[ < ]]> now()) AS remarksTotal,
+                (SELECT COUNT(cbr.recordID) FROM cm_behavior_record cbr LEFT JOIN club c ON cbr.userID = c.userID WHERE c.clubID = #{clubID} AND cbr.accessDate <![CDATA[ < ]]> NOW()) AS visitTotal
+    </select>
+
+    <select id="getClubRemarks" resultType="java.lang.String">
+        select remarks from cm_club_remarks
+        where clubId = #{clubId}
+        <if test="startTime != null and startTime != ''">
+            and addTime > #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and addTime <![CDATA[ < ]]> #{endTime}
+        </if>
+        GROUP BY remarks ORDER BY COUNT(remarks) DESC
+    </select>
+
+    <select id="getClubBehavior" resultType="java.lang.String">
+        SELECT cbr.pageLabel FROM cm_behavior_record cbr LEFT JOIN club c ON c.userID = cbr.userId
+        WHERE pageType IN (6, 8, 9, 11, 14) AND c.clubId = #{clubId}
+        <if test="startTime != null and startTime != ''">
+            and cbr.accessTime > #{startTime}
+        </if>
+        <if test="endTime != null and endTime != ''">
+            and cbr.accessTime <![CDATA[ < ]]> #{endTime}
+        </if>
+        GROUP BY cbr.pageLabel ORDER BY COUNT(cbr.pageLabel) DESC
     </select>
 
     <select id="selClubData" resultType="com.caimei.modules.user.entity.ClubStatistics">
         select
-        c.name,
-        c.linkMan,
-        c.contractMobile,
+            c.clubID,
+            c.name,
+            c.linkMan,
+            c.contractMobile,
+            c.linkManIdentity,
+            c.address,
+            c.businessLicenseImage,
+            u.userIdentity,
+            c.sname,
+            c.contractEmail,
+            c.contractPhone,
+            c.fax,
+            c.headpic,
+            c.socialCreditCode,
+            c.info,
         (CASE WHEN c.linkManIdentity=1 THEN '老板'
               WHEN c.linkManIdentity=2 THEN '采购'
               WHEN c.linkManIdentity=3 THEN '运营'
@@ -37,14 +74,24 @@
               WHEN c.secondClubType=6 THEN '养生馆'
               WHEN c.secondClubType=7 THEN '其他'
             END) AS classify,
+            u.registerTime as registerTime,
+            covs.activeState as activeState,
+            covs.customerValue as customerValues,
         c.addTime AS addTime
         FROM club c
-                 LEFT JOIN town b ON b.townID=c.townID
-                 LEFT JOIN city ct ON ct.cityID=c.cityID
-                 LEFT JOIN province d ON d.provinceID=c.provinceID
+         LEFT JOIN USER u ON u.userID = c.userID
+         LEFT JOIN town b ON b.townID=c.townID
+         LEFT JOIN city ct ON ct.cityID=c.cityID
+         LEFT JOIN province d ON d.provinceID=c.provinceID
+         LEFT JOIN (SELECT userID, activeState, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) AS covs ON covs.userID = c.userID
         where clubID = #{clubID}
     </select>
 
+    <select id="getClubRemarksInfo" resultType="com.caimei.modules.user.entity.CmClubRemarks">
+        SELECT id, communicationSituation, communicationMethods, customerSource, customerGender, customerAge, groupAddition,addTime
+        FROM cm_club_remarks WHERE clubId = #{clubId} ORDER BY ADDTIME DESC LIMIT 1
+    </select>
+
     <select id="selOrderList" resultType="com.caimei.modules.order.entity.NewOrder">
         SELECT
         DISTINCT cso.shopOrderId as shopOrderID,

+ 2 - 0
src/main/webapp/WEB-INF/views/modules/newhome/newPageHomeimageList.jsp

@@ -150,6 +150,7 @@
         <th>图片</th>
         <th>链接</th>
         <th>排序</th>
+        <th>点击量</th>
         <th>小程序端状态</th>
         <th>PC端状态</th>
         <th>创建时间</th>
@@ -171,6 +172,7 @@
                        value="${newPageHomeimage.sort}" onkeyup="onlynum(this)"
                        onchange="changeSort(${newPageHomeimage.id})"/>
             </td>
+            <td>${newPageHomeimage.count}</td>
             <td><shiro:hasPermission name="newhome:newPageHomeimage:edit">
                 <c:if test="${newPageHomeimage.crmEnabledStatus eq 1 }">
                     <a href="javascript:void(0);" onclick="updateCrmEnabledStatusByIds('0','${newPageHomeimage.id}');">

+ 119 - 2
src/main/webapp/WEB-INF/views/modules/userNew/cmClubPortrait.jsp

@@ -15,6 +15,7 @@
 <div class="ul-form">
     <input type="hidden" id="clubId" value="${cmPortrait.clubID}">
     <input type="hidden" id="eachtsAjaxUrl" value="${ctx}/new/user/agency/selPortraitData">
+    <input type="hidden" id="demandUrl" value="${ctx}/new/user/agency/getDemandData">
     <ul class="nav nav-tabs">
         <li class="active"><a href="${ctx}/new/user/agency/clubPortrait?clubID=${cmPortrait.clubID}&clubName=${cmPortrait.clubName}&dateType=0&type=4">仪表盘</a></li>
         <li><a href="${ctx}/new/user/agency/clubData?clubID=${cmPortrait.clubID}">机构资料</a></li>
@@ -22,7 +23,119 @@
     <div class="main-content">
         <div class="flex-header">
             <div class="flex-header-main">
-                <c:if test="${statistics.name ne null and statistics.name ne ''}">
+                <table width="100%">
+                    <tr>
+                        <th>机构Id</th>
+                        <th>联系人</th>
+                        <th>性别</th>
+                        <th>年龄</th>
+                        <th>手机号</th>
+                        <th>身份</th>
+                        <th>注册时间</th>
+                        <th>客户价值</th>
+                        <th>活跃状态</th>
+                        <th>资料完整度</th>
+                        <th>客户来源</th>
+                    </tr>
+                    <tr>
+                        <td>${statistics.clubID}</td>
+                        <td>${statistics.linkMan}</td>
+                        <td>
+                            <c:if test="${empty not statistics.sex}">
+                                ${statistics.sex == 0 ? '男': '女'}
+                            </c:if>
+                            <c:if test="${empty statistics.sex}">
+                                ---
+                            </c:if>
+                        </td>
+                        <td>
+                            <c:if test="${empty not statistics.age}">
+                                ${statistics.age}
+                            </c:if>
+                            <c:if test="${empty statistics.age}">
+                                ---
+                            </c:if>
+                        </td>
+                        <td>${statistics.contractMobile}</td>
+                        <td>${statistics.linkManStatus}</td>
+                        <td>${statistics.registerTime}</td>
+                        <td>${statistics.customerValues}</td>
+                        <td>${statistics.activeState}</td>
+                        <td>${statistics.clubDataIntegrity}</td>
+                        <td>
+                            <c:if test="${empty statistics.customerSource}">
+                                ---
+                            </c:if>
+                            <c:if test="${empty not statistics.customerSource}">
+                                <c:if test="${statistics.customerSource == 0}">公众号</c:if>
+                                <c:if test="${statistics.customerSource == 1}">小红书</c:if>
+                                <c:if test="${statistics.customerSource == 2}">微博</c:if>
+                                <c:if test="${statistics.customerSource == 3}">搜狐</c:if>
+                                <c:if test="${statistics.customerSource == 4}">其他</c:if>
+                            </c:if>
+                        </td>
+                    </tr>
+                    <tr>
+                        <th>机构名称</th>
+                        <th>机构地址</th>
+                        <th>机构级别</th>
+                        <th>机构类型</th>
+                    </tr>
+                    <tr>
+                        <td>${statistics.name}</td>
+                        <td>${statistics.address}</td>
+                        <td>${statistics.clubRank}</td>
+                        <td>${statistics.clubType}</td>
+                    </tr>
+                    <tr>
+                        <td>入群状态</td>
+                        <td>微信触达</td>
+                        <td>电话触达</td>
+                    </tr>
+                    <tr>
+                        <th>
+                            <c:if test="${empty not statistics.groupAddition}">
+                                <c:if test="${statistics.groupAddition == 0}">以加群</c:if>
+                                <c:if test="${statistics.groupAddition == 1}">未加群(${statistics.fillTime})</c:if>
+                            </c:if>
+
+                        </th>
+                        <th>
+                            <c:if test="${empty not statistics.wxReach}">
+                                <c:if test="${statistics.wxReach == 0}">触达</c:if>
+                                <c:if test="${statistics.wxReach == 1}">未触达(${statistics.fillTime})</c:if>
+                            </c:if>
+                        </th>
+                        <th>
+                            <c:if test="${empty not statistics.mobileReach}">
+                                <c:if test="${statistics.mobileReach == 0}">触达</c:if>
+                                <c:if test="${statistics.mobileReach == 1}">未触达(${statistics.fillTime})</c:if>
+                            </c:if>
+                        </th>
+                    </tr>
+                    <tr>
+                        <H4 class="H_tag">客户需求</H4>
+                        <div class="box-tabmain">
+                            <div class="box-tabs" id="customerDemand">
+                                <a class="box-tabs-li active" href="javascript: void(0);" data-type="4">全年</a>
+                                <a class="box-tabs-li" href="javascript: void(0);" data-type="3">半年</a>
+                                <a class="box-tabs-li" href="javascript: void(0);" data-type="2">月</a>
+                                <a class="box-tabs-li" href="javascript: void(0);" data-type="1">日</a>
+                            </div>
+                            <div class="box-time" id="customerDemandData">
+                                <div class="time-input">
+                                    <input type="text" placeholder="开始时间" class="input start" id="demandStart">
+                                </div>
+                                <span class="line">至</span>
+                                <div class="time-input">
+                                    <input type="text" placeholder="结束时间" class="input end" id="demandEnd">
+                                </div>
+                            </div>
+                        </div>
+                        <div id="demand"></div>
+                    </tr>
+                </table>
+                <%--<c:if test="${statistics.name ne null and statistics.name ne ''}">
                     <p><i class="icon i1"></i><span>${statistics.name}</span></p>
                 </c:if>
                 <c:if test="${statistics.linkMan ne null and statistics.linkMan ne ''}">
@@ -42,7 +155,7 @@
                 </c:if>
                 <c:if test="${statistics.addTime ne null and statistics.addTime ne ''}">
                     <p><i class="icon i7"></i><span>${statistics.addTime}</span></p>
-                </c:if>
+                </c:if>--%>
             </div>
         </div>
         <div class="flex-content">
@@ -155,6 +268,10 @@
                 <div class="box-title">
                     <H4 class="H_tag">访问记录</H4>
                 </div>
+                <div class="box-title">
+                    <span>所有:<a class="line" href="${ctx}/new/user/agency/regist?clubId=${cmPortrait.clubID}&clubName=${cmPortrait.clubName}"><c:if test="${!empty portrait.visitTotal}">${portrait.visitTotal}</c:if><c:if test="${empty portrait.visitTotal}">0</c:if> 条</a></span>
+                    <span class="right_span">当前范围:<a id="visitNum" href="javascript:void(0);"></a></span>
+                </div>
                 <div class="box-tabmain">
                     <div class="box-tabs" id="visitTabs">
                         <a class="box-tabs-li active" href="javascript: void(0);" data-type="4">全年</a>

+ 59 - 0
src/main/webapp/static/modules/cmClubPortrait/cmClubEacths.js

@@ -18,9 +18,45 @@ const defaultParams = {
     endTime:'',//   结束时间
     type:0//  统计类别 0订单 1搜索关键词 2咨询记录 3访问记录 4初始状态
 }
+//默认参数
+const defaultDemand = {
+    clubID:$('#clubId').val()*1,//  机构id
+    dateType:0,//   日期类别 0日 1月 2半年 3全年
+    startTime:'',//   开始时间
+    endTime:'',//   结束时间
+}
 // 默认时间
 const startDate = getDateStr(new Date(), -365),
       endDate = getDateStr(new Date(), 0);
+// 初始化客户需求选择时间控件
+const getInfoDemandDate = function () {
+    $('#customerDemandData').dateRangePicker({
+        language: 'cn',
+        startDate: startDate,
+        endDate: endDate,
+        format: 'YYYY-MM-DD',
+        showShortcuts: false,
+        autoClose: isPC,
+        isNowrap: false,
+        getValue: function () {
+            if (defaultParams.startTime && defaultParams.endTime) {
+                return defaultParams.startTime + ' to ' + defaultParams.endTime;
+            } else {
+                return '';
+            }
+        },
+        setValue: function (s, s1, s2) {
+            defaultParams.startTime = s1;
+            defaultParams.endTime = s2;
+            $('#demandStart').val(s1);
+            $('#demandEnd').val(s2);
+            if (defaultParams.startTime && defaultParams.endTime) {
+                $('#customerDemand').find('a').removeClass('active');
+                getDemandData(0,0)
+            }
+        }
+    });
+}
 // 初始化订单选择时间控件
 const getInfoOrderDate = function () {
     $('#orderDate').dateRangePicker({
@@ -137,6 +173,27 @@ const getInfoVisitDate = function () {
         }
     });
 }
+const getDemandData = function (dateType) {
+    defaultDemand.dateType = dateType;
+    $({
+        url: $('#demandUrl').val(),
+        type: "GET",
+        data: defaultDemand,
+        contentType : 'application/json;charset=UTF-8',
+        success: function (data) {
+            if (data.length > 0) {
+                $('#demandEnd').val(data.endTime);
+                $('#demandStart').val(data.startTime);
+                $('#demand').html(
+                    data.forEach((item) => {
+                        '<span>${item}</span>'
+                    }))
+            } else {
+                $('#demand').html('<div>暂无数据</div>')
+            }
+        }
+    })
+}
 // 数据接口请求
 const  getClubEacthsData = function (type,dateType) {
     defaultParams.type = type;
@@ -189,6 +246,7 @@ const  getClubEacthsData = function (type,dateType) {
                             $('#visitEacths').hide();
                             $('#visitTimeEnd').val(data.portrait.endTime);
                             $('#visitTimeStart').val(data.portrait.startTime);
+                            $('#visitNum').text(`0(个)`);
                         }else{
                             setOtherData(type,data)
                         }
@@ -329,6 +387,7 @@ const setOtherData = function (type,data) {
                 $('#visitEacthsNone').hide();
                 $('#visitTimeEnd').val(data.pageType.endTime);
                 $('#visitTimeStart').val(data.pageType.startTime);
+                $('#visitNum').text(`${data.portrait.visitNum}(个)`);
             },
             id:'visitEacths',
             series:{

+ 11 - 0
src/main/webapp/static/modules/cmClubPortrait/cmClubPortrait.js

@@ -2,6 +2,8 @@
  * Created 机构画像 by zjy on 2023/02/10.
  */
 $(function(){
+    // 机构客户需求初始化时间
+    getDemandData()
     // 机构订单初始化时间
     getInfoOrderDate();
     // 机构搜索关键词初始化时间
@@ -16,6 +18,15 @@ $(function(){
     getClubEacthsData(2,4);
     getClubEacthsData(3,4);
     // 点击筛选机构订单数据
+    $('#customerDemand').children("a").each(function (index) {
+        $(this).click(function () {
+            //alert(index);
+            $(this).addClass('active').siblings('a').removeClass('active');
+            let dateType = $(this).attr('data-type');
+            getDemandData(dateType)
+        });
+    });
+    // 点击筛选机构订单数据
     $('#orderTabs').children("a").each(function (index) {
         $(this).click(function () {
             //alert(index);