修改投放压缩

master
wjt 1 year ago
parent 313b87eca3
commit fd0a728489

@ -14,9 +14,9 @@ import java.util.List;
public interface TbBDNewBackdataEntityRepository extends JpaRepository<TbBdNewBackdataEntity, Long> { public interface TbBDNewBackdataEntityRepository extends JpaRepository<TbBdNewBackdataEntity, Long> {
/** /**
* *
*
* @param imeiStrFirst * @param imeiStrFirst
* @param imeiSecond * @param imeiSecond
* @param startDate * @param startDate
@ -29,6 +29,6 @@ public interface TbBDNewBackdataEntityRepository extends JpaRepository<TbBdNewBa
"and gmtCreate >= :startDate and gmtCreate < :endDate and tag in :tag group by imei,tag") "and gmtCreate >= :startDate and gmtCreate < :endDate and tag in :tag group by imei,tag")
List<PlateFormDTO> queryPlateFormDTO(@Param("imeiStrFirst") String imeiStrFirst, @Param("imeiSecond") String imeiSecond, @Param("startDate") DateTime startDate, @Param("endDate") DateTime endDate, @Param("tag") List<String> tag); List<PlateFormDTO> queryPlateFormDTO(@Param("imeiStrFirst") String imeiStrFirst, @Param("imeiSecond") String imeiSecond, @Param("startDate") DateTime startDate, @Param("endDate") DateTime endDate, @Param("tag") List<String> tag);
@Query(value = "SELECT * FROM tb_bd_new_backdata WHERE imei != '' AND imei != '__imei__' AND gmt_create > ?1 AND gmt_create < ?2", nativeQuery = true) @Query("SELECT t FROM TbBdNewBackdataEntity t WHERE t.imei != '' AND t.imei != '__imei__' AND t.gmtCreate > ?1 AND t.gmtCreate < ?2")
List<TbBdNewBackdataEntity> queryByDate(String startDate, String endDate); List<TbBdNewBackdataEntity> queryByDate(DateTime startDate, DateTime endDate);
} }

@ -30,6 +30,6 @@ public interface TbGdtNewBackdataEntityRepository extends JpaRepository<TbGdtNew
"and gmtCreate >= :startDate and gmtCreate < :endDate and tag in :tag and deviceOsType = :models group by imei,tag") "and gmtCreate >= :startDate and gmtCreate < :endDate and tag in :tag and deviceOsType = :models group by imei,tag")
List<PlateFormDTO> queryPlateFormDTO(@Param("imeiStrFirst") String imeiStrFirst, @Param("imeiSecond") String imeiSecond, @Param("startDate") DateTime startDate, @Param("endDate") DateTime endDate, @Param("tag") List<String> tag, @Param("models") String models); List<PlateFormDTO> queryPlateFormDTO(@Param("imeiStrFirst") String imeiStrFirst, @Param("imeiSecond") String imeiSecond, @Param("startDate") DateTime startDate, @Param("endDate") DateTime endDate, @Param("tag") List<String> tag, @Param("models") String models);
@Query(value = "SELECT * FROM tb_gdt_new_backdata WHERE imei != '' AND imei != '__imei__' AND gmt_create > ?1 AND gmt_create < ?2", nativeQuery = true) @Query("SELECT t FROM TbGdtNewBackdataEntity t WHERE t.imei != '' AND t.imei != '__imei__' AND t.gmtCreate > ?1 AND t.gmtCreate < ?2")
List<TbGdtNewBackdataEntity> queryByDate(String startDate, String endDate); List<TbGdtNewBackdataEntity> queryByDate(DateTime startDate, DateTime endDate);
} }

@ -37,8 +37,8 @@ public interface TbJLV1BackdataEntityRepository extends JpaRepository<TbJLBackDa
"and gmtCreate >= :startDate and gmtCreate < :endDate and tag in :tag group by imei,tag") "and gmtCreate >= :startDate and gmtCreate < :endDate and tag in :tag group by imei,tag")
List<PlateFormDTO> queryPlateFormDTO(@Param("imeiStrFirst") String imeiStrFirst, @Param("imeiSecond") String imeiSecond, @Param("startDate") DateTime startDate, @Param("endDate") DateTime endDate, @Param("tag") List<String> tag); List<PlateFormDTO> queryPlateFormDTO(@Param("imeiStrFirst") String imeiStrFirst, @Param("imeiSecond") String imeiSecond, @Param("startDate") DateTime startDate, @Param("endDate") DateTime endDate, @Param("tag") List<String> tag);
@Query(value = "SELECT * FROM tb_jl_v1_backdata WHERE imei != '' AND imei != '__IMEI__' AND gmt_create > ?1 AND gmt_create < ?2", nativeQuery = true) @Query("SELECT t FROM TbJLBackDataV1Entity t WHERE t.imei != '' AND t.imei != '__IMEI__' AND t.gmtCreate > ?1 AND t.gmtCreate < ?2")
List<TbJLBackDataV1Entity> queryByDate(String startDate, String endDate); List<TbJLBackDataV1Entity> queryByDate(DateTime startDate, DateTime endDate);
List<TbJLBackDataV1Entity> queryBytag(String s); List<TbJLBackDataV1Entity> queryBytag(String s);
} }

@ -21,8 +21,8 @@ public interface TbJLV2BackdataEntityRepository extends JpaRepository<TbJLBackDa
@Query(value = "SELECT imei FROM tb_jl_v2_backdata WHERE imei != '' AND imei != '__IMEI__' AND gmt_create > :startDate AND gmt_create < :endDate", nativeQuery = true) @Query(value = "SELECT imei FROM tb_jl_v2_backdata WHERE imei != '' AND imei != '__IMEI__' AND gmt_create > :startDate AND gmt_create < :endDate", nativeQuery = true)
List<String> queryAllImeiByDate(Date startDate, Date endDate); List<String> queryAllImeiByDate(Date startDate, Date endDate);
@Query(value = "SELECT * FROM tb_jl_v2_backdata WHERE imei != '' AND imei != '__IMEI__' AND gmt_create > ?1 AND gmt_create < ?2", nativeQuery = true) @Query("SELECT t FROM TbJLBackDataV2Entity t WHERE t.imei != '' AND t.imei != '__IMEI__' AND t.gmtCreate > ?1 AND t.gmtCreate < ?2")
List<TbJLBackDataV2Entity> queryByDate(String startDate, String endDate); List<TbJLBackDataV2Entity> queryByDate(DateTime startDate, DateTime endDate);
/** /**
* *

@ -29,6 +29,6 @@ public interface TbKSNewBackdataEntityRepository extends JpaRepository<TbKSNewBa
"and gmtCreate >= :startDate and gmtCreate < :endDate and tag in :tag group by imei,tag") "and gmtCreate >= :startDate and gmtCreate < :endDate and tag in :tag group by imei,tag")
List<PlateFormDTO> queryPlateFormDTO(@Param("imeiStrFirst") String imeiStrFirst, @Param("imeiSecond") String imeiSecond, @Param("startDate") DateTime startDate, @Param("endDate") DateTime endDate, @Param("tag") List<String> tag); List<PlateFormDTO> queryPlateFormDTO(@Param("imeiStrFirst") String imeiStrFirst, @Param("imeiSecond") String imeiSecond, @Param("startDate") DateTime startDate, @Param("endDate") DateTime endDate, @Param("tag") List<String> tag);
@Query(value = "SELECT * FROM tb_ks_new_backdata WHERE imei != '' AND imei != '__imei__' AND gmt_create > ?1 AND gmt_create < ?2", nativeQuery = true) @Query("SELECT t FROM TbKSNewBackdataEntity t WHERE t.imei != '' AND t.imei != '__imei__' AND t.gmtCreate > ?1 AND t.gmtCreate < ?2")
List<TbKSNewBackdataEntity> queryByDate(String startDate, String endDate); List<TbKSNewBackdataEntity> queryByDate(DateTime startDate, DateTime endDate);
} }

@ -2,6 +2,7 @@ package com.baiyee.adcallback.task;
import cn.hutool.core.collection.CollUtil; import cn.hutool.core.collection.CollUtil;
import cn.hutool.core.convert.Convert; import cn.hutool.core.convert.Convert;
import cn.hutool.core.date.DateTime;
import cn.hutool.core.date.DateUtil; import cn.hutool.core.date.DateUtil;
import cn.hutool.core.text.csv.CsvWriter; import cn.hutool.core.text.csv.CsvWriter;
import cn.hutool.core.util.RandomUtil; import cn.hutool.core.util.RandomUtil;
@ -56,13 +57,13 @@ public class TfSourceTask {
@Transactional(rollbackFor = Exception.class) @Transactional(rollbackFor = Exception.class)
public void tfSource() { public void tfSource() {
log.info("++++++++++++++++++++++TfSource Sync start time {} ++++++++++++++++", DateUtil.now()); log.info("++++++++++++++++++++++TfSource Sync start time {} ++++++++++++++++", DateUtil.now());
String startTime = DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd 00:00:00"); DateTime startTime = DateUtil.beginOfDay(DateUtil.yesterday());
String endTime = DateUtil.format(DateUtil.yesterday(), "yyyy-MM-dd 23:59:59"); DateTime endTime = DateUtil.endOfDay(DateUtil.yesterday());
List<TfSourceDTO> list = new ArrayList<>(); List<TfSourceDTO> list = new ArrayList<>();
//jlv2
obtainDateByJlV2(startTime, endTime, list);
//jlv1 //jlv1
obtainDateByJlv1(startTime, endTime, list); obtainDateByJlv1(startTime, endTime, list);
//jlv2
obtainDateByJlV2(startTime, endTime, list);
//gdt //gdt
obtainDateByGdt(startTime, endTime, list); obtainDateByGdt(startTime, endTime, list);
//ks //ks
@ -100,7 +101,7 @@ public class TfSourceTask {
* @param list * @param list
*/ */
private String generateFile(String tag, String format, String password, List<TfSourceDTO> list) { private String generateFile(String tag, String format, String password, List<TfSourceDTO> list) {
String filePath = path + format; String filePath = path + File.separator + format;
File file = new File(filePath + File.separator + tag + ".csv"); File file = new File(filePath + File.separator + tag + ".csv");
CsvWriter writer = new CsvWriter(file, StandardCharsets.UTF_8); CsvWriter writer = new CsvWriter(file, StandardCharsets.UTF_8);
writer.writeBeans(list); writer.writeBeans(list);
@ -140,7 +141,7 @@ public class TfSourceTask {
return null; return null;
} }
private void obtainDateByJlV2(String startTime, String endTime, List<TfSourceDTO> list) { private void obtainDateByJlV2(DateTime startTime, DateTime endTime, List<TfSourceDTO> list) {
List<TbJLBackDataV2Entity> jlV2Data = tbJLV2BackdataEntityRepository.queryByDate(startTime, endTime); List<TbJLBackDataV2Entity> jlV2Data = tbJLV2BackdataEntityRepository.queryByDate(startTime, endTime);
if (CollUtil.isNotEmpty(jlV2Data)) { if (CollUtil.isNotEmpty(jlV2Data)) {
List<TfSourceDTO> tfSourceDTOS = Convert.toList(TfSourceDTO.class, jlV2Data); List<TfSourceDTO> tfSourceDTOS = Convert.toList(TfSourceDTO.class, jlV2Data);
@ -148,7 +149,7 @@ public class TfSourceTask {
} }
} }
private void obtainDateByJlv1(String startTime, String endTime, List<TfSourceDTO> list) { private void obtainDateByJlv1(DateTime startTime, DateTime endTime, List<TfSourceDTO> list) {
List<TbJLBackDataV1Entity> jlV1Data = tbJLV1BackdataEntityRepository.queryByDate(startTime, endTime); List<TbJLBackDataV1Entity> jlV1Data = tbJLV1BackdataEntityRepository.queryByDate(startTime, endTime);
if (CollUtil.isNotEmpty(jlV1Data)) { if (CollUtil.isNotEmpty(jlV1Data)) {
List<TfSourceDTO> tfSourceDTOS = Convert.toList(TfSourceDTO.class, jlV1Data); List<TfSourceDTO> tfSourceDTOS = Convert.toList(TfSourceDTO.class, jlV1Data);
@ -156,7 +157,7 @@ public class TfSourceTask {
} }
} }
private void obtainDateByGdt(String startTime, String endTime, List<TfSourceDTO> list) { private void obtainDateByGdt(DateTime startTime, DateTime endTime, List<TfSourceDTO> list) {
List<TbGdtNewBackdataEntity> jlV2Data = tbGdtNewBackdataEntityRepository.queryByDate(startTime, endTime); List<TbGdtNewBackdataEntity> jlV2Data = tbGdtNewBackdataEntityRepository.queryByDate(startTime, endTime);
if (CollUtil.isNotEmpty(jlV2Data)) { if (CollUtil.isNotEmpty(jlV2Data)) {
List<TfSourceDTO> tfSourceDTOS = Convert.toList(TfSourceDTO.class, jlV2Data); List<TfSourceDTO> tfSourceDTOS = Convert.toList(TfSourceDTO.class, jlV2Data);
@ -164,7 +165,7 @@ public class TfSourceTask {
} }
} }
private void obtainDateByKs(String startTime, String endTime, List<TfSourceDTO> list) { private void obtainDateByKs(DateTime startTime, DateTime endTime, List<TfSourceDTO> list) {
List<TbKSNewBackdataEntity> jlV2Data = tbKSNewBackdataEntityRepository.queryByDate(startTime, endTime); List<TbKSNewBackdataEntity> jlV2Data = tbKSNewBackdataEntityRepository.queryByDate(startTime, endTime);
if (CollUtil.isNotEmpty(jlV2Data)) { if (CollUtil.isNotEmpty(jlV2Data)) {
List<TfSourceDTO> tfSourceDTOS = Convert.toList(TfSourceDTO.class, jlV2Data); List<TfSourceDTO> tfSourceDTOS = Convert.toList(TfSourceDTO.class, jlV2Data);
@ -172,7 +173,7 @@ public class TfSourceTask {
} }
} }
private void obtainDateByBd(String startTime, String endTime, List<TfSourceDTO> list) { private void obtainDateByBd(DateTime startTime, DateTime endTime, List<TfSourceDTO> list) {
List<TbBdNewBackdataEntity> jlV2Data = tbBDNewBackdataEntityRepository.queryByDate(startTime, endTime); List<TbBdNewBackdataEntity> jlV2Data = tbBDNewBackdataEntityRepository.queryByDate(startTime, endTime);
if (CollUtil.isNotEmpty(jlV2Data)) { if (CollUtil.isNotEmpty(jlV2Data)) {
List<TfSourceDTO> tfSourceDTOS = Convert.toList(TfSourceDTO.class, jlV2Data); List<TfSourceDTO> tfSourceDTOS = Convert.toList(TfSourceDTO.class, jlV2Data);

@ -58,7 +58,7 @@ spring:
type: com.alibaba.druid.pool.DruidDataSource type: com.alibaba.druid.pool.DruidDataSource
# 数据库驱动类名 # 数据库驱动类名
driver-class-name: com.mysql.cj.jdbc.Driver driver-class-name: com.mysql.cj.jdbc.Driver
url: jdbc:mysql://localhost:3306/db_ad?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&rewriteBatchedStatements=true url: jdbc:mysql://localhost:3306/db_ad1?serverTimezone=Asia/Shanghai&useUnicode=true&characterEncoding=utf8&useSSL=false&rewriteBatchedStatements=true
username: root username: root
password: Yuyou@2020 password: Yuyou@2020
# 规则配置 # 规则配置

Loading…
Cancel
Save