|
|
@@ -279,8 +279,14 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
tMonitoringRetrievalPlan1.setParentId(id);
|
|
|
tMonitoringRetrievalPlan1.setIsDistribute("1");
|
|
|
tMonitoringRetrievalPlan1.setCreateType(1);
|
|
|
- i = insertTMonitoringRetrievalPlan(tMonitoringRetrievalPlan1);
|
|
|
+ if (!tMonitoringRetrievalPlan.getOrgType().equals("3")) {
|
|
|
+ i = insertTMonitoringRetrievalPlan(tMonitoringRetrievalPlan1);
|
|
|
+ }
|
|
|
if (tMonitoringRetrievalPlan.getOrgType().equals("3")) {
|
|
|
+ tMonitoringRetrievalPlan.setCreateType(1);
|
|
|
+ tMonitoringRetrievalPlan.setUpdateBy(SecurityUtils.getUsername());
|
|
|
+ tMonitoringRetrievalPlan.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ baseMapper.updateById(tMonitoringRetrievalPlan);
|
|
|
if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
|
|
|
tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE)) {
|
|
|
tMonitoringRetrievalPlan1.setStartTime(new Date());
|
|
|
@@ -313,7 +319,6 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
cal.add(Calendar.DATE, amount);
|
|
|
Date time = cal.getTime();
|
|
|
tMonitoringRetrievalPlan1.setEndTime(time);
|
|
|
- // List<TMonitoringRetrievalPlan> tMonitoringRetrievalPlans1 = tMonitoringRetrievalPlans(l.getPath(), l.getType(), tMonitoringRetrievalPlan1);
|
|
|
}
|
|
|
tMonitoringRetrievalPlans.add(tMonitoringRetrievalPlan1);
|
|
|
} else {
|
|
|
@@ -326,6 +331,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
BeanUtils.copyProperties(tMonitoringRetrievalPlan, plan);
|
|
|
plan.setPlanName(tMonitoringRetrievalPlan.getPlanName());
|
|
|
plan.setOrgId(s.getId());
|
|
|
+ plan.setId(tMonitoringRetrievalPlan1.getId());
|
|
|
plan.setOrgName(s.getShortName());
|
|
|
plan.setRoleId(tMonitoringRetrievalPlan.getRoleId());
|
|
|
plan.setRoleName(tMonitoringRetrievalPlan.getRoleName());
|
|
|
@@ -526,14 +532,18 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
QueryWrapper queryWrapper = new QueryWrapper();
|
|
|
queryWrapper.eq(PARENT_ID, id);
|
|
|
List<TMonitoringRetrievalPlan> list1 = tMonitoringRetrievalPlanMapper.selectList(queryWrapper);
|
|
|
+ List<Long> collect = new ArrayList<>();
|
|
|
if (CollectionUtils.isNotEmpty(list1)) {
|
|
|
+ collect = list1.stream().map(TMonitoringRetrievalPlan::getId).collect(Collectors.toList());
|
|
|
+ if (plan.getPlanCycle().equals("0")) {
|
|
|
+ iCoreMonitoringRetrievalTaskService.deleteAllTaskByPlanIds(collect);
|
|
|
+ }
|
|
|
for (TMonitoringRetrievalPlan tMonitoringRetrievalPlan : list1) {
|
|
|
tMonitoringRetrievalPlan.setPlanStatus(2);
|
|
|
tMonitoringRetrievalPlan.setIsDistribute("0");
|
|
|
baseMapper.updateById(tMonitoringRetrievalPlan);
|
|
|
//删除所有的任务,现在删除本周期的任务
|
|
|
if (plan.getPlanCycle().equals("0")) {
|
|
|
- iCoreMonitoringRetrievalTaskService.deleteAllTaskByPlanId(tMonitoringRetrievalPlan.getId());
|
|
|
//如果无周期删除计划
|
|
|
baseMapper.deleteById(tMonitoringRetrievalPlan.getId());
|
|
|
}
|
|
|
@@ -551,6 +561,11 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
break;
|
|
|
}
|
|
|
}
|
|
|
+ } else if (plan.getOrgType().equals("3")) {
|
|
|
+ collect.add(id);
|
|
|
+ if (plan.getPlanCycle().equals("0")) {
|
|
|
+ iCoreMonitoringRetrievalTaskService.deleteAllTaskByPlanIds(collect);
|
|
|
+ }
|
|
|
}
|
|
|
plan.setPlanStatus(2);
|
|
|
plan.setIsDistribute("0");
|
|
|
@@ -623,88 +638,12 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
long id = IdWorker.getId();
|
|
|
tMonitoringRetrievalPlan.setId(id);
|
|
|
tMonitoringRetrievalPlan.setOrgPath(data.getPath());
|
|
|
- // SysOrg sysOrg1 = remoteOrgService.selectSysOrgById(sysUser.getOrgId(), SecurityConstants.INNER);
|
|
|
- //如果是行社新增就没有下发的按钮
|
|
|
-/* if (sysOrg1.getType() == 3) {
|
|
|
- tMonitoringRetrievalPlan.setCreateType(1);
|
|
|
- tMonitoringRetrievalPlan.setIsDistribute("1");
|
|
|
- SysOrg sysOrg = new SysOrg();
|
|
|
- sysOrg.setPath(sysOrg1.getPath());
|
|
|
- sysOrg.setType(Integer.valueOf(tMonitoringRetrievalPlan.getOrgType()));
|
|
|
- List<SysOrg> sysOrgs = remoteOrgService.listByParentIdAndType(sysOrg, SecurityConstants.INNER);
|
|
|
- List<TMonitoringRetrievalPlan> tMonitoringRetrievalPlans = new ArrayList<>();
|
|
|
- for (SysOrg s : sysOrgs) {
|
|
|
- TMonitoringRetrievalPlan plan = new TMonitoringRetrievalPlan();
|
|
|
- BeanUtils.copyProperties(tMonitoringRetrievalPlan, plan);
|
|
|
- plan.setPlanName(tMonitoringRetrievalPlan.getPlanName());
|
|
|
- plan.setOrgId(s.getId());
|
|
|
- plan.setOrgName(s.getShortName());
|
|
|
- plan.setRoleId(tMonitoringRetrievalPlan.getRoleId());
|
|
|
- plan.setRoleName(tMonitoringRetrievalPlan.getRoleName());
|
|
|
- plan.setOrgPath(s.getPath());
|
|
|
- plan.setOrgType(tMonitoringRetrievalPlan.getOrgType());
|
|
|
- plan.setPlanCycle(tMonitoringRetrievalPlan.getPlanCycle());
|
|
|
- plan.setPlanFrequency(tMonitoringRetrievalPlan.getPlanFrequency());
|
|
|
- plan.setPlanStatus(ZERO);
|
|
|
- plan.setCreateBy(SecurityUtils.getUsername());
|
|
|
- plan.setUpdateTime(DateUtils.getNowDate());
|
|
|
- plan.setUpdateBy(SecurityUtils.getUsername());
|
|
|
- plan.setCreateTime(DateUtils.getNowDate());
|
|
|
- plan.setDescription(tMonitoringRetrievalPlan.getDescription());
|
|
|
- plan.setCreateType(1);
|
|
|
- plan.setParentId(tMonitoringRetrievalPlan.getId());
|
|
|
- plan.setIsDistribute("1");
|
|
|
- if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
|
|
|
- tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE)) {
|
|
|
- plan.setStartTime(new Date());
|
|
|
- int amount = 0;
|
|
|
- LocalDate lastDayOfMonth;
|
|
|
- switch (tMonitoringRetrievalPlan.getPlanCycle()) {
|
|
|
- case "1":
|
|
|
- amount = 1;
|
|
|
- break;
|
|
|
- case "2":
|
|
|
- amount = 7;
|
|
|
- break;
|
|
|
- case "3":
|
|
|
- LocalDate currentDate = LocalDate.now();
|
|
|
- lastDayOfMonth = currentDate.withDayOfMonth(currentDate.lengthOfMonth());
|
|
|
- amount = lastDayOfMonth.getDayOfMonth() - currentDate.getDayOfMonth();
|
|
|
- break;
|
|
|
- case "4":
|
|
|
- amount = getDayNum(3);
|
|
|
- break;
|
|
|
- case "5":
|
|
|
- amount = getDayNum(6);
|
|
|
- break;
|
|
|
- case "6":
|
|
|
- amount = getDayNum(12);
|
|
|
- break;
|
|
|
- }
|
|
|
- Calendar cal = Calendar.getInstance();
|
|
|
- cal.setTime(new Date());
|
|
|
- cal.add(Calendar.DATE, amount);
|
|
|
- Date time = cal.getTime();
|
|
|
- plan.setEndTime(time);
|
|
|
- }
|
|
|
- tMonitoringRetrievalPlans.add(plan);
|
|
|
- }
|
|
|
- if ((tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE) || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
|
|
|
- try {
|
|
|
- iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
|
|
|
- } catch (Exception e) {
|
|
|
- throw new ServiceException("下发任务异常,请联系管理员");
|
|
|
- }
|
|
|
- }
|
|
|
- } else {*/
|
|
|
if (tMonitoringRetrievalPlan.getCreateType() == null) {
|
|
|
tMonitoringRetrievalPlan.setCreateType(ZERO);
|
|
|
}
|
|
|
if (tMonitoringRetrievalPlan.getIsDistribute() == null) {
|
|
|
tMonitoringRetrievalPlan.setIsDistribute(ZERO.toString());
|
|
|
}
|
|
|
-
|
|
|
- // }
|
|
|
return tMonitoringRetrievalPlanMapper.insert(tMonitoringRetrievalPlan);
|
|
|
}
|
|
|
|
|
|
@@ -722,7 +661,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
tMonitoringRetrievalPlan.setUpdateBy(SecurityUtils.getUsername());
|
|
|
TMonitoringRetrievalPlan plan = baseMapper.selectById(tMonitoringRetrievalPlan.getId());
|
|
|
BeanUtils.copyProperties(tMonitoringRetrievalPlan, plan);
|
|
|
- plan.setIsDistribute("0");
|
|
|
+ // plan.setIsDistribute("0");
|
|
|
int i = tMonitoringRetrievalPlanMapper.updateById(plan);
|
|
|
if (CollectionUtils.isEmpty(coreMonitoringRetrievalTasks)) {
|
|
|
iCoreMonitoringRetrievalTaskService.deleteTaskByPlanId(tMonitoringRetrievalPlan.getId());
|
|
|
@@ -732,7 +671,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
baseMapper.delete(queryWrapper);
|
|
|
SysOrg sysOrg1 = remoteOrgService.selectSysOrgById(SecurityUtils.getLoginUser().getOrgId(), SecurityConstants.INNER);
|
|
|
List<TMonitoringRetrievalPlan> tMonitoringRetrievalPlans = new ArrayList<>();
|
|
|
- if (sysOrg1.getType() == 1) {
|
|
|
+ if (sysOrg1.getType() == 1 && plan.getIsDistribute().equals("1")) {
|
|
|
distribute(plan.getId());
|
|
|
} else {
|
|
|
SysOrg sysOrg = new SysOrg();
|
|
|
@@ -795,7 +734,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
}
|
|
|
tMonitoringRetrievalPlans.add(plan1);
|
|
|
}
|
|
|
- if ((tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE) || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
|
|
|
+ if ((tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE) || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans) && tMonitoringRetrievalPlan.getIsDistribute().equals("1")) {
|
|
|
try {
|
|
|
iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
|
|
|
} catch (Exception e) {
|
|
|
@@ -803,7 +742,6 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
} catch (Exception e) {
|
|
|
e.getMessage();
|
|
|
}
|