|
@@ -35,134 +35,142 @@ public class NewMonitorServiceImpl implements NewMonitorService {
|
|
|
List<Map> kuaiShouCampaign = new ArrayList<>();
|
|
|
List<Map> TouTiaoCampaign = new ArrayList<>();
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd");
|
|
|
- /*--------------------快手广告组-----------------------*/
|
|
|
- if (type.equals("0")) {
|
|
|
- //查询创建不满7天的快手组信息
|
|
|
- kuaiShouGroup = newMonitorMapper.getKuaiShouGroup(sdf.format(new Date()));
|
|
|
- } else {
|
|
|
- //查询全量快手组信息
|
|
|
- kuaiShouGroup = newMonitorMapper.getKuaiShouGroup(null);
|
|
|
- }
|
|
|
- //处理快手组数据
|
|
|
- if (!kuaiShouGroup.isEmpty()) {
|
|
|
- kuaiShouGroup.stream().forEach(obj -> {
|
|
|
- if (obj != null) {
|
|
|
- String unitId = obj.get("unitId") == null ? null : String.valueOf(obj.get("unitId"));
|
|
|
- String afterTime = obj.get("afterTime") == null ? null : (String) obj.get("afterTime");
|
|
|
- String accountId = obj.get("accountId") == null ? null : String.valueOf(obj.get("accountId"));
|
|
|
- String accountName = obj.get("accountName") == null ? null : (String) obj.get("accountName");
|
|
|
- String userName = obj.get("userName") == null ? null : (String) obj.get("userName");
|
|
|
- String groupCreatTime = obj.get("groupCreatTime") == null ? null : (String) obj.get("groupCreatTime");
|
|
|
- if (unitId != null && afterTime != null) {
|
|
|
- String groupCharge = newMonitorMapper.getGroupCharge(unitId, afterTime);
|
|
|
- //大于500为有效广告组
|
|
|
- String effective = "0";
|
|
|
- if (groupCharge != null && Long.parseLong(groupCharge) > 500) {
|
|
|
- //有效
|
|
|
- effective = "1";
|
|
|
- }
|
|
|
- String effectiveResult = newMonitorMapper.getMonitorGroupByUnitId(unitId);
|
|
|
- //判断是否存在
|
|
|
- if (effectiveResult != null) {
|
|
|
- if (!effectiveResult.equals(effective)) {
|
|
|
- //存在更新
|
|
|
- newMonitorMapper.updateMonitorGroupByUnitId(unitId, effective);
|
|
|
+ List<Long> allAccountId = newMonitorMapper.getAllAccountId();
|
|
|
+ if (!allAccountId.isEmpty()) {
|
|
|
+ for (Long accId : allAccountId) {
|
|
|
+ if (accId != null) {
|
|
|
+ /*--------------------快手广告组-----------------------*/
|
|
|
+ if (type.equals("0")) {
|
|
|
+ //查询创建不满7天的快手组信息
|
|
|
+ kuaiShouGroup = newMonitorMapper.getKuaiShouGroup(sdf.format(new Date()), String.valueOf(accId));
|
|
|
+ } else {
|
|
|
+ //查询全量快手组信息
|
|
|
+ kuaiShouGroup = newMonitorMapper.getKuaiShouGroup(null, String.valueOf(accId));
|
|
|
+ }
|
|
|
+ //处理快手组数据
|
|
|
+ if (!kuaiShouGroup.isEmpty()) {
|
|
|
+ kuaiShouGroup.stream().forEach(obj -> {
|
|
|
+ if (obj != null) {
|
|
|
+ String unitId = obj.get("unitId") == null ? null : String.valueOf(obj.get("unitId"));
|
|
|
+ String afterTime = obj.get("afterTime") == null ? null : (String) obj.get("afterTime");
|
|
|
+ String accountId = obj.get("accountId") == null ? null : String.valueOf(obj.get("accountId"));
|
|
|
+ String accountName = obj.get("accountName") == null ? null : (String) obj.get("accountName");
|
|
|
+ String userName = obj.get("userName") == null ? null : (String) obj.get("userName");
|
|
|
+ String groupCreatTime = obj.get("groupCreatTime") == null ? null : (String) obj.get("groupCreatTime");
|
|
|
+ if (unitId != null && afterTime != null) {
|
|
|
+ String groupCharge = newMonitorMapper.getGroupCharge(unitId, afterTime);
|
|
|
+ //大于500为有效广告组
|
|
|
+ String effective = "0";
|
|
|
+ if (groupCharge != null && Long.parseLong(groupCharge) > 500) {
|
|
|
+ //有效
|
|
|
+ effective = "1";
|
|
|
+ }
|
|
|
+ String effectiveResult = newMonitorMapper.getMonitorGroupByUnitId(unitId);
|
|
|
+ //判断是否存在
|
|
|
+ if (effectiveResult != null) {
|
|
|
+ if (!effectiveResult.equals(effective)) {
|
|
|
+ //存在更新
|
|
|
+ newMonitorMapper.updateMonitorGroupByUnitId(unitId, effective);
|
|
|
+ }
|
|
|
+
|
|
|
+ } else {
|
|
|
+ //不存在插入
|
|
|
+ newMonitorMapper.saveMonitorGroup(accountId, accountName, userName, unitId, groupCreatTime, "1", effective);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
-
|
|
|
- } else {
|
|
|
- //不存在插入
|
|
|
- newMonitorMapper.saveMonitorGroup(accountId, accountName, userName, unitId, groupCreatTime, "1", effective);
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
|
|
|
- /*---------------快手广告计划------------------*/
|
|
|
- if (type.equals("0")) {
|
|
|
- //查询创建不满7天的快手广告计划
|
|
|
- kuaiShouCampaign = newMonitorMapper.getKuaiShouCampaign(sdf.format(new Date()));
|
|
|
- } else {
|
|
|
- //查询全量快手广告计划
|
|
|
- kuaiShouCampaign = newMonitorMapper.getKuaiShouCampaign(null);
|
|
|
- }
|
|
|
- //处理快手广告计划数据
|
|
|
- if (!kuaiShouCampaign.isEmpty()) {
|
|
|
- kuaiShouCampaign.stream().forEach(obj -> {
|
|
|
- if (obj != null) {
|
|
|
- String campaignId = obj.get("campaignId") == null ? null : String.valueOf(obj.get("campaignId"));
|
|
|
- String afterTime = obj.get("afterTime") == null ? null : (String) obj.get("afterTime");
|
|
|
- String accountId = obj.get("accountId") == null ? null : String.valueOf(obj.get("accountId"));
|
|
|
- String accountName = obj.get("accountName") == null ? null : (String) obj.get("accountName");
|
|
|
- String userName = obj.get("userName") == null ? null : (String) obj.get("userName");
|
|
|
- String campaignCreatTime = obj.get("campaignCreatTime") == null ? null : (String) obj.get("campaignCreatTime");
|
|
|
- if (campaignId != null && afterTime != null) {
|
|
|
- String campaignCharge = newMonitorMapper.getCampaignCharge(campaignId, afterTime);
|
|
|
- //大于500为有效广告计划
|
|
|
- String effective = "0";
|
|
|
- if (campaignCharge != null && Long.parseLong(campaignCharge) > 500) {
|
|
|
- //有效
|
|
|
- effective = "1";
|
|
|
- }
|
|
|
- String effectiveResult = newMonitorMapper.getMonitorPlanByCampaignId(campaignId);
|
|
|
- //判断是否存在
|
|
|
- if (effectiveResult != null) {
|
|
|
- if (!effectiveResult.equals(effective)) {
|
|
|
- //存在更新
|
|
|
- newMonitorMapper.updateMonitorPlanByCampaignId(campaignId, effective);
|
|
|
+ /*---------------快手广告计划------------------*/
|
|
|
+ if (type.equals("0")) {
|
|
|
+ //查询创建不满7天的快手广告计划
|
|
|
+ kuaiShouCampaign = newMonitorMapper.getKuaiShouCampaign(sdf.format(new Date()), String.valueOf(accId));
|
|
|
+ } else {
|
|
|
+ //查询全量快手广告计划
|
|
|
+ kuaiShouCampaign = newMonitorMapper.getKuaiShouCampaign(null, String.valueOf(accId));
|
|
|
+ }
|
|
|
+ //处理快手广告计划数据
|
|
|
+ if (!kuaiShouCampaign.isEmpty()) {
|
|
|
+ kuaiShouCampaign.stream().forEach(obj -> {
|
|
|
+ if (obj != null) {
|
|
|
+ String campaignId = obj.get("campaignId") == null ? null : String.valueOf(obj.get("campaignId"));
|
|
|
+ String afterTime = obj.get("afterTime") == null ? null : (String) obj.get("afterTime");
|
|
|
+ String accountId = obj.get("accountId") == null ? null : String.valueOf(obj.get("accountId"));
|
|
|
+ String accountName = obj.get("accountName") == null ? null : (String) obj.get("accountName");
|
|
|
+ String userName = obj.get("userName") == null ? null : (String) obj.get("userName");
|
|
|
+ String campaignCreatTime = obj.get("campaignCreatTime") == null ? null : (String) obj.get("campaignCreatTime");
|
|
|
+ if (campaignId != null && afterTime != null) {
|
|
|
+ String campaignCharge = newMonitorMapper.getCampaignCharge(campaignId, afterTime);
|
|
|
+ //大于500为有效广告计划
|
|
|
+ String effective = "0";
|
|
|
+ if (campaignCharge != null && Long.parseLong(campaignCharge) > 500) {
|
|
|
+ //有效
|
|
|
+ effective = "1";
|
|
|
+ }
|
|
|
+ String effectiveResult = newMonitorMapper.getMonitorPlanByCampaignId(campaignId);
|
|
|
+ //判断是否存在
|
|
|
+ if (effectiveResult != null) {
|
|
|
+ if (!effectiveResult.equals(effective)) {
|
|
|
+ //存在更新
|
|
|
+ newMonitorMapper.updateMonitorPlanByCampaignId(campaignId, effective);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //不存在插入
|
|
|
+ newMonitorMapper.saveMonitorCampaign(accountId, accountName, userName, campaignId, campaignCreatTime, "1", effective);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- //不存在插入
|
|
|
- newMonitorMapper.saveMonitorCampaign(accountId, accountName, userName, campaignId, campaignCreatTime, "1", effective);
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
- }
|
|
|
- });
|
|
|
- }
|
|
|
|
|
|
- /*---------------头条广告计划------------------*/
|
|
|
- if (type.equals("0")) {
|
|
|
- //查询创建不满7天的头条广告计划
|
|
|
- TouTiaoCampaign = newMonitorMapper.getTouTiaoCampaign(sdf.format(new Date()));
|
|
|
- } else {
|
|
|
- //查询全量头条广告计划
|
|
|
- TouTiaoCampaign = newMonitorMapper.getTouTiaoCampaign(null);
|
|
|
- }
|
|
|
- //处理快手广告计划数据
|
|
|
- if (!TouTiaoCampaign.isEmpty()) {
|
|
|
- TouTiaoCampaign.stream().forEach(obj -> {
|
|
|
- if (obj != null) {
|
|
|
- String campaignId = obj.get("campaignId") == null ? null : String.valueOf(obj.get("campaignId"));
|
|
|
- String afterTime = obj.get("afterTime") == null ? null : (String) obj.get("afterTime");
|
|
|
- String accountId = obj.get("accountId") == null ? null : String.valueOf(obj.get("accountId"));
|
|
|
- String accountName = obj.get("accountName") == null ? null : (String) obj.get("accountName");
|
|
|
- String userName = obj.get("userName") == null ? null : (String) obj.get("userName");
|
|
|
- String campaignCreatTime = obj.get("campaignCreatTime") == null ? null : (String) obj.get("campaignCreatTime");
|
|
|
- if (campaignId != null && afterTime != null) {
|
|
|
- String campaignCharge = newMonitorMapper.getCampaignChargeTouTiao(campaignId, afterTime);
|
|
|
- //大于500为有效广告计划
|
|
|
- String effective = "0";
|
|
|
- if (campaignCharge != null && Long.parseLong(campaignCharge) > 500) {
|
|
|
- //有效
|
|
|
- effective = "1";
|
|
|
- }
|
|
|
- String effectiveResult = newMonitorMapper.getMonitorPlanByCampaignId(campaignId);
|
|
|
- //判断是否存在
|
|
|
- if (effectiveResult != null) {
|
|
|
- if (!effectiveResult.equals(effective)) {
|
|
|
- //存在更新
|
|
|
- newMonitorMapper.updateMonitorPlanByCampaignId(campaignId, effective);
|
|
|
+ /*---------------头条广告计划------------------*/
|
|
|
+ if (type.equals("0")) {
|
|
|
+ //查询创建不满7天的头条广告计划
|
|
|
+ TouTiaoCampaign = newMonitorMapper.getTouTiaoCampaign(sdf.format(new Date()), String.valueOf(accId));
|
|
|
+ } else {
|
|
|
+ //查询全量头条广告计划
|
|
|
+ TouTiaoCampaign = newMonitorMapper.getTouTiaoCampaign(null, String.valueOf(accId));
|
|
|
+ }
|
|
|
+ //处理快手广告计划数据
|
|
|
+ if (!TouTiaoCampaign.isEmpty()) {
|
|
|
+ TouTiaoCampaign.stream().forEach(obj -> {
|
|
|
+ if (obj != null) {
|
|
|
+ String campaignId = obj.get("campaignId") == null ? null : String.valueOf(obj.get("campaignId"));
|
|
|
+ String afterTime = obj.get("afterTime") == null ? null : (String) obj.get("afterTime");
|
|
|
+ String accountId = obj.get("accountId") == null ? null : String.valueOf(obj.get("accountId"));
|
|
|
+ String accountName = obj.get("accountName") == null ? null : (String) obj.get("accountName");
|
|
|
+ String userName = obj.get("userName") == null ? null : (String) obj.get("userName");
|
|
|
+ String campaignCreatTime = obj.get("campaignCreatTime") == null ? null : (String) obj.get("campaignCreatTime");
|
|
|
+ if (campaignId != null && afterTime != null) {
|
|
|
+ String campaignCharge = newMonitorMapper.getCampaignChargeTouTiao(campaignId, afterTime);
|
|
|
+ //大于500为有效广告计划
|
|
|
+ String effective = "0";
|
|
|
+ if (campaignCharge != null && Long.parseLong(campaignCharge) > 500) {
|
|
|
+ //有效
|
|
|
+ effective = "1";
|
|
|
+ }
|
|
|
+ String effectiveResult = newMonitorMapper.getMonitorPlanByCampaignId(campaignId);
|
|
|
+ //判断是否存在
|
|
|
+ if (effectiveResult != null) {
|
|
|
+ if (!effectiveResult.equals(effective)) {
|
|
|
+ //存在更新
|
|
|
+ newMonitorMapper.updateMonitorPlanByCampaignId(campaignId, effective);
|
|
|
+ }
|
|
|
+ } else {
|
|
|
+ //不存在插入
|
|
|
+ newMonitorMapper.saveMonitorCampaign(accountId, accountName, userName, campaignId, campaignCreatTime, "0", effective);
|
|
|
+ }
|
|
|
+ }
|
|
|
}
|
|
|
- } else {
|
|
|
- //不存在插入
|
|
|
- newMonitorMapper.saveMonitorCampaign(accountId, accountName, userName, campaignId, campaignCreatTime, "0", effective);
|
|
|
- }
|
|
|
+ });
|
|
|
}
|
|
|
}
|
|
|
- });
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
+
|
|
|
return result;
|
|
|
}
|
|
|
|
|
@@ -175,8 +183,9 @@ public class NewMonitorServiceImpl implements NewMonitorService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<JSONObject> getKuaiShouGroupMessage(JSONArray array, String startDate, String endDate, String target) {
|
|
|
- return newMonitorMapper.getKuaiShouGroupMessage(array,startDate,endDate);
|
|
|
+ return newMonitorMapper.getKuaiShouGroupMessage(array, startDate, endDate);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 查询快手组新上和有效数量
|
|
|
*
|
|
@@ -185,8 +194,9 @@ public class NewMonitorServiceImpl implements NewMonitorService {
|
|
|
*/
|
|
|
@Override
|
|
|
public JSONObject getKuaiShouGroupSum(JSONArray array, String startDate, String endDate) {
|
|
|
- return newMonitorMapper.getKuaiShouGroupSum(array,startDate,endDate);
|
|
|
+ return newMonitorMapper.getKuaiShouGroupSum(array, startDate, endDate);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 查询快手组时间轴数据
|
|
|
*
|
|
@@ -195,15 +205,15 @@ public class NewMonitorServiceImpl implements NewMonitorService {
|
|
|
*/
|
|
|
@Override
|
|
|
public List<JSONObject> getKuaiShouGroupMessageGroup(JSONArray array, String startDate, String endDate) {
|
|
|
- String group="0";
|
|
|
- List<JSONObject> kuaiShouGroupMessageGroup=new ArrayList<>();
|
|
|
+ String group = "0";
|
|
|
+ List<JSONObject> kuaiShouGroupMessageGroup = new ArrayList<>();
|
|
|
try {
|
|
|
- if(DateUtils.isMoreSixMonth(startDate,endDate)){
|
|
|
- group="1";
|
|
|
+ if (DateUtils.isMoreSixMonth(startDate, endDate)) {
|
|
|
+ group = "1";
|
|
|
}
|
|
|
- kuaiShouGroupMessageGroup= newMonitorMapper.getKuaiShouGroupMessageGroup(array, startDate, endDate, group);
|
|
|
- }catch (Exception e){
|
|
|
- log.info("查询数据错误:{}",e.toString());
|
|
|
+ kuaiShouGroupMessageGroup = newMonitorMapper.getKuaiShouGroupMessageGroup(array, startDate, endDate, group);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("查询数据错误:{}", e.toString());
|
|
|
}
|
|
|
|
|
|
return kuaiShouGroupMessageGroup;
|
|
@@ -211,8 +221,9 @@ public class NewMonitorServiceImpl implements NewMonitorService {
|
|
|
|
|
|
@Override
|
|
|
public List<JSONObject> getPlanMessage(JSONArray array, String startDate, String endDate, String target, String project) {
|
|
|
- return newMonitorMapper.getPlanMessage(array,startDate,endDate,project);
|
|
|
+ return newMonitorMapper.getPlanMessage(array, startDate, endDate, project);
|
|
|
}
|
|
|
+
|
|
|
/**
|
|
|
* 查询快手广告计划 新上和有效数量
|
|
|
*
|
|
@@ -221,20 +232,20 @@ public class NewMonitorServiceImpl implements NewMonitorService {
|
|
|
*/
|
|
|
@Override
|
|
|
public JSONObject getPlanSum(JSONArray array, String startDate, String endDate, String project) {
|
|
|
- return newMonitorMapper.getPlanSum(array,startDate,endDate,project);
|
|
|
+ return newMonitorMapper.getPlanSum(array, startDate, endDate, project);
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
public List<JSONObject> getPlanMessageGroup(JSONArray array, String startDate, String endDate, String project) {
|
|
|
- String group="0";
|
|
|
- List<JSONObject> planGroupMessageGroup=new ArrayList<>();
|
|
|
+ String group = "0";
|
|
|
+ List<JSONObject> planGroupMessageGroup = new ArrayList<>();
|
|
|
try {
|
|
|
- if(DateUtils.isMoreSixMonth(startDate,endDate)){
|
|
|
- group="1";
|
|
|
+ if (DateUtils.isMoreSixMonth(startDate, endDate)) {
|
|
|
+ group = "1";
|
|
|
}
|
|
|
- planGroupMessageGroup= newMonitorMapper.getPlanMessageGroup(array, startDate, endDate, group,project);
|
|
|
- }catch (Exception e){
|
|
|
- log.info("查询数据错误:{}",e.toString());
|
|
|
+ planGroupMessageGroup = newMonitorMapper.getPlanMessageGroup(array, startDate, endDate, group, project);
|
|
|
+ } catch (Exception e) {
|
|
|
+ log.info("查询数据错误:{}", e.toString());
|
|
|
}
|
|
|
|
|
|
return planGroupMessageGroup;
|