Commit c89dff3e by shenjunjie

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

parent 5d2c8b2b
...@@ -43,8 +43,7 @@ public class AopLogRecord { ...@@ -43,8 +43,7 @@ public class AopLogRecord {
@Resource(name = "behaviorDao") @Resource(name = "behaviorDao")
private BehaviorDao behaviorDao; private BehaviorDao behaviorDao;
private static final List<String> URL_PATTERNS = Arrays.asList("/getNewAll", "/getNew", "/schedule", "/app/event/detail/baseInfo", "/app/event/detail/dissemination-trends", private static final List<String> URL_PATTERNS = Arrays.asList("/getNewAll", "/getNew", "/schedule");
"/app/event/detail/channel-voices", "/app/event/detail/top-articles-analysis");
@Before("execution(public * com..controller..admin..*Controller.*(..)) || execution(* com..controller..app..*Controller.*(..))") @Before("execution(public * com..controller..admin..*Controller.*(..)) || execution(* com..controller..app..*Controller.*(..))")
private void beforeLog(JoinPoint joinPoint) throws UnknownHostException, ClassNotFoundException{ private void beforeLog(JoinPoint joinPoint) throws UnknownHostException, ClassNotFoundException{
......
...@@ -1125,7 +1125,6 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1125,7 +1125,6 @@ public class MarkDataServiceImpl implements MarkDataService {
return JSON.parseObject(result); return JSON.parseObject(result);
} }
} }
List<Map<String, Long>> dayList = Tools.parseToDays(startTime, endTime);
List<JSONObject> resList = new ArrayList<>(2); List<JSONObject> resList = new ArrayList<>(2);
JSONObject result = new JSONObject(); JSONObject result = new JSONObject();
// 开始时间 // 开始时间
...@@ -1137,7 +1136,7 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1137,7 +1136,7 @@ public class MarkDataServiceImpl implements MarkDataService {
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, dayList); List<LineVO> primarySpread = getArticleSpread(projectId, project.getBrandLinkedGroupId(), Constant.PRIMARY_CONTEND_ID, startTime, endTime);
primaryLine.put("spread", primarySpread); primaryLine.put("spread", primarySpread);
resList.add(primaryLine); resList.add(primaryLine);
result.put("days", primarySpread.size()); result.put("days", primarySpread.size());
...@@ -1146,7 +1145,7 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1146,7 +1145,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, dayList); List<LineVO> contendSpread = getArticleSpread(projectId, contendLinkedGroupId, contendId, startTime, endTime);
contendLine.put("spread", contendSpread); contendLine.put("spread", contendSpread);
resList.add(contendLine); resList.add(contendLine);
result.put("spread", resList); result.put("spread", resList);
...@@ -1574,16 +1573,24 @@ public class MarkDataServiceImpl implements MarkDataService { ...@@ -1574,16 +1573,24 @@ public class MarkDataServiceImpl implements MarkDataService {
* @param projectId 项目ID * @param projectId 项目ID
* @param linkedGroupId 关联组Id * @param linkedGroupId 关联组Id
* @param contendId 竞品ID * @param contendId 竞品ID
* @param dayList 以天为最小单位分割的时间 * @param start 开始时间
* @param end 结束时间
* @return * @return
*/ */
private List<LineVO> getArticleSpread(String projectId, String linkedGroupId, String contendId, List<Map<String, Long>> dayList) { private List<LineVO> getArticleSpread(String projectId, String linkedGroupId, String contendId,Long start,Long end) {
List<LineVO> lineList = new ArrayList<>(dayList.size()); List<Map<String, Long>> cutList;
dayList.forEach(day -> { // 时间超过三天则选用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());
cutList.forEach(day -> {
LineVO lineVO = new LineVO(); LineVO lineVO = new LineVO();
Long startTime = day.get("startTime"); Long startTime = day.get("startTime");
Long endTime = day.get("endTime"); Long endTime = day.get("endTime");
Long articleCount = null; Long articleCount;
try { try {
articleCount = getMarkArticleCount(startTime, endTime, projectId, linkedGroupId, contendId); articleCount = getMarkArticleCount(startTime, endTime, projectId, linkedGroupId, contendId);
} catch (IOException e) { } catch (IOException e) {
......
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