|
@@ -65,7 +65,60 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
Set<String> operatorUserIds = getAffiliateId(userId);
|
|
|
//头条
|
|
|
if (StringUtils.equals(mediaType,"1")){
|
|
|
- return Result.successMsg("暂无头条数据。",null);
|
|
|
+ //return Result.successMsg("暂无头条数据。",null);
|
|
|
+ //汇总
|
|
|
+ if (StringUtils.equals(type,"1")){
|
|
|
+ //查询一天数据时 查询时报
|
|
|
+ if (stratDate == endDate){
|
|
|
+ Map resultMap = new HashMap<>();
|
|
|
+ //时报
|
|
|
+ List<Map> todayList = materialStareMapper.getBytedanceCostHourlyByUserIdList(stratDate, endDate, operatorUserIds);
|
|
|
+ long time = DateUtils.getDateInteger(DateUtils.addDayParse(Long.toString(endDate), -1));
|
|
|
+ List<Map> yesterdayList = materialStareMapper.getBytedanceCostHourlyByUserIdList(time,time , operatorUserIds);
|
|
|
+ resultMap.put("todayList",todayList);
|
|
|
+ resultMap.put("yesterdayList",yesterdayList);
|
|
|
+ return Result.successMsg("查询-头条-时报-汇总。",resultMap);
|
|
|
+ }
|
|
|
+ //多天 数据
|
|
|
+ // 日报
|
|
|
+ List<Map> dailyList = materialStareMapper.getBytedanceCostDailyByUserIdList(stratDate, endDate, operatorUserIds);
|
|
|
+ return Result.successMsg("查询-头条-日报-汇总成功。",dailyList);
|
|
|
+ }
|
|
|
+
|
|
|
+ //运营个人
|
|
|
+ if (StringUtils.equals(type,"2")){
|
|
|
+ if (stratDate == endDate){
|
|
|
+ //时报 消耗前5
|
|
|
+ List<JSONObject> userList = materialStareMapper.getBytedanceCostByTop5HourList(stratDate, endDate, operatorUserIds);
|
|
|
+ List<Map> resultList = new ArrayList<>();
|
|
|
+ for (JSONObject jsonObject : userList) {
|
|
|
+ Map map = new HashMap();
|
|
|
+ Set<String> userSet = new HashSet<String>(){{
|
|
|
+ add(jsonObject.getString("user_id"));
|
|
|
+ }};
|
|
|
+ List<Map> usertopList = materialStareMapper.getBytedanceCostHourlyByUserIdList(stratDate, endDate, userSet);
|
|
|
+ map.put("userName",jsonObject.getString("userName"));
|
|
|
+ map.put("data",usertopList);
|
|
|
+ resultList.add(map);
|
|
|
+ }
|
|
|
+ return Result.successMsg("查询-头条-时报-运营个人消耗top5成功。",resultList);
|
|
|
+ }
|
|
|
+ //日报 消耗前5
|
|
|
+ List<JSONObject> userList = materialStareMapper.getBytedanceCostByTop5DailyList(stratDate,endDate, operatorUserIds);
|
|
|
+ List<Map> resultList = new ArrayList<>();
|
|
|
+ for (JSONObject jsonObject : userList) {
|
|
|
+ Map map = new HashMap();
|
|
|
+ Set<String> userSet = new HashSet<String>(){{
|
|
|
+ add(jsonObject.getString("user_id"));
|
|
|
+ }};
|
|
|
+ //日报
|
|
|
+ List<Map> usertopList = materialStareMapper.getBytedanceCostDailyByUserIdList(stratDate, endDate, userSet);
|
|
|
+ map.put("userName",jsonObject.getString("userName"));
|
|
|
+ map.put("data",usertopList);
|
|
|
+ resultList.add(map);
|
|
|
+ }
|
|
|
+ return Result.successMsg("查询-快手-日报-运营个人消耗top5成功。",resultList);
|
|
|
+ }
|
|
|
}
|
|
|
//快手
|
|
|
if (StringUtils.equals(mediaType,"2")){
|
|
@@ -80,12 +133,12 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
List<Map> yesterdayList = materialStareMapper.getKuaiShouCostHourlyByUserIdList(time,time , operatorUserIds);
|
|
|
resultMap.put("todayList",todayList);
|
|
|
resultMap.put("yesterdayList",yesterdayList);
|
|
|
- return Result.successMsg("查询-时报-汇总。",resultMap);
|
|
|
+ return Result.successMsg("查询-快手-时报-汇总。",resultMap);
|
|
|
}
|
|
|
//多天 数据
|
|
|
// 日报
|
|
|
List<Map> dailyList = materialStareMapper.getKuaiShouCostDailyByUserIdList(stratDate, endDate, operatorUserIds);
|
|
|
- return Result.successMsg("查询-日报-汇总成功。",dailyList);
|
|
|
+ return Result.successMsg("查询-快手-日报-汇总成功。",dailyList);
|
|
|
|
|
|
//运营个人
|
|
|
}else if (StringUtils.equals(type,"2")){
|
|
@@ -103,7 +156,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
map.put("data",usertopList);
|
|
|
resultList.add(map);
|
|
|
}
|
|
|
- return Result.successMsg("查询-时报-运营个人消耗top5成功。",resultList);
|
|
|
+ return Result.successMsg("查询-快手-时报-运营个人消耗top5成功。",resultList);
|
|
|
}
|
|
|
|
|
|
//日报 消耗前5
|
|
@@ -119,7 +172,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
map.put("data",usertopList);
|
|
|
resultList.add(map);
|
|
|
}
|
|
|
- return Result.successMsg("查询-日报-运营个人消耗top5成功。",resultList);
|
|
|
+ return Result.successMsg("查询-快手-日报-运营个人消耗top5成功。",resultList);
|
|
|
}
|
|
|
}
|
|
|
return null;
|
|
@@ -191,15 +244,8 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
//查询用户所属公司
|
|
|
String companyId = materialStareMapper.getUserCompanyByUserId(userId);
|
|
|
Set<String> operatorUserIds = null;
|
|
|
- try {
|
|
|
- //查询当前人员所有下级
|
|
|
- operatorUserIds= getAffiliateId(userId);
|
|
|
-
|
|
|
- //有消耗的账户
|
|
|
- operatorUserIds = materialStareMapper.getKuaiShouAllOperators(companyId,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
|
|
|
|
|
|
- //快手-在投项目数量
|
|
|
- String projectNum = materialStareMapper.getKuaiShouOperatorProjectNum(DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
|
|
|
+ try {
|
|
|
|
|
|
SimpleDateFormat sdf = new SimpleDateFormat("yyyyMMdd");
|
|
|
// ==>> 20220202
|
|
@@ -209,28 +255,73 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
//昨天时间
|
|
|
long time = DateUtils.getDateInteger(DateUtils.addDayParse(now, -1));
|
|
|
|
|
|
- //当天总消耗
|
|
|
- JSONObject jsonObjectNow = materialStareMapper.getKuaiShouTotalCost(nowDate,nowDate,nowHour,operatorUserIds);
|
|
|
- resultMap.put("todayCost",jsonObjectNow.getString("totalCost"));
|
|
|
- //昨天总消耗
|
|
|
- JSONObject jsonObjectYesterday = materialStareMapper.getKuaiShouTotalCost(time,time,nowHour,operatorUserIds);
|
|
|
- //今日同比 = (今天总消耗 - 昨天总消耗 ) / 昨天总消耗
|
|
|
- Double d = (Double.valueOf(jsonObjectNow.getString("totalCost")) - Double.valueOf(jsonObjectYesterday.getString("totalCost"))) / Double.valueOf(jsonObjectYesterday.getString("totalCost"));
|
|
|
- resultMap.put("compare",decimalFormat.format(d));
|
|
|
-
|
|
|
- //时间段内 总消耗 及 账户数量
|
|
|
- JSONObject totalCost = materialStareMapper.getKuaiShouTotalCostDaily(Long.valueOf(DateUtils.getDateInteger(startTime)),
|
|
|
- Long.valueOf(DateUtils.getDateInteger(endTime)),
|
|
|
- operatorUserIds);
|
|
|
- resultMap.put("sectionCost",totalCost.getDoubleValue("totalCost"));
|
|
|
- // 人均账户数量 = 时间段内 账户总数量 / 人数
|
|
|
- Double userAverageAccount = Double.valueOf(totalCost.getString("accountNum")) / operatorUserIds.size();
|
|
|
- // 人均消耗 = 时间段内 总消耗 / 人数
|
|
|
- Double userAveragecost = Double.valueOf(totalCost.getString("totalCost")) / operatorUserIds.size();
|
|
|
- DecimalFormat df = new DecimalFormat("#.000");
|
|
|
- resultMap.put("userAverageAccount",new Double(Math.ceil(userAverageAccount)).intValue());
|
|
|
- resultMap.put("userAveragecost",df.format(userAveragecost));
|
|
|
- resultMap.put("projectNum",projectNum);
|
|
|
+ //查询当前人员所有下级
|
|
|
+ operatorUserIds= getAffiliateId(userId);
|
|
|
+
|
|
|
+ //头条
|
|
|
+ if (mediaType.equals("1")){
|
|
|
+
|
|
|
+ //有消耗的账户
|
|
|
+ operatorUserIds = materialStareMapper.getBytedanceAllOperators(companyId,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
|
|
|
+ //头条-在投项目数量
|
|
|
+ String projectNum = materialStareMapper.getBytedanceOperatorProjectNum(DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
|
|
|
+
|
|
|
+ //当天总消耗
|
|
|
+ JSONObject jsonObjectNow = materialStareMapper.getBytedanceTotalCost(nowDate,nowDate,nowHour,operatorUserIds);
|
|
|
+ resultMap.put("todayCost",jsonObjectNow.getString("totalCost"));
|
|
|
+ //昨天总消耗
|
|
|
+ JSONObject jsonObjectYesterday = materialStareMapper.getBytedanceTotalCost(time,time,nowHour,operatorUserIds);
|
|
|
+ //今日同比 = (今天总消耗 - 昨天总消耗 ) / 昨天总消耗
|
|
|
+ Double d = (Double.valueOf(jsonObjectNow.getString("totalCost")) - Double.valueOf(jsonObjectYesterday.getString("totalCost"))) / Double.valueOf(jsonObjectYesterday.getString("totalCost"));
|
|
|
+ resultMap.put("compare",decimalFormat.format(d));
|
|
|
+
|
|
|
+ //时间段内 总消耗 及 账户数量
|
|
|
+ JSONObject totalCost = materialStareMapper.getBytedanceTotalCostDaily(Long.valueOf(DateUtils.getDateInteger(startTime)),
|
|
|
+ Long.valueOf(DateUtils.getDateInteger(endTime)),
|
|
|
+ operatorUserIds);
|
|
|
+ resultMap.put("sectionCost",totalCost.getDoubleValue("totalCost"));
|
|
|
+ // 人均账户数量 = 时间段内 账户总数量 / 人数
|
|
|
+ Double userAverageAccount = Double.valueOf(totalCost.getString("accountNum")) / operatorUserIds.size();
|
|
|
+ // 人均消耗 = 时间段内 总消耗 / 人数
|
|
|
+ Double userAveragecost = Double.valueOf(totalCost.getString("totalCost")) / operatorUserIds.size();
|
|
|
+ DecimalFormat df = new DecimalFormat("#.000");
|
|
|
+ resultMap.put("userAverageAccount",new Double(Math.ceil(userAverageAccount)).intValue());
|
|
|
+ resultMap.put("userAveragecost",df.format(userAveragecost));
|
|
|
+ resultMap.put("projectNum",projectNum);
|
|
|
+ }
|
|
|
+
|
|
|
+ //快手
|
|
|
+ if (mediaType.equals("2")){
|
|
|
+
|
|
|
+ //有消耗的账户
|
|
|
+ operatorUserIds = materialStareMapper.getKuaiShouAllOperators(companyId,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
|
|
|
+ //快手-在投项目数量
|
|
|
+ String projectNum = materialStareMapper.getKuaiShouOperatorProjectNum(DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
|
|
|
+
|
|
|
+ //当天总消耗
|
|
|
+ JSONObject jsonObjectNow = materialStareMapper.getKuaiShouTotalCost(nowDate,nowDate,nowHour,operatorUserIds);
|
|
|
+ resultMap.put("todayCost",jsonObjectNow.getString("totalCost"));
|
|
|
+ //昨天总消耗
|
|
|
+ JSONObject jsonObjectYesterday = materialStareMapper.getKuaiShouTotalCost(time,time,nowHour,operatorUserIds);
|
|
|
+ //今日同比 = (今天总消耗 - 昨天总消耗 ) / 昨天总消耗
|
|
|
+ Double d = (Double.valueOf(jsonObjectNow.getString("totalCost")) - Double.valueOf(jsonObjectYesterday.getString("totalCost"))) / Double.valueOf(jsonObjectYesterday.getString("totalCost"));
|
|
|
+ resultMap.put("compare",decimalFormat.format(d));
|
|
|
+
|
|
|
+ //时间段内 总消耗 及 账户数量
|
|
|
+ JSONObject totalCost = materialStareMapper.getKuaiShouTotalCostDaily(Long.valueOf(DateUtils.getDateInteger(startTime)),
|
|
|
+ Long.valueOf(DateUtils.getDateInteger(endTime)),
|
|
|
+ operatorUserIds);
|
|
|
+ resultMap.put("sectionCost",totalCost.getDoubleValue("totalCost"));
|
|
|
+ // 人均账户数量 = 时间段内 账户总数量 / 人数
|
|
|
+ Double userAverageAccount = Double.valueOf(totalCost.getString("accountNum")) / operatorUserIds.size();
|
|
|
+ // 人均消耗 = 时间段内 总消耗 / 人数
|
|
|
+ Double userAveragecost = Double.valueOf(totalCost.getString("totalCost")) / operatorUserIds.size();
|
|
|
+ DecimalFormat df = new DecimalFormat("#.000");
|
|
|
+ resultMap.put("userAverageAccount",new Double(Math.ceil(userAverageAccount)).intValue());
|
|
|
+ resultMap.put("userAveragecost",df.format(userAveragecost));
|
|
|
+ resultMap.put("projectNum",projectNum);
|
|
|
+ }
|
|
|
+
|
|
|
}catch (Exception e){
|
|
|
e.printStackTrace();
|
|
|
}
|
|
@@ -494,9 +585,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
* @time: 2022/2/17
|
|
|
*/
|
|
|
@Override
|
|
|
- public Result getKuaiShouOperateProjectInfo(Integer pageNum, int pageSize, String startTime, String endTime, String userId) {
|
|
|
+ public Result getKuaiShouOperateProjectInfo(Integer pageNum, int pageSize, String mediaType,String startTime, String endTime, String userId) {
|
|
|
DecimalFormat decimalFormat = new DecimalFormat("0.00%");
|
|
|
long now = Long.valueOf(DateUtils.getDateInteger(DateUtils.getDate("yyyy-MM-dd")));
|
|
|
+ List<KuaiShouOperateProjectVo> listOperate = new ArrayList<>();
|
|
|
try {
|
|
|
//查询当前人员所有下级
|
|
|
Set<String> operatorUserIds = getAffiliateId(userId);
|
|
@@ -518,75 +610,131 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
endEqually = DateUtils.getDateInteger(DateUtils.addDayParse(String.valueOf(DateUtils.getDateInteger(endTime)), -7));
|
|
|
}
|
|
|
|
|
|
- PageHelper.startPage(pageNum,pageSize);
|
|
|
- //查询运营数据-项目维度
|
|
|
- List<KuaiShouOperateProjectVo> listOperate = materialStareMapper.getKuaiShouOperateProjectInfo(startDate,entDate,null,operatorUserIds);
|
|
|
- for (KuaiShouOperateProjectVo projectInfo : listOperate) {
|
|
|
- String projectId = projectInfo.getProjectId();
|
|
|
+ //头条
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
|
|
- //环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
- String yearOnYear = "0";
|
|
|
-
|
|
|
- //当天
|
|
|
- int newUnitNumNow = 0;
|
|
|
- int trustUnitNum = 0;
|
|
|
- if (startDate == now || entDate == now){
|
|
|
- //查询 当天有效 上新计划 上新组
|
|
|
- JSONObject newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(null,projectInfo.getProjectId(),null,now,now);
|
|
|
- newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
|
|
|
- trustUnitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum");//智能托管
|
|
|
-
|
|
|
- //时报 消费
|
|
|
+ PageHelper.startPage(pageNum,pageSize);
|
|
|
+ //查询运营数据-项目维度
|
|
|
+ listOperate = materialStareMapper.getBytedanceOperateProjectInfo(startDate,entDate,null,operatorUserIds);
|
|
|
+ for (KuaiShouOperateProjectVo projectInfo : listOperate) {
|
|
|
+
|
|
|
+ //查询 有效 上新视频 爆款视频
|
|
|
+ JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(null,projectInfo.getProjectId(),null,startDate,entDate);
|
|
|
+ projectInfo.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
|
|
|
+ projectInfo.setNewVideoNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newVideoNum"));//上新
|
|
|
+ projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
|
|
|
+ projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum"));//基建数
|
|
|
+ projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
|
|
|
+
|
|
|
+ /*
|
|
|
+ //查看 上传到助手、媒体的素材数量 分版位花费
|
|
|
+ List<JSONObject> materailUpload = materialStareMapper.getKuaiShouMaterailUploadType(projectInfo.getProjectId(),startDate,entDate);
|
|
|
+ projectInfo.setAdspNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(0)+"").getLong("num"));//上传到助手
|
|
|
+ projectInfo.setMediaNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(1)+"").getLong("num"));//上传到媒体
|
|
|
+ //分版位
|
|
|
+ List<JSONObject> adSceneDate = materialStareMapper.getKuaiShouAdSceneData(projectInfo.getProjectId(),startDate,entDate);
|
|
|
+ projectInfo.setAdSceneDate(adSceneDate);
|
|
|
+
|
|
|
+ */
|
|
|
+
|
|
|
+ String projectId = projectInfo.getProjectId();
|
|
|
//环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
- int hour = DateUtils.getNowHour();
|
|
|
- List<KuaiShouOperateProjectVo> projectYearOnYearInfoNow = materialStareMapper.getKuaiShouOperateProjectInfoHour(startDate,entDate,hour,projectId,operatorUserIds);
|
|
|
- List<KuaiShouOperateProjectVo> projectYearOnYearInfoLast = materialStareMapper.getKuaiShouOperateProjectInfoHour(lastTimeStart,lastTimeEnd,hour,projectId,operatorUserIds);
|
|
|
- if (!Check.isNull(projectYearOnYearInfoNow) && !Check.isNull(projectYearOnYearInfoLast)){
|
|
|
- Double yearOnYearD = (projectYearOnYearInfoNow.get(0).getTotalCost() - projectYearOnYearInfoLast.get(0).getTotalCost()) / projectYearOnYearInfoNow.get(0).getTotalCost();
|
|
|
- yearOnYear = decimalFormat.format(yearOnYearD);
|
|
|
- }
|
|
|
- projectInfo.setYearOnYear(yearOnYear);
|
|
|
- }else {
|
|
|
+ String yearOnYear = "0";
|
|
|
//环比 日报
|
|
|
- List<KuaiShouOperateProjectVo> projectYearOnYearInfo = materialStareMapper.getKuaiShouOperateProjectInfo(lastTimeStart,lastTimeEnd,projectId,operatorUserIds);
|
|
|
+ List<KuaiShouOperateProjectVo> projectYearOnYearInfo = materialStareMapper.getBytedanceOperateProjectInfo(lastTimeStart,lastTimeEnd,projectId,operatorUserIds);
|
|
|
if (!Check.isNull(projectYearOnYearInfo)){
|
|
|
Double yearOnYearD = (projectInfo.getTotalCost() - projectYearOnYearInfo.get(0).getTotalCost()) / projectYearOnYearInfo.get(0).getTotalCost();
|
|
|
yearOnYear = decimalFormat.format(yearOnYearD);
|
|
|
}
|
|
|
projectInfo.setYearOnYear(yearOnYear);
|
|
|
+
|
|
|
+
|
|
|
+ //同比 日期超过 7 天 则不显示
|
|
|
+ String equallyRate = "-";
|
|
|
+ if (daysBetween <= 7){
|
|
|
+ List<KuaiShouOperateProjectVo> projectEquallyInfo = materialStareMapper.getBytedanceOperateProjectInfo(startEqually,endEqually,projectId,operatorUserIds);
|
|
|
+ if (!Check.isNull(projectEquallyInfo)){
|
|
|
+ Double equallyRateD = (projectInfo.getTotalCost() - projectEquallyInfo.get(0).getTotalCost()) / projectEquallyInfo.get(0).getTotalCost();
|
|
|
+ equallyRate = decimalFormat.format(equallyRateD);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ projectInfo.setEquallyRate(equallyRate);
|
|
|
}
|
|
|
|
|
|
- //查询 有效 上新视频 爆款视频
|
|
|
- JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(null,projectInfo.getProjectId(),null,startDate,entDate);
|
|
|
- projectInfo.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
|
|
|
- projectInfo.setNewVideoNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newVideoNum"));//上新
|
|
|
- projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
|
|
|
|
|
|
- projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+newUnitNumNow);//基建数
|
|
|
- projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum")+trustUnitNum);//智能托管
|
|
|
+ }
|
|
|
+ //快手
|
|
|
+ if (mediaType.equals("2")){
|
|
|
+ PageHelper.startPage(pageNum,pageSize);
|
|
|
+ //查询运营数据-项目维度
|
|
|
+ listOperate = materialStareMapper.getKuaiShouOperateProjectInfo(startDate,entDate,null,operatorUserIds);
|
|
|
+ for (KuaiShouOperateProjectVo projectInfo : listOperate) {
|
|
|
+ String projectId = projectInfo.getProjectId();
|
|
|
+ //环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
+ String yearOnYear = "0";
|
|
|
+ //当天
|
|
|
+ int newUnitNumNow = 0;
|
|
|
+ int trustUnitNum = 0;
|
|
|
+ if (startDate == now || entDate == now){
|
|
|
+ //查询 当天有效 上新计划 上新组
|
|
|
+ JSONObject newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(null,projectInfo.getProjectId(),null,now,now);
|
|
|
+ newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
|
|
|
+ trustUnitNum = Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum");//智能托管
|
|
|
+
|
|
|
+ //时报 消费
|
|
|
+ //环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
+ int hour = DateUtils.getNowHour();
|
|
|
+ List<KuaiShouOperateProjectVo> projectYearOnYearInfoNow = materialStareMapper.getKuaiShouOperateProjectInfoHour(startDate,entDate,hour,projectId,operatorUserIds);
|
|
|
+ List<KuaiShouOperateProjectVo> projectYearOnYearInfoLast = materialStareMapper.getKuaiShouOperateProjectInfoHour(lastTimeStart,lastTimeEnd,hour,projectId,operatorUserIds);
|
|
|
+ if (!Check.isNull(projectYearOnYearInfoNow) && !Check.isNull(projectYearOnYearInfoLast)){
|
|
|
+ Double yearOnYearD = (projectYearOnYearInfoNow.get(0).getTotalCost() - projectYearOnYearInfoLast.get(0).getTotalCost()) / projectYearOnYearInfoNow.get(0).getTotalCost();
|
|
|
+ yearOnYear = decimalFormat.format(yearOnYearD);
|
|
|
+ }
|
|
|
+ projectInfo.setYearOnYear(yearOnYear);
|
|
|
+ }else {
|
|
|
+ //环比 日报
|
|
|
+ List<KuaiShouOperateProjectVo> projectYearOnYearInfo = materialStareMapper.getKuaiShouOperateProjectInfo(lastTimeStart,lastTimeEnd,projectId,operatorUserIds);
|
|
|
+ if (!Check.isNull(projectYearOnYearInfo)){
|
|
|
+ Double yearOnYearD = (projectInfo.getTotalCost() - projectYearOnYearInfo.get(0).getTotalCost()) / projectYearOnYearInfo.get(0).getTotalCost();
|
|
|
+ yearOnYear = decimalFormat.format(yearOnYearD);
|
|
|
+ }
|
|
|
+ projectInfo.setYearOnYear(yearOnYear);
|
|
|
+ }
|
|
|
|
|
|
- //查看 上传到助手、媒体的素材数量 分版位花费
|
|
|
- List<JSONObject> materailUpload = materialStareMapper.getKuaiShouMaterailUploadType(projectInfo.getProjectId(),startDate,entDate);
|
|
|
+ //查询 有效 上新视频 爆款视频
|
|
|
+ JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(null,projectInfo.getProjectId(),null,startDate,entDate);
|
|
|
+ projectInfo.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
|
|
|
+ projectInfo.setNewVideoNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newVideoNum"));//上新
|
|
|
+ projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
|
|
|
|
|
|
- projectInfo.setAdspNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(0)+"").getLong("num"));//上传到助手
|
|
|
- projectInfo.setMediaNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(1)+"").getLong("num"));//上传到媒体
|
|
|
+ projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+newUnitNumNow);//基建数
|
|
|
+ projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum")+trustUnitNum);//智能托管
|
|
|
|
|
|
- //分版位
|
|
|
- List<JSONObject> adSceneDate = materialStareMapper.getKuaiShouAdSceneData(projectInfo.getProjectId(),startDate,entDate);
|
|
|
- projectInfo.setAdSceneDate(adSceneDate);
|
|
|
+ //查看 上传到助手、媒体的素材数量 分版位花费
|
|
|
+ List<JSONObject> materailUpload = materialStareMapper.getKuaiShouMaterailUploadType(projectInfo.getProjectId(),startDate,entDate);
|
|
|
|
|
|
- //同比 日期超过 7 天 则不显示
|
|
|
- String equallyRate = "-";
|
|
|
- if (daysBetween <= 7){
|
|
|
- List<KuaiShouOperateProjectVo> projectEquallyInfo = materialStareMapper.getKuaiShouOperateProjectInfo(startEqually,endEqually,projectId,operatorUserIds);
|
|
|
- if (!Check.isNull(projectEquallyInfo)){
|
|
|
- Double equallyRateD = (projectInfo.getTotalCost() - projectEquallyInfo.get(0).getTotalCost()) / projectEquallyInfo.get(0).getTotalCost();
|
|
|
- equallyRate = decimalFormat.format(equallyRateD);
|
|
|
+ projectInfo.setAdspNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(0)+"").getLong("num"));//上传到助手
|
|
|
+ projectInfo.setMediaNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(1)+"").getLong("num"));//上传到媒体
|
|
|
+
|
|
|
+ //分版位
|
|
|
+ List<JSONObject> adSceneDate = materialStareMapper.getKuaiShouAdSceneData(projectInfo.getProjectId(),startDate,entDate);
|
|
|
+ projectInfo.setAdSceneDate(adSceneDate);
|
|
|
+
|
|
|
+ //同比 日期超过 7 天 则不显示
|
|
|
+ String equallyRate = "-";
|
|
|
+ if (daysBetween <= 7){
|
|
|
+ List<KuaiShouOperateProjectVo> projectEquallyInfo = materialStareMapper.getKuaiShouOperateProjectInfo(startEqually,endEqually,projectId,operatorUserIds);
|
|
|
+ if (!Check.isNull(projectEquallyInfo)){
|
|
|
+ Double equallyRateD = (projectInfo.getTotalCost() - projectEquallyInfo.get(0).getTotalCost()) / projectEquallyInfo.get(0).getTotalCost();
|
|
|
+ equallyRate = decimalFormat.format(equallyRateD);
|
|
|
+ }
|
|
|
}
|
|
|
+ projectInfo.setEquallyRate(equallyRate);
|
|
|
}
|
|
|
- projectInfo.setEquallyRate(equallyRate);
|
|
|
}
|
|
|
|
|
|
+
|
|
|
+
|
|
|
PageInfo<KuaiShouOperateProjectVo> pageInfo = new PageInfo<>(listOperate);
|
|
|
return Result.successMsg("运营项目列表数据查询成功。",pageInfo);
|
|
|
}catch (Exception e){
|