Commit db15d67e by carrieyzzhang

event 4 tracking

parent d07ba824
...@@ -100,7 +100,7 @@ public class EventController { ...@@ -100,7 +100,7 @@ public class EventController {
@RequestMapping(value = "find4tracking", method = RequestMethod.GET) @RequestMapping(value = "find4tracking", method = RequestMethod.GET)
public ResultModel findAllEvent4Tracking(@PathVariable Long app, @RequestParam String appkey) { public ResultModel findAllEvent4Tracking(@PathVariable Long app, @RequestParam String appkey) {
App appObject = appRepository.findByAppkey(appkey); App appObject = appRepository.findByAppkey(appkey);
return ResultModel.OK(eventService.listAllEvent(appObject.getId())); return ResultModel.OK(eventService.listEvent4Tracking(appObject.getId()));
} }
@ResponseBody @ResponseBody
......
package com.reyun.model;
import java.util.List;
/**
* Created by sunhao on 17/4/19.
* description:事件页面展示model
*/
public class Event4Tracking {
private String eventName;
private String eventNameAlias;
private Boolean isCommon;
private Boolean status;
private Boolean isVirtual;
public Event4Tracking(Event4Web event4Web) {
this.eventName = event4Web.getEventName();
this.eventNameAlias = event4Web.getEventNameAlias();
this.status = event4Web.getStatus();
this.isCommon = event4Web.getCommon();
this.isVirtual = event4Web.getVirtual();
}
public Boolean getVirtual() {
return isVirtual;
}
public void setVirtual(Boolean virtual) {
isVirtual = virtual;
}
public String getEventName() {
return eventName;
}
public void setEventName(String eventName) {
this.eventName = eventName;
}
public String getEventNameAlias() {
return eventNameAlias;
}
public void setEventNameAlias(String eventNameAlias) {
this.eventNameAlias = eventNameAlias;
}
public Boolean getCommon() {
return isCommon;
}
public void setCommon(Boolean common) {
isCommon = common;
}
public Boolean getStatus() {
return status;
}
public void setStatus(Boolean status) {
this.status = status;
}
@Override
public String toString() {
return "{" +
"eventName='" + eventName + '\'' +
", eventNameAlias='" + eventNameAlias + '\'' +
", isCommon=" + isCommon +
", status=" + status +
'}';
}
}
...@@ -15,7 +15,6 @@ public class Event4Web { ...@@ -15,7 +15,6 @@ public class Event4Web {
private List<EventAttr4Web> firstLevelAttr; private List<EventAttr4Web> firstLevelAttr;
private List<EventAttr4Web> secondLevelAttr; private List<EventAttr4Web> secondLevelAttr;
private List<EventAttr4Web> profiles; private List<EventAttr4Web> profiles;
private Map<String, EventAttr4Web> eventAttr4WebMap;
private Boolean isCommon; private Boolean isCommon;
private Boolean status; private Boolean status;
private Boolean isVirtual; private Boolean isVirtual;
...@@ -76,13 +75,6 @@ public class Event4Web { ...@@ -76,13 +75,6 @@ public class Event4Web {
this.profiles = profiles; this.profiles = profiles;
} }
public Map<String, EventAttr4Web> getEventAttr4WebMap() {
return eventAttr4WebMap;
}
public void setEventAttr4WebMap(Map<String, EventAttr4Web> eventAttr4WebMap) {
this.eventAttr4WebMap = eventAttr4WebMap;
}
public Boolean getCommon() { public Boolean getCommon() {
return isCommon; return isCommon;
...@@ -108,7 +100,6 @@ public class Event4Web { ...@@ -108,7 +100,6 @@ public class Event4Web {
", firstLevelAttr=" + firstLevelAttr + ", firstLevelAttr=" + firstLevelAttr +
", secondLevelAttr=" + secondLevelAttr + ", secondLevelAttr=" + secondLevelAttr +
", profiles=" + profiles + ", profiles=" + profiles +
", eventAttr4WebMap=" + eventAttr4WebMap +
", isCommon=" + isCommon + ", isCommon=" + isCommon +
", status=" + status + ", status=" + status +
'}'; '}';
......
...@@ -70,4 +70,6 @@ public interface EventService { ...@@ -70,4 +70,6 @@ public interface EventService {
List<Dimension4Web> listAllAttr(Long app); List<Dimension4Web> listAllAttr(Long app);
List<Event4Tracking> listEvent4Tracking(Long app);
} }
...@@ -344,6 +344,59 @@ public class EventServiceImpl implements EventService { ...@@ -344,6 +344,59 @@ public class EventServiceImpl implements EventService {
@Override @Override
public List<Event4Tracking> listEvent4Tracking(Long app) {
String appkey = appRepository.findAppkeyById(app);
List<Event> eventList = eventRepository.findByAppkey(appkey);
List<EventMeta> metas = eventMetaRepository.findByAppkey(appkey);
List<CommonEvent> commonEventList = commonEventRepository.findAll();
Map<String, EventMeta> metaMap = new HashMap<>();
if (ValidateUtil.isValid(metas)) {
for (EventMeta e : metas) {
metaMap.put(e.getEventId(), e);
}
}
Map<String, CommonEvent> commonMap = new HashMap<>();
if (ValidateUtil.isValid(commonEventList)) {
for (CommonEvent e : commonEventList) {
commonMap.put(e.getEvent(), e);
}
}
LinkedList<Event4Tracking> result = new LinkedList<>();
LinkedList<Event4Tracking> temp = new LinkedList<>();
List<String> nameList = new ArrayList<>();
if (ValidateUtil.isValid(eventList)) {
for (Event e : eventList) {
if (!nameList.contains(e.getEventName())) {
if (commonMap.containsKey(e.getEventName())) {
nameList.add(e.getEventName());
CommonEvent commonEvent = commonMap.get(e.getEventName());
Event4Web event4Web = commonEventTo4Web(commonEvent);
result.add(new Event4Tracking(event4Web));
} else {
nameList.add(e.getEventName());
if (metaMap.containsKey(e.getEventName())) {
EventMeta eventMeta = metaMap.get(e.getEventName());
Event4Web event4Web = eventMetaTo4Web(eventMeta);
temp.add(new Event4Tracking(event4Web));
} else {
Event4Web event4Web = eventTo4Web(e);
temp.add(new Event4Tracking(event4Web));
}
}
}
}
result.addAll(temp);
}
return result;
}
@Override
public List<EventAttr4Web> listOneEvent(Long app, String name) { public List<EventAttr4Web> listOneEvent(Long app, String name) {
String appkey = appRepository.findAppkeyById(app); String appkey = appRepository.findAppkeyById(app);
......
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