|
|
@@ -172,7 +172,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
i = insertTMonitoringRetrievalPlan(tMonitoringRetrievalPlan1);
|
|
|
if (tMonitoringRetrievalPlan.getOrgType().equals("3")) {
|
|
|
if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
|
|
|
- tMonitoringRetrievalPlan.getImmediately().equals("1")) {
|
|
|
+ tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE)) {
|
|
|
tMonitoringRetrievalPlan1.setStartTime(new Date());
|
|
|
int amount = 0;
|
|
|
LocalDate lastDayOfMonth;
|
|
|
@@ -232,7 +232,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
plan.setParentId(tMonitoringRetrievalPlan.getId());
|
|
|
plan.setIsDistribute("1");
|
|
|
if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
|
|
|
- tMonitoringRetrievalPlan.getImmediately().equals("1")) {
|
|
|
+ tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE)) {
|
|
|
plan.setStartTime(new Date());
|
|
|
int amount = 0;
|
|
|
LocalDate lastDayOfMonth;
|
|
|
@@ -268,7 +268,8 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- if ((tMonitoringRetrievalPlan.getImmediately().equals("1") || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
|
|
|
+ SysOrg sysOrg1 = remoteOrgService.selectSysOrgById(SecurityUtils.getLoginUser().getOrgId(), SecurityConstants.INNER);
|
|
|
+ if (sysOrg1.getType() == 1 && (tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE) || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
|
|
|
try {
|
|
|
iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
|
|
|
} catch (Exception e) {
|
|
|
@@ -369,7 +370,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
plan.setParentId(tMonitoringRetrievalPlan.getId());
|
|
|
plan.setIsDistribute("1");
|
|
|
if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
|
|
|
- tMonitoringRetrievalPlan.getImmediately().equals("1")) {
|
|
|
+ tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE)) {
|
|
|
plan.setStartTime(new Date());
|
|
|
int amount = 0;
|
|
|
LocalDate lastDayOfMonth;
|
|
|
@@ -403,7 +404,7 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
}
|
|
|
tMonitoringRetrievalPlans.add(plan);
|
|
|
}
|
|
|
- if ((tMonitoringRetrievalPlan.getImmediately().equals("1") || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
|
|
|
+ if ((tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE) || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
|
|
|
try {
|
|
|
iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
|
|
|
} catch (Exception e) {
|
|
|
@@ -446,7 +447,80 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
QueryWrapper queryWrapper = new QueryWrapper();
|
|
|
queryWrapper.eq("parent_id", plan.getId());
|
|
|
baseMapper.delete(queryWrapper);
|
|
|
- distribute(plan.getId());
|
|
|
+ SysOrg sysOrg1 = remoteOrgService.selectSysOrgById(SecurityUtils.getLoginUser().getOrgId(), SecurityConstants.INNER);
|
|
|
+ List<TMonitoringRetrievalPlan> tMonitoringRetrievalPlans = new ArrayList<>();
|
|
|
+ if (sysOrg1.getType() == 1) {
|
|
|
+ distribute(plan.getId());
|
|
|
+ } else {
|
|
|
+ SysOrg sysOrg = new SysOrg();
|
|
|
+ sysOrg.setPath(plan.getOrgPath());
|
|
|
+ sysOrg.setType(Integer.valueOf(tMonitoringRetrievalPlan.getOrgType()));
|
|
|
+ List<SysOrg> sysOrgs = remoteOrgService.listByParentIdAndType(sysOrg, SecurityConstants.INNER);
|
|
|
+ for (SysOrg s : sysOrgs) {
|
|
|
+ TMonitoringRetrievalPlan plan1 = new TMonitoringRetrievalPlan();
|
|
|
+ BeanUtils.copyProperties(tMonitoringRetrievalPlan, plan1);
|
|
|
+ plan1.setPlanName(tMonitoringRetrievalPlan.getPlanName());
|
|
|
+ plan1.setOrgId(s.getId());
|
|
|
+ plan1.setOrgName(s.getShortName());
|
|
|
+ plan1.setRoleId(tMonitoringRetrievalPlan.getRoleId());
|
|
|
+ plan1.setRoleName(tMonitoringRetrievalPlan.getRoleName());
|
|
|
+ plan1.setOrgPath(s.getPath());
|
|
|
+ plan1.setOrgType(tMonitoringRetrievalPlan.getOrgType());
|
|
|
+ plan1.setPlanCycle(tMonitoringRetrievalPlan.getPlanCycle());
|
|
|
+ plan1.setPlanFrequency(tMonitoringRetrievalPlan.getPlanFrequency());
|
|
|
+ plan1.setPlanStatus(ZERO);
|
|
|
+ plan1.setCreateBy(SecurityUtils.getUsername());
|
|
|
+ plan1.setUpdateTime(DateUtils.getNowDate());
|
|
|
+ plan1.setUpdateBy(SecurityUtils.getUsername());
|
|
|
+ plan1.setCreateTime(DateUtils.getNowDate());
|
|
|
+ plan1.setDescription(tMonitoringRetrievalPlan.getDescription());
|
|
|
+ plan1.setCreateType(1);
|
|
|
+ plan1.setParentId(tMonitoringRetrievalPlan.getId());
|
|
|
+ plan1.setIsDistribute("1");
|
|
|
+ if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
|
|
|
+ tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE)) {
|
|
|
+ plan1.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();
|
|
|
+ plan1.setEndTime(time);
|
|
|
+ }
|
|
|
+ tMonitoringRetrievalPlans.add(plan1);
|
|
|
+ }
|
|
|
+ if ((tMonitoringRetrievalPlan.getImmediately().equals(Boolean.TRUE) || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
|
|
|
+ try {
|
|
|
+ iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
|
|
|
+ } catch (Exception e) {
|
|
|
+ throw new ServiceException("下发任务异常,请联系管理员");
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
} catch (Exception e) {
|
|
|
e.getMessage();
|
|
|
}
|