|
@@ -573,7 +573,9 @@ public class SunDataServiceImpl implements SunDataService {
|
|
|
.insertDate(dateStr)
|
|
|
.build());
|
|
|
//重新 渠道-日期 历史天的累计
|
|
|
- computerChanelDateRecharge(sunChannel, static_date);
|
|
|
+ if (static_date.equals(dateStr)) {
|
|
|
+ computerChanelDateRecharge(sunChannel, static_date);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
SunStaticIncomeChannel sunStaticIncomeChannel = new SunStaticIncomeChannel();
|
|
@@ -595,9 +597,10 @@ public class SunDataServiceImpl implements SunDataService {
|
|
|
sunStaticIncomeChannel.setUpdateTime(new Date());
|
|
|
|
|
|
sunStaticIncomeChannelMapper.insert(sunStaticIncomeChannel);
|
|
|
- }
|
|
|
-
|
|
|
|
|
|
+ // 再统计当天的
|
|
|
+ computerChanelDateRecharge(sunChannel, dateStr);
|
|
|
+ }
|
|
|
|
|
|
//再统计当天,group 渠道即可
|
|
|
HashMap<String, String> incomeMap = sun2Mapper.selectIncomeCount(dateStr);
|
|
@@ -608,9 +611,9 @@ public class SunDataServiceImpl implements SunDataService {
|
|
|
sunStaticIncome.setNewFollowCount(getIntFromDb(incomeMap.get("new_follow_count")));
|
|
|
sunStaticIncome.setNewRechargeSum(String.format("%.2f", getFloatFromDb(incomeMap.get("new_recharge_sum"))));
|
|
|
sunStaticIncome.setAllSpend(String.format("%.2f", getFloatFromDb(incomeMap.get("all_spend"))));
|
|
|
- sunStaticIncome.setFirstRoi("");
|
|
|
+ sunStaticIncome.setFirstRoi(""); // setNewRechargeSum / setAllSpend
|
|
|
sunStaticIncome.setAllRecharge(String.format("%.2f", getFloatFromDb(incomeMap.get("all_recharge"))));
|
|
|
- sunStaticIncome.setAllRoi("");
|
|
|
+ sunStaticIncome.setAllRoi(""); // setAllRecharge / setAllSpend
|
|
|
sunStaticIncome.setInsertTime(new Date());
|
|
|
sunStaticIncome.setUpdateTime(new Date());
|
|
|
sunStaticIncomeMapper.insert(sunStaticIncome);
|
|
@@ -647,9 +650,14 @@ public class SunDataServiceImpl implements SunDataService {
|
|
|
private void computerChanelDateRecharge(SunChannel sunChannel, String static_date) {
|
|
|
SunStaticIncomeChannel sunStaticIncomeChannel = sunStaticIncomeChannelMapper.selectOneByExample(SunStaticIncomeChannelExample.newAndCreateCriteria().andStaticDateEqualTo(static_date).andChannelIdEqualTo(sunChannel.getChannelId()).example());
|
|
|
if (sunStaticIncomeChannel == null) {
|
|
|
+ log.error("没有找到历史统计数据:" + sunChannel.getChannelId() + "--" + static_date);
|
|
|
return;
|
|
|
}
|
|
|
- sunStaticIncomeChannel.setAllRecharge(sun2Mapper.selectIncomeRechargeByChannel(static_date, sunChannel.getChannelId()));
|
|
|
+ String s = sun2Mapper.selectIncomeRechargeByChannel(static_date, sunChannel.getChannelId());
|
|
|
+ if (s == null) {
|
|
|
+ s = "0";
|
|
|
+ }
|
|
|
+ sunStaticIncomeChannel.setAllRecharge(s);
|
|
|
// todo 需要更新ROI
|
|
|
sunStaticIncomeChannelMapper.updateByPrimaryKeySelective(sunStaticIncomeChannel, SunStaticIncomeChannel.Column.allRecharge);
|
|
|
}
|
|
@@ -662,9 +670,14 @@ public class SunDataServiceImpl implements SunDataService {
|
|
|
private void computerDateRecharge(String static_date) {
|
|
|
SunStaticIncome sunStaticIncome = sunStaticIncomeMapper.selectOneByExample(SunStaticIncomeExample.newAndCreateCriteria().andStaticDateEqualTo(static_date).example());
|
|
|
if (sunStaticIncome == null) {
|
|
|
+ log.error("没有找到历史统计数据:" + static_date);
|
|
|
return;
|
|
|
}
|
|
|
- sunStaticIncome.setAllRecharge(sun2Mapper.selectIncomeRecharge(static_date));
|
|
|
+ String s = sun2Mapper.selectIncomeRecharge(static_date);
|
|
|
+ if (s == null) {
|
|
|
+ s = "0";
|
|
|
+ }
|
|
|
+ sunStaticIncome.setAllRecharge(s);
|
|
|
// todo 需要更新ROI
|
|
|
sunStaticIncomeMapper.updateByPrimaryKeySelective(sunStaticIncome, SunStaticIncome.Column.allRecharge);
|
|
|
}
|