Commit cb87de34 by shenjunjie

Merge branch 'feature' into 'release'

竞品对比分析图谱时间间隔调整2

See merge request !222
parents 3b896078 944c7ff9
...@@ -1131,12 +1131,20 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1131,12 +1131,20 @@ public class MarkDataServiceImpl implements MarkDataService {
result.put("startTime", startTime); result.put("startTime", startTime);
// 结束时间 // 结束时间
result.put("endTime", endTime); result.put("endTime", endTime);
// 时间超过三天则选用day
List<Map<String, Long>> cutList;
if (endTime - startTime > Constant.ONE_DAY * 3) {
cutList = Tools.parseToDays(startTime, endTime);
result.put("timeType", "day");
} else {
cutList = Tools.parseToHours(startTime, endTime);
result.put("timeType", "hour");
}
// 主品牌图谱 // 主品牌图谱
JSONObject primaryLine = new JSONObject(); JSONObject primaryLine = new JSONObject();
primaryLine.put("id", Constant.PRIMARY_CONTEND_ID); primaryLine.put("id", Constant.PRIMARY_CONTEND_ID);
primaryLine.put("brand", project.getBrandName()); primaryLine.put("brand", project.getBrandName());
List<LineVO> primarySpread = getArticleSpread(projectId, project.getBrandLinkedGroupId(), Constant.PRIMARY_CONTEND_ID, startTime, endTime); List<LineVO> primarySpread = getArticleSpread(projectId, project.getBrandLinkedGroupId(), Constant.PRIMARY_CONTEND_ID, cutList);
primaryLine.put("spread", primarySpread); primaryLine.put("spread", primarySpread);
resList.add(primaryLine); resList.add(primaryLine);
result.put("days", primarySpread.size()); result.put("days", primarySpread.size());
...@@ -1145,7 +1153,7 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1145,7 +1153,7 @@ public class MarkDataServiceImpl implements MarkDataService {
JSONObject contendLine = new JSONObject(); JSONObject contendLine = new JSONObject();
contendLine.put("id", contendId); contendLine.put("id", contendId);
contendLine.put("brand", brandName); contendLine.put("brand", brandName);
List<LineVO> contendSpread = getArticleSpread(projectId, contendLinkedGroupId, contendId, startTime, endTime); List<LineVO> contendSpread = getArticleSpread(projectId, contendLinkedGroupId, contendId, cutList);
contendLine.put("spread", contendSpread); contendLine.put("spread", contendSpread);
resList.add(contendLine); resList.add(contendLine);
result.put("spread", resList); result.put("spread", resList);
...@@ -1573,18 +1581,10 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1573,18 +1581,10 @@ public class MarkDataServiceImpl implements MarkDataService {
* @param projectId 项目ID * @param projectId 项目ID
* @param linkedGroupId 关联组Id * @param linkedGroupId 关联组Id
* @param contendId 竞品ID * @param contendId 竞品ID
* @param start 开始时间 * @param cutList 拆分list
* @param end 结束时间
* @return * @return
*/ */
private List<LineVO> getArticleSpread(String projectId, String linkedGroupId, String contendId,Long start,Long end) { private List<LineVO> getArticleSpread(String projectId, String linkedGroupId, String contendId, List<Map<String, Long>> cutList) {
List<Map<String, Long>> cutList;
// 时间超过三天则选用day
if(end-start>Constant.ONE_DAY*3){
cutList = Tools.parseToDays(start, end);
}else{
cutList = Tools.parseToHours(start, end);
}
List<LineVO> lineList = new ArrayList<>(cutList.size()); List<LineVO> lineList = new ArrayList<>(cutList.size());
cutList.forEach(day -> { cutList.forEach(day -> {
LineVO lineVO = new LineVO(); LineVO lineVO = new LineVO();
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment