Commit bc55e647 by kangxiaoshan

流量查询方式更改

parent f5cf2cbd
......@@ -2,16 +2,7 @@ package common.repository;
import common.model.TkioFlowHistory;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;
import org.springframework.data.jpa.repository.Query;
import org.springframework.transaction.annotation.Transactional;
import java.math.BigDecimal;
public interface TkioFlowHistoryRepository extends JpaRepository<TkioFlowHistory, Long> {
@Transactional
@Modifying
@Query(value = " insert into tkio_flow_history select * from tkio_flow where email = ?1 and cost_flow > 0 ", nativeQuery = true)
void backDatasByEmail(String email);
}
package tkio.service;
import java.math.BigInteger;
import java.util.List;
public interface FlowService {
BigInteger getFlowByAccount(String yesterday, String yesterday1, List<String> appkeys);
}
package tkio.service.impl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;
import org.springframework.jdbc.core.JdbcTemplate;
import org.springframework.jdbc.core.namedparam.NamedParameterJdbcTemplate;
import org.springframework.stereotype.Service;
import tkio.service.FlowService;
import java.math.BigInteger;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@Service
public class FlowServiceImpl implements FlowService {
@Autowired
@Qualifier("tikoTemplate")
JdbcTemplate etlJdbcTemplate;
@Override
public BigInteger getFlowByAccount(String startDate, String pastDate, List<String> appkeys) {
NamedParameterJdbcTemplate nameJdbc = new NamedParameterJdbcTemplate(etlJdbcTemplate);
String sql = " SELECT sum(click_num+ IFNULL(num_impression,0)) as click_sum FROM tkio.measures_trackingio_new " +
" WHERE appid in (:appids ) AND ds>= :startdate and ds<= :enddate ";
Map param = new HashMap();
param.put("appids", appkeys);
param.put("startdate", startDate);
param.put("enddate", pastDate);
return nameJdbc.queryForObject(sql, param, BigInteger.class);
}
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment