|
@@ -9,6 +9,7 @@ import cn.cslg.pas.common.model.vo.InvestigationTypeProjectNumberVO;
|
|
import cn.cslg.pas.common.utils.CacheUtils;
|
|
import cn.cslg.pas.common.utils.CacheUtils;
|
|
import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
|
|
import cn.cslg.pas.common.utils.SecurityUtils.LoginUtils;
|
|
import cn.cslg.pas.common.utils.ThrowException;
|
|
import cn.cslg.pas.common.utils.ThrowException;
|
|
|
|
+import cn.cslg.pas.domain.ApplicationScenario;
|
|
import cn.cslg.pas.domain.Event;
|
|
import cn.cslg.pas.domain.Event;
|
|
import cn.cslg.pas.domain.Project;
|
|
import cn.cslg.pas.domain.Project;
|
|
import cn.cslg.pas.domain.Type;
|
|
import cn.cslg.pas.domain.Type;
|
|
@@ -125,7 +126,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
|
|
List<EventAddNewDTO> oldEventAddNewDTOs = eventAddNewDTOs.stream().filter(item -> item.getId() != null).collect(Collectors.toList());
|
|
List<EventAddNewDTO> oldEventAddNewDTOs = eventAddNewDTOs.stream().filter(item -> item.getId() != null).collect(Collectors.toList());
|
|
eventAddNewDTOs.removeAll(oldEventAddNewDTOs);
|
|
eventAddNewDTOs.removeAll(oldEventAddNewDTOs);
|
|
|
|
|
|
- //过滤后为新事件↓,新事件需要先去新增事件,拿到事件ids后再做关联
|
|
|
|
|
|
+ //过滤后为新事件↓,新事件需要先新增事件,拿到事件ids后再和专题库做关联
|
|
if (eventAddNewDTOs.size() > 0) {
|
|
if (eventAddNewDTOs.size() > 0) {
|
|
List<Integer> newEventIds = this.addNew(eventAddNewDTOs);
|
|
List<Integer> newEventIds = this.addNew(eventAddNewDTOs);
|
|
eventIds.addAll(newEventIds);
|
|
eventIds.addAll(newEventIds);
|
|
@@ -184,21 +185,68 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
- * 查询9大应用场景及分别对应的事件数量
|
|
|
|
|
|
+ * 查询9大应用场景分别对应的事件数量
|
|
*/
|
|
*/
|
|
@Override
|
|
@Override
|
|
public List<ApplicationScenarioEventNumberVO> queryApplicationScenarioEventNumber() {
|
|
public List<ApplicationScenarioEventNumberVO> queryApplicationScenarioEventNumber() {
|
|
- log.info("开始处理【查询9大应用场景及分别对应的事件数量】的业务");
|
|
|
|
|
|
+ log.info("开始处理【查询9大应用场景分别对应的事件数量】的业务");
|
|
|
|
|
|
PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
Integer tenantId = personnelVO.getTenantId();
|
|
Integer tenantId = personnelVO.getTenantId();
|
|
|
|
+ /*
|
|
|
|
+ * 原先学到的野方法直接在sql中装载好,只需以下几行代码返回给前台(但是杰哥说这样访问数据库效率降到最低,故舍弃)
|
|
|
|
+ * List<ApplicationScenarioEventNumberVO> applicationScenarioEventNumberVOS = eventMapper.queryApplicationScenarioEventNumber(tenantId);
|
|
|
|
+ * //遍历给事件数量属性赋上值 (事件数量=应用场景直接对应的事件数量+应用场景对应的专题库对应的事件数量(且该部分事件没有直接应用场景))
|
|
|
|
+ * for (ApplicationScenarioEventNumberVO n : applicationScenarioEventNumberVOS) {
|
|
|
|
+ * n.setEventNumber(n.getEventNumberFromEvent() + n.getEventNumberFromProject());
|
|
|
|
+ * }
|
|
|
|
+ */
|
|
|
|
+
|
|
|
|
+ //查询所有应用场景(目前为9个应用场景)
|
|
|
|
+ List<ApplicationScenario> applicationScenarios = eventMapper.queryApplicationScenarios();
|
|
|
|
+
|
|
|
|
+ //查询所有事件(分为两类:1.有应用场景的事件;2.没有应用场景的事件(该部分事件使用它们所属的专题库的应用场景))
|
|
|
|
+ List<EventListItemVO> eventsDirectApplicationScenario = eventMapper.queryEventsDirectApplicationScenario(tenantId);
|
|
|
|
+ List<EventListItemVO> eventsInDirectApplicationScenario = eventMapper.queryEventsInDirectApplicationScenario(tenantId);
|
|
|
|
+ //装载上述两类事件的应用场景
|
|
|
|
+ ArrayList<String> applicationScenarioStrs = new ArrayList<>();
|
|
|
|
+ if (eventsDirectApplicationScenario != null) {
|
|
|
|
+ for (EventListItemVO n : eventsDirectApplicationScenario) {
|
|
|
|
+ applicationScenarioStrs.add(n.getApplicationScenario());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if (eventsInDirectApplicationScenario != null) {
|
|
|
|
+ for (EventListItemVO n : eventsInDirectApplicationScenario) {
|
|
|
|
+ applicationScenarioStrs.add(n.getApplicationScenario());
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
|
|
- List<ApplicationScenarioEventNumberVO> applicationScenarioEventNumberVOS = eventMapper.queryApplicationScenarioEventNumber(tenantId);
|
|
|
|
- //遍历给事件数量属性赋上值 (事件数量=应用场景直接对应的事件数量+应用场景对应的专题库对应的事件数量(且该部分事件没有直接应用场景))
|
|
|
|
- for (ApplicationScenarioEventNumberVO n : applicationScenarioEventNumberVOS) {
|
|
|
|
- n.setEventNumber(n.getEventNumberFromEvent() + n.getEventNumberFromProject());
|
|
|
|
|
|
+ //开始装载9大应用场景分别对应的事件数量
|
|
|
|
+ ArrayList<ApplicationScenarioEventNumberVO> results = new ArrayList<>();
|
|
|
|
+ //遍历所有9大应用场景
|
|
|
|
+ for (ApplicationScenario applicationScenario : applicationScenarios) {
|
|
|
|
+ Integer applicationScenarioValue = applicationScenario.getApplicationScenarioValue();
|
|
|
|
+ String applicationScenarioName = applicationScenario.getApplicationScenarioName();
|
|
|
|
+ //定义当前应用场景对应的事件数量为0
|
|
|
|
+ int eventNumber = 0;
|
|
|
|
+ if (applicationScenarioStrs.size() > 0) {
|
|
|
|
+ //遍历所有事件的应用场景
|
|
|
|
+ for (String n : applicationScenarioStrs) {
|
|
|
|
+ ArrayList<String> applicationScenarioValues = new ArrayList<>(Arrays.asList(n.split(",")));
|
|
|
|
+ //若当前事件的应用场景集合包含当前正在遍历的应用场景,则当前正在遍历的应用场景对应事件数量 +1
|
|
|
|
+ if (applicationScenarioValues.contains(applicationScenarioValue + "")) {
|
|
|
|
+ eventNumber++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ ApplicationScenarioEventNumberVO applicationScenarioEventNumberVO = new ApplicationScenarioEventNumberVO()
|
|
|
|
+ .setApplicationScenarioValue(applicationScenarioValue)
|
|
|
|
+ .setApplicationScenarioName(applicationScenarioName)
|
|
|
|
+ .setEventNumber(eventNumber);
|
|
|
|
+ results.add(applicationScenarioEventNumberVO);
|
|
}
|
|
}
|
|
- return applicationScenarioEventNumberVOS;
|
|
|
|
|
|
+
|
|
|
|
+ return results;
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
@@ -238,8 +286,8 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
|
|
Integer eventId = queryInvestigationTypeProjectNumberDTO.getEventId();
|
|
Integer eventId = queryInvestigationTypeProjectNumberDTO.getEventId();
|
|
//1.根据应用场景查询出所有调查类型
|
|
//1.根据应用场景查询出所有调查类型
|
|
List<Type> types = eventMapper.queryTypeid(applicationScenario);
|
|
List<Type> types = eventMapper.queryTypeid(applicationScenario);
|
|
- //2.根据事件id查询出所有专题库
|
|
|
|
- List<Project> projects = eventMapper.queryProjects(eventId);
|
|
|
|
|
|
+ //2.根据应用场景和事件id查询出所有专题库
|
|
|
|
+ List<Project> projects = eventMapper.queryProjects(applicationScenario, eventId);
|
|
|
|
|
|
//3.遍历调查类型,在每一个调查类型中遍历专题库,装载调查类型对应的专题库数量
|
|
//3.遍历调查类型,在每一个调查类型中遍历专题库,装载调查类型对应的专题库数量
|
|
ArrayList<InvestigationTypeProjectNumberVO> results = new ArrayList<>();
|
|
ArrayList<InvestigationTypeProjectNumberVO> results = new ArrayList<>();
|
|
@@ -248,7 +296,7 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
|
|
result.setInvestigationType(type.getTypeId());
|
|
result.setInvestigationType(type.getTypeId());
|
|
result.setInvestigationTypeName(type.getTypeName());
|
|
result.setInvestigationTypeName(type.getTypeName());
|
|
int projectNumber = 0;
|
|
int projectNumber = 0;
|
|
- if (projects != null) {
|
|
|
|
|
|
+ if (projects != null && projects.size() > 0) {
|
|
for (Project project : projects) {
|
|
for (Project project : projects) {
|
|
if (project.getType() != null) {
|
|
if (project.getType() != null) {
|
|
String[] typeArr = project.getType().split(",");
|
|
String[] typeArr = project.getType().split(",");
|