|
@@ -28,6 +28,7 @@ import java.net.URLEncoder;
|
|
|
import java.text.DecimalFormat;
|
|
|
import java.text.SimpleDateFormat;
|
|
|
import java.util.*;
|
|
|
+import java.util.stream.Collectors;
|
|
|
import java.util.stream.DoubleStream;
|
|
|
import java.util.stream.IntStream;
|
|
|
|
|
@@ -521,6 +522,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
//查询运营数据-项目维度
|
|
|
List<KuaiShouOperateProjectVo> listOperate = materialStareMapper.getKuaiShouOperateProjectInfo(startDate,entDate,null,operatorUserIds);
|
|
|
for (KuaiShouOperateProjectVo projectInfo : listOperate) {
|
|
|
+ String projectId = projectInfo.getProjectId();
|
|
|
+
|
|
|
+ //环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
+ String yearOnYear = "0";
|
|
|
|
|
|
//当天
|
|
|
int newUnitNumNow = 0;
|
|
@@ -530,6 +535,25 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
//查询 有效 上新视频 爆款视频
|
|
@@ -551,17 +575,6 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
List<JSONObject> adSceneDate = materialStareMapper.getKuaiShouAdSceneData(projectInfo.getProjectId(),startDate,entDate);
|
|
|
projectInfo.setAdSceneDate(adSceneDate);
|
|
|
|
|
|
-
|
|
|
- String projectId = projectInfo.getProjectId();
|
|
|
- List<KuaiShouOperateProjectVo> projectYearOnYearInfo = materialStareMapper.getKuaiShouOperateProjectInfo(lastTimeStart,lastTimeEnd,projectId,operatorUserIds);
|
|
|
- //环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
- String yearOnYear = "0";
|
|
|
- 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){
|
|
@@ -572,7 +585,6 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
}
|
|
|
}
|
|
|
projectInfo.setEquallyRate(equallyRate);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
PageInfo<KuaiShouOperateProjectVo> pageInfo = new PageInfo<>(listOperate);
|
|
@@ -612,6 +624,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
//查询运营数据-项目维度
|
|
|
List<KuaiShouOperateProjectVo> listOperate = materialStareMapper.getKuaiShouOperateProjectInfo(startDate,entDate,null,operatorUserIds);
|
|
|
for (KuaiShouOperateProjectVo projectInfo : listOperate) {
|
|
|
+ String projectId = projectInfo.getProjectId();
|
|
|
+
|
|
|
+ //环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
+ String yearOnYear = "0";
|
|
|
|
|
|
//当天
|
|
|
int newUnitNumNow = 0;
|
|
@@ -621,6 +637,25 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
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);
|
|
|
}
|
|
|
|
|
|
//查询 有效 上新视频 爆款视频
|
|
@@ -642,16 +677,6 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
List<JSONObject> adSceneDate = materialStareMapper.getKuaiShouAdSceneData(projectInfo.getProjectId(),startDate,entDate);
|
|
|
projectInfo.setAdSceneDate(adSceneDate);
|
|
|
|
|
|
- String projectId = projectInfo.getProjectId();
|
|
|
- List<KuaiShouOperateProjectVo> projectYearOnYearInfo = materialStareMapper.getKuaiShouOperateProjectInfo(lastTimeStart,lastTimeEnd,projectId,operatorUserIds);
|
|
|
- //环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
- String yearOnYear = "0";
|
|
|
- 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){
|
|
@@ -662,7 +687,6 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
}
|
|
|
}
|
|
|
projectInfo.setEquallyRate(equallyRate);
|
|
|
-
|
|
|
}
|
|
|
|
|
|
return listOperate;
|
|
@@ -1102,21 +1126,32 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
|
|
|
//查询用户角色
|
|
|
String roleCode = materialStareMapper.getRoleCodeByUserId(userId);
|
|
|
- JSONObject userName = materialStareMapper.getKuaiShouUserByUserId(userId);
|
|
|
+
|
|
|
+ //所有运营经理
|
|
|
+ List<KuaiShouOperateGroupVo> allOperationManagerList = materialStareMapper.getOperationManagerUser();
|
|
|
+ List<String> allManagerList = allOperationManagerList.stream().map(KuaiShouOperateGroupVo:: getUserId).collect(Collectors.toList());
|
|
|
|
|
|
List<KuaiShouOperateGroupVo> operationManagerList = new ArrayList<>();
|
|
|
if ("admin".equals(roleCode)) {
|
|
|
- PageHelper.startPage(pageNum,pageSize);
|
|
|
- //查询运营经理
|
|
|
- operationManagerList = materialStareMapper.getOperationManagerUser();
|
|
|
+ //所有运营经理
|
|
|
+ operationManagerList = allOperationManagerList;
|
|
|
}else if (roleCode.contains("OperationManager")){
|
|
|
- operationManagerList.add(new KuaiShouOperateGroupVo(userId,userName.getString("userName")));
|
|
|
+ // 如果下级有 运营经理 也需要分组展示
|
|
|
+ // 获取下级中 角色为 运营经理人员
|
|
|
+ //获取所有下级
|
|
|
+ Set<String> userIds = getAffiliateId(userId);
|
|
|
+ for (String uId : userIds) {
|
|
|
+ if (allManagerList.contains(uId)){
|
|
|
+ JSONObject userName = materialStareMapper.getKuaiShouUserByUserId(uId);
|
|
|
+ operationManagerList.add(new KuaiShouOperateGroupVo(uId,userName.getString("userName")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}else {
|
|
|
Result.successMsg("运营组列表数据查询成功。",null);
|
|
|
}
|
|
|
|
|
|
for (KuaiShouOperateGroupVo groupVo : operationManagerList) {
|
|
|
-
|
|
|
//下级员工
|
|
|
Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
|
|
|
//运营数量
|
|
@@ -1125,6 +1160,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
|
|
|
//查询账户数据
|
|
|
List<KuaiShouOperateVo> listOperate= new ArrayList<>();
|
|
|
+ PageHelper.startPage(pageNum,pageSize);
|
|
|
if (daysBetween < 0){
|
|
|
//时报
|
|
|
listOperate= materialStareMapper.getKuaiShouOperateInfoHourly(startDate,entDate,operatorUserIds);
|
|
@@ -1199,17 +1235,29 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
long lastTimeStart = Long.valueOf(DateUtils.getDateInteger(lastTime.get("lastTimeStart")));
|
|
|
long lastTimeEnd = Long.valueOf(DateUtils.getDateInteger(lastTime.get("lastTimeEnd")));
|
|
|
Integer daysBetween = Integer.valueOf(lastTime.get("daysBetween"))+1;
|
|
|
-
|
|
|
//查询用户角色
|
|
|
String roleCode = materialStareMapper.getRoleCodeByUserId(userId);
|
|
|
- JSONObject userName = materialStareMapper.getKuaiShouUserByUserId(userId);
|
|
|
+
|
|
|
+ //所有运营经理
|
|
|
+ List<KuaiShouOperateGroupVo> allOperationManagerList = materialStareMapper.getOperationManagerUser();
|
|
|
+ List<String> allManagerList = allOperationManagerList.stream().map(KuaiShouOperateGroupVo:: getUserId).collect(Collectors.toList());
|
|
|
|
|
|
List<KuaiShouOperateGroupVo> operationManagerList = new ArrayList<>();
|
|
|
if ("admin".equals(roleCode)) {
|
|
|
- //查询运营经理
|
|
|
- operationManagerList = materialStareMapper.getOperationManagerUser();
|
|
|
+ //所有运营经理
|
|
|
+ operationManagerList = allOperationManagerList;
|
|
|
}else if (roleCode.contains("OperationManager")){
|
|
|
- operationManagerList.add(new KuaiShouOperateGroupVo(userId,userName.getString("userName")));
|
|
|
+ // 如果下级有 运营经理 也需要分组展示
|
|
|
+ // 获取下级中 角色为 运营经理人员
|
|
|
+ //获取所有下级
|
|
|
+ Set<String> userIds = getAffiliateId(userId);
|
|
|
+ for (String uId : userIds) {
|
|
|
+ if (allManagerList.contains(uId)){
|
|
|
+ JSONObject userName = materialStareMapper.getKuaiShouUserByUserId(uId);
|
|
|
+ operationManagerList.add(new KuaiShouOperateGroupVo(uId,userName.getString("userName")));
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
}else {
|
|
|
Result.successMsg("运营组列表数据查询成功。",null);
|
|
|
}
|