|
@@ -2,17 +2,16 @@ package cn.cslg.pas.service.impl;
|
|
|
|
|
|
import cn.cslg.pas.common.JsonPage;
|
|
import cn.cslg.pas.common.JsonPage;
|
|
import cn.cslg.pas.common.model.PersonnelVO;
|
|
import cn.cslg.pas.common.model.PersonnelVO;
|
|
-import cn.cslg.pas.common.model.dto.EventAddNewDTO;
|
|
|
|
-import cn.cslg.pas.common.model.dto.EventQueryPageDTO;
|
|
|
|
-import cn.cslg.pas.common.model.dto.EventUpdateDTO;
|
|
|
|
-import cn.cslg.pas.common.model.dto.ProjectEventAddNewDTO;
|
|
|
|
|
|
+import cn.cslg.pas.common.model.dto.*;
|
|
|
|
+import cn.cslg.pas.common.model.vo.ApplicationScenarioEventNumberVO;
|
|
import cn.cslg.pas.common.model.vo.EventListItemVO;
|
|
import cn.cslg.pas.common.model.vo.EventListItemVO;
|
|
|
|
+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.Event;
|
|
import cn.cslg.pas.domain.Event;
|
|
import cn.cslg.pas.domain.Project;
|
|
import cn.cslg.pas.domain.Project;
|
|
-import cn.cslg.pas.domain.asso.AssoEventProject;
|
|
|
|
|
|
+import cn.cslg.pas.domain.Type;
|
|
import cn.cslg.pas.mapper.EventMapper;
|
|
import cn.cslg.pas.mapper.EventMapper;
|
|
import cn.cslg.pas.mapper.asso.AssoEventProjectMapper;
|
|
import cn.cslg.pas.mapper.asso.AssoEventProjectMapper;
|
|
import cn.cslg.pas.service.IAssoEventProjectService;
|
|
import cn.cslg.pas.service.IAssoEventProjectService;
|
|
@@ -154,10 +153,10 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
|
|
Integer current = eventQueryPageDTO.getCurrent();
|
|
Integer current = eventQueryPageDTO.getCurrent();
|
|
Integer size = eventQueryPageDTO.getSize();
|
|
Integer size = eventQueryPageDTO.getSize();
|
|
String orderBy = eventQueryPageDTO.getOrderBy();
|
|
String orderBy = eventQueryPageDTO.getOrderBy();
|
|
|
|
+ //将前端传来的需要排序的字段做映射转换(如:xxxAxxBxx -> xxx_axx_bxx)
|
|
if (orderBy != null && !orderBy.equals("")) {
|
|
if (orderBy != null && !orderBy.equals("")) {
|
|
String regex = "[A-Z]+";
|
|
String regex = "[A-Z]+";
|
|
- Pattern compile = Pattern.compile(regex);
|
|
|
|
- Matcher matcher = compile.matcher(orderBy);
|
|
|
|
|
|
+ Matcher matcher = Pattern.compile(regex).matcher(orderBy);
|
|
while (matcher.find()) {
|
|
while (matcher.find()) {
|
|
orderBy = orderBy.replaceFirst(matcher.group(), "_" + matcher.group().toLowerCase());
|
|
orderBy = orderBy.replaceFirst(matcher.group(), "_" + matcher.group().toLowerCase());
|
|
}
|
|
}
|
|
@@ -168,17 +167,107 @@ public class EventServiceImpl extends ServiceImpl<EventMapper, Event> implements
|
|
PageHelper.startPage(current, size);
|
|
PageHelper.startPage(current, size);
|
|
}
|
|
}
|
|
List<EventListItemVO> queryResults = eventMapper.queryList(eventQueryPageDTO);
|
|
List<EventListItemVO> queryResults = eventMapper.queryList(eventQueryPageDTO);
|
|
|
|
+ //将以逗号拼接的字符串应用场景applicationScenario转化为应用场景value集合
|
|
for (EventListItemVO queryResult : queryResults) {
|
|
for (EventListItemVO queryResult : queryResults) {
|
|
String applicationScenario = queryResult.getApplicationScenario();
|
|
String applicationScenario = queryResult.getApplicationScenario();
|
|
if (applicationScenario != null && !applicationScenario.equals("")) {
|
|
if (applicationScenario != null && !applicationScenario.equals("")) {
|
|
- List<Integer> applicationScenarioIds = Arrays.stream(applicationScenario.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
|
|
|
- queryResult.setApplicationScenarios(applicationScenarioIds);
|
|
|
|
|
|
+ String[] applicationScenarioArr = applicationScenario.split(",");
|
|
|
|
+ ArrayList<Integer> applicationScenarioValues = new ArrayList<>();
|
|
|
|
+ for (String n : applicationScenarioArr) {
|
|
|
|
+ applicationScenarioValues.add(Integer.parseInt(n));
|
|
|
|
+ }
|
|
|
|
+ //List<Integer> applicationScenarioIds = Arrays.stream(applicationScenario.split(",")).map(Integer::parseInt).collect(Collectors.toList());
|
|
|
|
+ queryResult.setApplicationScenarios(applicationScenarioValues);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return JsonPage.restPage(new PageInfo<>(queryResults));
|
|
return JsonPage.restPage(new PageInfo<>(queryResults));
|
|
}
|
|
}
|
|
|
|
|
|
/**
|
|
/**
|
|
|
|
+ * 查询9大应用场景及分别对应的事件数量
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public List<ApplicationScenarioEventNumberVO> queryApplicationScenarioEventNumber() {
|
|
|
|
+ log.info("开始处理【查询9大应用场景及分别对应的事件数量】的业务");
|
|
|
|
+
|
|
|
|
+ PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
|
+ Integer tenantId = personnelVO.getTenantId();
|
|
|
|
+
|
|
|
|
+ List<ApplicationScenarioEventNumberVO> applicationScenarioEventNumberVOS = eventMapper.queryApplicationScenarioEventNumber(tenantId);
|
|
|
|
+ //遍历给事件数量属性赋上值 (事件数量=应用场景直接对应的事件数量+应用场景对应的专题库对应的事件数量(且该部分事件没有直接应用场景))
|
|
|
|
+ for (ApplicationScenarioEventNumberVO n : applicationScenarioEventNumberVOS) {
|
|
|
|
+ n.setEventNumber(n.getEventNumberFromEvent() + n.getEventNumberFromProject());
|
|
|
|
+ }
|
|
|
|
+ return applicationScenarioEventNumberVOS;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据应用场景value和事件名称分页查询事件清单
|
|
|
|
+ *
|
|
|
|
+ * @param eventQueryPageDTO 查询参数
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public JsonPage queryEvents(EventQueryPageDTO eventQueryPageDTO) {
|
|
|
|
+ log.info("开始处理【根据应用场景value和事件名称分页查询事件清单】的业务,参数为:{}", eventQueryPageDTO);
|
|
|
|
+
|
|
|
|
+ PersonnelVO personnelVO = cacheUtils.getLoginUser(loginUtils.getId());
|
|
|
|
+ eventQueryPageDTO.setTenantId(personnelVO.getTenantId());
|
|
|
|
+ Integer current = eventQueryPageDTO.getCurrent();
|
|
|
|
+ Integer size = eventQueryPageDTO.getSize();
|
|
|
|
+
|
|
|
|
+ if (current != null && size != null) {
|
|
|
|
+ PageHelper.startPage(current, size);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ //根据应用场景value和事件名称分页查询事件清单
|
|
|
|
+ List<EventListItemVO> events = eventMapper.queryEvents(eventQueryPageDTO);
|
|
|
|
+ return JsonPage.restPage(new PageInfo<>(events));
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据应用场景和事件id查询调查类型对应的专题库数量
|
|
|
|
+ *
|
|
|
|
+ * @param queryInvestigationTypeProjectNumberDTO 查询参数
|
|
|
|
+ * @return 返回查询到的数据
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public List<InvestigationTypeProjectNumberVO> queryInvestigationTypeProjectNumber(QueryInvestigationTypeProjectNumberDTO queryInvestigationTypeProjectNumberDTO) {
|
|
|
|
+ log.info("开始处理【根据应用场景和事件id查询调查类型对应的专题库数量】的业务,参数为:{}", queryInvestigationTypeProjectNumberDTO);
|
|
|
|
+
|
|
|
|
+ Integer applicationScenario = queryInvestigationTypeProjectNumberDTO.getApplicationScenario();
|
|
|
|
+ Integer eventId = queryInvestigationTypeProjectNumberDTO.getEventId();
|
|
|
|
+ //1.根据应用场景查询出所有调查类型
|
|
|
|
+ List<Type> types = eventMapper.queryTypeid(applicationScenario);
|
|
|
|
+ //2.根据事件id查询出所有专题库
|
|
|
|
+ List<Project> projects = eventMapper.queryProjects(eventId);
|
|
|
|
+
|
|
|
|
+ //3.遍历调查类型,在每一个调查类型中遍历专题库,装载调查类型对应的专题库数量
|
|
|
|
+ ArrayList<InvestigationTypeProjectNumberVO> results = new ArrayList<>();
|
|
|
|
+ for (Type type : types) {
|
|
|
|
+ InvestigationTypeProjectNumberVO result = new InvestigationTypeProjectNumberVO();
|
|
|
|
+ result.setInvestigationType(type.getTypeId());
|
|
|
|
+ result.setInvestigationTypeName(type.getTypeName());
|
|
|
|
+ int projectNumber = 0;
|
|
|
|
+ if (projects != null) {
|
|
|
|
+ for (Project project : projects) {
|
|
|
|
+ if (project.getType() != null) {
|
|
|
|
+ String[] typeArr = project.getType().split(",");
|
|
|
|
+ if (new ArrayList<>(Arrays.asList(typeArr)).contains(type.getTypeId() + "")) {
|
|
|
|
+ projectNumber++;
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ result.setProjectNumber(projectNumber);
|
|
|
|
+ results.add(result);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ return results;
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+ /**
|
|
* 修改事件
|
|
* 修改事件
|
|
*
|
|
*
|
|
* @param eventUpdateDTO 修改事件的DTO类对象
|
|
* @param eventUpdateDTO 修改事件的DTO类对象
|