|
@@ -1,11 +1,16 @@
|
|
package org.jeecg.modules.ctop.service.impl;
|
|
package org.jeecg.modules.ctop.service.impl;
|
|
|
|
|
|
|
|
+import cn.com.ctop.common.module.utils.Check;
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
import cn.com.ctop.common.module.utils.CtopAdConstant;
|
|
|
|
+import cn.com.ctop.common.module.utils.ExportExcelUtils;
|
|
|
|
+import cn.com.ctop.common.module.utils.HttpUtils;
|
|
import cn.com.ctop.kuaishou.modules.utils.LinkUtils;
|
|
import cn.com.ctop.kuaishou.modules.utils.LinkUtils;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONArray;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.alibaba.fastjson.JSONObject;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageHelper;
|
|
import com.github.pagehelper.PageInfo;
|
|
import com.github.pagehelper.PageInfo;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.apache.poi.xssf.usermodel.XSSFWorkbook;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.apache.shiro.SecurityUtils;
|
|
import org.jeecg.common.constant.AccountReportConstants;
|
|
import org.jeecg.common.constant.AccountReportConstants;
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
import org.jeecg.common.system.vo.LoginUser;
|
|
@@ -17,10 +22,15 @@ import org.jeecg.modules.system.service.ISysRoleService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
|
|
|
|
+import javax.servlet.http.HttpServletRequest;
|
|
|
|
+import javax.servlet.http.HttpServletResponse;
|
|
|
|
+import java.io.IOException;
|
|
|
|
+import java.io.OutputStream;
|
|
import java.math.BigDecimal;
|
|
import java.math.BigDecimal;
|
|
import java.text.ParseException;
|
|
import java.text.ParseException;
|
|
import java.util.*;
|
|
import java.util.*;
|
|
|
|
|
|
|
|
+@Slf4j
|
|
@Service
|
|
@Service
|
|
public class MaterialReportOverViewServiceImpl implements IMaterialReportOverViewService {
|
|
public class MaterialReportOverViewServiceImpl implements IMaterialReportOverViewService {
|
|
|
|
|
|
@@ -47,24 +57,24 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Set<JSONObject> queryProjectBy(Set<String> userIds, int mediaId) {
|
|
public Set<JSONObject> queryProjectBy(Set<String> userIds, int mediaId) {
|
|
- JSONArray mediaIds= new JSONArray();
|
|
|
|
|
|
+ JSONArray mediaIds = new JSONArray();
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
mediaIds.add(1);
|
|
mediaIds.add(1);
|
|
mediaIds.add(3);
|
|
mediaIds.add(3);
|
|
- }else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
|
|
|
|
+ } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
mediaIds.add(2);
|
|
mediaIds.add(2);
|
|
mediaIds.add(4);
|
|
mediaIds.add(4);
|
|
}
|
|
}
|
|
- return materialReportOverViewMapper.queryProjectBy(userIds, mediaIds);
|
|
|
|
|
|
+ return materialReportOverViewMapper.queryProjectBy(userIds, mediaIds);
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public JSONArray queryProjectIdBy(Set<String> userIds, int mediaId) {
|
|
public JSONArray queryProjectIdBy(Set<String> userIds, int mediaId) {
|
|
- JSONArray mediaIds= new JSONArray();
|
|
|
|
|
|
+ JSONArray mediaIds = new JSONArray();
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
mediaIds.add(1);
|
|
mediaIds.add(1);
|
|
mediaIds.add(3);
|
|
mediaIds.add(3);
|
|
- }else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
|
|
|
|
+ } else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
mediaIds.add(2);
|
|
mediaIds.add(2);
|
|
mediaIds.add(4);
|
|
mediaIds.add(4);
|
|
}
|
|
}
|
|
@@ -78,21 +88,21 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
projects = getProjectsByCurrentUser(mediaId);
|
|
projects = getProjectsByCurrentUser(mediaId);
|
|
}
|
|
}
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
- BigDecimal cost= materialReportOverViewMapper.queryBytedanceCost(startDate, endDate, projects);
|
|
|
|
- BigDecimal lastCost= materialReportOverViewMapper.queryBytedanceCost(DateUtils.addDay(DateUtils.addDay(endDate,-1),-DateUtils.dateDiff(startDate,endDate)), DateUtils.addDay(endDate,-1),projects);
|
|
|
|
|
|
+ BigDecimal cost = materialReportOverViewMapper.queryBytedanceCost(startDate, endDate, projects);
|
|
|
|
+ BigDecimal lastCost = materialReportOverViewMapper.queryBytedanceCost(DateUtils.addDay(DateUtils.addDay(endDate, -1), -DateUtils.dateDiff(startDate, endDate)), DateUtils.addDay(endDate, -1), projects);
|
|
result.put("cost", cost);
|
|
result.put("cost", cost);
|
|
- result.put("costLink", LinkUtils.countLink(cost==null?BigDecimal.ZERO:cost,lastCost==null?BigDecimal.ZERO:lastCost));
|
|
|
|
|
|
+ result.put("costLink", LinkUtils.countLink(cost == null ? BigDecimal.ZERO : cost, lastCost == null ? BigDecimal.ZERO : lastCost));
|
|
result.put("video", materialReportOverViewMapper.queryMaterialCount(startDate, endDate, projects));
|
|
result.put("video", materialReportOverViewMapper.queryMaterialCount(startDate, endDate, projects));
|
|
- result.put("newVideo",materialReportOverViewMapper.queryNewMaterialCount(DateUtils.now(),projects));
|
|
|
|
|
|
+ result.put("newVideo", materialReportOverViewMapper.queryNewMaterialCount(DateUtils.date2Str(), projects));
|
|
result.put("hot", 0);
|
|
result.put("hot", 0);
|
|
result.put("valid", 0);
|
|
result.put("valid", 0);
|
|
} else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
} else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
BigDecimal cost = materialReportOverViewMapper.queryKuaishouCost(startDate, endDate, projects);
|
|
BigDecimal cost = materialReportOverViewMapper.queryKuaishouCost(startDate, endDate, projects);
|
|
- BigDecimal lastCost= materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(DateUtils.addDay(endDate,-1),-DateUtils.dateDiff(startDate,endDate)), DateUtils.addDay(endDate,-1),projects);
|
|
|
|
|
|
+ BigDecimal lastCost = materialReportOverViewMapper.queryKuaishouCost(DateUtils.addDay(DateUtils.addDay(endDate, -1), -DateUtils.dateDiff(startDate, endDate)), DateUtils.addDay(endDate, -1), projects);
|
|
result.put("cost", cost);
|
|
result.put("cost", cost);
|
|
- result.put("costLink", LinkUtils.countLink(cost==null?BigDecimal.ZERO:cost,lastCost==null?BigDecimal.ZERO:lastCost));
|
|
|
|
|
|
+ result.put("costLink", LinkUtils.countLink(cost == null ? BigDecimal.ZERO : cost, lastCost == null ? BigDecimal.ZERO : lastCost));
|
|
result.put("video", materialReportOverViewMapper.queryMaterialCount(startDate, endDate, projects));
|
|
result.put("video", materialReportOverViewMapper.queryMaterialCount(startDate, endDate, projects));
|
|
- result.put("newVideo",materialReportOverViewMapper.queryNewMaterialCount(DateUtils.now(),projects));
|
|
|
|
|
|
+ result.put("newVideo", materialReportOverViewMapper.queryNewMaterialCount(DateUtils.date2Str(), projects));
|
|
result.put("hot", 0);
|
|
result.put("hot", 0);
|
|
result.put("valid", 0);
|
|
result.put("valid", 0);
|
|
}
|
|
}
|
|
@@ -147,23 +157,23 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public PageInfo<JSONObject> getTopMaterialList(int mediaId, String startDate, String endDate, JSONArray projects
|
|
public PageInfo<JSONObject> getTopMaterialList(int mediaId, String startDate, String endDate, JSONArray projects
|
|
- , String channelType,String md5,String target,String order, int pageNo, int pageSize) {
|
|
|
|
|
|
+ , String channelType, String md5, String target, String order, int pageNo, int pageSize) {
|
|
PageInfo<JSONObject> result = new PageInfo<>();
|
|
PageInfo<JSONObject> result = new PageInfo<>();
|
|
if (projects.isEmpty()) {
|
|
if (projects.isEmpty()) {
|
|
projects = getProjectsByCurrentUser(mediaId);
|
|
projects = getProjectsByCurrentUser(mediaId);
|
|
}
|
|
}
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapByVideo);
|
|
String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.dicMapByVideo);
|
|
- PageHelper.startPage(pageNo,pageSize,false);
|
|
|
|
- List<JSONObject> list= materialReportOverViewMapper.queryBytedanceMaterialReport(filedAll,startDate, endDate, projects,md5,target,order);
|
|
|
|
- Long count= materialReportOverViewMapper.queryBytedanceMaterialReportCount(startDate, endDate, projects,md5);
|
|
|
|
|
|
+ PageHelper.startPage(pageNo, pageSize, false);
|
|
|
|
+ List<JSONObject> list = materialReportOverViewMapper.queryBytedanceMaterialReport(filedAll, startDate, endDate, projects, md5, target, order);
|
|
|
|
+ Long count = materialReportOverViewMapper.queryBytedanceMaterialReportCount(startDate, endDate, projects, md5);
|
|
result.setTotal(count);
|
|
result.setTotal(count);
|
|
result.setList(list);
|
|
result.setList(list);
|
|
} else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
} else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
- String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.kuaishouVideoReportMap );
|
|
|
|
- PageHelper.startPage(pageNo,pageSize,false);
|
|
|
|
- List<JSONObject> list= materialReportOverViewMapper.queryKuaishouMaterialReport(filedAll,startDate, endDate, projects,channelType,md5,target,order);
|
|
|
|
- Long count= materialReportOverViewMapper.queryKuaishouMaterialReportCount(startDate, endDate, projects,channelType,md5);
|
|
|
|
|
|
+ String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.kuaishouVideoReportMap);
|
|
|
|
+ PageHelper.startPage(pageNo, pageSize, false);
|
|
|
|
+ List<JSONObject> list = materialReportOverViewMapper.queryKuaishouMaterialReport(filedAll, startDate, endDate, projects, channelType, md5, target, order);
|
|
|
|
+ Long count = materialReportOverViewMapper.queryKuaishouMaterialReportCount(startDate, endDate, projects, channelType, md5);
|
|
result.setTotal(count);
|
|
result.setTotal(count);
|
|
result.setList(list);
|
|
result.setList(list);
|
|
}
|
|
}
|
|
@@ -171,15 +181,119 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
- public PageInfo<JSONObject> getTopDesignList(String startDate, String endDate, String userId,String target,String order, int pageSize, int pageNo) {
|
|
|
|
|
|
+ public void exportBytedanceExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
+ JSONArray projects= requestBody.getJSONArray("projects");
|
|
|
|
+ if (projects.isEmpty()) {
|
|
|
|
+ projects = getProjectsByCurrentUser(requestBody.getInteger("mediaId"));
|
|
|
|
+ }
|
|
|
|
+ JSONArray columns = requestBody.getJSONArray("columns");
|
|
|
|
+ if (columns.isEmpty()) {
|
|
|
|
+ //默认消耗必查
|
|
|
|
+ columns.add("cost");
|
|
|
|
+ }
|
|
|
|
+ String filed = JsonResourceUtil.joinFiled(AccountReportConstants.dicMapByVideo, columns);
|
|
|
|
+ List<String> titles = new ArrayList<>(JsonResourceUtil.joinTitle(AccountReportConstants.dicMapByVideo, columns));
|
|
|
|
+
|
|
|
|
+ titles.add(0, "唯一标识");
|
|
|
|
+ titles.add(1, "视频");
|
|
|
|
+ titles.add(2, "视频名称");
|
|
|
|
+ titles.add(3, "项目名称");
|
|
|
|
+ columns.add(0, "signature");
|
|
|
|
+ columns.add(1, "url");
|
|
|
|
+ columns.add(2, "materialName");
|
|
|
|
+ columns.add(3, "projectName");
|
|
|
|
+
|
|
|
|
+ List<JSONObject> excelData = materialReportOverViewMapper.queryBytedanceMaterialReport(filed, requestBody.getString("startDate"), requestBody.getString("endDate"),
|
|
|
|
+ projects, requestBody.getString("md5"),requestBody.getString("target")==null?"cost":requestBody.getString("target")
|
|
|
|
+ , requestBody.getString("order")==null?"desc":requestBody.getString("order"));
|
|
|
|
+
|
|
|
|
+ if (null != excelData && excelData.isEmpty()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ List<List<Object>> excelList = new ArrayList<>();
|
|
|
|
+ excelData.forEach(data -> {
|
|
|
|
+ List<Object> temp = new ArrayList<>();
|
|
|
|
+ columns.forEach(k -> {
|
|
|
|
+ temp.add(data.get(k.toString()));
|
|
|
|
+ });
|
|
|
|
+ excelList.add(temp);
|
|
|
|
+ });
|
|
|
|
+ try {
|
|
|
|
+ String[] headers = titles.toArray(new String[titles.size()]);
|
|
|
|
+ OutputStream os = response.getOutputStream();
|
|
|
|
+ ExportExcelUtils eeu = new ExportExcelUtils();
|
|
|
|
+ XSSFWorkbook workbook = new XSSFWorkbook();
|
|
|
|
+ eeu.exportExcel(workbook, 0, "头条视频报表", headers, excelList);
|
|
|
|
+ HttpUtils.setResponseHeader(response, "头条视频报表.xlsx");
|
|
|
|
+ workbook.write(os);
|
|
|
|
+ os.flush();
|
|
|
|
+ os.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ log.error(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public void exportKuaishouExcel(JSONObject requestBody, HttpServletRequest request, HttpServletResponse response) {
|
|
|
|
+ JSONArray projects= requestBody.getJSONArray("projects");
|
|
|
|
+ if (projects.isEmpty()) {
|
|
|
|
+ projects = getProjectsByCurrentUser(requestBody.getInteger("mediaId"));
|
|
|
|
+ }
|
|
|
|
+ JSONArray columns2 = new JSONArray();
|
|
|
|
+ columns2.add(0, "signature");
|
|
|
|
+ columns2.add(1, "url");
|
|
|
|
+ columns2.add(2, "projectName");
|
|
|
|
+ columns2.add(3, "materialName");
|
|
|
|
+ JSONArray columns = requestBody.getJSONArray("columns");
|
|
|
|
+ for (int i = 0; i < columns.size(); i++) {
|
|
|
|
+ columns2.add(columns2.size(), columns.getString(i));
|
|
|
|
+ }
|
|
|
|
+ columns2.add(columns2.size(), "url");
|
|
|
|
+ List<String> titles = getfileIds(AccountReportConstants.kuaishouVideoReportDict, columns2);
|
|
|
|
+ String filedAll = JsonResourceUtil.joinAllFiled(AccountReportConstants.kuaishouVideoReportMap);
|
|
|
|
+ List<JSONObject> excelData = materialReportOverViewMapper.queryKuaishouMaterialReport(filedAll, requestBody.getString("startDate"), requestBody.getString("endDate"),
|
|
|
|
+ projects, requestBody.getString("channelType"),requestBody.getString("md5"), requestBody.getString("target")==null?"cost":requestBody.getString("target")
|
|
|
|
+ , requestBody.getString("order")==null?"desc":requestBody.getString("order"));
|
|
|
|
+ if (null != excelData && excelData.isEmpty()) {
|
|
|
|
+ return;
|
|
|
|
+ }
|
|
|
|
+ List<List<Object>> excelList = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < excelData.size(); i++) {
|
|
|
|
+ List<Object> temp = new ArrayList<>();
|
|
|
|
+ JSONObject jsonObject = excelData.get(i);
|
|
|
|
+ for (int j = 0; j < columns2.size(); j++) {
|
|
|
|
+ String key = columns2.getString(j);
|
|
|
|
+ String value = jsonObject.getString(key);
|
|
|
|
+ temp.add(value);
|
|
|
|
+ }
|
|
|
|
+ excelList.add(temp);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ try {
|
|
|
|
+ String[] strings = titles.toArray(new String[]{});
|
|
|
|
+ OutputStream os = response.getOutputStream();
|
|
|
|
+ ExportExcelUtils eeu = new ExportExcelUtils();
|
|
|
|
+ XSSFWorkbook workbook = new XSSFWorkbook();
|
|
|
|
+ eeu.exportExcel(workbook, 0, "快手素材报表", strings, excelList);
|
|
|
|
+ HttpUtils.setResponseHeader(response, "快手素材.xlsx");
|
|
|
|
+ workbook.write(os);
|
|
|
|
+ os.flush();
|
|
|
|
+ os.close();
|
|
|
|
+ } catch (IOException e) {
|
|
|
|
+ log.error(e.getMessage());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ @Override
|
|
|
|
+ public PageInfo<JSONObject> getTopDesignList(String startDate, String endDate, String userId, String target, String order, int pageSize, int pageNo) {
|
|
PageInfo<JSONObject> result = new PageInfo<>();
|
|
PageInfo<JSONObject> result = new PageInfo<>();
|
|
Set<String> subordinate = this.recursiveQuerySubordinate(userId);
|
|
Set<String> subordinate = this.recursiveQuerySubordinate(userId);
|
|
- if(subordinate.isEmpty()){
|
|
|
|
- subordinate=materialReportOverViewMapper.recursiveQuerySubordinateByUserId(userId);
|
|
|
|
|
|
+ if (subordinate.isEmpty()) {
|
|
|
|
+ subordinate = materialReportOverViewMapper.recursiveQuerySubordinateByUserId(userId);
|
|
}
|
|
}
|
|
- PageHelper.startPage(pageNo,pageSize,false);
|
|
|
|
- List<JSONObject> topDesign = materialReportOverViewMapper.queryTopDesign(startDate, endDate, subordinate,target,order);
|
|
|
|
- Long count=materialReportOverViewMapper.queryTopDesignCount(startDate, endDate, subordinate);
|
|
|
|
|
|
+ PageHelper.startPage(pageNo, pageSize, false);
|
|
|
|
+ List<JSONObject> topDesign = materialReportOverViewMapper.queryTopDesign(startDate, endDate, subordinate, target, order);
|
|
|
|
+ Long count = materialReportOverViewMapper.queryTopDesignCount(startDate, endDate, subordinate);
|
|
result.setList(topDesign);
|
|
result.setList(topDesign);
|
|
result.setTotal(count);
|
|
result.setTotal(count);
|
|
return result;
|
|
return result;
|
|
@@ -189,9 +303,9 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
public JSONObject getMaterialDetailInfo(int mediaId, String md5) {
|
|
public JSONObject getMaterialDetailInfo(int mediaId, String md5) {
|
|
JSONObject result = new JSONObject();
|
|
JSONObject result = new JSONObject();
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
- result= materialReportOverViewMapper.queryBytedanceVideoDetail(md5);
|
|
|
|
|
|
+ result = materialReportOverViewMapper.queryBytedanceVideoDetail(md5);
|
|
} else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
} else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
- result= materialReportOverViewMapper.queryKuaishouVideoDetail(md5);
|
|
|
|
|
|
+ result = materialReportOverViewMapper.queryKuaishouVideoDetail(md5);
|
|
|
|
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
@@ -199,26 +313,26 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
|
|
|
|
@Override
|
|
@Override
|
|
public Map<String, Object> materialDetailAnalyse(int mediaId, String md5) {
|
|
public Map<String, Object> materialDetailAnalyse(int mediaId, String md5) {
|
|
- Map<String,Object> result = new HashMap<>();
|
|
|
|
|
|
+ Map<String, Object> result = new HashMap<>();
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
- Long projectId= materialReportOverViewMapper.queryBytedanceProjectIdByMd5(md5);
|
|
|
|
- result.put("cost",materialReportOverViewMapper.queryBytedanceCostByMd5(md5,projectId));
|
|
|
|
- result.put("click",materialReportOverViewMapper.queryBytedanceClickByMd5(md5,projectId));
|
|
|
|
- result.put("materialShow",materialReportOverViewMapper.queryBytedanceMaterialShowByMd5(md5,projectId));
|
|
|
|
- result.put("play100Rate",materialReportOverViewMapper.queryBytedancePlay100RateByMd5(md5,projectId));
|
|
|
|
- result.put("likeMaterial",materialReportOverViewMapper.queryBytedanceLikeMaterialByMd5(md5,projectId));
|
|
|
|
- result.put("commentMaterial",materialReportOverViewMapper.queryBytedanceCommentMaterialByMd5(md5,projectId));
|
|
|
|
- result.put("shareMaterial",materialReportOverViewMapper.queryBytedanceShareMaterialByMd5(md5,projectId));
|
|
|
|
- result.put("follow",materialReportOverViewMapper.queryBytedanceFollowByMd5(md5,projectId));
|
|
|
|
|
|
+ Long projectId = materialReportOverViewMapper.queryBytedanceProjectIdByMd5(md5);
|
|
|
|
+ result.put("cost", materialReportOverViewMapper.queryBytedanceCostByMd5(md5, projectId));
|
|
|
|
+ result.put("click", materialReportOverViewMapper.queryBytedanceClickByMd5(md5, projectId));
|
|
|
|
+ result.put("materialShow", materialReportOverViewMapper.queryBytedanceMaterialShowByMd5(md5, projectId));
|
|
|
|
+ result.put("play100Rate", materialReportOverViewMapper.queryBytedancePlay100RateByMd5(md5, projectId));
|
|
|
|
+ result.put("likeMaterial", materialReportOverViewMapper.queryBytedanceLikeMaterialByMd5(md5, projectId));
|
|
|
|
+ result.put("commentMaterial", materialReportOverViewMapper.queryBytedanceCommentMaterialByMd5(md5, projectId));
|
|
|
|
+ result.put("shareMaterial", materialReportOverViewMapper.queryBytedanceShareMaterialByMd5(md5, projectId));
|
|
|
|
+ result.put("follow", materialReportOverViewMapper.queryBytedanceFollowByMd5(md5, projectId));
|
|
} else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
} else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
- Long projectId= materialReportOverViewMapper.queryKuaishouProjectIdByMd5(md5);
|
|
|
|
- result.put("charge",materialReportOverViewMapper.queryKuaishouChargeByMd5(md5,projectId));
|
|
|
|
- result.put("photoShow",materialReportOverViewMapper.queryKuaishouPhotoShowByMd5(md5,projectId));
|
|
|
|
- result.put("photoClick",materialReportOverViewMapper.queryKuaishouPhotoClickByMd5(md5,projectId));
|
|
|
|
- result.put("aclick",materialReportOverViewMapper.queryKuaishouAClickByMd5(md5,projectId));
|
|
|
|
- result.put("bclick",materialReportOverViewMapper.queryKuaishouBClickByMd5(md5,projectId));
|
|
|
|
- result.put("activation",materialReportOverViewMapper.queryKuaishouActivationByMd5(md5,projectId));
|
|
|
|
- result.put("play3sRate",materialReportOverViewMapper.queryKuaishouPlay3sRateByMd5(md5,projectId));
|
|
|
|
|
|
+ Long projectId = materialReportOverViewMapper.queryKuaishouProjectIdByMd5(md5);
|
|
|
|
+ result.put("charge", materialReportOverViewMapper.queryKuaishouChargeByMd5(md5, projectId));
|
|
|
|
+ result.put("photoShow", materialReportOverViewMapper.queryKuaishouPhotoShowByMd5(md5, projectId));
|
|
|
|
+ result.put("photoClick", materialReportOverViewMapper.queryKuaishouPhotoClickByMd5(md5, projectId));
|
|
|
|
+ result.put("aclick", materialReportOverViewMapper.queryKuaishouAClickByMd5(md5, projectId));
|
|
|
|
+ result.put("bclick", materialReportOverViewMapper.queryKuaishouBClickByMd5(md5, projectId));
|
|
|
|
+ result.put("activation", materialReportOverViewMapper.queryKuaishouActivationByMd5(md5, projectId));
|
|
|
|
+ result.put("play3sRate", materialReportOverViewMapper.queryKuaishouPlay3sRateByMd5(md5, projectId));
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
@@ -227,9 +341,9 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
public List<JSONObject> getMaterialDetailChat(int mediaId, String md5) {
|
|
public List<JSONObject> getMaterialDetailChat(int mediaId, String md5) {
|
|
List<JSONObject> result = new ArrayList<>();
|
|
List<JSONObject> result = new ArrayList<>();
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
if (mediaId == CtopAdConstant.PLATFORM_TYPE_BYTEDANCE_INT) {
|
|
- result= materialReportOverViewMapper.queryBytedanceVideoChat(md5);
|
|
|
|
|
|
+ result = materialReportOverViewMapper.queryBytedanceVideoChat(md5);
|
|
} else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
} else if (mediaId == CtopAdConstant.PLATFORM_TYPE_KUAISHOU_INT) {
|
|
- result= materialReportOverViewMapper.queryKuaishouVideoChat(md5);
|
|
|
|
|
|
+ result = materialReportOverViewMapper.queryKuaishouVideoChat(md5);
|
|
}
|
|
}
|
|
return result;
|
|
return result;
|
|
}
|
|
}
|
|
@@ -249,10 +363,25 @@ public class MaterialReportOverViewServiceImpl implements IMaterialReportOverVie
|
|
private JSONArray getProjectsByCurrentUser(int mediaId) {
|
|
private JSONArray getProjectsByCurrentUser(int mediaId) {
|
|
String currentUser = ((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId();
|
|
String currentUser = ((LoginUser) SecurityUtils.getSubject().getPrincipal()).getId();
|
|
//TODO 为了解决管理员等角色初始化查全部项目查询效率慢的问题判断角色,待优化
|
|
//TODO 为了解决管理员等角色初始化查全部项目查询效率慢的问题判断角色,待优化
|
|
- String roleCode= roleService.getRoleCodeByUserId(currentUser);
|
|
|
|
- if(roleCode.equals("admin")){
|
|
|
|
|
|
+ String roleCode = roleService.getRoleCodeByUserId(currentUser);
|
|
|
|
+ if (roleCode.equals("admin")) {
|
|
return null;
|
|
return null;
|
|
}
|
|
}
|
|
return queryProjectIdBy(recursiveQuerySubordinate(currentUser), mediaId);
|
|
return queryProjectIdBy(recursiveQuerySubordinate(currentUser), mediaId);
|
|
}
|
|
}
|
|
|
|
+ private List<String> getfileIds(Map<String, Map<String, Object>> kuaishouVideoReportMap, JSONArray columns) {
|
|
|
|
+ List<String> titles = new ArrayList<>();
|
|
|
|
+ for (int i = 0; i < columns.size(); i++) {
|
|
|
|
+ String string = columns.getString(i);
|
|
|
|
+ Map<String, Object> stringObjectMap = kuaishouVideoReportMap.get(string);
|
|
|
|
+ if (Check.isNull(stringObjectMap)) {
|
|
|
|
+ titles.add("-");
|
|
|
|
+ continue;
|
|
|
|
+ }
|
|
|
|
+ Object comment = stringObjectMap.get("comment");
|
|
|
|
+ titles.add(String.valueOf(comment));
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ return titles;
|
|
|
|
+ }
|
|
}
|
|
}
|