Commit c89dff3e by shenjunjie

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

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