|
|
@@ -156,56 +156,24 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
//如果顶级
|
|
|
List<TMonitoringRetrievalPlan> tMonitoringRetrievalPlans = new ArrayList<>();
|
|
|
Integer i = ZERO;
|
|
|
- if (topOrg.getType() == 1) {
|
|
|
- SysOrg org = new SysOrg();
|
|
|
- org.setType(3);
|
|
|
- org.setPath(topOrg.getPath());
|
|
|
- //查询符合的机构,需求是先把行社加入
|
|
|
- List<SysOrg> list = remoteOrgService.listByParentIdAndType(org, SecurityConstants.INNER);
|
|
|
- for (SysOrg l : list) {
|
|
|
- TMonitoringRetrievalPlan tMonitoringRetrievalPlan1 = new TMonitoringRetrievalPlan();
|
|
|
- BeanUtils.copyProperties(tMonitoringRetrievalPlan, tMonitoringRetrievalPlan1);
|
|
|
- tMonitoringRetrievalPlan1.setOrgId(l.getId());
|
|
|
- tMonitoringRetrievalPlan1.setOrgPath(l.getPath());
|
|
|
- tMonitoringRetrievalPlan1.setParentId(id);
|
|
|
- if (tMonitoringRetrievalPlan.getOrgType().equals("3")) {
|
|
|
- tMonitoringRetrievalPlan1.setIsDistribute("1");
|
|
|
- }
|
|
|
- tMonitoringRetrievalPlan1.setCreateType(1);
|
|
|
- i = insertTMonitoringRetrievalPlan(tMonitoringRetrievalPlan1);
|
|
|
- }
|
|
|
- } else {
|
|
|
- SysOrg sysOrg = new SysOrg();
|
|
|
- sysOrg.setPath(tMonitoringRetrievalPlan.getOrgPath());
|
|
|
- sysOrg.setType(Integer.valueOf(tMonitoringRetrievalPlan.getOrgType()));
|
|
|
- List<SysOrg> sysOrgs = remoteOrgService.listByParentIdAndType(sysOrg, SecurityConstants.INNER);
|
|
|
- tMonitoringRetrievalPlan.setIsDistribute("1");
|
|
|
- tMonitoringRetrievalPlan.setCreateType(1);
|
|
|
- tMonitoringRetrievalPlanMapper.updateById(tMonitoringRetrievalPlan);
|
|
|
- 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.setId(tMonitoringRetrievalPlan.getId());
|
|
|
- plan.setParentId(tMonitoringRetrievalPlan.getId());
|
|
|
- plan.setIsDistribute("1");
|
|
|
- if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) && tMonitoringRetrievalPlan.getImmediately().equals("1")) {
|
|
|
- plan.setStartTime(new Date());
|
|
|
+ SysOrg org = new SysOrg();
|
|
|
+ org.setType(3);
|
|
|
+ org.setPath(topOrg.getPath());
|
|
|
+ //查询符合的机构,需求是先把行社加入
|
|
|
+ List<SysOrg> list = remoteOrgService.listByParentIdAndType(org, SecurityConstants.INNER);
|
|
|
+ for (SysOrg l : list) {
|
|
|
+ TMonitoringRetrievalPlan tMonitoringRetrievalPlan1 = new TMonitoringRetrievalPlan();
|
|
|
+ BeanUtils.copyProperties(tMonitoringRetrievalPlan, tMonitoringRetrievalPlan1);
|
|
|
+ tMonitoringRetrievalPlan1.setOrgId(l.getId());
|
|
|
+ tMonitoringRetrievalPlan1.setOrgPath(l.getPath());
|
|
|
+ tMonitoringRetrievalPlan1.setParentId(id);
|
|
|
+ tMonitoringRetrievalPlan1.setIsDistribute("1");
|
|
|
+ tMonitoringRetrievalPlan1.setCreateType(1);
|
|
|
+ i = insertTMonitoringRetrievalPlan(tMonitoringRetrievalPlan1);
|
|
|
+ if (tMonitoringRetrievalPlan.getOrgType().equals("3")) {
|
|
|
+ if (!tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) &&
|
|
|
+ tMonitoringRetrievalPlan.getImmediately().equals("1")) {
|
|
|
+ tMonitoringRetrievalPlan1.setStartTime(new Date());
|
|
|
int amount = 0;
|
|
|
LocalDate lastDayOfMonth;
|
|
|
switch (tMonitoringRetrievalPlan.getPlanCycle()) {
|
|
|
@@ -234,9 +202,70 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
cal.setTime(new Date());
|
|
|
cal.add(Calendar.DATE, amount);
|
|
|
Date time = cal.getTime();
|
|
|
- plan.setEndTime(time);
|
|
|
+ tMonitoringRetrievalPlan1.setEndTime(time);
|
|
|
+ }
|
|
|
+ tMonitoringRetrievalPlans.add(tMonitoringRetrievalPlan1);
|
|
|
+ } else {
|
|
|
+ SysOrg sysOrg = new SysOrg();
|
|
|
+ sysOrg.setPath(l.getPath());
|
|
|
+ sysOrg.setType(Integer.valueOf(tMonitoringRetrievalPlan.getOrgType()));
|
|
|
+ List<SysOrg> sysOrgs = remoteOrgService.listByParentIdAndType(sysOrg, SecurityConstants.INNER);
|
|
|
+ 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("1")) {
|
|
|
+ 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);
|
|
|
}
|
|
|
- tMonitoringRetrievalPlans.add(plan);
|
|
|
}
|
|
|
}
|
|
|
if ((tMonitoringRetrievalPlan.getImmediately().equals("1") || tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString())) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
|
|
|
@@ -309,12 +338,15 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
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");
|
|
|
+
|
|
|
} else {
|
|
|
tMonitoringRetrievalPlan.setCreateType(ZERO);
|
|
|
+ tMonitoringRetrievalPlan.setIsDistribute(ZERO.toString());
|
|
|
}
|
|
|
- tMonitoringRetrievalPlan.setIsDistribute(ZERO.toString());
|
|
|
return tMonitoringRetrievalPlanMapper.insert(tMonitoringRetrievalPlan);
|
|
|
}
|
|
|
|