add code
This commit is contained in:
+41
-3
@@ -32,6 +32,9 @@ public class CustomerStatServiceImpl implements CustomerStatService {
|
|||||||
@Autowired
|
@Autowired
|
||||||
private AdVisitLogService adVisitLogService;
|
private AdVisitLogService adVisitLogService;
|
||||||
|
|
||||||
|
@Autowired
|
||||||
|
private EnterpriseProductUserService enterpriseProductUserService;
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void removeCustomerStat(Long eid, String uid) {
|
public void removeCustomerStat(Long eid, String uid) {
|
||||||
Query query = Query.query(Criteria.where("eid").is(eid).and("uid").is(uid));
|
Query query = Query.query(Criteria.where("eid").is(eid).and("uid").is(uid));
|
||||||
@@ -144,10 +147,45 @@ public class CustomerStatServiceImpl implements CustomerStatService {
|
|||||||
if (adClickRate <= config.getAdClickRate()) {
|
if (adClickRate <= config.getAdClickRate()) {
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// 判断房产分析PV
|
||||||
|
if (visitLogService.queryPvCountByUser(eid, uid, Arrays.asList("/fsh/result"), start, end) <= config.getHouseAnalyPv()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 判断出售分析PV
|
||||||
|
if (visitLogService.queryPvCountByUser(eid, uid, Arrays.asList("/saleAnalysis/analysisDetail"), start, end) <= config.getSaleAnalyPv()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 判断出租管理PV
|
||||||
|
if (visitLogService.queryPvCountByUser(eid, uid, Arrays.asList("/rent/index"), start, end) <= config.getRentManagerPv()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 判断房产数量
|
||||||
|
if (houseInfoService.queryCountByEidAndUid(eid, uid) <= config.getHouseCountRank()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
// 判断房产价值排名
|
||||||
|
if (this.getHousePriceLevel(eid, uid) <= config.getHousePriceRank()) {
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
return i;
|
||||||
}
|
}
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 获取用户房产价值排名<br>
|
||||||
|
* 所有的有效房产数量总价值 这个企业下的用户的总价值排名 = 自己的总价值的排名/总人数
|
||||||
|
* @param eid
|
||||||
|
* @param uid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private double getHousePriceLevel(Long eid, String uid) {
|
||||||
|
// 企业下的用户数量
|
||||||
|
long enterpriseUserCount = enterpriseProductUserService.queryUserCount(eid);
|
||||||
|
long level = houseInfoService.queryHouseTotalPriceLevel(eid, uid);
|
||||||
|
return level / enterpriseUserCount * 100.0;
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取用户理财广告点击率<br>
|
* 获取用户理财广告点击率<br>
|
||||||
* 点击率=广告点击次数/广告位页面PV
|
* 点击率=广告点击次数/广告位页面PV
|
||||||
@@ -159,8 +197,8 @@ public class CustomerStatServiceImpl implements CustomerStatService {
|
|||||||
*
|
*
|
||||||
* 页面:
|
* 页面:
|
||||||
* 1、房产分析 /fsh/result
|
* 1、房产分析 /fsh/result
|
||||||
* 2、出租管理 /saleAnalysis/analysisDetail
|
* 2、出租管理 /rent/index
|
||||||
* 3、出售分析 /rent/index
|
* 3、出售分析 /saleAnalysis/analysisDetail
|
||||||
* @param eid
|
* @param eid
|
||||||
* @param uid
|
* @param uid
|
||||||
* @return
|
* @return
|
||||||
@@ -169,7 +207,7 @@ public class CustomerStatServiceImpl implements CustomerStatService {
|
|||||||
long adClickCount = adVisitLogService.queryPvCount(eid, uid, Arrays.asList(0, 1, 2, 3), start, end);
|
long adClickCount = adVisitLogService.queryPvCount(eid, uid, Arrays.asList(0, 1, 2, 3), start, end);
|
||||||
List<String> uriList = Arrays.asList("/fsh/result", "/saleAnalysis/analysisDetail", "/rent/index");
|
List<String> uriList = Arrays.asList("/fsh/result", "/saleAnalysis/analysisDetail", "/rent/index");
|
||||||
long pvCount = visitLogService.queryPvCountByUser(eid, uid, uriList, start, end);
|
long pvCount = visitLogService.queryPvCountByUser(eid, uid, uriList, start, end);
|
||||||
double rate = adClickCount / pvCount * 1.0;
|
double rate = adClickCount / pvCount * 100.0;
|
||||||
return rate;
|
return rate;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+16
@@ -76,4 +76,20 @@ public interface HouseInfoService {
|
|||||||
*/
|
*/
|
||||||
Map<String, Long> queryHouseCountGroupByCity(Long eid, int limit);
|
Map<String, Long> queryHouseCountGroupByCity(Long eid, int limit);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 用户所有有效房产总价值排名
|
||||||
|
* @param eid
|
||||||
|
* @param uid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
long queryHouseTotalPriceLevel(Long eid, String uid);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询用户有效房产总价值
|
||||||
|
* @param eid
|
||||||
|
* @param uid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Long queryUserHouseTotalPrice(Long eid, String uid);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
+26
@@ -81,4 +81,30 @@ public class HouseInfoServiceImpl extends EntityService<HouseInfo> implements Ho
|
|||||||
return super.count(new String[] { "eid", "uid" }, new Object[] { eid, uid });
|
return super.count(new String[] { "eid", "uid" }, new Object[] { eid, uid });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 按用户分组查询出总价值,降序排序,然后根据当前用户自己的总价值,查询在它之上的有多少位,来算出排名
|
||||||
|
* @param eid
|
||||||
|
* @param uid
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
|
public long queryHouseTotalPriceLevel(Long eid, String uid) {
|
||||||
|
Long totalPrice = this.queryUserHouseTotalPrice(eid, uid);
|
||||||
|
StringBuilder sql = new StringBuilder();
|
||||||
|
sql.append("select count(*) from");
|
||||||
|
sql.append(" (select uid,SUM(total_price) as total_price from house_info where eid = ? and remove_status = 0 GROUP BY uid ORDER BY total_price desc ) as t");
|
||||||
|
sql.append(" where t.total_price >= ?");
|
||||||
|
return super.count(new String[] { "eid", "uid" }, new Object[] { eid, totalPrice });
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Long queryUserHouseTotalPrice(Long eid, String uid) {
|
||||||
|
String sql = "select sum(total_price) from house_info where eid = ? and uid = ? and remove_status = 0";
|
||||||
|
Long sum = super.getJdbcTemplate().queryForObject(sql, Long.class, new Object[] { eid, uid });
|
||||||
|
if (sum == 0) {
|
||||||
|
return 0L;
|
||||||
|
}
|
||||||
|
return sum;
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user