|
@@ -5367,14 +5367,18 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
sum(fourteen_amount) as fourteen_amount,
|
|
|
sum(seventeen_amount) as seventeen_amount,
|
|
|
sum(twentyfour_amount)as twentyfour_amount,
|
|
|
- sum(yesterday_amount) as yesterday_amount
|
|
|
+ (
|
|
|
+ select sum(amount) twentyfour_amount
|
|
|
+ from game_dw.dw_order_day_amount
|
|
|
+ """+yesterdayTotalAmountCri+"""
|
|
|
+ AND day=adddate(f.day,-1)
|
|
|
+ ) as yesterday_amount
|
|
|
from (select a.source_system,
|
|
|
a.day,
|
|
|
ifnull(b.ten_amount, 0) ten_amount,
|
|
|
ifnull(c.fourteen_amount, 0) fourteen_amount,
|
|
|
ifnull(d.seventeen_amount, 0) seventeen_amount,
|
|
|
- ifnull(x.twentyfour_amount, 0) twentyfour_amount,
|
|
|
- ifnull(e.yesterday_amount, 0) yesterday_amount
|
|
|
+ ifnull(x.twentyfour_amount, 0) twentyfour_amount
|
|
|
from (
|
|
|
select source_system,
|
|
|
dt as day,
|
|
@@ -5452,21 +5456,6 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
account_type) d
|
|
|
on a.source_system = d.source_system and a.day = d.day and a.agent_id = d.order_agent_id
|
|
|
and a.game_id=d.parent_game_id
|
|
|
- left join (select source_system,
|
|
|
- day,
|
|
|
- pitcher_id,
|
|
|
- order_agent_id,
|
|
|
- account_id,
|
|
|
- parent_game_id,
|
|
|
- account_type,
|
|
|
- sum(amount) yesterday_amount, -- 昨日
|
|
|
- game_id
|
|
|
- from game_dw.dw_order_day_amount
|
|
|
- group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
|
|
|
- account_type,game_id) e
|
|
|
- on a.source_system = e.source_system and a.day = Date(adddate(e.day, 1))
|
|
|
- and a.agent_id = e.order_agent_id
|
|
|
- and a.game_id=e.parent_game_id
|
|
|
"""
|
|
|
+ subGameSql +
|
|
|
"""
|
|
@@ -5477,8 +5466,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
ifnull(b.ten_amount, 0) ten_amount,
|
|
|
ifnull(c.fourteen_amount, 0) fourteen_amount,
|
|
|
ifnull(d.seventeen_amount, 0) seventeen_amount,
|
|
|
- ifnull(a.twentyfour_amount, 0) twentyfour_amount,
|
|
|
- ifnull(e.yesterday_amount, 0) yesterday_amount
|
|
|
+ ifnull(a.twentyfour_amount, 0) twentyfour_amount
|
|
|
from (
|
|
|
select
|
|
|
source_system,
|
|
@@ -5544,22 +5532,6 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
account_type) d
|
|
|
on a.source_system = d.source_system and a.day = d.day and a.order_agent_id = d.order_agent_id
|
|
|
and a.parent_game_id=d.parent_game_id
|
|
|
- left join (select source_system,
|
|
|
- day,
|
|
|
- pitcher_id,
|
|
|
- order_agent_id,
|
|
|
- account_id,
|
|
|
- parent_game_id,
|
|
|
- account_type,
|
|
|
- sum(amount) yesterday_amount -- 昨日
|
|
|
- from game_dw.dw_order_day_amount
|
|
|
- """ + yesterdayTotalAmountCri +"""
|
|
|
- and order_agent_id = 0
|
|
|
- group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
|
|
|
- account_type) e
|
|
|
- on a.source_system = e.source_system and a.day = Date(adddate(e.day, 1))
|
|
|
- and a.order_agent_id = e.order_agent_id
|
|
|
- and a.parent_game_id=e.parent_game_id
|
|
|
) f
|
|
|
group by day, source_system
|
|
|
) ab
|
|
@@ -5598,14 +5570,18 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
sum(fourteen_amount) as fourteen_amount,
|
|
|
sum(seventeen_amount) as seventeen_amount,
|
|
|
sum(twentyfour_amount)as twentyfour_amount,
|
|
|
- sum(yesterday_amount) as yesterday_amount
|
|
|
+ (
|
|
|
+ select sum(amount) twentyfour_amount
|
|
|
+ from game_dw.dw_order_day_amount
|
|
|
+ """+yesterdayTotalAmountCri+"""
|
|
|
+ AND day=adddate(f.day,-1)
|
|
|
+ ) as yesterday_amount
|
|
|
from (select a.source_system,
|
|
|
a.day,
|
|
|
ifnull(b.ten_amount, 0) ten_amount,
|
|
|
ifnull(c.fourteen_amount, 0) fourteen_amount,
|
|
|
ifnull(d.seventeen_amount, 0) seventeen_amount,
|
|
|
- ifnull(x.twentyfour_amount, 0) twentyfour_amount,
|
|
|
- ifnull(e.yesterday_amount, 0) yesterday_amount
|
|
|
+ ifnull(x.twentyfour_amount, 0) twentyfour_amount
|
|
|
from (
|
|
|
select source_system,
|
|
|
dt as day,
|
|
@@ -5683,23 +5659,6 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
account_type) d
|
|
|
on a.source_system = d.source_system and a.day = d.day and a.agent_id = d.order_agent_id
|
|
|
and a.game_id=d.parent_game_id
|
|
|
- left join (select source_system,
|
|
|
- day,
|
|
|
- pitcher_id,
|
|
|
- order_agent_id,
|
|
|
- account_id,
|
|
|
- parent_game_id,
|
|
|
- account_type,
|
|
|
- sum(amount) yesterday_amount, -- 昨日
|
|
|
- game_id
|
|
|
- from game_dw.dw_order_day_amount
|
|
|
- """ + yesterdayTotalAmountCri + """
|
|
|
- group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
|
|
|
- account_type,game_id) e
|
|
|
- on a.source_system = e.source_system and a.day = Date(adddate(e.day, 1))
|
|
|
- and a.agent_id = e.order_agent_id
|
|
|
- and a.game_id=e.parent_game_id
|
|
|
-
|
|
|
"""
|
|
|
+ subGameSql +
|
|
|
"""
|
|
@@ -5712,8 +5671,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
ifnull(b.ten_amount, 0) ten_amount,
|
|
|
ifnull(c.fourteen_amount, 0) fourteen_amount,
|
|
|
ifnull(d.seventeen_amount, 0) seventeen_amount,
|
|
|
- ifnull(a.twentyfour_amount, 0) twentyfour_amount,
|
|
|
- ifnull(e.yesterday_amount, 0) yesterday_amount
|
|
|
+ ifnull(a.twentyfour_amount, 0) twentyfour_amount
|
|
|
from (
|
|
|
select
|
|
|
source_system,
|
|
@@ -5779,23 +5737,6 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
account_type) d
|
|
|
on a.source_system = d.source_system and a.day = d.day and a.order_agent_id = d.order_agent_id
|
|
|
and a.parent_game_id=d.parent_game_id
|
|
|
- left join (select source_system,
|
|
|
- day,
|
|
|
- pitcher_id,
|
|
|
- order_agent_id,
|
|
|
- account_id,
|
|
|
- parent_game_id,
|
|
|
- account_type,
|
|
|
- sum(amount) yesterday_amount -- 昨日
|
|
|
- from game_dw.dw_order_day_amount
|
|
|
- """ + yesterdayTotalAmountCri + """
|
|
|
- and order_agent_id = 0
|
|
|
- group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
|
|
|
- account_type) e
|
|
|
- on a.source_system = e.source_system and a.day = Date(adddate(e.day, 1))
|
|
|
- and a.order_agent_id = e.order_agent_id
|
|
|
- and a.parent_game_id=e.parent_game_id
|
|
|
-
|
|
|
) f
|
|
|
group by day, source_system
|
|
|
) ab
|
|
@@ -5820,6 +5761,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
cri.where().andEquals("source_system", dto.getSourceSystem());
|
|
|
}
|
|
|
|
|
|
+
|
|
|
String gameColumn = "game_id";
|
|
|
if (dto.getGameDimension() != 1) {
|
|
|
gameColumn = "parent_game_id";
|