fix bug
This commit is contained in:
+26
@@ -0,0 +1,26 @@
|
||||
package com.fangjia.job.common.util;
|
||||
|
||||
import java.math.BigDecimal;
|
||||
|
||||
public class DataUtil {
|
||||
|
||||
public static double getDoubleRound(int scale, double dSource) {
|
||||
BigDecimal deSource = new BigDecimal(dSource);
|
||||
return deSource.setScale(scale, BigDecimal.ROUND_HALF_UP).doubleValue();
|
||||
}
|
||||
|
||||
/**
|
||||
* 求最大公约数
|
||||
* @param m
|
||||
* @param n
|
||||
* @return
|
||||
*/
|
||||
public static int divisor(int m,int n) {
|
||||
if (m % n == 0) {
|
||||
return n;
|
||||
} else {
|
||||
return divisor(n,m % n);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
||||
import com.cxytiandi.jdbc.util.PageBean;
|
||||
import com.dangdang.ddframe.job.api.ShardingContext;
|
||||
import com.dangdang.ddframe.job.api.simple.SimpleJob;
|
||||
import com.fangjia.job.common.util.DataUtil;
|
||||
import com.fangjia.job.common.util.DingDingMessageUtil;
|
||||
import com.fangjia.job.fsh.document.UserStat;
|
||||
import com.fangjia.job.fsh.po.EnterpriseProductUser;
|
||||
@@ -104,7 +105,8 @@ public class UserStatJob implements SimpleJob {
|
||||
stat.setRegion(user.getRegion());
|
||||
}
|
||||
stat.setHouseCount(houseInfoService.queryCountByEidAndUid(eid, uid));
|
||||
stat.setHousePrice(houseInfoService.querySumMoneyByEidAndUid(eid, uid));
|
||||
Double totalPrice = houseInfoService.querySumMoneyByEidAndUid(eid, uid);
|
||||
stat.setHousePrice(totalPrice > 0 ? DataUtil.getDoubleRound(2, totalPrice) : totalPrice);
|
||||
stat.setSubstitutionCount(houseSubstitutionService.queryCount(eid, uid));
|
||||
stat.setSubstitutionMaxPrice(houseSubstitutionService.queryMaxBudget(eid, uid));
|
||||
stat.setLoanEvalCount(loanApplyService.queryUserCountByType(eid, uid, 2));
|
||||
|
||||
+14
-5
@@ -150,7 +150,7 @@ public class CustomerStatServiceImpl implements CustomerStatService {
|
||||
// 判断是否超过指定浏览次数,浏览次数是所有页面的PV
|
||||
if (financiaFilterConfig.getAllPageVisit() > 0) {
|
||||
long pv = visitLogService.queryPvCountByUser(eid, uid, start, end);
|
||||
if (pv <= financiaFilterConfig.getAllPageVisit()) {
|
||||
if (pv > financiaFilterConfig.getAllPageVisit()) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -158,7 +158,7 @@ public class CustomerStatServiceImpl implements CustomerStatService {
|
||||
// 判断房产数量(含删除)的套数
|
||||
if (financiaFilterConfig.getHouseCount() > 0) {
|
||||
long houseCount = houseInfoService.queryAllCountByEidAndUid(eid, uid);
|
||||
if (houseCount <= financiaFilterConfig.getHouseCount()) {
|
||||
if (houseCount > financiaFilterConfig.getHouseCount()) {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
@@ -281,8 +281,8 @@ public class CustomerStatServiceImpl implements CustomerStatService {
|
||||
// 配置了最近分析时间才需要根据时间去查询PV
|
||||
String start = "";
|
||||
String end = "";
|
||||
if (financiaFilterConfig.getAnalyTime() > 0) {
|
||||
Map<String, String> timeMap = DateUtilCustom.getLatelyDate(financiaFilterConfig.getAnalyTime());
|
||||
if (config.getAnalyTime() > 0) {
|
||||
Map<String, String> timeMap = DateUtilCustom.getLatelyDate(config.getAnalyTime());
|
||||
start = timeMap.get("start");
|
||||
end = timeMap.get("end");
|
||||
}
|
||||
@@ -361,7 +361,10 @@ public class CustomerStatServiceImpl implements CustomerStatService {
|
||||
// 企业下的用户数量
|
||||
long enterpriseUserCount = enterpriseProductUserService.queryUserCount(eid);
|
||||
long level = houseInfoService.queryHouseTotalPriceLevel(eid, uid);
|
||||
double rate = new BigDecimal((double)enterpriseUserCount/level).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
|
||||
if (enterpriseUserCount == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
double rate = new BigDecimal((double)level/enterpriseUserCount).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
|
||||
return rate;
|
||||
}
|
||||
|
||||
@@ -386,6 +389,9 @@ public class CustomerStatServiceImpl implements CustomerStatService {
|
||||
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");
|
||||
long pvCount = visitLogService.queryPvCountByUser(eid, uid, uriList, start, end);
|
||||
if (pvCount == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
double rate = new BigDecimal((double)adClickCount/pvCount).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
|
||||
return rate;
|
||||
}
|
||||
@@ -402,6 +408,9 @@ public class CustomerStatServiceImpl implements CustomerStatService {
|
||||
long adClickCount = adVisitLogService.queryPvCount(eid, uid, Arrays.asList(4), start, end);
|
||||
List<String> uriList = Arrays.asList("/changeHouse/details");
|
||||
long pvCount = visitLogService.queryPvCountByUser(eid, uid, uriList, start, end);
|
||||
if (pvCount == 0) {
|
||||
return 0.0;
|
||||
}
|
||||
double rate = new BigDecimal((double)adClickCount/pvCount).setScale(2, BigDecimal.ROUND_HALF_UP).doubleValue() * 100;
|
||||
return rate;
|
||||
}
|
||||
|
||||
+2
-2
@@ -94,14 +94,14 @@ public class HouseInfoServiceImpl extends EntityService<HouseInfo> implements Ho
|
||||
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 });
|
||||
return super.count(sql.toString(), 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) {
|
||||
if (sum == null) {
|
||||
return 0L;
|
||||
}
|
||||
return sum;
|
||||
|
||||
Reference in New Issue
Block a user