|
@@ -5254,10 +5254,10 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
//订单结束时间默认为消耗结束时间
|
|
|
dto.setOrderEndDate(dto.getCostEndDate());
|
|
|
//获取前一天
|
|
|
- LocalDate twoDaysAgo = dto.getCostEndDate().minusDays(1);
|
|
|
+ LocalDate oneDaysAgo = dto.getCostEndDate().minusDays(1);
|
|
|
//如果前一天在消耗开始之后或等于,那么就将订单开始时间设置为前一天
|
|
|
- if(twoDaysAgo.isEqual(dto.getCostBeginDate())||twoDaysAgo.isAfter(dto.getCostBeginDate())){
|
|
|
- dto.setOrderBeginDate(twoDaysAgo);
|
|
|
+ if(oneDaysAgo.isEqual(dto.getCostBeginDate())||oneDaysAgo.isAfter(dto.getCostBeginDate())){
|
|
|
+ dto.setOrderBeginDate(oneDaysAgo);
|
|
|
}else {
|
|
|
dto.setOrderBeginDate(dto.getCostEndDate());
|
|
|
}
|
|
@@ -5271,8 +5271,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
//渠道单独的查询条件
|
|
|
Criteria agentCri = getAgentQueryStr(dto);
|
|
|
|
|
|
- //昨日总充值金额查询条件
|
|
|
- Criteria yesterdayTotalAmountCri = getYesterdayTotalAmountQueryStr(dto);
|
|
|
+
|
|
|
|
|
|
//查询总记录数
|
|
|
Sql countSql = Sqls.create(getCountNumSql(cri,agentCri));
|
|
@@ -5281,7 +5280,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
pager.setRecordCount(countSql.getInt());
|
|
|
|
|
|
//查询sql
|
|
|
- Sql sql = Sqls.create(flowMonitorSql(cri,agentCri,yesterdayTotalAmountCri));
|
|
|
+ Sql sql = Sqls.create(flowMonitorSql(cri,agentCri));
|
|
|
//设置自定义回传类型
|
|
|
sql.setCallback(Sqls.callback.entities());
|
|
|
sql.setEntity(dao.getEntity(FlowMonitorVO.class));
|
|
@@ -5321,49 +5320,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
|
|
|
}
|
|
|
|
|
|
- /**
|
|
|
- * 昨日总充值金额查询条件
|
|
|
- * @param dto
|
|
|
- * @return
|
|
|
- */
|
|
|
- private Criteria getYesterdayTotalAmountQueryStr(FlowMonitorDTO dto) {
|
|
|
- Criteria cri = Cnd.cri();
|
|
|
|
|
|
- //SDK类型
|
|
|
- if (StringUtils.isNotBlank(dto.getSourceSystem())) {
|
|
|
- cri.where().andEquals("source_system", dto.getSourceSystem());
|
|
|
- }
|
|
|
-
|
|
|
- String gameColumn = "game_id";
|
|
|
- if (dto.getGameDimension() != 1) {
|
|
|
- gameColumn = "parent_game_id";
|
|
|
- }
|
|
|
-
|
|
|
- //拼接游戏ID
|
|
|
- if (CollectionUtils.isNotEmpty(dto.getGameId())) {
|
|
|
- cri.where().andInList(gameColumn, dto.getGameId());
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
- if(dto.getCostBeginDate()!=null && dto.getCostEndDate()!=null){
|
|
|
- cri.where().andBetween("to_date(reg_time)", dto.getCostBeginDate(), dto.getCostEndDate());
|
|
|
- }
|
|
|
-
|
|
|
- //拼接投手ID
|
|
|
- if (CollectionUtils.isNotEmpty(dto.getPitcherId())) {
|
|
|
- cri.where().andInList("pitcher_id", dto.getPitcherId());
|
|
|
- }
|
|
|
- //拼接渠道ID
|
|
|
- if (CollectionUtils.isNotEmpty(dto.getAgentId())) {
|
|
|
- cri.where().andInList("agent_id", dto.getAgentId());
|
|
|
- }
|
|
|
- //拼接广告账号id
|
|
|
- if (CollectionUtils.isNotEmpty(dto.getAccountId())) {
|
|
|
- cri.where().andInList("account_id", dto.getAccountId());
|
|
|
- }
|
|
|
-
|
|
|
- return cri;
|
|
|
- }
|
|
|
|
|
|
|
|
|
public Double getCostCount(FlowMonitorDTO dto){
|
|
@@ -5434,6 +5391,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
game_id,
|
|
|
account_type
|
|
|
from game_dw.dw_agent_day
|
|
|
+ """ + agentCri + """
|
|
|
group by source_system, dt, pitcher_id, agent_id,account_id, game_id, account_type
|
|
|
) a left join (
|
|
|
select
|
|
@@ -5609,7 +5567,6 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
) f
|
|
|
group by day, source_system
|
|
|
) ab
|
|
|
- """+ agentCri +"""
|
|
|
order by day desc
|
|
|
|
|
|
|
|
@@ -5693,7 +5650,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
* @param cri 条件
|
|
|
* @return sql
|
|
|
*/
|
|
|
- public String flowMonitorSql(Criteria cri,Criteria agentCri,Criteria yesterdayTotalAmountCri){
|
|
|
+ public String flowMonitorSql(Criteria cri,Criteria agentCri){
|
|
|
|
|
|
String sql = """
|
|
|
select day as order_date,
|
|
@@ -5731,6 +5688,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
game_id,
|
|
|
account_type
|
|
|
from game_dw.dw_agent_day
|
|
|
+ """+ agentCri +"""
|
|
|
group by source_system, dt, pitcher_id, agent_id,account_id, game_id, account_type
|
|
|
) a left join (
|
|
|
select
|
|
@@ -5806,7 +5764,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
account_type,
|
|
|
sum(amount) yesterday_amount -- 昨日
|
|
|
from game_dw.dw_order_day_amount
|
|
|
- """ + yesterdayTotalAmountCri + """
|
|
|
+ """ + cri + """
|
|
|
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))
|
|
@@ -5896,7 +5854,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
account_type,
|
|
|
sum(amount) yesterday_amount -- 昨日
|
|
|
from game_dw.dw_order_day_amount
|
|
|
- """ + yesterdayTotalAmountCri + """
|
|
|
+ """ + cri + """
|
|
|
and order_agent_id = 0
|
|
|
group by source_system, day, pitcher_id, order_agent_id, account_id, parent_game_id,
|
|
|
account_type) e
|
|
@@ -5907,7 +5865,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
) f
|
|
|
group by day, source_system
|
|
|
) ab
|
|
|
- """+ agentCri +"""
|
|
|
+
|
|
|
order by day desc
|
|
|
|
|
|
""";
|
|
@@ -5942,7 +5900,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
|
|
|
//拼接查询时间
|
|
|
if (dto.getOrderBeginDate() != null && dto.getOrderEndDate() != null) {
|
|
|
- cri.where().andBetween("day", dto.getOrderBeginDate(), dto.getOrderEndDate());
|
|
|
+ cri.where().andBetween("dt", dto.getOrderBeginDate(), dto.getOrderEndDate());
|
|
|
}
|
|
|
|
|
|
|
|
@@ -5990,7 +5948,7 @@ public class GameDataServiceImpl implements IGameDataService {
|
|
|
if (dto.getOrderBeginDate() != null && dto.getOrderEndDate() != null) {
|
|
|
cri.where().andBetween("day", dto.getOrderBeginDate(), dto.getOrderEndDate());
|
|
|
}
|
|
|
-
|
|
|
+ //消耗时间
|
|
|
if(dto.getCostBeginDate()!=null && dto.getCostEndDate()!=null){
|
|
|
cri.where().andBetween("to_date(reg_time)", dto.getCostBeginDate(), dto.getCostEndDate());
|
|
|
}
|