package com.imooc.ad.sender.index;
import com.alibaba.fastjson.JSON;
import com.imooc.ad.dump.table.AdCreativeTable;
import com.imooc.ad.dump.table.AdCreativeUnitTable;
import com.imooc.ad.dump.table.AdPlanTable;
import com.imooc.ad.dump.table.AdUnitDistrictTable;
import com.imooc.ad.dump.table.AdUnitItTable;
import com.imooc.ad.dump.table.AdUnitKeywordTable;
import com.imooc.ad.dump.table.AdUnitTable;
import com.imooc.ad.handler.AdLevelDataHandler;
import com.imooc.ad.index.DataLevel;
import com.imooc.ad.mysql.constant.Constant;
import com.imooc.ad.mysql.dto.MySqlRowData;
import com.imooc.ad.sender.ISender;
import com.imooc.ad.utils.CommonUtils;
import lombok.extern.slf4j.Slf4j;
import org.springframework.stereotype.Component;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* Created by Qinyi.
*/
@Slf4j
@Component("indexSender")
public class IndexSender implements ISender {
@Override
public void sender(MySqlRowData rowData) {
String level = rowData.getLevel();
if (DataLevel.LEVEL2.getLevel().equals(level)) {
Level2RowData(rowData);
} else if (DataLevel.LEVEL3.getLevel().equals(level)) {
Level3RowData(rowData);
} else if (DataLevel.LEVEL4.getLevel().equals(level)) {
Level4RowData(rowData);
} else {
log.error("MysqlRowData ERROR: {}", JSON.toJSONString(rowData));
}
}
private void Level2RowData(MySqlRowData rowData) {
if (rowData.getTableName().equals(
Constant.AD_PLAN_TABLE_INFO.TABLE_NAME)) {
List<AdPlanTable> planTables = new ArrayList<>();
for (Map<String, String> fieldValueMap :
rowData.getFieldValueMap()) {
AdPlanTable planTable = new AdPlanTable();
fieldValueMap.forEach((k, v) -> {
switch (k) {
case Constant.AD_PLAN_TABLE_INFO.COLUMN_ID:
planTable.setId(Long.valueOf(v));
break;
case Constant.AD_PLAN_TABLE_INFO.COLUMN_USER_ID:
planTable.setUserId(Long.valueOf(v));
break;
case Constant.AD_PLAN_TABLE_INFO.COLUMN_PLAN_STATUS:
planTable.setPlanStatus(Integer.valueOf(v));
break;
case Constant.AD_PLAN_TABLE_INFO.COLUMN_START_DATE:
planTable.setStartDate(
CommonUtils.parseStringDate(v)
);
break;
case Constant.AD_PLAN_TABLE_INFO.COLUMN_END_DATE:
planTable.setEndDate(
CommonUtils.parseStringDate(v)
);
break;
}
});
planTables.add(planTable);
}
planTables.forEach(p ->
AdLevelDataHandler.handleLevel2(p, rowData.getOpType()));
} else if (rowData.getTableName().equals(
Constant.AD_CREATIVE_TABLE_INFO.TABLE_NAME
)) {
List<AdCreativeTable> creativeTables = new ArrayList<>();
for (Map<String, String> fieldValeMap :
rowData.getFieldValueMap()) {
AdCreativeTable creativeTable = new AdCreativeTable();
fieldValeMap.forEach((k, v) -> {
switch (k) {
case Constant.AD_CREATIVE_TABLE_INFO.COLUMN_ID:
creativeTable.setAdId(Long.valueOf(v));
break;
case Constant.AD_CREATIVE_TABLE_INFO.COLUMN_TYPE:
creativeTable.setType(Integer.valueOf(v));
break;
case Constant.AD_CREATIVE_TABLE_INFO.COLUMN_MATERIAL_TYPE:
creativeTable.setMaterialType(Integer.valueOf(v));
break;
case Constant.AD_CREATIVE_TABLE_INFO.COLUMN_HEIGHT:
creativeTable.setHeight(Integer.valueOf(v));
break;
case Constant.AD_CREATIVE_TABLE_INFO.COLUMN_WIDTH:
creativeTable.setWidth(Integer.valueOf(v));
break;
case Constant.AD_CREATIVE_TABLE_INFO.COLUMN_AUDIT_STATUS:
creativeTable.setAuditStatus(Integer.valueOf(v));
break;
case Constant.AD_CREATIVE_TABLE_INFO.COLUMN_URL:
creativeTable.setAdUrl(v);
break;
}
});
creativeTables.add(creativeTable);
}
creativeTables.forEach(c ->
AdLevelDataHandler.handleLevel2(c, rowData.getOpType()));
}
}
private void Level3RowData(MySqlRowData rowData) {
if (rowData.getTableName().equals(
Constant.AD_UNIT_TABLE_INFO.TABLE_NAME)) {
List<AdUnitTable> unitTables = new ArrayList<>();
for (Map<String, String> fieldValueMap :
rowData.getFieldValueMap()) {
AdUnitTable unitTable = new AdUnitTable();
fieldValueMap.forEach((k, v) -> {
switch (k) {
case Constant.AD_UNIT_TABLE_INFO.COLUMN_ID:
unitTable.setUnitId(Long.valueOf(v));
break;
case Constant.AD_UNIT_TABLE_INFO.COLUMN_UNIT_STATUS:
unitTable.setUnitStatus(Integer.valueOf(v));
break;
case Constant.AD_UNIT_TABLE_INFO.COLUMN_POSITION_TYPE:
unitTable.setPositionType(Integer.valueOf(v));
break;
case Constant.AD_UNIT_TABLE_INFO.COLUMN_PLAN_ID:
unitTable.setPlanId(Long.valueOf(v));
break;
}
});
unitTables.add(unitTable);
}
unitTables.forEach(u ->
AdLevelDataHandler.handleLevel3(u, rowData.getOpType()));
} else if (rowData.getTableName().equals(
Constant.AD_CREATIVE_UNIT_TABLE_INFO.TABLE_NAME
)) {
List<AdCreativeUnitTable> creativeUnitTables = new ArrayList<>();
for (Map<String, String> fieldValueMap :
rowData.getFieldValueMap()) {
AdCreativeUnitTable creativeUnitTable = new AdCreativeUnitTable();
fieldValueMap.forEach((k, v) -> {
switch (k) {
case Constant.AD_CREATIVE_UNIT_TABLE_INFO.COLUMN_CREATIVE_ID:
creativeUnitTable.setAdId(Long.valueOf(v));
break;
case Constant.AD_CREATIVE_UNIT_TABLE_INFO.COLUMN_UNIT_ID:
creativeUnitTable.setUnitId(Long.valueOf(v));
break;
}
});
creativeUnitTables.add(creativeUnitTable);
}
creativeUnitTables.forEach(
u -> AdLevelDataHandler.handleLevel3(u, rowData.getOpType())
);
}
}
private void Level4RowData(MySqlRowData rowData) {
switch (rowData.getTableName()) {
case Constant.AD_UNIT_DISTRICT_TABLE_INFO.TABLE_NAME:
List<AdUnitDistrictTable> districtTables = new ArrayList<>();
for (Map<String, String> fieldValueMap :
rowData.getFieldValueMap()) {
没有合适的资源?快使用搜索试试~ 我知道了~
cpa cpc广告系统.zip
共683个文件
xml:248个
class:159个
java:149个
需积分: 34 6 下载量 95 浏览量
2020-05-09
18:38:13
上传
评论
收藏 78.31MB ZIP 举报
温馨提示
DSP投放系统架构图平台核心要素 流量资源 不同的流量资源会有不同的效果,如何选择媒体和广告位是关键。平台上各种站点,频道,广告位
资源推荐
资源详情
资源评论
收起资源包目录
cpa cpc广告系统.zip (683个子文件)
DumpDataService.class 15KB
IndexSender.class 13KB
SearchImpl.class 12KB
AdUnitServiceImpl.class 11KB
Creative.class 8KB
AdLevelDataHandler.class 8KB
AggregationListener.class 8KB
CreativeRequest.class 6KB
AdUnit.class 6KB
AdPlan.class 6KB
SearchResponse$Creative.class 6KB
ParseTemplate.class 6KB
UnitDistrictIndex.class 6KB
TemplateHolder.class 6KB
IndexFileLoader.class 6KB
SearchTest.class 6KB
CreativeObject.class 5KB
AdUnitIndex.class 5KB
AdPlan.class 5KB
IncrementListener.class 5KB
AdCreativeTable.class 5KB
AdUnitObject.class 5KB
AdUser.class 5KB
UnitKeywordIndex.class 5KB
UnitItIndex.class 5KB
SearchRequest$RequestInfo.class 4KB
CreativeUnitIndex.class 4KB
AdSlot.class 4KB
Device.class 4KB
AdPlanServiceImpl.class 4KB
CreativeIndex.class 4KB
JsonTable.class 4KB
BinlogConfig.class 4KB
SearchRequest$FeatureInfo.class 4KB
TableTemplate.class 4KB
AdPlanRequest.class 4KB
AdPlanObject.class 4KB
MySqlRowData.class 4KB
AdUnitDistrict.class 4KB
CreateUserResponse.class 4KB
AdPlanTable.class 4KB
AdUnitRequest.class 3KB
CommonResponse.class 3KB
BinlogRowData.class 3KB
CommonUtils.class 3KB
BinlogClient.class 3KB
SearchRequest.class 3KB
MyProducer.class 3KB
AdUnitTable.class 3KB
AdUnitKeyword.class 3KB
CreativeUnit.class 3KB
AdUnitIt.class 3KB
MyConsumer.class 3KB
SearchResponse.class 3KB
Geo.class 3KB
App.class 3KB
AdUnitOPController.class 3KB
CommonResponseDataAdvice.class 3KB
SearchController.class 3KB
KafkaSender.class 3KB
AdUnitDistrictRequest$UnitDistrict.class 3KB
UnitDistrictObject.class 3KB
AdUnitDistrictTable.class 3KB
AdPlanGetRequest.class 3KB
AdPlanOPController.class 3KB
AdPlanIndex.class 3KB
Template.class 2KB
BinlogServiceTest.class 2KB
AdPlanGetRequest.class 2KB
UserServiceImpl.class 2KB
AdUnitKeywordRequest$UnitKeyword.class 2KB
CreativeUnitRequest$CreativeUnitItem.class 2KB
AdUnitItRequest$UnitIt.class 2KB
DistrictFeature$ProvinceAndCity.class 2KB
UnitKeywordObject.class 2KB
AdUnitKeywordTable.class 2KB
DistrictFeature.class 2KB
UnitItObject.class 2KB
AdUnitItTable.class 2KB
AdUnitDistrictRequest.class 2KB
CreativeUnitObject.class 2KB
AdUnitResponse.class 2KB
AdPlanResponse.class 2KB
AdUnitKeywordRequest.class 2KB
CreativeUnitRequest.class 2KB
AdCreativeUnitTable.class 2KB
CreativeResponse.class 2KB
AccessLogFilter.class 2KB
DataTable.class 2KB
AdUnitItRequest.class 2KB
KeywordFeature.class 2KB
AdUnitDistrictResponse.class 2KB
CreativeUnitResponse.class 2KB
AdUnitKeywordResponse.class 2KB
ItFeature.class 2KB
AdUnitItResponse.class 2KB
CustomPartitioner.class 2KB
CreateUserRequest.class 2KB
AdPlanServiceTest.class 2KB
JsonTable$Column.class 2KB
共 683 条
- 1
- 2
- 3
- 4
- 5
- 6
- 7
资源评论
死性丶卟改
- 粉丝: 0
- 资源: 2
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
最新资源
资源上传下载、课程学习等过程中有任何疑问或建议,欢迎提出宝贵意见哦~我们会及时处理!
点击此处反馈
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功