|
|
@@ -21,15 +21,14 @@ import com.xunmei.common.core.domain.retrieval.domain.CoreMonitoringRetrievalTas
|
|
|
import com.xunmei.common.core.domain.retrieval.dto.RetrievalTaskPageDto;
|
|
|
import com.xunmei.common.core.domain.retrieval.vo.*;
|
|
|
import com.xunmei.common.core.domain.safetyindex.domain.CoreSafetyExceptionData;
|
|
|
-import com.xunmei.common.core.enums.edu.EduTrainingPlanCycleEnum;
|
|
|
import com.xunmei.common.core.domain.worktime.domain.SysWorkTime;
|
|
|
import com.xunmei.common.core.domain.worktime.dto.WorkTimeDto;
|
|
|
import com.xunmei.common.core.enums.CycleCommonEnum;
|
|
|
import com.xunmei.common.core.enums.RetrievalTaskCycle;
|
|
|
+import com.xunmei.common.core.enums.edu.EduTrainingPlanCycleEnum;
|
|
|
import com.xunmei.common.core.event.WorkTimeChangeEvent;
|
|
|
import com.xunmei.common.core.utils.DateHelper;
|
|
|
import com.xunmei.common.core.utils.DateUtils;
|
|
|
-import com.xunmei.common.core.utils.KeyValue;
|
|
|
import com.xunmei.common.core.utils.Ymd;
|
|
|
import com.xunmei.common.core.web.page.TableDataInfo;
|
|
|
import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
@@ -41,9 +40,11 @@ import com.xunmei.core.retrieval.mapper.CoreMonitoringRetrievalTaskMapper;
|
|
|
import com.xunmei.core.retrieval.service.ICoreMonitoringRetrievalTaskService;
|
|
|
import com.xunmei.system.api.RemoteDictDataService;
|
|
|
import com.xunmei.system.api.RemoteOrgService;
|
|
|
+import com.xunmei.system.api.RemoteRoleService;
|
|
|
import com.xunmei.system.api.RemoteWorkTimeService;
|
|
|
import com.xunmei.system.api.domain.SysDictData;
|
|
|
import com.xunmei.system.api.domain.SysOrg;
|
|
|
+import com.xunmei.system.api.domain.SysRole;
|
|
|
import com.xunmei.system.api.function.RemoteCallHandlerExecutor;
|
|
|
import com.xunmei.system.api.model.LoginUser;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
@@ -60,7 +61,6 @@ import java.net.URLEncoder;
|
|
|
import java.time.*;
|
|
|
import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
-import java.util.stream.Stream;
|
|
|
|
|
|
|
|
|
/**
|
|
|
@@ -83,7 +83,7 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
@Autowired
|
|
|
private CoreMonitoringTaskRegistrationMapper coreMonitoringTaskRegistrationMapper;
|
|
|
@Autowired
|
|
|
- private RemoteOrgService remoteOrgService;
|
|
|
+ private RemoteRoleService roleService;
|
|
|
@Autowired
|
|
|
RemoteWorkTimeService workTimeService;
|
|
|
|
|
|
@@ -251,7 +251,7 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
}
|
|
|
//立即生效的计划要排除截至时间在当前时间之前的数据
|
|
|
List<CoreMonitoringRetrievalTask> lista = taskList.stream().filter(r -> r.getPlanEndTime().after(new Date())).collect(Collectors.toList());
|
|
|
- if(CollectionUtil.isNotEmpty(lista)){
|
|
|
+ if (CollectionUtil.isNotEmpty(lista)) {
|
|
|
this.saveBatch(lista);
|
|
|
}
|
|
|
}
|
|
|
@@ -405,10 +405,10 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
@Override
|
|
|
public void deleteAllTaskByPlanIds(List<Long> planId) {
|
|
|
Long[] longs = planId.toArray(new Long[planId.size()]);
|
|
|
- // coreMonitoringRetrievalTaskMapper.deleteAllTaskByPlanIds(longs);
|
|
|
+ // coreMonitoringRetrievalTaskMapper.deleteAllTaskByPlanIds(longs);
|
|
|
|
|
|
- QueryWrapper queryWrapper=new QueryWrapper();
|
|
|
- queryWrapper.in("plan_id",longs);
|
|
|
+ QueryWrapper queryWrapper = new QueryWrapper();
|
|
|
+ queryWrapper.in("plan_id", longs);
|
|
|
coreMonitoringRetrievalTaskMapper.delete(queryWrapper);
|
|
|
}
|
|
|
|
|
|
@@ -460,7 +460,7 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
sysOrg.setPath(p.getOrgPath());
|
|
|
sysOrg.setType(Integer.valueOf(p.getOrgType()));
|
|
|
List<SysOrg> sysOrgs = remoteOrgService.listByParentIdAndType(sysOrg, SecurityConstants.INNER);*/
|
|
|
- List<SysOrg> sysOrgs = orgList.stream().filter(s -> s.getPath().contains(p.getOrgPath()) && (s.getType()!=null&&s.getType().toString().equals(p.getOrgType()))).collect(Collectors.toList());
|
|
|
+ List<SysOrg> sysOrgs = orgList.stream().filter(s -> s.getPath().contains(p.getOrgPath()) && (s.getType() != null && s.getType().toString().equals(p.getOrgType()))).collect(Collectors.toList());
|
|
|
for (SysOrg s : sysOrgs) {
|
|
|
TMonitoringRetrievalPlan plan = new TMonitoringRetrievalPlan();
|
|
|
BeanUtils.copyProperties(p, plan);
|
|
|
@@ -522,25 +522,25 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
}
|
|
|
Map<Integer, DateRange> dateRanges = DateUtils.splitDateRange(dateRange.getStartTime(), dateRange.getEndTime(), plan.getPlanFrequency().intValue());
|
|
|
//判断作息(无周期排开)
|
|
|
- if(!plan.getPlanCycle().equals(RetrievalTaskCycle.NOCYCLE.getCode().toString())){
|
|
|
+ if (!plan.getPlanCycle().equals(RetrievalTaskCycle.NOCYCLE.getCode().toString())) {
|
|
|
boolean flag = checkWorkTime(dateRange.getStartTime(), dateRange.getEndTime(), sysOrg.getId());
|
|
|
- if(flag){
|
|
|
+ if (flag) {
|
|
|
for (int i = 1; i <= plan.getPlanFrequency(); i++) {
|
|
|
DateRange dateRange1 = dateRanges.get(i);
|
|
|
CoreMonitoringRetrievalTask task = this.buildCoreMonitoringRetrievalTask(batchNum, i, plan, sysOrg, dateRange1, ymd);
|
|
|
taskList.add(task);
|
|
|
}
|
|
|
- }else{
|
|
|
- log.error("机构"+sysOrg.getName()+"在时间"+dateRange.getStartTime()+"-"+dateRange.getEndTime()+"没有作息,不生成监控调阅任务");
|
|
|
+ } else {
|
|
|
+ log.error("机构" + sysOrg.getName() + "在时间" + dateRange.getStartTime() + "-" + dateRange.getEndTime() + "没有作息,不生成监控调阅任务");
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
for (int i = 1; i <= plan.getPlanFrequency(); i++) {
|
|
|
DateRange dateRange1 = dateRanges.get(i);
|
|
|
CoreMonitoringRetrievalTask task = this.buildCoreMonitoringRetrievalTask(batchNum, i, plan, sysOrg, dateRange1, ymd);
|
|
|
taskList.add(task);
|
|
|
}
|
|
|
}
|
|
|
- //
|
|
|
+ //
|
|
|
return taskList;
|
|
|
|
|
|
}
|
|
|
@@ -607,21 +607,23 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
|
|
|
@Override
|
|
|
public List<CoreSafetyExceptionData> selectMonitorExceptionData(DateTime time) {
|
|
|
- //逾期数据
|
|
|
+ //获取监控调阅的异常数据 , 扩展字段2=overTime表示逾期数据 扩展字段2=nums表示异常通道数量数据
|
|
|
+ /* 逾期数据 扩展字段1:任务状态
|
|
|
List<CoreSafetyExceptionData> overTimeExceptionData = baseMapper.selectMonitorOverTimeExceptionData(time);
|
|
|
- //检查通道占比数量数据
|
|
|
- List<CoreSafetyExceptionData> numsExceptionData = baseMapper.selectMonitorNumsExceptionData(time);
|
|
|
-
|
|
|
- final List<CoreSafetyExceptionData> collect = Stream.of(overTimeExceptionData, numsExceptionData).flatMap(Collection::stream).collect(Collectors.toList());
|
|
|
- collect.removeIf(item -> ObjectUtil.isNull(item.getDataId()));
|
|
|
- return collect;
|
|
|
+ //检查通道占比数量数据 扩展字段1:通道数
|
|
|
+ List<CoreSafetyExceptionData> numsExceptionData = baseMapper.selectMonitorNumsExceptionData(time);*/
|
|
|
+ SysRole role = roleService.getRoleByName("网点安全员", SecurityConstants.INNER);
|
|
|
+ //扩展字段1:任务状态 扩展字段2 计划id
|
|
|
+ List<CoreSafetyExceptionData> exceptionData = baseMapper.selectMonitorExceptionData(time.year(), time.quarter(), time.month() + 1, role.getId());
|
|
|
+ exceptionData.removeIf(item -> ObjectUtil.isNull(item.getDataId()));
|
|
|
+ return exceptionData;
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
- public void taskChangeForTimeWorkChange(WorkTimeChangeEvent event) {
|
|
|
+ public void taskChangeForTimeWorkChange(WorkTimeChangeEvent event) {
|
|
|
//修改的作息的日期
|
|
|
- Date ymdDate = event.getDataList().get(0).getYmdDate();
|
|
|
+ Date ymdDate = event.getDataList().get(0).getYmdDate();
|
|
|
|
|
|
//受影响的机构
|
|
|
List<Long> orgIds = event.getOrgIds();
|
|
|
@@ -638,34 +640,34 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
//要重新生成任务的机构和计划
|
|
|
List<KeyValueVo> keyValues = new ArrayList<>();
|
|
|
|
|
|
- Map<String,Object> dayObjectMap = null;
|
|
|
- Map<String,Object> weekObjectMap=null;
|
|
|
- Map<String,Object> monthObjectMap=null;
|
|
|
- Map<String,Object> quarterObjectMap=null;
|
|
|
- Map<String,Object> halfYearObjectMap=null;
|
|
|
- Map<String,Object> yearObjectMap=null;
|
|
|
+ Map<String, Object> dayObjectMap = null;
|
|
|
+ Map<String, Object> weekObjectMap = null;
|
|
|
+ Map<String, Object> monthObjectMap = null;
|
|
|
+ Map<String, Object> quarterObjectMap = null;
|
|
|
+ Map<String, Object> halfYearObjectMap = null;
|
|
|
+ Map<String, Object> yearObjectMap = null;
|
|
|
//判断ymdDate 月today是否是同一日期
|
|
|
- if(DateUtil.isSameDay(ymdDate,today)){
|
|
|
- //获取当天的调阅任务
|
|
|
- dayObjectMap = this.deleteTaskList(ymdDate,orgIds,RetrievalTaskCycle.DAYCYCLE.getCode());
|
|
|
+ if (DateUtil.isSameDay(ymdDate, today)) {
|
|
|
+ //获取当天的调阅任务
|
|
|
+ dayObjectMap = this.deleteTaskList(ymdDate, orgIds, RetrievalTaskCycle.DAYCYCLE.getCode());
|
|
|
}
|
|
|
- weekObjectMap = this.deleteTaskList(ymdDate,orgIds,RetrievalTaskCycle.WEEKCYCLE.getCode());
|
|
|
- monthObjectMap = this.deleteTaskList(ymdDate,orgIds,RetrievalTaskCycle.MONTHCYCLE.getCode());
|
|
|
- quarterObjectMap = this.deleteTaskList(ymdDate,orgIds,RetrievalTaskCycle.QUARTERCYCLE.getCode());
|
|
|
- halfYearObjectMap = this.deleteTaskList(ymdDate,orgIds,RetrievalTaskCycle.HALFYEARCYCLE.getCode());
|
|
|
- yearObjectMap = this.deleteTaskList(ymdDate,orgIds,RetrievalTaskCycle.YEARCYCLE.getCode());
|
|
|
+ weekObjectMap = this.deleteTaskList(ymdDate, orgIds, RetrievalTaskCycle.WEEKCYCLE.getCode());
|
|
|
+ monthObjectMap = this.deleteTaskList(ymdDate, orgIds, RetrievalTaskCycle.MONTHCYCLE.getCode());
|
|
|
+ quarterObjectMap = this.deleteTaskList(ymdDate, orgIds, RetrievalTaskCycle.QUARTERCYCLE.getCode());
|
|
|
+ halfYearObjectMap = this.deleteTaskList(ymdDate, orgIds, RetrievalTaskCycle.HALFYEARCYCLE.getCode());
|
|
|
+ yearObjectMap = this.deleteTaskList(ymdDate, orgIds, RetrievalTaskCycle.YEARCYCLE.getCode());
|
|
|
|
|
|
- Map<String,Object> allMap = this.buildDeleteTaskList(dayObjectMap,weekObjectMap,monthObjectMap,quarterObjectMap,halfYearObjectMap,yearObjectMap);
|
|
|
+ Map<String, Object> allMap = this.buildDeleteTaskList(dayObjectMap, weekObjectMap, monthObjectMap, quarterObjectMap, halfYearObjectMap, yearObjectMap);
|
|
|
deleteTaskList = (List<CoreMonitoringRetrievalTask>) allMap.get("deleteTaskList");
|
|
|
keyValues = (List<KeyValueVo>) allMap.get("keyValues");
|
|
|
//删除任务
|
|
|
- if(CollectionUtil.isNotEmpty(deleteTaskList)){
|
|
|
+ if (CollectionUtil.isNotEmpty(deleteTaskList)) {
|
|
|
this.removeBatchByIds(deleteTaskList);
|
|
|
}
|
|
|
//生成新的任务
|
|
|
- // if(CollectionUtil.isNotEmpty(keyValues)){
|
|
|
- this.createNewtask(keyValues,ymdDate,orgIds);
|
|
|
- // }
|
|
|
+ // if(CollectionUtil.isNotEmpty(keyValues)){
|
|
|
+ this.createNewtask(keyValues, ymdDate, orgIds);
|
|
|
+ // }
|
|
|
|
|
|
}
|
|
|
|
|
|
@@ -674,10 +676,10 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
List<CoreMonitoringRetrievalTask> deleteTaskList = new ArrayList<>();
|
|
|
List<KeyValueVo> keyValues = new ArrayList<>();
|
|
|
for (Map<String, Object> objMap : ObjMaps) {
|
|
|
- if(objMap != null&&objMap.containsKey("deleteTaskList")&&objMap.containsKey("keyValues")){
|
|
|
+ if (objMap != null && objMap.containsKey("deleteTaskList") && objMap.containsKey("keyValues")) {
|
|
|
List<CoreMonitoringRetrievalTask> listTask = (List<CoreMonitoringRetrievalTask>) objMap.get("deleteTaskList");
|
|
|
List<KeyValueVo> keyValueList = (List<KeyValueVo>) objMap.get("keyValues");
|
|
|
- if(CollectionUtil.isNotEmpty(listTask)){
|
|
|
+ if (CollectionUtil.isNotEmpty(listTask)) {
|
|
|
deleteTaskList.addAll(listTask);
|
|
|
}
|
|
|
if (CollectionUtil.isNotEmpty(keyValueList)) {
|
|
|
@@ -690,13 +692,14 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
deleteTaskListMap.put("keyValues", keyValues);
|
|
|
return deleteTaskListMap;
|
|
|
}
|
|
|
- private void createNewtask(List<KeyValueVo> keyValues,Date taskTime,List<Long> orgIds) {
|
|
|
+
|
|
|
+ private void createNewtask(List<KeyValueVo> keyValues, Date taskTime, List<Long> orgIds) {
|
|
|
//获取所有机构
|
|
|
List<SysOrg> orgList = RemoteCallHandlerExecutor.executeRemoteCall(() -> orgService.findAllOrg(SecurityConstants.INNER), ErrorMsgConstants.QUERY_ORG_DATA_ERROR);
|
|
|
- List<SysOrg> orgs = orgList.stream().filter(r->orgIds.contains(r.getId())).collect(Collectors.toList());
|
|
|
+ List<SysOrg> orgs = orgList.stream().filter(r -> orgIds.contains(r.getId())).collect(Collectors.toList());
|
|
|
//通过parentId获取orgList中orgs的直属上级
|
|
|
- List<SysOrg> parentOrgList = orgList.stream().filter(r->orgs.stream().anyMatch(s->s.getParentId().equals(r.getId()))).collect(Collectors.toList());
|
|
|
- List<Long> orgParentIds = parentOrgList.stream().map(r->r.getId()).collect(Collectors.toList());
|
|
|
+ List<SysOrg> parentOrgList = orgList.stream().filter(r -> orgs.stream().anyMatch(s -> s.getParentId().equals(r.getId()))).collect(Collectors.toList());
|
|
|
+ List<Long> orgParentIds = parentOrgList.stream().map(r -> r.getId()).collect(Collectors.toList());
|
|
|
|
|
|
//获取计划
|
|
|
List<CoreMonitoringRetrievalTask> taskList = new ArrayList<>();
|
|
|
@@ -710,16 +713,16 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
List<TMonitoringRetrievalPlan> plans = itMonitoringRetrievalPlanService.list(queryWrapper);
|
|
|
List<TMonitoringRetrievalPlan> planList = new ArrayList<>();
|
|
|
|
|
|
- for(TMonitoringRetrievalPlan p:plans){
|
|
|
+ for (TMonitoringRetrievalPlan p : plans) {
|
|
|
for (SysOrg s : orgs) {
|
|
|
- if(CollectionUtil.isNotEmpty(keyValues)){
|
|
|
+ if (CollectionUtil.isNotEmpty(keyValues)) {
|
|
|
//机构和计划没有同时在排除的范围内的计划不生成任务
|
|
|
- if(keyValues.stream().filter(r->r.getValue().equals(p.getId())&&r.getKey().equals(s.getId())).count()>0){
|
|
|
+ if (keyValues.stream().filter(r -> r.getValue().equals(p.getId()) && r.getKey().equals(s.getId())).count() > 0) {
|
|
|
continue;
|
|
|
}
|
|
|
}
|
|
|
//计划的机构id不是当前机构的直属父机构,不生成任务,计划的机构类型不是当前机构的机构类型不生成任务
|
|
|
- if(!p.getOrgId().equals(s.getParentId())||(s.getType()!=null&&!s.getType().toString().equals(p.getOrgType()))){
|
|
|
+ if (!p.getOrgId().equals(s.getParentId()) || (s.getType() != null && !s.getType().toString().equals(p.getOrgType()))) {
|
|
|
continue;
|
|
|
}
|
|
|
TMonitoringRetrievalPlan plan = new TMonitoringRetrievalPlan();
|
|
|
@@ -747,7 +750,7 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
}
|
|
|
for (TMonitoringRetrievalPlan plan : planList) {
|
|
|
//任务的开始时间按周期计算用下面的方式
|
|
|
- DateRange dateRange = DateUtils.getStartAndEnd(taskTime, Integer.valueOf(plan.getPlanCycle()));
|
|
|
+ DateRange dateRange = DateUtils.getStartAndEnd(taskTime, Integer.valueOf(plan.getPlanCycle()));
|
|
|
Instant instant = dateRange.getStartTime().toInstant();
|
|
|
// 创建 ZonedDateTime 对象,并指定时区
|
|
|
ZonedDateTime zdt = instant.atZone(ZoneId.systemDefault());
|
|
|
@@ -759,14 +762,14 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
if (CollectionUtil.isNotEmpty(listByType)) {
|
|
|
List<CoreMonitoringRetrievalTask> list = this.buildCoreMonitoringRetrievalTask(plan, localDate, listByType.get(0));
|
|
|
if (CollectionUtil.isNotEmpty(list)) {
|
|
|
- if(!plan.getPlanCycle().equals(RetrievalTaskCycle.DAYCYCLE.getCode().toString())){
|
|
|
+ if (!plan.getPlanCycle().equals(RetrievalTaskCycle.DAYCYCLE.getCode().toString())) {
|
|
|
List<CoreMonitoringRetrievalTask> lista = list.stream().filter(r -> r.getPlanEndTime().after(taskTime)).collect(Collectors.toList());
|
|
|
- if(CollectionUtil.isNotEmpty(lista)){
|
|
|
+ if (CollectionUtil.isNotEmpty(lista)) {
|
|
|
taskList.addAll(lista);
|
|
|
}
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
List<CoreMonitoringRetrievalTask> lista = list.stream().filter(r -> r.getPlanEndTime().after(new Date())).collect(Collectors.toList());
|
|
|
- if(CollectionUtil.isNotEmpty(lista)){
|
|
|
+ if (CollectionUtil.isNotEmpty(lista)) {
|
|
|
taskList.addAll(lista);
|
|
|
}
|
|
|
}
|
|
|
@@ -777,39 +780,39 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
this.saveBatch(taskList);
|
|
|
}
|
|
|
|
|
|
- private Map<String,Object> deleteTaskList(Date ymdDate,List<Long> orgIds,Integer cycle){
|
|
|
- Map<String,Object> objectMap = new HashMap<>();
|
|
|
+ private Map<String, Object> deleteTaskList(Date ymdDate, List<Long> orgIds, Integer cycle) {
|
|
|
+ Map<String, Object> objectMap = new HashMap<>();
|
|
|
QueryWrapper<CoreMonitoringRetrievalTask> queryWrapper = new QueryWrapper<>();
|
|
|
- //每日条件
|
|
|
+ //每日条件
|
|
|
Date datetime = ymdDate;
|
|
|
- if(!cycle.equals(RetrievalTaskCycle.DAYCYCLE.getCode())){
|
|
|
- //根据ymdDate获取周的第一天的日期
|
|
|
- DateRange dateRange = DateUtils.getStartAndEnd(ymdDate,cycle);
|
|
|
+ if (!cycle.equals(RetrievalTaskCycle.DAYCYCLE.getCode())) {
|
|
|
+ //根据ymdDate获取周的第一天的日期
|
|
|
+ DateRange dateRange = DateUtils.getStartAndEnd(ymdDate, cycle);
|
|
|
datetime = dateRange.getStartTime();
|
|
|
}
|
|
|
- LocalDate taskTime=DateUtils.toLocalDate(datetime);
|
|
|
+ LocalDate taskTime = DateUtils.toLocalDate(datetime);
|
|
|
/* queryWrapper.lambda().eq(CoreMonitoringRetrievalTask::getYmdDate,taskTime);
|
|
|
//公共条件
|
|
|
queryWrapper.lambda().in(CoreMonitoringRetrievalTask::getOrgId,orgIds);
|
|
|
queryWrapper.lambda().eq(CoreMonitoringRetrievalTask::getCycle,cycle);
|
|
|
List<CoreMonitoringRetrievalTask> taskList = this.list(queryWrapper);*/
|
|
|
- List<CoreMonitoringRetrievalTask> taskList = baseMapper.selectTaskList(taskTime,orgIds,cycle);
|
|
|
+ List<CoreMonitoringRetrievalTask> taskList = baseMapper.selectTaskList(taskTime, orgIds, cycle);
|
|
|
List<CoreMonitoringRetrievalTask> deleteTaskList = new ArrayList<>();
|
|
|
List<KeyValueVo> keyValues = new ArrayList<>();
|
|
|
- if(CollectionUtil.isNotEmpty(taskList)){
|
|
|
+ if (CollectionUtil.isNotEmpty(taskList)) {
|
|
|
//将数据按机构分组
|
|
|
- Map<Long,List<CoreMonitoringRetrievalTask>> taskMap = taskList.stream().collect(Collectors.groupingBy(CoreMonitoringRetrievalTask::getOrgId));
|
|
|
- for(Long key:taskMap.keySet()){
|
|
|
+ Map<Long, List<CoreMonitoringRetrievalTask>> taskMap = taskList.stream().collect(Collectors.groupingBy(CoreMonitoringRetrievalTask::getOrgId));
|
|
|
+ for (Long key : taskMap.keySet()) {
|
|
|
List<CoreMonitoringRetrievalTask> taskList1 = taskMap.get(key);
|
|
|
- //将taskList1 按batchNum进行分组
|
|
|
- Map<Long,List<CoreMonitoringRetrievalTask>> taskMap1 = taskList1.stream().collect(Collectors.groupingBy(CoreMonitoringRetrievalTask::getBatchNum));
|
|
|
- for(Long key1:taskMap1.keySet()){
|
|
|
+ //将taskList1 按batchNum进行分组
|
|
|
+ Map<Long, List<CoreMonitoringRetrievalTask>> taskMap1 = taskList1.stream().collect(Collectors.groupingBy(CoreMonitoringRetrievalTask::getBatchNum));
|
|
|
+ for (Long key1 : taskMap1.keySet()) {
|
|
|
List<CoreMonitoringRetrievalTask> taskList2 = taskMap1.get(key1);
|
|
|
- int num = (int) taskList2.stream().filter(t->t.getStatus().equals(2)).count();
|
|
|
+ int num = (int) taskList2.stream().filter(t -> t.getStatus().equals(2)).count();
|
|
|
//没有完成的任务,改批次的任务删除
|
|
|
- if(num==0){
|
|
|
+ if (num == 0) {
|
|
|
deleteTaskList.addAll(taskList2);
|
|
|
- }else{
|
|
|
+ } else {
|
|
|
Long planId = taskList2.get(0).getPlanId();
|
|
|
KeyValueVo keyValue = new KeyValueVo();
|
|
|
keyValue.setKey(key);
|
|
|
@@ -819,24 +822,25 @@ public class CoreMonitoringRetrievalTaskServiceImpl extends ServiceImpl<CoreMoni
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- objectMap.put("deleteTaskList",deleteTaskList);
|
|
|
- objectMap.put("keyValues",keyValues);
|
|
|
+ objectMap.put("deleteTaskList", deleteTaskList);
|
|
|
+ objectMap.put("keyValues", keyValues);
|
|
|
return objectMap;
|
|
|
}
|
|
|
|
|
|
|
|
|
- private boolean checkWorkTime(Date workstartTime, Date workendTime,Long orgId){
|
|
|
- Map<String,Object> map = new HashMap<>();
|
|
|
- map.put("workstartTime",DateUtil.format(workstartTime,"yyyy-MM-dd"));
|
|
|
- map.put("workendTime",DateUtil.format(workendTime,"yyyy-MM-dd"));
|
|
|
- map.put("orgId",orgId);
|
|
|
- Integer num = workTimeService.checkWorkTime(map,SecurityConstants.INNER);
|
|
|
- if(num>0){
|
|
|
+ private boolean checkWorkTime(Date workstartTime, Date workendTime, Long orgId) {
|
|
|
+ Map<String, Object> map = new HashMap<>();
|
|
|
+ map.put("workstartTime", DateUtil.format(workstartTime, "yyyy-MM-dd"));
|
|
|
+ map.put("workendTime", DateUtil.format(workendTime, "yyyy-MM-dd"));
|
|
|
+ map.put("orgId", orgId);
|
|
|
+ Integer num = workTimeService.checkWorkTime(map, SecurityConstants.INNER);
|
|
|
+ if (num > 0) {
|
|
|
return true;
|
|
|
- }else {
|
|
|
- return false;
|
|
|
+ } else {
|
|
|
+ return false;
|
|
|
}
|
|
|
}
|
|
|
+
|
|
|
private List<SysWorkTime> selectWorkTimeList(Date now, CycleCommonEnum cycle, WorkTimeChangeEvent event) {
|
|
|
DateRange range = DateUtils.getStartAndEnd(now, cycle);
|
|
|
String startTime = DateUtil.format(range.getStartTime(), Constants.DAILY_FORMAT);
|