|
@@ -19,6 +19,7 @@ import org.jeecg.ctop.material.mapper.MaterialStareMapper;
|
|
import org.jeecg.ctop.material.service.MaterialStareService;
|
|
import org.jeecg.ctop.material.service.MaterialStareService;
|
|
import org.jeecg.ctop.material.utils.FeidNotNullUtils;
|
|
import org.jeecg.ctop.material.utils.FeidNotNullUtils;
|
|
import org.jeecg.ctop.material.utils.LinkUtil;
|
|
import org.jeecg.ctop.material.utils.LinkUtil;
|
|
|
|
+import org.jeecg.ctop.material.utils.ListPageUtil;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
import javax.annotation.Resource;
|
|
import javax.annotation.Resource;
|
|
@@ -279,14 +280,15 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
JSONObject totalCost = materialStareMapper.getBytedanceTotalCostDaily(Long.valueOf(DateUtils.getDateInteger(startTime)),
|
|
JSONObject totalCost = materialStareMapper.getBytedanceTotalCostDaily(Long.valueOf(DateUtils.getDateInteger(startTime)),
|
|
Long.valueOf(DateUtils.getDateInteger(endTime)),
|
|
Long.valueOf(DateUtils.getDateInteger(endTime)),
|
|
operatorUserIds);
|
|
operatorUserIds);
|
|
- resultMap.put("sectionCost",totalCost.getDoubleValue("totalCost"));
|
|
|
|
|
|
+ Double tCost = Check.isNull(totalCost.getDoubleValue("totalCost")) ? 0.0 : totalCost.getDoubleValue("totalCost");
|
|
|
|
+ resultMap.put("sectionCost",tCost);
|
|
// 人均账户数量 = 时间段内 账户总数量 / 人数
|
|
// 人均账户数量 = 时间段内 账户总数量 / 人数
|
|
Double userAverageAccount = Double.valueOf(totalCost.getString("accountNum")) / operatorUserIds.size();
|
|
Double userAverageAccount = Double.valueOf(totalCost.getString("accountNum")) / operatorUserIds.size();
|
|
// 人均消耗 = 时间段内 总消耗 / 人数
|
|
// 人均消耗 = 时间段内 总消耗 / 人数
|
|
- Double userAveragecost = Double.valueOf(totalCost.getString("totalCost")) / operatorUserIds.size();
|
|
|
|
|
|
+ Double userAveragecost = tCost / operatorUserIds.size();
|
|
DecimalFormat df = new DecimalFormat("#.000");
|
|
DecimalFormat df = new DecimalFormat("#.000");
|
|
resultMap.put("userAverageAccount",new Double(Math.ceil(userAverageAccount)).intValue());
|
|
resultMap.put("userAverageAccount",new Double(Math.ceil(userAverageAccount)).intValue());
|
|
- resultMap.put("userAveragecost",df.format(userAveragecost));
|
|
|
|
|
|
+ resultMap.put("userAveragecost",userAveragecost == 0.0 ? 0 : df.format(userAveragecost));
|
|
resultMap.put("projectNum",projectNum);
|
|
resultMap.put("projectNum",projectNum);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -612,21 +614,60 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
|
|
|
//头条
|
|
//头条
|
|
if (mediaType.equals("1")){
|
|
if (mediaType.equals("1")){
|
|
-
|
|
|
|
PageHelper.startPage(pageNum,pageSize);
|
|
PageHelper.startPage(pageNum,pageSize);
|
|
//查询运营数据-项目维度
|
|
//查询运营数据-项目维度
|
|
listOperate = materialStareMapper.getBytedanceOperateProjectInfo(startDate,entDate,null,operatorUserIds);
|
|
listOperate = materialStareMapper.getBytedanceOperateProjectInfo(startDate,entDate,null,operatorUserIds);
|
|
for (KuaiShouOperateProjectVo projectInfo : listOperate) {
|
|
for (KuaiShouOperateProjectVo projectInfo : listOperate) {
|
|
|
|
+ String projectId = projectInfo.getProjectId();
|
|
|
|
+ //环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
|
+ String yearOnYear = "0";
|
|
|
|
+ //当天
|
|
|
|
+ int newUnitNumNow = 0;
|
|
|
|
+ int trustUnitNum = 0;
|
|
|
|
+ if (startDate == now || entDate == now){
|
|
|
|
+
|
|
|
|
+ //查询当天数据
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ //时报 消费
|
|
|
|
+ //环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
|
+ int hour = DateUtils.getNowHour();
|
|
|
|
+ List<KuaiShouOperateProjectVo> projectYearOnYearInfoNow = materialStareMapper.getBytedanceOperateProjectInfoHour(startDate,entDate,hour,projectId,operatorUserIds);
|
|
|
|
+ List<KuaiShouOperateProjectVo> projectYearOnYearInfoLast = materialStareMapper.getBytedanceOperateProjectInfoHour(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.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);
|
|
|
|
+ }
|
|
|
|
|
|
//查询 有效 上新视频 爆款视频
|
|
//查询 有效 上新视频 爆款视频
|
|
- JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(null,projectInfo.getProjectId(),null,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.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+newUnitNumNow);//基建数
|
|
|
|
+ projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum")+trustUnitNum);//智能托管
|
|
|
|
+*/
|
|
|
|
+ //查询 有效 上新计划 上新组
|
|
|
|
+ JSONObject newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(null,projectInfo.getProjectId(),null,now,now);
|
|
projectInfo.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
|
|
projectInfo.setNewEffectNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newEffectNum"));//有效
|
|
projectInfo.setNewVideoNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newVideoNum"));//上新
|
|
projectInfo.setNewVideoNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newVideoNum"));//上新
|
|
projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
|
|
projectInfo.setNewHotNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newHotNum"));//爆款
|
|
projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum"));//基建数
|
|
projectInfo.setNewUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum"));//基建数
|
|
projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
|
|
projectInfo.setTrustUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("trustUnitNum"));//智能托管
|
|
|
|
|
|
|
|
+
|
|
/*
|
|
/*
|
|
|
|
+
|
|
//查看 上传到助手、媒体的素材数量 分版位花费
|
|
//查看 上传到助手、媒体的素材数量 分版位花费
|
|
List<JSONObject> materailUpload = materialStareMapper.getKuaiShouMaterailUploadType(projectInfo.getProjectId(),startDate,entDate);
|
|
List<JSONObject> materailUpload = materialStareMapper.getKuaiShouMaterailUploadType(projectInfo.getProjectId(),startDate,entDate);
|
|
projectInfo.setAdspNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(0)+"").getLong("num"));//上传到助手
|
|
projectInfo.setAdspNum(Check.isNull(materailUpload) ? 0L : JSONObject.parseObject(materailUpload.get(0)+"").getLong("num"));//上传到助手
|
|
@@ -634,20 +675,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
//分版位
|
|
//分版位
|
|
List<JSONObject> adSceneDate = materialStareMapper.getKuaiShouAdSceneData(projectInfo.getProjectId(),startDate,entDate);
|
|
List<JSONObject> adSceneDate = materialStareMapper.getKuaiShouAdSceneData(projectInfo.getProjectId(),startDate,entDate);
|
|
projectInfo.setAdSceneDate(adSceneDate);
|
|
projectInfo.setAdSceneDate(adSceneDate);
|
|
-
|
|
|
|
- */
|
|
|
|
-
|
|
|
|
- String projectId = projectInfo.getProjectId();
|
|
|
|
- //环比 = (当前 - 上阶段 ) / 上阶段
|
|
|
|
- String yearOnYear = "0";
|
|
|
|
- //环比 日报
|
|
|
|
- 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 天 则不显示
|
|
//同比 日期超过 7 天 则不显示
|
|
String equallyRate = "-";
|
|
String equallyRate = "-";
|
|
@@ -662,6 +690,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
+
|
|
}
|
|
}
|
|
//快手
|
|
//快手
|
|
if (mediaType.equals("2")){
|
|
if (mediaType.equals("2")){
|
|
@@ -1259,9 +1288,10 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
* @time: 2022/8/31 15:16
|
|
* @time: 2022/8/31 15:16
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
- public Result getOperationGroupData(String userId,String startTime,String endTime,Integer pageNum,Integer pageSize) {
|
|
|
|
|
|
+ public Result getOperationGroupData(String userId,String mediaType,String startTime,String endTime,Integer pageNum,Integer pageSize) {
|
|
DecimalFormat decimalFormat = new DecimalFormat("0.00%");
|
|
DecimalFormat decimalFormat = new DecimalFormat("0.00%");
|
|
try {
|
|
try {
|
|
|
|
+
|
|
long nowDate = Long.valueOf(DateUtils.getDateInteger(DateUtils.getDate("yyyy-MM-dd")));
|
|
long nowDate = Long.valueOf(DateUtils.getDateInteger(DateUtils.getDate("yyyy-MM-dd")));
|
|
|
|
|
|
long startDate = Long.valueOf(DateUtils.getDateInteger(startTime));
|
|
long startDate = Long.valueOf(DateUtils.getDateInteger(startTime));
|
|
@@ -1275,8 +1305,14 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
//查询用户角色
|
|
//查询用户角色
|
|
String roleCode = materialStareMapper.getRoleCodeByUserId(userId);
|
|
String roleCode = materialStareMapper.getRoleCodeByUserId(userId);
|
|
|
|
|
|
- //所有运营经理
|
|
|
|
- List<KuaiShouOperateGroupVo> allOperationManagerList = materialStareMapper.getOperationManagerUser("kuaishouOperationManager");
|
|
|
|
|
|
+ //所有运营经理 1-头条 2-快手
|
|
|
|
+ String roleCodeName = "";
|
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
+ roleCodeName = "touTiaoOperationManager";
|
|
|
|
+ }else {
|
|
|
|
+ roleCodeName = "kuaishouOperationManager";
|
|
|
|
+ }
|
|
|
|
+ List<KuaiShouOperateGroupVo> allOperationManagerList = materialStareMapper.getOperationManagerUser(roleCodeName);
|
|
List<String> allManagerList = allOperationManagerList.stream().map(KuaiShouOperateGroupVo:: getUserId).collect(Collectors.toList());
|
|
List<String> allManagerList = allOperationManagerList.stream().map(KuaiShouOperateGroupVo:: getUserId).collect(Collectors.toList());
|
|
|
|
|
|
List<KuaiShouOperateGroupVo> operationManagerList = new ArrayList<>();
|
|
List<KuaiShouOperateGroupVo> operationManagerList = new ArrayList<>();
|
|
@@ -1299,11 +1335,19 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
Result.successMsg("运营组列表数据查询成功。",null);
|
|
Result.successMsg("运营组列表数据查询成功。",null);
|
|
}
|
|
}
|
|
|
|
|
|
- for (KuaiShouOperateGroupVo groupVo : operationManagerList) {
|
|
|
|
|
|
+ List<KuaiShouOperateGroupVo> operationList = ListPageUtil.page(operationManagerList, pageSize, pageNum);
|
|
|
|
+ for (KuaiShouOperateGroupVo groupVo : operationList) {
|
|
//下级员工
|
|
//下级员工
|
|
Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
|
|
Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
|
|
//有消耗的账户
|
|
//有消耗的账户
|
|
- operatorUserIds = materialStareMapper.getKuaiShouAllOperators(null,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
|
|
|
|
|
|
+
|
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
+ operatorUserIds = materialStareMapper.getBytedanceAllOperators(null,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
|
|
|
|
+
|
|
|
|
+ }else {
|
|
|
|
+ operatorUserIds = materialStareMapper.getKuaiShouAllOperators(null,DateUtils.getDateInteger(startTime).longValue(),DateUtils.getDateInteger(endTime).longValue(),operatorUserIds);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
|
|
if (Check.isNull(operatorUserIds) || operatorUserIds.size() < 1){
|
|
if (Check.isNull(operatorUserIds) || operatorUserIds.size() < 1){
|
|
continue;
|
|
continue;
|
|
@@ -1315,14 +1359,27 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
|
|
|
//查询账户数据
|
|
//查询账户数据
|
|
List<KuaiShouOperateVo> listOperate= new ArrayList<>();
|
|
List<KuaiShouOperateVo> listOperate= new ArrayList<>();
|
|
- PageHelper.startPage(pageNum,pageSize);
|
|
|
|
- if (daysBetween <= 1){
|
|
|
|
- //时报
|
|
|
|
- listOperate= materialStareMapper.getKuaiShouOperateInfoHourly(startDate,entDate,operatorUserIds);
|
|
|
|
|
|
+
|
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
+ if (daysBetween <= 1){
|
|
|
|
+ //时报
|
|
|
|
+ listOperate= materialStareMapper.getBytedanceOperateInfoHourly(startDate,entDate,operatorUserIds);
|
|
|
|
+ }else {
|
|
|
|
+
|
|
|
|
+ listOperate = materialStareMapper.getBytedanceOperateInfo(startDate,entDate,operatorUserIds);
|
|
|
|
+ }
|
|
}else {
|
|
}else {
|
|
- listOperate = materialStareMapper.getKuaiShouOperateInfo(startDate,entDate,operatorUserIds);
|
|
|
|
|
|
+ if (daysBetween <= 1){
|
|
|
|
+ //时报
|
|
|
|
+ listOperate= materialStareMapper.getKuaiShouOperateInfoHourly(startDate,entDate,operatorUserIds);
|
|
|
|
+ }else {
|
|
|
|
+
|
|
|
|
+ listOperate = materialStareMapper.getKuaiShouOperateInfo(startDate,entDate,operatorUserIds);
|
|
|
|
+ }
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+
|
|
|
|
+
|
|
//总花费
|
|
//总花费
|
|
Double totalCost = Check.isNull(listOperate) ? 0 : listOperate.stream().mapToDouble(KuaiShouOperateVo::getTotalCost).sum();
|
|
Double totalCost = Check.isNull(listOperate) ? 0 : listOperate.stream().mapToDouble(KuaiShouOperateVo::getTotalCost).sum();
|
|
groupVo.setTotalCost(new BigDecimal(totalCost).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
groupVo.setTotalCost(new BigDecimal(totalCost).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
@@ -1343,8 +1400,14 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
//平均账户消耗 总花费/账户数量
|
|
//平均账户消耗 总花费/账户数量
|
|
Double aveAccount = accountNum.intValue() == 0 ? 0 : totalCost/accountNum;
|
|
Double aveAccount = accountNum.intValue() == 0 ? 0 : totalCost/accountNum;
|
|
groupVo.setAverageAccountCost(new BigDecimal(aveAccount).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
groupVo.setAverageAccountCost(new BigDecimal(aveAccount).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
|
|
+
|
|
//环比 = (当前 - 上阶段 ) / 上阶段
|
|
//环比 = (当前 - 上阶段 ) / 上阶段
|
|
- List<KuaiShouOperateVo> yearOnYearInfo = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,operatorUserIds);
|
|
|
|
|
|
+ List<KuaiShouOperateVo> yearOnYearInfo = new ArrayList<>();
|
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
+ yearOnYearInfo = materialStareMapper.getBytedanceOperateInfo(lastTimeStart,lastTimeEnd,operatorUserIds);
|
|
|
|
+ }else {
|
|
|
|
+ yearOnYearInfo = materialStareMapper.getKuaiShouOperateInfo(lastTimeStart,lastTimeEnd,operatorUserIds);
|
|
|
|
+ }
|
|
String yearOnYear = "0";
|
|
String yearOnYear = "0";
|
|
if (!Check.isNull(yearOnYearInfo)){
|
|
if (!Check.isNull(yearOnYearInfo)){
|
|
Double lastTotalCost = Check.isNull(yearOnYearInfo) ? 0 : yearOnYearInfo.stream().mapToDouble(KuaiShouOperateVo::getTotalCost).sum();
|
|
Double lastTotalCost = Check.isNull(yearOnYearInfo) ? 0 : yearOnYearInfo.stream().mapToDouble(KuaiShouOperateVo::getTotalCost).sum();
|
|
@@ -1354,22 +1417,36 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
//花费环比
|
|
//花费环比
|
|
groupVo.setYearOnYearCost(yearOnYear);
|
|
groupVo.setYearOnYearCost(yearOnYear);
|
|
|
|
|
|
-
|
|
|
|
//当天
|
|
//当天
|
|
int newUnitNumNow = 0;
|
|
int newUnitNumNow = 0;
|
|
if (startDate == nowDate || entDate == nowDate){
|
|
if (startDate == nowDate || entDate == nowDate){
|
|
- //查询 当天有效 上新计划 上新组
|
|
|
|
- JSONObject newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(operatorUserIds,null,null,nowDate,nowDate);
|
|
|
|
|
|
+ JSONObject newEffect = new JSONObject();
|
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
+ //查询 当天有效 上新计划 上新组
|
|
|
|
+ newEffect = materialStareMapper.getBytedanceAccountBaseByUserId(operatorUserIds,null,null,nowDate,nowDate);
|
|
|
|
+ }else {
|
|
|
|
+ //查询 当天有效 上新计划 上新组
|
|
|
|
+ newEffect = materialStareMapper.getKuaiShouAccountNowBaseByUserId(operatorUserIds,null,null,nowDate,nowDate);
|
|
|
|
+ }
|
|
newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
|
|
newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum");//组
|
|
}
|
|
}
|
|
|
|
|
|
- //查询 历史上新组
|
|
|
|
- JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(operatorUserIds,null,null,startDate,entDate);
|
|
|
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
+ }else {
|
|
|
|
+ //查询 历史上新组
|
|
|
|
+ JSONObject newEffect = materialStareMapper.getKuaiShouAccountBaseByUserId(operatorUserIds,null,null,startDate,entDate);
|
|
|
|
+ newUnitNumNow = Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+newUnitNumNow;
|
|
|
|
+ }
|
|
|
|
+
|
|
//基建数量
|
|
//基建数量
|
|
- groupVo.setUnitNum(Check.isNull(newEffect) ? 0 : newEffect.getInteger("newUnitNum")+newUnitNumNow);//组
|
|
|
|
|
|
+ groupVo.setUnitNum(newUnitNumNow);//组
|
|
}
|
|
}
|
|
-
|
|
|
|
- PageInfo<KuaiShouOperateGroupVo> pageInfo = new PageInfo<>(operationManagerList);
|
|
|
|
|
|
+ PageInfo<KuaiShouOperateGroupVo> pageInfo = new PageInfo<>(operationList);
|
|
|
|
+ pageInfo.setTotal(operationManagerList.size());
|
|
|
|
+ pageInfo.setPageSize(pageSize);
|
|
|
|
+ pageInfo.setPageNum(pageNum);
|
|
|
|
+ pageInfo.setIsLastPage(false);
|
|
|
|
+ pageInfo.setHasNextPage(true);
|
|
return Result.successMsg("运营组列表数据查询成功。",pageInfo);
|
|
return Result.successMsg("运营组列表数据查询成功。",pageInfo);
|
|
}catch (Exception e){
|
|
}catch (Exception e){
|
|
e.printStackTrace();
|
|
e.printStackTrace();
|
|
@@ -1378,7 +1455,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
}
|
|
}
|
|
|
|
|
|
|
|
|
|
- public Result exportOperationGroupData(String userId,String startTime,String endTime, HttpServletResponse response) {
|
|
|
|
|
|
+ public Result exportOperationGroupData(String userId,String mediaType,String startTime,String endTime, HttpServletResponse response) {
|
|
DecimalFormat decimalFormat = new DecimalFormat("0.00%");
|
|
DecimalFormat decimalFormat = new DecimalFormat("0.00%");
|
|
try {
|
|
try {
|
|
long nowDate = Long.valueOf(DateUtils.getDateInteger(DateUtils.getDate("yyyy-MM-dd")));
|
|
long nowDate = Long.valueOf(DateUtils.getDateInteger(DateUtils.getDate("yyyy-MM-dd")));
|
|
@@ -1393,8 +1470,14 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
//查询用户角色
|
|
//查询用户角色
|
|
String roleCode = materialStareMapper.getRoleCodeByUserId(userId);
|
|
String roleCode = materialStareMapper.getRoleCodeByUserId(userId);
|
|
|
|
|
|
- //所有运营经理
|
|
|
|
- List<KuaiShouOperateGroupVo> allOperationManagerList = materialStareMapper.getOperationManagerUser("kuaishouOperationManager");
|
|
|
|
|
|
+ //所有运营经理 1-头条 2-快手
|
|
|
|
+ String roleCodeName = "";
|
|
|
|
+ if (mediaType.equals("1")){
|
|
|
|
+ roleCodeName = "touTiaoOperationManager";
|
|
|
|
+ }else {
|
|
|
|
+ roleCodeName = "kuaishouOperationManager";
|
|
|
|
+ }
|
|
|
|
+ List<KuaiShouOperateGroupVo> allOperationManagerList = materialStareMapper.getOperationManagerUser(roleCodeName);
|
|
List<String> allManagerList = allOperationManagerList.stream().map(KuaiShouOperateGroupVo:: getUserId).collect(Collectors.toList());
|
|
List<String> allManagerList = allOperationManagerList.stream().map(KuaiShouOperateGroupVo:: getUserId).collect(Collectors.toList());
|
|
|
|
|
|
List<KuaiShouOperateGroupVo> operationManagerList = new ArrayList<>();
|
|
List<KuaiShouOperateGroupVo> operationManagerList = new ArrayList<>();
|
|
@@ -1418,7 +1501,6 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
}
|
|
}
|
|
|
|
|
|
for (KuaiShouOperateGroupVo groupVo : operationManagerList) {
|
|
for (KuaiShouOperateGroupVo groupVo : operationManagerList) {
|
|
-
|
|
|
|
//下级员工
|
|
//下级员工
|
|
Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
|
|
Set<String> operatorUserIds = getAffiliateId(groupVo.getUserId());
|
|
//有消耗的账户
|
|
//有消耗的账户
|
|
@@ -1430,26 +1512,31 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
|
|
|
|
//运营数量
|
|
//运营数量
|
|
int operationNum = Check.isNull(operatorUserIds) ? 0 : operatorUserIds.size();
|
|
int operationNum = Check.isNull(operatorUserIds) ? 0 : operatorUserIds.size();
|
|
-
|
|
|
|
groupVo.setOperationNum(operationNum);
|
|
groupVo.setOperationNum(operationNum);
|
|
|
|
+
|
|
//查询账户数据
|
|
//查询账户数据
|
|
List<KuaiShouOperateVo> listOperate= new ArrayList<>();
|
|
List<KuaiShouOperateVo> listOperate= new ArrayList<>();
|
|
|
|
+
|
|
if (daysBetween <= 1){
|
|
if (daysBetween <= 1){
|
|
//时报
|
|
//时报
|
|
listOperate= materialStareMapper.getKuaiShouOperateInfoHourly(startDate,entDate,operatorUserIds);
|
|
listOperate= materialStareMapper.getKuaiShouOperateInfoHourly(startDate,entDate,operatorUserIds);
|
|
}else {
|
|
}else {
|
|
|
|
+
|
|
listOperate = materialStareMapper.getKuaiShouOperateInfo(startDate,entDate,operatorUserIds);
|
|
listOperate = materialStareMapper.getKuaiShouOperateInfo(startDate,entDate,operatorUserIds);
|
|
}
|
|
}
|
|
|
|
+
|
|
//总花费
|
|
//总花费
|
|
Double totalCost = Check.isNull(listOperate) ? 0 : listOperate.stream().mapToDouble(KuaiShouOperateVo::getTotalCost).sum();
|
|
Double totalCost = Check.isNull(listOperate) ? 0 : listOperate.stream().mapToDouble(KuaiShouOperateVo::getTotalCost).sum();
|
|
groupVo.setTotalCost(new BigDecimal(totalCost).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
groupVo.setTotalCost(new BigDecimal(totalCost).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
|
|
+
|
|
//日均消耗 总花费/天数
|
|
//日均消耗 总花费/天数
|
|
Double aveDay = daysBetween == 0 ? 0 : totalCost/daysBetween;
|
|
Double aveDay = daysBetween == 0 ? 0 : totalCost/daysBetween;
|
|
groupVo.setAverageDayCost(new BigDecimal(aveDay).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
groupVo.setAverageDayCost(new BigDecimal(aveDay).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
//人均消耗
|
|
//人均消耗
|
|
Double avePeople = totalCost/operationNum;
|
|
Double avePeople = totalCost/operationNum;
|
|
- groupVo.setAveragePeopleCost(avePeople);
|
|
|
|
- //项目数量
|
|
|
|
|
|
+ groupVo.setAveragePeopleCost(new BigDecimal(avePeople).setScale(3,BigDecimal.ROUND_HALF_UP).doubleValue());
|
|
|
|
+
|
|
|
|
+ //项目数量
|
|
Double projectNum = Check.isNull(listOperate) ? 0 : listOperate.stream().mapToDouble(KuaiShouOperateVo::getProjectNum).sum();
|
|
Double projectNum = Check.isNull(listOperate) ? 0 : listOperate.stream().mapToDouble(KuaiShouOperateVo::getProjectNum).sum();
|
|
groupVo.setProjectNum(projectNum.longValue());
|
|
groupVo.setProjectNum(projectNum.longValue());
|
|
//账户数量
|
|
//账户数量
|
|
@@ -1468,6 +1555,7 @@ public class MaterialStareServiceImpl implements MaterialStareService {
|
|
}
|
|
}
|
|
//花费环比
|
|
//花费环比
|
|
groupVo.setYearOnYearCost(yearOnYear);
|
|
groupVo.setYearOnYearCost(yearOnYear);
|
|
|
|
+
|
|
//当天
|
|
//当天
|
|
int newUnitNumNow = 0;
|
|
int newUnitNumNow = 0;
|
|
if (startDate == nowDate || entDate == nowDate){
|
|
if (startDate == nowDate || entDate == nowDate){
|