|
|
@@ -2,18 +2,27 @@ package com.xunmei.core.panel.service.impl;
|
|
|
|
|
|
import cn.hutool.core.collection.ListUtil;
|
|
|
import cn.hutool.core.util.ObjectUtil;
|
|
|
+import com.xunmei.common.core.constant.ErrorMsgConstants;
|
|
|
+import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
+import com.xunmei.common.core.domain.R;
|
|
|
import com.xunmei.common.core.domain.panel.adapter.PanelAdapter;
|
|
|
import com.xunmei.common.core.domain.panel.dto.PanelListDto;
|
|
|
import com.xunmei.common.core.domain.panel.enums.PanelTypeEnums;
|
|
|
import com.xunmei.common.core.domain.panel.vo.PanelListVo;
|
|
|
import com.xunmei.common.core.domain.panel.vo.PanelResultVo;
|
|
|
+import com.xunmei.common.core.vo.IdNameVo;
|
|
|
import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
import com.xunmei.core.drill.service.ICoreDrillTaskService;
|
|
|
import com.xunmei.core.edu.service.ICoreEduTrainingTaskService;
|
|
|
import com.xunmei.core.panel.service.PanelService;
|
|
|
+import com.xunmei.core.resumption.service.IProtectionService;
|
|
|
import com.xunmei.core.resumption.service.ResumptionService;
|
|
|
import com.xunmei.core.retrieval.service.ICoreMonitoringRetrievalTaskService;
|
|
|
import com.xunmei.core.safetyCheck.service.ICoreSafetyTaskService;
|
|
|
+import com.xunmei.system.api.RemoteRoleService;
|
|
|
+import com.xunmei.system.api.RemoteUserService;
|
|
|
+import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
|
|
|
+import com.xunmei.system.api.model.LoginUser;
|
|
|
import lombok.extern.slf4j.Slf4j;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
|
@@ -39,11 +48,20 @@ public class PanelServiceImpl implements PanelService {
|
|
|
@Autowired
|
|
|
private ICoreEduTrainingTaskService eduTrainingTaskService;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private RemoteRoleService roleService;
|
|
|
+ @Autowired
|
|
|
+ private IProtectionService protectionService;
|
|
|
+
|
|
|
@Override
|
|
|
public List<PanelResultVo> selectPage() {
|
|
|
+
|
|
|
+ List<Long> roles = RemoteCallHandlerExecutor.executeRemoteCall(
|
|
|
+ () -> roleService.getUserRoleId(SecurityUtils.getUserId(), SecurityConstants.FROM_SOURCE),
|
|
|
+ ErrorMsgConstants.QUERY_USER_ROLE_ERROR);
|
|
|
+
|
|
|
PanelListDto panelListDto = PanelAdapter.getMapperSelectParam(SecurityUtils.getLoginUser().getOrgId(),
|
|
|
- SecurityUtils.getLoginUser().getRoles(),
|
|
|
- SecurityUtils.getUserId());
|
|
|
+ roles,SecurityUtils.getUserId());
|
|
|
|
|
|
List<PanelListVo> resultList = Collections.synchronizedList(new ArrayList<>(6));
|
|
|
|
|
|
@@ -52,6 +70,7 @@ public class PanelServiceImpl implements PanelService {
|
|
|
return resumptionService.selectCurUserTaskList(panelListDto);
|
|
|
}).whenComplete((resumptionTaskList, throwable) -> {
|
|
|
if (ObjectUtil.isNotEmpty(resumptionTaskList)) {
|
|
|
+ resumptionTaskList.forEach(vo->vo.setType(PanelTypeEnums.RESUMPTION.getCode()));
|
|
|
resultList.addAll(resumptionTaskList);
|
|
|
}
|
|
|
if (throwable != null) {
|
|
|
@@ -59,11 +78,25 @@ public class PanelServiceImpl implements PanelService {
|
|
|
}
|
|
|
});
|
|
|
|
|
|
+ //布撤防
|
|
|
+ CompletableFuture<List<PanelListVo>> protectionTaskFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
+ return protectionService.selectCurUserTaskList(panelListDto);
|
|
|
+ }).whenComplete((protectionTaskList, throwable) -> {
|
|
|
+ if (ObjectUtil.isNotEmpty(protectionTaskList)) {
|
|
|
+ protectionTaskList.forEach(vo->vo.setType(PanelTypeEnums.PROTECTION.getCode()));
|
|
|
+ resultList.addAll(protectionTaskList);
|
|
|
+ }
|
|
|
+ if (throwable != null) {
|
|
|
+ log.error("protectionTaskFuture Exception error.", throwable);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
//监控调阅任务
|
|
|
CompletableFuture<List<PanelListVo>> monitorTaskFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
return coreMonitoringRetrievalTaskService.selectCurUserTaskList(panelListDto);
|
|
|
}).whenComplete((monitorTaskList, throwable) -> {
|
|
|
if (ObjectUtil.isNotEmpty(monitorTaskList)) {
|
|
|
+ monitorTaskList.forEach(vo->vo.setType(PanelTypeEnums.MONITORING_RETRIEVAL.getCode()));
|
|
|
resultList.addAll(monitorTaskList);
|
|
|
}
|
|
|
if (throwable != null) {
|
|
|
@@ -76,6 +109,7 @@ public class PanelServiceImpl implements PanelService {
|
|
|
return safetyTaskService.selectCurUserTaskList(panelListDto);
|
|
|
}).whenComplete((safetyTaskList, throwable) -> {
|
|
|
if (ObjectUtil.isNotEmpty(safetyTaskList)) {
|
|
|
+ safetyTaskList.forEach(vo->vo.setType(PanelTypeEnums.SAFETY_CHECK.getCode()));
|
|
|
resultList.addAll(safetyTaskList);
|
|
|
}
|
|
|
if (throwable != null) {
|
|
|
@@ -89,6 +123,7 @@ public class PanelServiceImpl implements PanelService {
|
|
|
return drillTaskService.selectCurUserTaskList(panelListDto);
|
|
|
}).whenComplete((drillTaskList, throwable) -> {
|
|
|
if (ObjectUtil.isNotEmpty(drillTaskList)) {
|
|
|
+ drillTaskList.forEach(vo->vo.setType(PanelTypeEnums.DRILL.getCode()));
|
|
|
resultList.addAll(drillTaskList);
|
|
|
}
|
|
|
if (throwable != null) {
|
|
|
@@ -99,9 +134,10 @@ public class PanelServiceImpl implements PanelService {
|
|
|
//教育培训任务
|
|
|
CompletableFuture<List<PanelListVo>> eduTrainingTaskFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
return eduTrainingTaskService.selectCurUserTaskList(panelListDto);
|
|
|
- }).whenComplete((duTrainingTaskList, throwable) -> {
|
|
|
- if (ObjectUtil.isNotEmpty(duTrainingTaskList)) {
|
|
|
- resultList.addAll(duTrainingTaskList);
|
|
|
+ }).whenComplete((eduTrainingTaskList, throwable) -> {
|
|
|
+ if (ObjectUtil.isNotEmpty(eduTrainingTaskList)) {
|
|
|
+ eduTrainingTaskList.forEach(vo->vo.setType(PanelTypeEnums.EDU_TRAINING.getCode()));
|
|
|
+ resultList.addAll(eduTrainingTaskList);
|
|
|
}
|
|
|
if (throwable != null) {
|
|
|
log.error("eduTrainingTaskFuture Exception error.", throwable);
|
|
|
@@ -110,6 +146,7 @@ public class PanelServiceImpl implements PanelService {
|
|
|
|
|
|
List<CompletableFuture<List<PanelListVo>>> futureList = ListUtil.list(true,
|
|
|
resumptionTaskFuture,
|
|
|
+ protectionTaskFuture,
|
|
|
monitorTaskFuture,
|
|
|
safetyTaskFuture,
|
|
|
drillTaskFuture,
|
|
|
@@ -123,8 +160,7 @@ public class PanelServiceImpl implements PanelService {
|
|
|
log.error("CompletableFuture.allOf Exception error.", e);
|
|
|
}
|
|
|
|
|
|
- // Map<Integer, List<PanelListVo>> listMap = resultList.stream().collect(Collectors.groupingBy(PanelListVo::getType));
|
|
|
- //将 resultList根据type字段分组,并排序
|
|
|
+ //将resultList根据type字段分组,并排序
|
|
|
Map<Integer, List<PanelListVo>> listMap = resultList.stream().sorted(Comparator.comparing(PanelListVo::getType)).collect(Collectors.groupingBy(PanelListVo::getType));
|
|
|
List<PanelResultVo> list = new ArrayList<PanelResultVo>();
|
|
|
for (Integer type : listMap.keySet()) {
|