理财潜在客户分析
This commit is contained in:
+17
-1
@@ -56,7 +56,23 @@ public class DateUtilCustom {
|
|||||||
return map;
|
return map;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取近几天的时间范围
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
public static Map<String, String> getLatelyDate(int days) {
|
||||||
|
Map<String, String> map = new HashMap<String, String>();
|
||||||
|
DateTime dt = new DateTime();
|
||||||
|
// 昨天
|
||||||
|
DateTime yesterday = dt.minusDays(days);
|
||||||
|
String start = yesterday.toString("yyyy-MM-dd") + " 00:00:00";
|
||||||
|
String end = dt.toString("yyyy-MM-dd") + " 00:00:00";
|
||||||
|
map.put("start", start);
|
||||||
|
map.put("end", end);
|
||||||
|
return map;
|
||||||
|
}
|
||||||
|
|
||||||
public static void main(String[] args) {
|
public static void main(String[] args) {
|
||||||
getTopMonth();
|
System.err.println(JsonUtils.toJson(getLatelyDate(3)));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+151
@@ -0,0 +1,151 @@
|
|||||||
|
package com.fangjia.job.fsh.document;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import org.springframework.data.annotation.Id;
|
||||||
|
import org.springframework.data.mongodb.core.mapping.Field;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 理财和贷款潜客统计
|
||||||
|
* @author yinjihuan
|
||||||
|
*/
|
||||||
|
public class CustomerStat {
|
||||||
|
|
||||||
|
@Id
|
||||||
|
private String id;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 企业编号
|
||||||
|
*/
|
||||||
|
@Field(value="eid")
|
||||||
|
private Long eid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户ID
|
||||||
|
*/
|
||||||
|
@Field(value="uid")
|
||||||
|
private String uid;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 城市
|
||||||
|
*/
|
||||||
|
@Field(value="city")
|
||||||
|
private String city;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 区域
|
||||||
|
*/
|
||||||
|
@Field(value="region")
|
||||||
|
private String region;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房产总数量
|
||||||
|
*/
|
||||||
|
@Field(value="h_count")
|
||||||
|
private Long houseCount;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 房产总价格(万元)
|
||||||
|
*/
|
||||||
|
@Field(value="h_price")
|
||||||
|
private Double housePrice;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 等级
|
||||||
|
*/
|
||||||
|
@Field(value="level")
|
||||||
|
private int level;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 类型 1理财或者2贷款
|
||||||
|
*/
|
||||||
|
@Field(value="type")
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 创建时间
|
||||||
|
*/
|
||||||
|
@Field(value="c_date")
|
||||||
|
private Date createDate;
|
||||||
|
|
||||||
|
public String getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(String id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getEid() {
|
||||||
|
return eid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setEid(Long eid) {
|
||||||
|
this.eid = eid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getUid() {
|
||||||
|
return uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setUid(String uid) {
|
||||||
|
this.uid = uid;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getCity() {
|
||||||
|
return city;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCity(String city) {
|
||||||
|
this.city = city;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getRegion() {
|
||||||
|
return region;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRegion(String region) {
|
||||||
|
this.region = region;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getHouseCount() {
|
||||||
|
return houseCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHouseCount(Long houseCount) {
|
||||||
|
this.houseCount = houseCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Double getHousePrice() {
|
||||||
|
return housePrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHousePrice(Double housePrice) {
|
||||||
|
this.housePrice = housePrice;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getLevel() {
|
||||||
|
return level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setLevel(int level) {
|
||||||
|
this.level = level;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getCreateDate() {
|
||||||
|
return createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setCreateDate(Date createDate) {
|
||||||
|
this.createDate = createDate;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@@ -1,6 +1,7 @@
|
|||||||
package com.fangjia.job.fsh.document;
|
package com.fangjia.job.fsh.document;
|
||||||
|
|
||||||
import java.util.Date;
|
import java.util.Date;
|
||||||
|
|
||||||
import org.springframework.data.annotation.Id;
|
import org.springframework.data.annotation.Id;
|
||||||
import org.springframework.data.mongodb.core.mapping.Document;
|
import org.springframework.data.mongodb.core.mapping.Document;
|
||||||
import org.springframework.data.mongodb.core.mapping.Field;
|
import org.springframework.data.mongodb.core.mapping.Field;
|
||||||
|
|||||||
@@ -13,10 +13,15 @@ import com.dangdang.ddframe.job.api.simple.SimpleJob;
|
|||||||
import com.fangjia.job.common.util.DingDingMessageUtil;
|
import com.fangjia.job.common.util.DingDingMessageUtil;
|
||||||
import com.fangjia.job.fsh.document.UserStat;
|
import com.fangjia.job.fsh.document.UserStat;
|
||||||
import com.fangjia.job.fsh.po.EnterpriseProductUser;
|
import com.fangjia.job.fsh.po.EnterpriseProductUser;
|
||||||
|
import com.fangjia.job.fsh.po.FinancialCustomersConfig;
|
||||||
|
import com.fangjia.job.fsh.po.PotentialCustomersFilterConfig;
|
||||||
|
import com.fangjia.job.fsh.service.CustomerStatService;
|
||||||
import com.fangjia.job.fsh.service.EnterpriseProductUserService;
|
import com.fangjia.job.fsh.service.EnterpriseProductUserService;
|
||||||
|
import com.fangjia.job.fsh.service.FinancialCustomersConfigService;
|
||||||
import com.fangjia.job.fsh.service.HouseInfoService;
|
import com.fangjia.job.fsh.service.HouseInfoService;
|
||||||
import com.fangjia.job.fsh.service.HouseSubstitutionService;
|
import com.fangjia.job.fsh.service.HouseSubstitutionService;
|
||||||
import com.fangjia.job.fsh.service.LoanApplyService;
|
import com.fangjia.job.fsh.service.LoanApplyService;
|
||||||
|
import com.fangjia.job.fsh.service.PotentialCustomersFilterConfigService;
|
||||||
import com.fangjia.job.fsh.service.UserStatService;
|
import com.fangjia.job.fsh.service.UserStatService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -42,9 +47,25 @@ public class UserStatJob implements SimpleJob {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private LoanApplyService loanApplyService;
|
private LoanApplyService loanApplyService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private CustomerStatService customerStatService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private PotentialCustomersFilterConfigService potentialCustomersFilterConfigService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private FinancialCustomersConfigService financialCustomersConfigService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void execute(ShardingContext shardingContext) {
|
public void execute(ShardingContext shardingContext) {
|
||||||
logger.info("开始执行UserStatJob");
|
logger.info("开始执行UserStatJob");
|
||||||
|
// 理财潜客过滤条件
|
||||||
|
PotentialCustomersFilterConfig financiaFilterConfig = potentialCustomersFilterConfigService.get(1);
|
||||||
|
// 贷款潜客过滤条件
|
||||||
|
PotentialCustomersFilterConfig loanFilterConfig = potentialCustomersFilterConfigService.get(2);
|
||||||
|
// 理财潜客分析条件
|
||||||
|
List<FinancialCustomersConfig> financialCustomersList = financialCustomersConfigService.queryAll();
|
||||||
|
|
||||||
long total = enterpriseProductUserService.queryCount();
|
long total = enterpriseProductUserService.queryCount();
|
||||||
int pages = PageBean.calcPages(total, 1000);
|
int pages = PageBean.calcPages(total, 1000);
|
||||||
for (int i = 1; i <= pages; i++) {
|
for (int i = 1; i <= pages; i++) {
|
||||||
@@ -52,6 +73,9 @@ public class UserStatJob implements SimpleJob {
|
|||||||
for (EnterpriseProductUser user : users) {
|
for (EnterpriseProductUser user : users) {
|
||||||
try {
|
try {
|
||||||
processStat(user);
|
processStat(user);
|
||||||
|
|
||||||
|
// 理财和贷款潜客统计
|
||||||
|
customerStatService.customerStat(user, financiaFilterConfig, loanFilterConfig, financialCustomersList);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
logger.error("用户维度统计任务异常", e);
|
logger.error("用户维度统计任务异常", e);
|
||||||
DingDingMessageUtil.sendTextMessage("用户维度统计任务异常:" + e.getMessage());
|
DingDingMessageUtil.sendTextMessage("用户维度统计任务异常:" + e.getMessage());
|
||||||
|
|||||||
+148
@@ -0,0 +1,148 @@
|
|||||||
|
package com.fangjia.job.fsh.po;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.cxytiandi.jdbc.annotation.AutoId;
|
||||||
|
import com.cxytiandi.jdbc.annotation.Field;
|
||||||
|
import com.cxytiandi.jdbc.annotation.TableName;
|
||||||
|
|
||||||
|
@TableName(value = "financial_customers_config", author = "yinjihuan", desc = "理财潜在客户设置表")
|
||||||
|
public class FinancialCustomersConfig implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = -1463438428120590218L;
|
||||||
|
|
||||||
|
@AutoId
|
||||||
|
@Field(value="id", desc="ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Field(value="star_level", desc="星级(1就代表1星)")
|
||||||
|
private int starLevel;
|
||||||
|
|
||||||
|
@Field(value="analy_time", desc="分析时间(近N天)")
|
||||||
|
private int analyTime;
|
||||||
|
|
||||||
|
@Field(value="ad_click_rate", desc="理财广告点击率(大于%之多少)")
|
||||||
|
private int adClickRate;
|
||||||
|
|
||||||
|
@Field(value="house_count_rank", desc="房产数量排名(大于N套)")
|
||||||
|
private int houseCountRank;
|
||||||
|
|
||||||
|
@Field(value="house_price_rank", desc="房产价值排名(大于%之多少)")
|
||||||
|
private int housePriceRank;
|
||||||
|
|
||||||
|
@Field(value="house_analy_pv", desc="房产分析PV(大于多少)")
|
||||||
|
private int houseAnalyPv;
|
||||||
|
|
||||||
|
@Field(value="sale_analy_pv", desc="出售分析PV(大于多少)")
|
||||||
|
private int saleAnalyPv;
|
||||||
|
|
||||||
|
@Field(value="rent_manager_pv", desc="出租管理PV(大于多少)")
|
||||||
|
private int rentManagerPv;
|
||||||
|
|
||||||
|
@Field(value="modify_time", desc="修改时间")
|
||||||
|
private Date modifyTime;
|
||||||
|
|
||||||
|
@Field(value="modify_user", desc="修改用户ID")
|
||||||
|
private Long modifyUser;
|
||||||
|
|
||||||
|
@Field(value="house_level", desc="房产评级(1:豪宅级、2:公寓级、3:平房级、4:草屋级、5:山洞级)")
|
||||||
|
private int houseLevel;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getStarLevel() {
|
||||||
|
return starLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setStarLevel(int starLevel) {
|
||||||
|
this.starLevel = starLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAnalyTime() {
|
||||||
|
return analyTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnalyTime(int analyTime) {
|
||||||
|
this.analyTime = analyTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAdClickRate() {
|
||||||
|
return adClickRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAdClickRate(int adClickRate) {
|
||||||
|
this.adClickRate = adClickRate;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHouseCountRank() {
|
||||||
|
return houseCountRank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHouseCountRank(int houseCountRank) {
|
||||||
|
this.houseCountRank = houseCountRank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHousePriceRank() {
|
||||||
|
return housePriceRank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHousePriceRank(int housePriceRank) {
|
||||||
|
this.housePriceRank = housePriceRank;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHouseAnalyPv() {
|
||||||
|
return houseAnalyPv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHouseAnalyPv(int houseAnalyPv) {
|
||||||
|
this.houseAnalyPv = houseAnalyPv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getSaleAnalyPv() {
|
||||||
|
return saleAnalyPv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setSaleAnalyPv(int saleAnalyPv) {
|
||||||
|
this.saleAnalyPv = saleAnalyPv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getRentManagerPv() {
|
||||||
|
return rentManagerPv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setRentManagerPv(int rentManagerPv) {
|
||||||
|
this.rentManagerPv = rentManagerPv;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getModifyTime() {
|
||||||
|
return modifyTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModifyTime(Date modifyTime) {
|
||||||
|
this.modifyTime = modifyTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getModifyUser() {
|
||||||
|
return modifyUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModifyUser(Long modifyUser) {
|
||||||
|
this.modifyUser = modifyUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHouseLevel() {
|
||||||
|
return houseLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHouseLevel(int houseLevel) {
|
||||||
|
this.houseLevel = houseLevel;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+93
@@ -0,0 +1,93 @@
|
|||||||
|
package com.fangjia.job.fsh.po;
|
||||||
|
|
||||||
|
import java.io.Serializable;
|
||||||
|
import java.util.Date;
|
||||||
|
|
||||||
|
import com.cxytiandi.jdbc.annotation.AutoId;
|
||||||
|
import com.cxytiandi.jdbc.annotation.Field;
|
||||||
|
import com.cxytiandi.jdbc.annotation.TableName;
|
||||||
|
|
||||||
|
@TableName(value = "potential_customers_filter_config", author = "yinjihuan", desc = "贷款理财潜在客户过滤条件设置表")
|
||||||
|
public class PotentialCustomersFilterConfig implements Serializable {
|
||||||
|
|
||||||
|
private static final long serialVersionUID = 395735765985199357L;
|
||||||
|
|
||||||
|
@AutoId
|
||||||
|
@Field(value="id", desc="ID")
|
||||||
|
private Long id;
|
||||||
|
|
||||||
|
@Field(value="analy_time", desc="分析时间(近多少天)")
|
||||||
|
private int analyTime;
|
||||||
|
|
||||||
|
@Field(value="all_page_visit", desc="所有页面浏览(访问较频繁),大于多少次")
|
||||||
|
private int allPageVisit;
|
||||||
|
|
||||||
|
@Field(value="house_count", desc="房产数量,含删除(大于多少套)")
|
||||||
|
private int houseCount;
|
||||||
|
|
||||||
|
@Field(value="type", desc="类型(1:理财潜客设置 2:贷款潜客设置)")
|
||||||
|
private int type;
|
||||||
|
|
||||||
|
@Field(value="modify_time", desc="修改时间")
|
||||||
|
private Date modifyTime;
|
||||||
|
|
||||||
|
@Field(value="modify_user", desc="修改用户ID")
|
||||||
|
private Long modifyUser;
|
||||||
|
|
||||||
|
public Long getId() {
|
||||||
|
return id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setId(Long id) {
|
||||||
|
this.id = id;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAnalyTime() {
|
||||||
|
return analyTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAnalyTime(int analyTime) {
|
||||||
|
this.analyTime = analyTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getAllPageVisit() {
|
||||||
|
return allPageVisit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setAllPageVisit(int allPageVisit) {
|
||||||
|
this.allPageVisit = allPageVisit;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getHouseCount() {
|
||||||
|
return houseCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setHouseCount(int houseCount) {
|
||||||
|
this.houseCount = houseCount;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int getType() {
|
||||||
|
return type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setType(int type) {
|
||||||
|
this.type = type;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Date getModifyTime() {
|
||||||
|
return modifyTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModifyTime(Date modifyTime) {
|
||||||
|
this.modifyTime = modifyTime;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Long getModifyUser() {
|
||||||
|
return modifyUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setModifyUser(Long modifyUser) {
|
||||||
|
this.modifyUser = modifyUser;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+28
@@ -0,0 +1,28 @@
|
|||||||
|
package com.fangjia.job.fsh.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import com.fangjia.job.fsh.po.EnterpriseProductUser;
|
||||||
|
import com.fangjia.job.fsh.po.FinancialCustomersConfig;
|
||||||
|
import com.fangjia.job.fsh.po.PotentialCustomersFilterConfig;
|
||||||
|
|
||||||
|
public interface CustomerStatService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 删除潜在客户统计信息
|
||||||
|
* @param eid
|
||||||
|
* @param uid
|
||||||
|
*/
|
||||||
|
void removeCustomerStat(Long eid, String uid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 理财和贷款潜客统计
|
||||||
|
* @param user 用户信息
|
||||||
|
* @param financiaFilterConfig 理财潜客过滤条件
|
||||||
|
* @param loanFilterConfig 贷款潜客过滤条件
|
||||||
|
* @param financialCustomersList 理财潜客分析条件
|
||||||
|
*/
|
||||||
|
void customerStat(EnterpriseProductUser user, PotentialCustomersFilterConfig financiaFilterConfig,
|
||||||
|
PotentialCustomersFilterConfig loanFilterConfig, List<FinancialCustomersConfig> financialCustomersList);
|
||||||
|
|
||||||
|
}
|
||||||
+149
@@ -0,0 +1,149 @@
|
|||||||
|
package com.fangjia.job.fsh.service;
|
||||||
|
|
||||||
|
import java.util.Date;
|
||||||
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
|
import org.springframework.beans.factory.annotation.Autowired;
|
||||||
|
import org.springframework.data.mongodb.core.MongoTemplate;
|
||||||
|
import org.springframework.data.mongodb.core.query.Criteria;
|
||||||
|
import org.springframework.data.mongodb.core.query.Query;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
|
import com.fangjia.job.common.util.DateUtilCustom;
|
||||||
|
import com.fangjia.job.fsh.document.CustomerStat;
|
||||||
|
import com.fangjia.job.fsh.po.EnterpriseProductUser;
|
||||||
|
import com.fangjia.job.fsh.po.FinancialCustomersConfig;
|
||||||
|
import com.fangjia.job.fsh.po.PotentialCustomersFilterConfig;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class CustomerStatServiceImpl implements CustomerStatService {
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private MongoTemplate mongoTemplate;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private VisitLogService visitLogService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private HouseInfoService houseInfoService;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void removeCustomerStat(Long eid, String uid) {
|
||||||
|
Query query = Query.query(Criteria.where("eid").is(eid).and("uid").is(uid));
|
||||||
|
mongoTemplate.remove(query, CustomerStat.class);
|
||||||
|
}
|
||||||
|
|
||||||
|
/*
|
||||||
|
分析逻辑:
|
||||||
|
先过滤
|
||||||
|
|
||||||
|
从5星开始分析,如果满足了5星就这个用户就跳过了,否则接着分析4星,以此类推
|
||||||
|
|
||||||
|
理财潜客设置:
|
||||||
|
分析时间:下面条件的筛选时间
|
||||||
|
理财广告点击率:多个广告位的点击次数/页面的pv +分析时间
|
||||||
|
房产数量排名:所有的有效房产数量
|
||||||
|
房产价值排名:所有的有效房产数量总价值 这个企业下的用户的总价值排名 自己的总价值的排名/总人数
|
||||||
|
房产分析PV:房产分析结果页面的pv /fsh/result +分析时间
|
||||||
|
出售分析PV: 出售分析结果页面pv saleAnalysis/analysisDetail +分析时间
|
||||||
|
出租管理PV: 出租管理结果页面pv /rent/index +分析时间
|
||||||
|
房产评级,就是用户房产等级最高的一个
|
||||||
|
|
||||||
|
过滤条件:
|
||||||
|
(访问较频繁)所有页面浏览 改成次数 +分析时间
|
||||||
|
房产数量(含删除) 套数
|
||||||
|
|
||||||
|
贷款潜客设置:
|
||||||
|
|
||||||
|
贷款广告点击率:多个广告位的点击次数/页面的pv +分析时间
|
||||||
|
贷款评估次数
|
||||||
|
贷款评估PV /myLoan/loanStep /myLoan/result +分析时间
|
||||||
|
贷款申请PV /myLoan/info /myLoan/applyResult +分析时间
|
||||||
|
我要贷款首页PV /myLoan/index +分析时间
|
||||||
|
我要置换首页PV changeHouse/index +分析时间
|
||||||
|
出租管理PV /rent/index +分析时间
|
||||||
|
出售管理PV /saleAnalysis/analysisDetail +分析时间
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public void customerStat(EnterpriseProductUser user, PotentialCustomersFilterConfig financiaFilterConfig,
|
||||||
|
PotentialCustomersFilterConfig loanFilterConfig, List<FinancialCustomersConfig> financialCustomersList) {
|
||||||
|
Long eid = user.getEid();
|
||||||
|
String uid = user.getUid();
|
||||||
|
// 删除之前这个用户的统计数据,每天都是最新的
|
||||||
|
this.removeCustomerStat(eid, uid);
|
||||||
|
|
||||||
|
int level = this.getFinanciaCustomerLevel(eid, uid, financiaFilterConfig, financialCustomersList);
|
||||||
|
if (level > 0) {
|
||||||
|
CustomerStat stat = new CustomerStat();
|
||||||
|
stat.setEid(eid);
|
||||||
|
stat.setUid(uid);
|
||||||
|
stat.setCity(user.getCity());
|
||||||
|
stat.setRegion(user.getRegion());
|
||||||
|
stat.setHouseCount(houseInfoService.queryCountByEidAndUid(eid, uid));
|
||||||
|
stat.setHousePrice(houseInfoService.querySumMoneyByEidAndUid(eid, uid));
|
||||||
|
stat.setCreateDate(new Date());
|
||||||
|
stat.setType(1);
|
||||||
|
stat.setLevel(level);
|
||||||
|
mongoTemplate.save(stat);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
private int getFinanciaCustomerLevel(Long eid, String uid, PotentialCustomersFilterConfig financiaFilterConfig,
|
||||||
|
List<FinancialCustomersConfig> financialCustomersList) {
|
||||||
|
// 有过滤条件才做过滤
|
||||||
|
if (financiaFilterConfig != null) {
|
||||||
|
// 配置了最近分析时间才需要根据时间去查询PV
|
||||||
|
String start = "";
|
||||||
|
String end = "";
|
||||||
|
if (financiaFilterConfig.getAnalyTime() > 0) {
|
||||||
|
Map<String, String> timeMap = DateUtilCustom.getLatelyDate(financiaFilterConfig.getAnalyTime());
|
||||||
|
start = timeMap.get("start");
|
||||||
|
end = timeMap.get("end");
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断是否超过指定浏览次数,浏览次数是所有页面的PV
|
||||||
|
if (financiaFilterConfig.getAllPageVisit() > 0) {
|
||||||
|
long pv = visitLogService.queryPvCountByUser(eid, uid, start, end);
|
||||||
|
if (pv <= financiaFilterConfig.getAllPageVisit()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// 判断房产数量(含删除)的套数
|
||||||
|
if (financiaFilterConfig.getHouseCount() > 0) {
|
||||||
|
long houseCount = houseInfoService.queryAllCountByEidAndUid(eid, uid);
|
||||||
|
if (houseCount <= financiaFilterConfig.getHouseCount()) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
// 从5星开始分析,满足条件则继续下个用户的分析,不满足则继续4星的分析,以此类推
|
||||||
|
for (int i = 5; i <= 1; i--) {
|
||||||
|
FinancialCustomersConfig config = getFinancialCustomersConfig(i, financialCustomersList);
|
||||||
|
if (config == null) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取星级对应的理财客户分析条件
|
||||||
|
* @param level
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private FinancialCustomersConfig getFinancialCustomersConfig(int level, List<FinancialCustomersConfig> financialCustomersList) {
|
||||||
|
for (FinancialCustomersConfig config : financialCustomersList) {
|
||||||
|
if (level == config.getStarLevel()) {
|
||||||
|
return config;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+10
@@ -0,0 +1,10 @@
|
|||||||
|
package com.fangjia.job.fsh.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import com.fangjia.job.fsh.po.FinancialCustomersConfig;
|
||||||
|
|
||||||
|
public interface FinancialCustomersConfigService {
|
||||||
|
|
||||||
|
List<FinancialCustomersConfig> queryAll();
|
||||||
|
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
package com.fangjia.job.fsh.service;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.cxytiandi.jdbc.EntityService;
|
||||||
|
import com.fangjia.job.fsh.po.FinancialCustomersConfig;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class FinancialCustomersConfigServiceImpl extends EntityService<FinancialCustomersConfig> implements FinancialCustomersConfigService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public List<FinancialCustomersConfig> queryAll() {
|
||||||
|
return super.list();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+8
@@ -52,6 +52,14 @@ public interface HouseInfoService {
|
|||||||
*/
|
*/
|
||||||
long queryCountByEidAndUid(Long eid, String uid);
|
long queryCountByEidAndUid(Long eid, String uid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询企业下用户的房产数量(包含删除)
|
||||||
|
* @param eid
|
||||||
|
* @param uid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
long queryAllCountByEidAndUid(Long eid, String uid);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 查询企业下用户的房产总价值
|
* 查询企业下用户的房产总价值
|
||||||
* @param eid
|
* @param eid
|
||||||
|
|||||||
+5
@@ -76,4 +76,9 @@ public class HouseInfoServiceImpl extends EntityService<HouseInfo> implements Ho
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long queryAllCountByEidAndUid(Long eid, String uid) {
|
||||||
|
return super.count(new String[] { "eid", "uid" }, new Object[] { eid, uid });
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+14
@@ -0,0 +1,14 @@
|
|||||||
|
package com.fangjia.job.fsh.service;
|
||||||
|
|
||||||
|
import com.fangjia.job.fsh.po.PotentialCustomersFilterConfig;
|
||||||
|
|
||||||
|
public interface PotentialCustomersFilterConfigService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取潜在客户分析过滤参数
|
||||||
|
* @param type 类型(1:理财潜客设置 2:贷款潜客设置)
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
PotentialCustomersFilterConfig get(int type);
|
||||||
|
|
||||||
|
}
|
||||||
+15
@@ -0,0 +1,15 @@
|
|||||||
|
package com.fangjia.job.fsh.service;
|
||||||
|
|
||||||
|
import org.springframework.stereotype.Service;
|
||||||
|
import com.cxytiandi.jdbc.EntityService;
|
||||||
|
import com.fangjia.job.fsh.po.PotentialCustomersFilterConfig;
|
||||||
|
|
||||||
|
@Service
|
||||||
|
public class PotentialCustomersFilterConfigServiceImpl extends EntityService<PotentialCustomersFilterConfig> implements PotentialCustomersFilterConfigService {
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public PotentialCustomersFilterConfig get(int type) {
|
||||||
|
return super.getById("type", type);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
+7
@@ -40,4 +40,11 @@ public interface VisitLogService {
|
|||||||
*/
|
*/
|
||||||
long queryUvCount(Long eid, String start, String end);
|
long queryUvCount(Long eid, String start, String end);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户的所有页面的PV
|
||||||
|
* @param eid
|
||||||
|
* @param uid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
long queryPvCountByUser(Long eid, String uid, String start, String end);
|
||||||
}
|
}
|
||||||
|
|||||||
+21
@@ -1,6 +1,11 @@
|
|||||||
package com.fangjia.job.fsh.service;
|
package com.fangjia.job.fsh.service;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
import org.apache.commons.lang3.StringUtils;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
import com.cxytiandi.jdbc.EntityService;
|
import com.cxytiandi.jdbc.EntityService;
|
||||||
import com.fangjia.job.fsh.po.VisitLog;
|
import com.fangjia.job.fsh.po.VisitLog;
|
||||||
|
|
||||||
@@ -31,4 +36,20 @@ public class VisitLogServiceImpl extends EntityService<VisitLog> implements Visi
|
|||||||
return super.count(sql.toString(), new Object[] {eid, start, end});
|
return super.count(sql.toString(), new Object[] {eid, start, end});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public long queryPvCountByUser(Long eid, String uid, String start, String end) {
|
||||||
|
StringBuilder sql = new StringBuilder("select count(id) from visit_log where eid = ? and uid = ?");
|
||||||
|
|
||||||
|
List<Object> params = new ArrayList<Object>();
|
||||||
|
params.add(eid);
|
||||||
|
params.add(uid);
|
||||||
|
|
||||||
|
if (StringUtils.isNotBlank(start) && StringUtils.isNotBlank(end)) {
|
||||||
|
sql.append(" and visit_time between ? and ?");
|
||||||
|
params.add(start);
|
||||||
|
params.add(end);
|
||||||
|
}
|
||||||
|
return super.count(sql.toString(), params.toArray());
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user