|
|
@@ -18,6 +18,7 @@ import com.xunmei.common.core.domain.panel.vo.PanelListVo;
|
|
|
import com.xunmei.common.core.domain.panel.vo.PanelResultVo;
|
|
|
import com.xunmei.common.core.domain.panel.vo.WebPanelResult;
|
|
|
import com.xunmei.common.core.web.page.TableDataInfo;
|
|
|
+import com.xunmei.common.redis.utils.RedisUtils;
|
|
|
import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
import com.xunmei.core.drill.service.ICoreDrillTaskService;
|
|
|
import com.xunmei.core.edu.service.ICoreEduTrainingTaskService;
|
|
|
@@ -61,7 +62,7 @@ import java.util.stream.Stream;
|
|
|
@Service
|
|
|
public class PanelServiceImpl implements PanelService {
|
|
|
|
|
|
- public static final int TIMEOUT = 3;
|
|
|
+ public static final int TIMEOUT = 10;
|
|
|
@Autowired
|
|
|
private ResumptionService resumptionService;
|
|
|
@Autowired
|
|
|
@@ -100,18 +101,28 @@ public class PanelServiceImpl implements PanelService {
|
|
|
@Override
|
|
|
public List<PanelResultVo> selectPage() throws ExecutionException, InterruptedException, TimeoutException {
|
|
|
Long userId = SecurityUtils.getUserId();
|
|
|
- Long orgId =SecurityUtils.getLoginUser().getOrgId();
|
|
|
- return getListByUserId(userId,orgId);
|
|
|
+ Long orgId = SecurityUtils.getLoginUser().getOrgId();
|
|
|
+ return getListByUserId(userId, orgId);
|
|
|
}
|
|
|
|
|
|
- private List<PanelResultVo> getListByUserId(Long userId,Long orgId) throws ExecutionException, InterruptedException, TimeoutException
|
|
|
- {
|
|
|
- List<Long> roles = RemoteCallHandlerExecutor.executeRemoteCall(
|
|
|
+ private List<PanelResultVo> getListByUserId(Long userId, Long orgId) throws ExecutionException, InterruptedException, TimeoutException {
|
|
|
+ /*List<Long> roles = RemoteCallHandlerExecutor.executeRemoteCall(
|
|
|
() -> roleService.getUserRoleId(userId, SecurityConstants.FROM_SOURCE),
|
|
|
- ErrorMsgConstants.QUERY_USER_ROLE_ERROR);
|
|
|
+ ErrorMsgConstants.QUERY_USER_ROLE_ERROR);*/
|
|
|
+ List<Long> roleIds = null;
|
|
|
+ if (ObjectUtil.equal(SecurityUtils.getUserId(), userId)) {
|
|
|
+ Set<String> roles = SecurityUtils.getLoginUser().getRoles();
|
|
|
+ //获取roles id 集合
|
|
|
+ roleIds = roles.stream().map(Long::valueOf).collect(Collectors.toList());
|
|
|
+ } else {
|
|
|
+ roleIds = RemoteCallHandlerExecutor.executeRemoteCall(
|
|
|
+ () -> roleService.getUserRoleId(userId, SecurityConstants.FROM_SOURCE),
|
|
|
+ ErrorMsgConstants.QUERY_USER_ROLE_ERROR);
|
|
|
+ }
|
|
|
+
|
|
|
|
|
|
PanelListDto panelListDto = PanelAdapter.getMapperSelectParam(orgId,
|
|
|
- roles, userId);
|
|
|
+ roleIds, userId);
|
|
|
if (ObjectUtil.isEmpty(panelListDto.getRoleIdList())) {
|
|
|
return new ArrayList<>();
|
|
|
}
|
|
|
@@ -121,11 +132,11 @@ public class PanelServiceImpl implements PanelService {
|
|
|
resumptionService.selectCurUserTaskList(panelListDto), threadPoolTaskExecutor
|
|
|
);
|
|
|
|
|
|
- //布撤防
|
|
|
+ /* //布撤防
|
|
|
CompletableFuture<List<PanelListVo>> protectionTaskFuture = CompletableFuture.supplyAsync(() ->
|
|
|
protectionService.selectCurUserTaskList(panelListDto), threadPoolTaskExecutor
|
|
|
);
|
|
|
-
|
|
|
+*/
|
|
|
//监控调阅任务
|
|
|
CompletableFuture<List<PanelListVo>> monitorTaskFuture = CompletableFuture.supplyAsync(() ->
|
|
|
coreMonitoringRetrievalTaskService.selectCurUserTaskList(panelListDto), threadPoolTaskExecutor
|
|
|
@@ -145,13 +156,13 @@ public class PanelServiceImpl implements PanelService {
|
|
|
drillTaskService.selectCurUserTaskList(panelListDto), threadPoolTaskExecutor
|
|
|
);
|
|
|
//预案演练-推优评优任务
|
|
|
- CompletableFuture<List<PanelListVo>> recLitFuture = CompletableFuture.supplyAsync(() ->{
|
|
|
- PanelListDto tempReqest=new PanelListDto();
|
|
|
- BeanUtils.copyProperties(panelListDto,tempReqest);
|
|
|
- tempReqest.setStartTime(DateUtil.offsetMonth(DateUtil.beginOfQuarter(new Date()),-3));
|
|
|
- tempReqest.setEndTime(DateUtil.endOfQuarter(new Date()));
|
|
|
- return drillTaskService.selectRecList(tempReqest);
|
|
|
- }, threadPoolTaskExecutor
|
|
|
+ CompletableFuture<List<PanelListVo>> recLitFuture = CompletableFuture.supplyAsync(() -> {
|
|
|
+ PanelListDto tempReqest = new PanelListDto();
|
|
|
+ BeanUtils.copyProperties(panelListDto, tempReqest);
|
|
|
+ tempReqest.setStartTime(DateUtil.offsetMonth(DateUtil.beginOfQuarter(new Date()), -3));
|
|
|
+ tempReqest.setEndTime(DateUtil.endOfQuarter(new Date()));
|
|
|
+ return drillTaskService.selectRecList(tempReqest);
|
|
|
+ }, threadPoolTaskExecutor
|
|
|
);
|
|
|
|
|
|
//教育培训任务
|
|
|
@@ -171,14 +182,14 @@ public class PanelServiceImpl implements PanelService {
|
|
|
);
|
|
|
|
|
|
CompletableFuture<Void> allQueries = CompletableFuture.allOf(
|
|
|
- resumptionTaskFuture, protectionTaskFuture, monitorTaskFuture, evaluateTaskFuture,
|
|
|
+ resumptionTaskFuture, monitorTaskFuture, evaluateTaskFuture,
|
|
|
safetyTaskFuture, drillTaskFuture, eduTrainingTaskFuture, recLitFuture, questionTaskFuture, letterOutInFuture
|
|
|
);
|
|
|
|
|
|
allQueries.get(TIMEOUT, TimeUnit.SECONDS);
|
|
|
|
|
|
List<PanelListVo> resultList = Stream.of(
|
|
|
- resumptionTaskFuture.join(), protectionTaskFuture.join(), monitorTaskFuture.join(), evaluateTaskFuture.join(),
|
|
|
+ resumptionTaskFuture.join(), monitorTaskFuture.join(), evaluateTaskFuture.join(),
|
|
|
safetyTaskFuture.join(), drillTaskFuture.join(), eduTrainingTaskFuture.join(), recLitFuture.join(),
|
|
|
questionTaskFuture.join(), letterOutInFuture.join()
|
|
|
)
|
|
|
@@ -195,26 +206,23 @@ public class PanelServiceImpl implements PanelService {
|
|
|
List<PanelListVo> data = map.getValue();
|
|
|
vo.setNums(data.size());
|
|
|
vo.setTaskTypeText(PanelTypeEnums.getName(map.getKey()));
|
|
|
- if(ObjectUtil.equal(map.getKey(),PanelTypeEnums.SAFETY_CHECK.getCode())){
|
|
|
- if(data.size()>0)
|
|
|
- {
|
|
|
+ if (ObjectUtil.equal(map.getKey(), PanelTypeEnums.SAFETY_CHECK.getCode())) {
|
|
|
+ if (data.size() > 0) {
|
|
|
Map<String, List<PanelListVo>> groupedItems = data.stream()
|
|
|
.collect(Collectors.groupingBy(PanelListVo::getTaskName));
|
|
|
- List<PanelListVo> tempData=new ArrayList<>();
|
|
|
+ List<PanelListVo> tempData = new ArrayList<>();
|
|
|
|
|
|
for (Map.Entry<String, List<PanelListVo>> entry : groupedItems.entrySet()) {
|
|
|
- PanelListVo parentItem=new PanelListVo();
|
|
|
- BeanUtils.copyProperties(entry.getValue().get(0),parentItem);
|
|
|
+ PanelListVo parentItem = new PanelListVo();
|
|
|
+ BeanUtils.copyProperties(entry.getValue().get(0), parentItem);
|
|
|
parentItem.setUncompleted(entry.getValue());
|
|
|
tempData.add(parentItem);
|
|
|
}
|
|
|
vo.setDataList(tempData);
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
vo.setDataList(data);
|
|
|
}
|
|
|
- }
|
|
|
- else {
|
|
|
+ } else {
|
|
|
|
|
|
vo.setDataList(data);
|
|
|
}
|
|
|
@@ -226,16 +234,13 @@ public class PanelServiceImpl implements PanelService {
|
|
|
|
|
|
@Override
|
|
|
public List<UserUnDoVo> selectUserUnDoList(List<UserUnDoTaskRequestDto> userList) throws ExecutionException, InterruptedException, TimeoutException {
|
|
|
- List<UserUnDoVo> result=new ArrayList<>();
|
|
|
- if(ObjectUtil.isNotEmpty(userList))
|
|
|
- {
|
|
|
- userList.forEach(user->{
|
|
|
+ List<UserUnDoVo> result = new ArrayList<>();
|
|
|
+ if (ObjectUtil.isNotEmpty(userList)) {
|
|
|
+ userList.forEach(user -> {
|
|
|
try {
|
|
|
- UserUnDoVo tempVo= getUserUnDo(user.getUserId(),user.getOrgId());
|
|
|
+ UserUnDoVo tempVo = getUserUnDo(user.getUserId(), user.getOrgId());
|
|
|
result.add(tempVo);
|
|
|
- }
|
|
|
- catch (Exception ex)
|
|
|
- {
|
|
|
+ } catch (Exception ex) {
|
|
|
|
|
|
}
|
|
|
});
|
|
|
@@ -243,14 +248,13 @@ public class PanelServiceImpl implements PanelService {
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
- private UserUnDoVo getUserUnDo(Long userId,Long orgId) throws ExecutionException, InterruptedException, TimeoutException
|
|
|
- {
|
|
|
- UserUnDoVo vo =new UserUnDoVo();
|
|
|
- List<PanelResultVo> unDoTaskList = getListByUserId(userId,orgId);
|
|
|
+ private UserUnDoVo getUserUnDo(Long userId, Long orgId) throws ExecutionException, InterruptedException, TimeoutException {
|
|
|
+ UserUnDoVo vo = new UserUnDoVo();
|
|
|
+ List<PanelResultVo> unDoTaskList = getListByUserId(userId, orgId);
|
|
|
vo.setUserId(userId);
|
|
|
- vo.setHaveUnDoTask(unDoTaskList.size()>0);
|
|
|
+ vo.setHaveUnDoTask(unDoTaskList.size() > 0);
|
|
|
// vo.setUnDoTaskList(unDoTaskList);
|
|
|
- return vo;
|
|
|
+ return vo;
|
|
|
}
|
|
|
|
|
|
|
|
|
@@ -350,14 +354,13 @@ public class PanelServiceImpl implements PanelService {
|
|
|
req.setOrgId(sysOrg.getId());
|
|
|
final TableDataInfo tableDataInfo = materialsService.selectPage(req);
|
|
|
final List<SysLearningMaterialsPageVo> rows = tableDataInfo.getRows();
|
|
|
- List<SysLearningMaterialsPageVo> resultList=new ArrayList<>();
|
|
|
+ List<SysLearningMaterialsPageVo> resultList = new ArrayList<>();
|
|
|
if (ObjectUtil.isEmpty(rows)) {
|
|
|
hashMap.put("index2", new ArrayList<>());
|
|
|
} else {
|
|
|
// List<String> fileLit = new ArrayList<>();
|
|
|
for (SysLearningMaterialsPageVo vo : rows) {
|
|
|
- if(vo.getIsOpen().equals(0))
|
|
|
- {
|
|
|
+ if (vo.getIsOpen().equals(0)) {
|
|
|
continue;
|
|
|
}
|
|
|
final String json = vo.getFileList();
|
|
|
@@ -365,9 +368,9 @@ public class PanelServiceImpl implements PanelService {
|
|
|
continue;
|
|
|
}
|
|
|
List<FileObject> objects = new ArrayList<>();
|
|
|
- List<String> lista = com.alibaba.fastjson2.JSON.parseArray(json, String.class);
|
|
|
- for(String str:lista){
|
|
|
- FileObject object = JSONObject.parseObject(str,FileObject.class);
|
|
|
+ List<String> lista = com.alibaba.fastjson2.JSON.parseArray(json, String.class);
|
|
|
+ for (String str : lista) {
|
|
|
+ FileObject object = JSONObject.parseObject(str, FileObject.class);
|
|
|
objects.add(object);
|
|
|
}
|
|
|
vo.setFileObjectList(objects);
|