Bladeren bron

Merge remote-tracking branch 'origin/developerD' into developer

huangzhiguo 1 jaar geleden
bovenliggende
commit
7d6ea33eb1

+ 9 - 0
src/main/java/com/caimei/modules/project/model/ServiceProviderModel.java

@@ -12,6 +12,7 @@ public class ServiceProviderModel extends DataEntity<ServiceProviderModel> {
     private Integer userID;
     private String contractMobile;
     private Integer mainServiceProviderID;
+    private String unionId;
     private Integer teamFlag;  //协销小组编辑页面回显标记,后台取数据的时候给1
 
     public String getContractMobile() {
@@ -46,6 +47,14 @@ public class ServiceProviderModel extends DataEntity<ServiceProviderModel> {
         this.mainServiceProviderID = mainServiceProviderID;
     }
 
+    public String getUnionId() {
+        return unionId;
+    }
+
+    public void setUnionId(String unionId) {
+        this.unionId = unionId;
+    }
+
     public Integer getTeamFlag() {
         return teamFlag;
     }

+ 1 - 1
src/main/java/com/caimei/modules/serviceteam/service/CmServiceteamRoleService.java

@@ -87,6 +87,6 @@ public class CmServiceteamRoleService extends CrudService<CmServiceteamRoleDao,
             // 协销小组不存在, 先添加协销小组
             dao.save(cmServiceteamRole);
         }
-        ids.forEach(i->dao.saveGroup(cmServiceteamRole.getId(),i));
+        ids.forEach(i->dao.saveGroup(cmServiceteamRole.getTeamId(),i));
     }
 }

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

@@ -91,6 +91,10 @@ public class ClubStatistics extends DataEntity<ClubStatistics> {
     private Integer mobileReach;    // 电话触达 0 触达 1 未触达
     private String fillTime;    // 填写时间
 
+    private String firstTime;   //首次咨询时间
+
+    private String recentlyTime;    //最近咨询时间
+
 
     public Integer getUserID() {
         return userID;
@@ -627,4 +631,20 @@ public class ClubStatistics extends DataEntity<ClubStatistics> {
     public void setFillTime(String fillTime) {
         this.fillTime = fillTime;
     }
+
+    public String getFirstTime() {
+        return firstTime;
+    }
+
+    public void setFirstTime(String firstTime) {
+        this.firstTime = firstTime;
+    }
+
+    public String getRecentlyTime() {
+        return recentlyTime;
+    }
+
+    public void setRecentlyTime(String recentlyTime) {
+        this.recentlyTime = recentlyTime;
+    }
 }

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

@@ -163,6 +163,14 @@ public class CmClubRemarks extends DataEntity<CmClubRemarks> {
     private String customerAge;
     // 加群情况 0 以加群 1 未加群
     private Integer groupAddition;
+    /**
+     * 首次咨询时间
+     */
+    private String firstTime;
+    /**
+     * 最近咨询时间
+     */
+    private String recentlyTime;
 
 
     public Integer getReportID() {
@@ -518,4 +526,20 @@ public class CmClubRemarks extends DataEntity<CmClubRemarks> {
     public void setGroupAddition(Integer groupAddition) {
         this.groupAddition = groupAddition;
     }
+
+    public String getFirstTime() {
+        return firstTime;
+    }
+
+    public void setFirstTime(String firstTime) {
+        this.firstTime = firstTime;
+    }
+
+    public String getRecentlyTime() {
+        return recentlyTime;
+    }
+
+    public void setRecentlyTime(String recentlyTime) {
+        this.recentlyTime = recentlyTime;
+    }
 }

+ 18 - 0
src/main/java/com/caimei/modules/user/entity/NewCmClub.java

@@ -98,6 +98,8 @@ public class NewCmClub extends DataEntity<NewCmClub> {
     private String userIdentity;  //用户身份
     private Integer svipUserFlag;   //超级会员用户标识,1是,2不是
     private Integer newDeal;//新分配机构状态 0.否,1.是
+    private String allocationStartTime; // 开始分配时间
+    private String allocationEndTime; // 开始分配时间
 
     public Date getProviderTime() {
         return providerTime;
@@ -694,4 +696,20 @@ public class NewCmClub extends DataEntity<NewCmClub> {
     public void setNewDeal(Integer newDeal) {
         this.newDeal = newDeal;
     }
+
+    public String getAllocationStartTime() {
+        return allocationStartTime;
+    }
+
+    public void setAllocationStartTime(String allocationStartTime) {
+        this.allocationStartTime = allocationStartTime;
+    }
+
+    public String getAllocationEndTime() {
+        return allocationEndTime;
+    }
+
+    public void setAllocationEndTime(String allocationEndTime) {
+        this.allocationEndTime = allocationEndTime;
+    }
 }

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

@@ -10,6 +10,7 @@ import org.springframework.stereotype.Service;
 
 import javax.annotation.Resource;
 import java.text.NumberFormat;
+import java.text.ParseException;
 import java.text.SimpleDateFormat;
 import java.util.*;
 
@@ -65,6 +66,13 @@ public class ClubPortraitService {
                 clubStatistics.setSex(clubRemarksInfo.getCustomerGender() != null ? clubRemarksInfo.getGroupAddition() : null);
                 clubStatistics.setAge(StringUtils.isNotBlank(clubRemarksInfo.getCustomerAge()) ? clubRemarksInfo.getCustomerAge() : null);
                 clubStatistics.setFillTime(dateFormat.format(clubRemarksInfo.getAddTime()));
+                try {
+                    clubStatistics.setFirstTime(StringUtils.isNotBlank(clubRemarksInfo.getFirstTime()) ? dateFormat.format(dateFormat.parse(clubRemarksInfo.getFirstTime())) : null);
+                    clubStatistics.setRecentlyTime(StringUtils.isNotBlank(clubRemarksInfo.getRecentlyTime()) ? dateFormat.format(dateFormat.parse(clubRemarksInfo.getRecentlyTime())) : null);
+                } catch (ParseException e) {
+                    e.printStackTrace();
+                }
+
             }
         }
         return clubStatistics;
@@ -119,12 +127,12 @@ public class ClubPortraitService {
                 if (clubRemark.contains(",")) {
                     String[] split = clubRemark.split(",");
                     for (String s : split) {
-                        if (demandList.size() < 10 && StringUtils.isNotBlank(s)) {
+                        if (demandList.size() < 10 && StringUtils.isNotBlank(s) && !demandList.contains(s)) {
                             demandList.add(s);
                         }
                     }
                 } else {
-                    if (demandList.size() < 10 && StringUtils.isNotBlank(clubRemark)) {
+                    if (demandList.size() < 10 && StringUtils.isNotBlank(clubRemark) && !demandList.contains(clubRemark)) {
                         demandList.add(clubRemark);
                     }
                 }
@@ -137,12 +145,12 @@ public class ClubPortraitService {
                 if (clubBehavior.contains(",")) {
                     String[] split = clubBehavior.split(",");
                     for (String s : split) {
-                        if (demandList.size() < 10 && StringUtils.isNotBlank(s)) {
+                        if (demandList.size() < 10 && StringUtils.isNotBlank(s) && !demandList.contains(s)) {
                             demandList.add(s);
                         }
                     }
                 } else {
-                    if (demandList.size() < 10 && StringUtils.isNotBlank(clubBehavior)) {
+                    if (demandList.size() < 10 && StringUtils.isNotBlank(clubBehavior) && !demandList.contains(clubBehavior)) {
                         demandList.add(clubBehavior);
                     }
                 }

+ 97 - 0
src/main/java/com/caimei/modules/user/service/WebChatUserService.java

@@ -0,0 +1,97 @@
+package com.caimei.modules.user.service;
+
+import com.alibaba.fastjson.JSONObject;
+import com.caimei.modules.utils.RequestUtil;
+import lombok.extern.slf4j.Slf4j;
+import org.springframework.beans.factory.annotation.Value;
+import org.springframework.stereotype.Service;
+
+import java.util.LinkedHashMap;
+import java.util.Map;
+
+/**
+ * Description
+ *
+ * @author : hzg
+ * @date : 2023/11/16
+ */
+@Slf4j
+@Service
+public class WebChatUserService {
+
+
+    /**
+     * 分配协销消息
+     *
+     * @param title      消息抬头
+     * @param keyWord1
+     * @param keyWord2
+     * @param keyWord3
+     * @param keyWord4
+     * @param Remark     消息下备注
+     * @param path       跳转链接
+     * @param openId     公众号openId
+     * @param templateId 模板Id
+     */
+    public void sendChoseServiceMessage(String title, String keyWord1, String keyWord2, String keyWord3, String keyWord4, String Remark, String path, String openId, String templateId) {
+        JSONObject first = new JSONObject();
+        first.put("value", title);
+        JSONObject keyword1 = new JSONObject();
+        keyword1.put("value", keyWord1);
+        JSONObject keyword2 = new JSONObject();
+        keyword2.put("value", keyWord2);
+        JSONObject keyword3 = new JSONObject();
+        keyword3.put("value", keyWord3);
+        JSONObject keyword4 = new JSONObject();
+        keyword4.put("value", keyWord4);
+        JSONObject remark = new JSONObject();
+        remark.put("value", Remark);
+
+        JSONObject data = new JSONObject();
+        data.put("first", first);
+        data.put("keyword1", keyword1);
+        data.put("keyword2", keyword2);
+        data.put("keyword3", keyword3);
+        data.put("keyword4", keyword4);
+        data.put("remark", remark);
+
+        JSONObject miniProgram = new JSONObject();
+        miniProgram.put("appid", "wxf3cd4ae0cdd11c36");
+        miniProgram.put("pagepath", path);
+
+        JSONObject json = new JSONObject(new LinkedHashMap());
+        json.put("touser", openId);
+        json.put("template_id", templateId);
+        json.put("url", "https://www.caimei365.com/");
+        json.put("miniprogram", miniProgram);
+        json.put("data", data);
+        // json 字符串
+        String jsonString = json.toJSONString();
+        log.info(">>>>>>>>推送微信模板消息:" + jsonString);
+        try {
+            String requestUrl = "https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=" + getAccessToken();
+            // 发送请求
+            String result = RequestUtil.httpRequest(requestUrl, "POST", jsonString);
+            log.info(">>>>>>>>推送结果:" + result);
+        } catch (Exception e) {
+            log.info("推送微信模板消息失败:" + e);
+        }
+    }
+
+
+    /**
+     * 微信公众号获取access_token
+     *
+     * @return access_token
+     */
+    public String getAccessToken() throws Exception {
+        String link = "https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET";
+        link = link.replace("APPID", "wx91c4152b60ca91a3");
+        link = link.replace("APPSECRET", "a563dd2c07c9c815a4e697c8b6cb73dc");
+        String result = RequestUtil.sendGet(link);
+        log.info("微信公众号获取access_token>>>" + link);
+        log.info("微信公众号获取access_token>>>" + result);
+        Map<String, Object> map = JSONObject.parseObject(result, Map.class);
+        return (String) map.get("access_token");
+    }
+}

+ 24 - 1
src/main/java/com/caimei/modules/user/web/newUser/SpController.java

@@ -6,12 +6,14 @@ import com.caimei.constants.UserIdentity;
 import com.caimei.constants.UserType;
 import com.caimei.modules.bulkpurchase.entity.CmClub;
 import com.caimei.modules.bulkpurchase.service.CmClubService;
+import com.caimei.modules.order.dao.NewShopOrderDao;
 import com.caimei.modules.project.dao.ClubDao;
 import com.caimei.modules.project.dao.ServiceProviderDao;
 import com.caimei.modules.project.model.ClubModel;
 import com.caimei.modules.project.model.ServiceProviderModel;
 import com.caimei.modules.sys.utils.SMSUtils;
 import com.caimei.modules.sys.utils.ValidateUtils;
+import com.caimei.modules.user.service.WebChatUserService;
 import com.caimei.modules.user.aop.OperationLogAnnotation;
 import com.caimei.modules.user.dao.NewCmClubDao;
 import com.caimei.modules.user.entity.*;
@@ -76,6 +78,10 @@ public class SpController extends BaseController {
     private NewCmClubService newCmClubService;
     @Resource
     private NewCmClubDao newCmClubDao;
+    @Resource
+    private NewShopOrderDao newShopOrderDao;
+    @Resource
+    private WebChatUserService webChatUserService;
 
     @ModelAttribute
     public NewCmSp get(@RequestParam(required = false) String id) {
@@ -243,7 +249,24 @@ public class SpController extends BaseController {
                                 MessageUtil.sendMessage(insideMessageMessageModel);
                                 SMSUtils.sendSms(4, oldServiceprovider.getContractMobile(), "【采美365】系统已将你的机构客户进行回收,你已无权管理该客户。机构名称【" + newCmClub.getName() + "】,联系人【"+ newCmClub.getLinkMan() +"】,手机号【"+ newCmClub.getContractMobile() +"】。");
                             }
-
+                            // 分配协销发送微信模板消息
+                            List<String> openidList = newShopOrderDao.getOpenidListByPermission(serviceProvider.getUnionId());
+                            if (null != openidList && openidList.size() > 0) {
+                                for (String openId : openidList) {
+                                    if (StringUtils.isNotBlank(openId)) {
+                                        String title = "你有一个新机构客户,请及时跟进。";
+                                        SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+                                        String keyWord1 = newCmClub.getLinkMan();
+                                        String keyWord2 = newCmClub.getContractMobile();
+                                        String keyWord3 = StringUtils.isNotBlank(newCmClub.getAddress()) ? newCmClub.getAddress() : "暂无";
+                                        String keyWord4 = new SimpleDateFormat("yyyy-MM-dd").format(new Date());
+                                        String remark = "点击查看详情,了解更多客户信息。";
+                                        String path = "pages/seller/club/list?type=wechat";
+                                        String templateId = "o1nMAIsHAFr0VOu0qEbI1rEFDS14hl40UXbt52I5row";
+                                        webChatUserService.sendChoseServiceMessage(title, keyWord1, keyWord2, keyWord3, keyWord4, remark, path, openId, templateId);
+                                    }
+                                }
+                            }
                         }
                     } else {
                         map.put("success", false);

+ 5 - 5
src/main/resources/mappings/modules/order/CmDiscernReceiptMapper.xml

@@ -1137,7 +1137,7 @@
 		and cdr.delFlag = '0' and cdr.receiptStatus = '3' and cdr.payWay != '3'
 	</select>
     <select id="findShoOrderIDReceipt" resultType="double">
-        select sum(associateAmount) from cm_receipt_order_relation cror
+        select ifnull(sum(cror.associateAmount), 0) as associateAmount from cm_receipt_order_relation cror
                                              left join cm_discern_receipt cdr on cror.receiptID = cdr.id
         where cror.shopOrderID = #{shopOrderID} and cror.delFlag = '0' and cror.relationType = '2'
           and cdr.delFlag = '0' and cdr.receiptStatus = '3' and cdr.payWay = '2'
@@ -1146,17 +1146,17 @@
     <select id="findShopReceipt" resultType="java.lang.Double">
         SELECT ifnull(SUM(associateAmount), 0) as associateAmount FROM (
              SELECT
-                 SUM(associateAmount) AS associateAmount
+                 SUM(cror.associateAmount) AS associateAmount
              FROM cm_receipt_order_relation cror
                       LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
-             WHERE relationType = 2 AND orderId = #{orderID}
+             WHERE cror.relationType = 2 AND cror.orderId = #{orderID}
                AND cror.delFlag = '0' AND cror.relationType = '2' AND cdr.delFlag = '0'
              UNION
              SELECT
-                 SUM(associateAmount) AS associateAmount
+                 SUM(cror.associateAmount) AS associateAmount
              FROM cm_receipt_order_relation cror
                       LEFT JOIN cm_discern_receipt cdr ON cror.receiptID = cdr.id
-             WHERE relationType = 1 AND orderId = #{shopOrderID}
+             WHERE cror.relationType = 1 AND cror.orderId = #{shopOrderID}
                AND cror.delFlag = '0' AND cror.relationType = '2' AND cdr.delFlag = '0'
          ) AS d
     </select>

+ 4 - 1
src/main/resources/mappings/modules/user/CmPortraitMapper.xml

@@ -88,7 +88,10 @@
     </select>
 
     <select id="getClubRemarksInfo" resultType="com.caimei.modules.user.entity.CmClubRemarks">
-        SELECT id, communicationSituation, communicationMethods, customerSource, customerGender, customerAge, groupAddition,addTime
+        SELECT id, communicationSituation, communicationMethods,
+               customerSource, customerGender, customerAge, groupAddition,addTime,
+               (SELECT ADDTIME FROM cm_club_remarks WHERE clubId = #{clubID} ORDER BY ADDTIME ASC LIMIT 1) AS firstTime,
+               (SELECT ADDTIME FROM cm_club_remarks WHERE clubId = #{clubID} ORDER BY ADDTIME DESC LIMIT 1) AS recentlyTime
         FROM cm_club_remarks WHERE clubId = #{clubID} ORDER BY ADDTIME DESC LIMIT 1
     </select>
 

+ 11 - 2
src/main/resources/mappings/modules/user/NewCmClubMapper.xml

@@ -101,8 +101,9 @@
         <include refid="otherColumns"/>,u.userPermission,u.source, covs.activeState,covs.customerValue,u.loginTime
         FROM club a
         <include refid="newCmClubJoins"/>
-        LEFT JOIN (SELECT userID, activeState, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1)
-        covs ON a.userID = covs.userID
+        LEFT JOIN (SELECT DISTINCT clubId, createTime FROM cm_provider_record GROUP BY clubId ORDER BY id DESC ) cpr ON a.clubId = cpr.clubId
+        LEFT JOIN (SELECT DISTINCT clubID, checkTime FROM clubchangesprecord WHERE checkStatus = 1 GROUP BY clubID ORDER BY clubChangeSpRecordID DESC )ccs ON ccs.clubId = a.clubId
+        LEFT JOIN (SELECT userID, activeState, customerValue FROM cm_organ_value_system WHERE stage = 0 AND delType = 1) covs ON a.userID = covs.userID
         <where>
             (u.userOrganizeID IN(0,1) or u.clubStatus != 92) and u.userOrganizeID != 4 AND u.userIdentity != 8
             <if test="clubID != null and clubID != ''">
@@ -150,6 +151,14 @@
             <if test="endTime != null and endTime != ''">
                 AND (u.registerTime &lt; #{endTime} OR u.registerTime = #{endTime})
             </if>
+            <if test="allocationStartTime != null and allocationStartTime != ''">
+                AND (ccs.checkTime <![CDATA[ >= ]]> #{allocationStartTime}
+                OR cpr.createTime <![CDATA[ >= ]]> #{allocationStartTime})
+            </if>
+            <if test="allocationEndTime != null and allocationEndTime != ''">
+                AND (ccs.checkTime <![CDATA[ <= ]]> #{allocationEndTime}
+                OR cpr.createTime <![CDATA[ <= ]]> #{allocationEndTime})
+            </if>
             <if test="startLoginTime != null and startLoginTime != ''">
                 AND (u.loginTime >= DATE_SUB(CURRENT_DATE, INTERVAL 6 MONTH) OR a.clubId in (select a.clubId
                 FROM ((

+ 36 - 39
src/main/webapp/WEB-INF/views/modules/userNew/cmAgencyList.jsp

@@ -103,30 +103,24 @@
 
         <br/>
         <br/>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
-        <label class="control-label">活跃状态:</label>
-        <form:select path="activeState" class="input-medium">
-            <form:option value="" label="请选择"/>
-            <form:option value="新增用户" label="新增用户"/>
-            <form:option value="活跃用户" label="活跃用户"/>
-            <form:option value="不活跃用户" label="不活跃用户"/>
-            <form:option value="流失用户" label="流失用户"/>
-            <form:option value="回流用户" label="回流用户"/>
-            <form:option value="忠诚用户" label="忠诚用户"/>
-            <form:option value="沉默用户" label="沉默用户"/>
-        </form:select>
-
-        <label class="control-label">客户价值:</label>
-        <form:select path="customerValue" class="input-medium">
-            <form:option value="" label="请选择"/>
-            <form:option value="一般保持客户" label="一般保持客户"/>
-            <form:option value="一般发展客户" label="一般发展客户"/>
-            <form:option value="一般价值客户" label="一般价值客户"/>
-            <form:option value="一般挽留客户" label="一般挽留客户"/>
-            <form:option value="重要保持客户" label="重要保持客户"/>
-            <form:option value="重要发展客户" label="重要发展客户"/>
-            <form:option value="重要价值客户" label="重要价值客户"/>
-            <form:option value="重要挽留客户" label="重要挽留客户"/>
-        </form:select>
+        <div class="item">
+            <label>活跃状态:</label>
+            <form:select path="activeState" class="input-medium">
+                <form:option value="" label="请选择"/>
+                <form:option value="活跃用户" label="活跃用户"/>
+                <form:option value="不活跃用户" label="不活跃用户"/>
+            </form:select>
+        </div>
+        <div class="item">
+            <label>客户价值:</label>
+            <form:select path="customerValue" class="input-medium">
+                <form:option value="" label="请选择"/>
+                <form:option value="高价值客户" label="高价值客户"/>
+                <form:option value="一般价值客户" label="一般价值客户"/>
+                <form:option value="潜在价值客户" label="潜在价值客户"/>
+                <form:option value="低价值客户" label="低价值客户"/>
+            </form:select>
+        </div>
         <div class="item">
             <label>注册时间:</label>
             <form:input path="searchStartTime" type="text" maxlength="20" class="input-mini Wdate" value="${startTime}"
@@ -150,6 +144,14 @@
                 <form:options items="${spNameList}" itemLabel="name" itemValue="serviceProviderID" htmlEscape="false"/>
             </form:select>
         </div>
+        <div class="item">
+            <label>分配时间:</label>
+            <form:input path="allocationStartTime" type="text" maxlength="20" class="input-mini Wdate" value="${startTime}"
+                        onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+            -
+            <form:input path="allocationEndTime" type="text" maxlength="20" class="input-mini Wdate" value="${endTime}"
+                        onclick="WdatePicker({dateFmt:'yyyy-MM-dd',isShowClear:false});"/>
+        </div>
         <div class="item">
             <input id="btnSubmit" class="btn btn-primary" type="submit" value="查询"/>
         </div>
@@ -904,22 +906,17 @@
         $.jBox(html, {title: "审核", submit: submit});
     }
     function activeStageMessage(type) {// 客户价值提示语
-        var content = '1.新增用户:30天内新注册的用户'+'<br/>'+
-        '2.活跃用户:90天内登录过商城的用户(排除新增用户和回流客户)'+'<br/>'+
-        '3.不活跃用户:90天内未登录过商城的用户(排除流失用户和沉默用户)'+'<br/>'+
-        '4.流失用户:两年内未登录且没有订单的机构'+'<br/>'+
-        '5.回流用户:上一统计阶段的流失用户中后续登录商城的用户或者后续有订单的用户'+'<br/>'+
-        '6.忠诚用户:90天内登录过商城且有订单记录的用户(排除新增用户,活跃用户)'+'<br/>'+
-        '7.沉默用户:两年内未登录过商城,但是在两年内存在订单的用户(排除回流用户)';
+        var content = '活跃状态是根据机构半年内是否产生活跃行为' +'<br/>'+
+            '来定义的,活跃行为包括以下3个部分(符合其一即可),数据每日更新'+'<br/>'+
+        '1、该机构登录了账号'+'<br/>'+
+        '2、该机构有订单(不论订单状态)'+'<br/>'+
+        '3、该机构有咨询记录';
 
-        var content2 = '1. 一般保持客户,指最近一次交易距今时间大于60天,交易频率大于等于一月一次,上个月交易金额小于¥100000的客户'+'<br/>'+
-            '2. 一般发展客户,指最近一次交易距今时间小于等于60天,交易频率小于一月一次,上个月交易金额小于¥100000的客户'+'<br/>'+
-            '3. 一般价值客户,指最近一次交易距今时间小于等于60天,交易频率大于等于一月一次,上个月交易金额小于¥100000的客户'+'<br/>'+
-            '4. 一般挽留客户,指最近一次交易距今时间大于60天,交易频率小于一月一次,上个月交易金额小于¥100000的客户'+'<br/>'+
-            '5.重要保持客户,指最近一次交易距今时间大于60天,交易频率大于等于一月一次,上个月交易金额大于等于¥100000的客户'+'<br/>'+
-            '6.重要发展客户,指最近一次交易距今时间小于等于60天,交易频率小于一月一次,上个月交易金额大于等于¥100000的客户'+'<br/>'+
-            '7.重要价值客户,指最近一次交易距今时间小于等于60天,交易频率大于等于一月一次,上个月交易金额大于等于¥100000的客户'+'<br/>'+
-            '8.重要挽留客户,指最近一次交易距今时间大于60天,交易频率小于一月一次,上个月交易金额大于等于¥100000的客户';
+        var content2 = '客户价值是根据机构一年内的订单数量、订单金额和访问频率3个方面来定义的,数据每日更新。'+'<br/>'+
+            '1、若机构一年内订单数大于等于5,则为高价值客户'+'<br/>'+
+            '2、若机构一年内订单数小于5,但总订单金额大于等于5万,则为一般价值客户'+'<br/>'+
+            '3、若机构一年内订单数小于5,总订单金额小于5万,但访问频率大于等于一月一次,则为潜在价值客户'+'<br/>'+
+            '4、若机构一年内订单数小于5,总订单金额小于5万,访问频率小于一月一次,则为低价值客户';
 
         var typeMap = {
                 1:content,

+ 33 - 3
src/main/webapp/WEB-INF/views/modules/userNew/cmClubPortrait.jsp

@@ -118,6 +118,8 @@
                     <div class="flex-header-th">入群状态</div>
                     <div class="flex-header-th">微信触达</div>
                     <div class="flex-header-th">电话触达</div>
+                    <div class="flex-header-th">首次咨询时间</div>
+                    <div class="flex-header-th">最近咨询时间</div>
                     <div class="flex-header-th last">机构地址</div>
                 </div>
                 <div class="flex-header-tb">
@@ -161,6 +163,22 @@
                             ---
                         </c:if>
                     </div>
+                    <div class="flex-header-td">
+                        <c:if test="${not empty statistics.firstTime}">
+                            ${statistics.firstTime}
+                        </c:if>
+                        <c:if test="${empty statistics.firstTime}">
+                            ---
+                        </c:if>
+                    </div>
+                    <div class="flex-header-td">
+                        <c:if test="${not empty statistics.recentlyTime}">
+                            ${statistics.recentlyTime}
+                        </c:if>
+                        <c:if test="${empty statistics.recentlyTime}">
+                            ---
+                        </c:if>
+                    </div>
                     <div class="flex-header-td last">
                         ${statistics.province}${statistics.city}${statistics.town}
                     </div>
@@ -305,7 +323,7 @@
                     <H4 class="H_tag">访问记录</H4>
                 </div>
                 <div class="box-title">
-                    <span>所有:<a class="line visit" href="javascript:void(0);"><c:if test="${!empty portrait.visitTotal}">${portrait.visitTotal}</c:if><c:if test="${empty portrait.visitTotal}">0</c:if> 条</a></span>
+                    <span>所有:<a id="visitAll" class="line visit" href="javascript:void(0);"><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" class="visit" href="javascript:void(0);"></a></span>
                 </div>
                 <div class="box-tabmain">
@@ -344,10 +362,22 @@
 <script type="text/javascript" src="${ctxStatic}/modules/cmClubPortrait/cmClubPortrait.js"></script>
 <script>
     // 前往新后台
-    $('.visit').click(function () {
+    $('#visitNum').click(function () {
+        var link = "";
+        var startTime = $('#visitTimeStart').val()
+        var endTime = $('#visitTimeEnd').val()
+        var name = "${statistics.name}"
+        $.get("${ctx}/jump/link", function (data) {
+            link = "https://manager-b.caimei365.com/#/user/record-list?type=second&corporateName="+name+"&startTime="+startTime+"&endTime="+endTime+"&token=" + data;
+            window.open(link, "_blank");
+        });
+    })
+    // 前往新后台
+    $('#visitAll').click(function () {
         var link = "";
+        var name = "${statistics.name}"
         $.get("${ctx}/jump/link", function (data) {
-            link = "https://manager.caimei365.com/#/user/record-list?token=" + data;
+            link = "https://manager-b.caimei365.com/#/user/record-list?type=second&corporateName="+name+"&startTime=&endTime="+"&token=" + data;
             window.open(link, "_blank");
         });
     })

+ 4 - 4
src/main/webapp/static/modules/cmClubPortrait/cmClubPortrait.css

@@ -41,7 +41,7 @@
     text-align: center;
 }
 .flex-header-main .flex-header-th.last{
-    width: 36%;
+    width: 20%;
     text-align: left;
     padding-left: 20px;
     box-sizing: border-box;
@@ -64,7 +64,7 @@
     text-overflow: ellipsis;
 }
 .flex-header-main .flex-header-td.last{
-    width: 36%;
+    width: 20%;
     text-align: left;
     padding-left: 20px;
     box-sizing: border-box;
@@ -155,7 +155,7 @@
 }
 .flex-content .flex-box{
     width: 700px;
-    height: 400px;
+    min-height: 400px;
     border:1px solid rgba(192,192,192,0.4);
     margin-left: 15px;
     margin-top: 15px;
@@ -166,7 +166,7 @@
 }
 .flex-content .flex-box.box1{
     width: 1415px;
-    height: 150px;
+    min-height: 100px;
     margin-top: 0;
 }
 .flex-box .box-title{

+ 50 - 25
src/test/java/com/caimei/info/InfoTest.java

@@ -8,6 +8,7 @@ import com.caimei.modules.order.entity.NewShopOrder;
 import com.caimei.modules.order.service.NewShopOrderService;
 import com.caimei.modules.product.dao.CmOrganizeProductInfoMapper;
 import com.caimei.modules.sys.utils.SMSUtils;
+import com.caimei.utils.MathUtil;
 import org.junit.Test;
 import org.springframework.beans.factory.annotation.Autowired;
 
@@ -19,7 +20,11 @@ import com.thinkgem.jeesite.common.utils.StringUtils;
 import com.thinkgem.jeesite.test.service.InfomationService;
 
 import java.io.UnsupportedEncodingException;
-import java.util.List;
+import java.net.Inet4Address;
+import java.net.InetAddress;
+import java.net.NetworkInterface;
+import java.util.*;
+import java.util.stream.Collectors;
 
 
 public class InfoTest extends SpringTransactionalContextTests {
@@ -34,14 +39,22 @@ public class InfoTest extends SpringTransactionalContextTests {
 	@Autowired
 	private InfoService infoService;
 
-	@Autowired
-	private CmBrandLandingMapper cmBrandLandingMapper;
 
-	@Autowired
-	private CmCouponVipDao dao;
 
 	@Test
-	public void test(){
+	public void test() throws Exception{
+		// 本地ipv4
+		Enumeration<NetworkInterface> networkInterfaces = NetworkInterface.getNetworkInterfaces();
+		while (networkInterfaces.hasMoreElements()) {
+			NetworkInterface networkInterface = networkInterfaces.nextElement();
+			Enumeration<InetAddress> inetAddresses = networkInterface.getInetAddresses();
+			while (inetAddresses.hasMoreElements()) {
+				InetAddress inetAddress = inetAddresses.nextElement();
+				if (inetAddress instanceof Inet4Address && !inetAddress.isLoopbackAddress()) {
+					System.out.println("ipv4===="+inetAddress.getHostAddress());
+				}
+			}
+		}
 //		SMSUtils.sendSms(4, "17708413951", "【采美365】系统已为你分配机构客户,请及时跟进。机构名称【" + "newCmClub.getName()" + "】,联系人【" + "newCmClub.getLinkMan()" + "】,手机号【" + "15600000000" + "】,上一任销售【" + "etName()" + "】。");
 
 //		NewShopOrder cmShopOrderByShopOrderID = newShopOrderService.getCmShopOrderByShopOrderID("29352");
@@ -83,24 +96,36 @@ public class InfoTest extends SpringTransactionalContextTests {
 
 	}
 
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+	/**
+	 * ross 数据计算
+	 */
+	@Test
+	public void testOrgan() {
+		String[] region = {
+				"安徽省合肥市 联通                    ",
+				"河南省南阳市 移动                    "
+		};
+		List<String> list = Arrays.asList(region);
+		Set<String> province = new HashSet<>();
+		String com = "";
+		for (String str : list ) {
+			String trim = str.trim();
+			/*if (trim.contains("省")) {
+				com = trim.substring(0, trim.indexOf("省"));
+			} else if (!trim.contains("省") && trim.contains("市")) {
+				com = trim.substring(0, trim.indexOf("市"));
+			} else {
+				com = trim.substring(0, 2);
+			}*/
+			com = trim.substring(0, 2);
+			province.add(com);
+		}
+		Map<String, Integer> map = new HashMap<>();
+		for (String str : province) {
+			List<String> collect = list.stream().filter(pro -> pro.substring(0, 3).contains(str)).collect(Collectors.toList());
+			map.put(str, collect.size());
+		}
+		System.out.println(map);
+	}
 
 }