|
|
@@ -9,6 +9,7 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
|
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
|
|
|
|
|
import com.xunmei.common.core.constant.SecurityConstants;
|
|
|
+import com.xunmei.common.core.domain.retrieval.domain.CoreMonitoringRetrievalTask;
|
|
|
import com.xunmei.common.core.exception.ServiceException;
|
|
|
import com.xunmei.common.core.util.BeanHelper;
|
|
|
import com.xunmei.common.core.utils.DateUtils;
|
|
|
@@ -19,6 +20,7 @@ import com.xunmei.common.security.utils.SecurityUtils;
|
|
|
import com.xunmei.core.access.domain.TMonitoringRetrievalPlan;
|
|
|
import com.xunmei.core.access.mapper.TMonitoringRetrievalPlanMapper;
|
|
|
import com.xunmei.core.access.service.ITMonitoringRetrievalPlanService;
|
|
|
+
|
|
|
import com.xunmei.core.access.vo.TMonitoringRetrievalPlanVO;
|
|
|
import com.xunmei.core.retrieval.service.ICoreMonitoringRetrievalTaskService;
|
|
|
|
|
|
@@ -102,29 +104,23 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
query.orderByAsc("parent_id");
|
|
|
query.orderByDesc("create_time");
|
|
|
//获取数据
|
|
|
- // query.isNull(PARENT_ID);
|
|
|
+ // query.isNull(PARENT_ID);
|
|
|
page = tMonitoringRetrievalPlanMapper.selectPage(page, query);
|
|
|
-// List<TMonitoringRetrievalPlan> records = page.getRecords();
|
|
|
-// List<TMonitoringRetrievalPlanVO> tMonitoringRetrievalPlanVOS = BeanHelper.copyProperties(records, TMonitoringRetrievalPlanVO.class);
|
|
|
-// for (TMonitoringRetrievalPlanVO monitoringRetrievalPlan : tMonitoringRetrievalPlanVOS) {
|
|
|
-// dealData(monitoringRetrievalPlan, tMonitoringRetrievalPlanVOS);
|
|
|
-// }
|
|
|
-// //抓换为TableDataInfo适配前端
|
|
|
-// TableDataInfo<TMonitoringRetrievalPlanVO> tableDataInfo = new TableDataInfo();
|
|
|
-// tableDataInfo.setMsg("操作成功");
|
|
|
-// tableDataInfo.setCode(200);
|
|
|
-// tableDataInfo.setTotal(page.getTotal());
|
|
|
-// tableDataInfo.setRows(tMonitoringRetrievalPlanVOS);
|
|
|
- // return tableDataInfo;
|
|
|
+ List<TMonitoringRetrievalPlan> records = page.getRecords();
|
|
|
+ List<TMonitoringRetrievalPlanVO>tMonitoringRetrievalPlanVOS = null;
|
|
|
+ SysOrg sysOrg = remoteOrgService.selectSysOrgById(SecurityUtils.getLoginUser().getOrgId(), SecurityConstants.INNER);
|
|
|
+ /* for (TMonitoringRetrievalPlan r:records){
|
|
|
+ TMonitoringRetrievalPlanVO tMonitoringRetrievalPlanVO=new TMonitoringRetrievalPlanVO();
|
|
|
+ BeanUtils.copyProperties(r,tMonitoringRetrievalPlanVO);
|
|
|
+ if (r.getOrgId().equals(sysOrg.getId())||r.getParentId().equals(sysOrg.getId())){
|
|
|
+ tMonitoringRetrievalPlanVO.setIsEdit(Boolean.TRUE);
|
|
|
+ }
|
|
|
+ tMonitoringRetrievalPlanVOS.add(tMonitoringRetrievalPlanVO);
|
|
|
+ }*/
|
|
|
+ // page.setRecords(tMonitoringRetrievalPlanVOS);
|
|
|
return TableDataInfo.build(page);
|
|
|
}
|
|
|
|
|
|
- private void dealData(TMonitoringRetrievalPlanVO record, List<TMonitoringRetrievalPlanVO> records) {
|
|
|
- record.setNo(records.indexOf(record) + 1);
|
|
|
- List<TMonitoringRetrievalPlan> tMonitoringRetrievalPlans = tMonitoringRetrievalPlanMapper.selectList(new LambdaQueryWrapper<TMonitoringRetrievalPlan>().eq(TMonitoringRetrievalPlan::getParentId, record.getId()));
|
|
|
- List<TMonitoringRetrievalPlanVO> children = BeanHelper.copyProperties(tMonitoringRetrievalPlans, TMonitoringRetrievalPlanVO.class);
|
|
|
- record.setChildren(children);
|
|
|
- }
|
|
|
|
|
|
/**
|
|
|
* 查询监控调阅计划
|
|
|
@@ -133,8 +129,19 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
* @return 监控调阅计划
|
|
|
*/
|
|
|
@Override
|
|
|
- public TMonitoringRetrievalPlan selectTMonitoringRetrievalPlanById(Long id) {
|
|
|
- return tMonitoringRetrievalPlanMapper.selectById(id);
|
|
|
+ public TMonitoringRetrievalPlanVO selectTMonitoringRetrievalPlanById(Long id) {
|
|
|
+ TMonitoringRetrievalPlanVO tMonitoringRetrievalPlanVO = new TMonitoringRetrievalPlanVO();
|
|
|
+ TMonitoringRetrievalPlan plan = tMonitoringRetrievalPlanMapper.selectById(id);
|
|
|
+ BeanUtils.copyProperties(plan, tMonitoringRetrievalPlanVO);
|
|
|
+ //1:
|
|
|
+ SysOrg sysOrg = remoteOrgService.selectSysOrgById(plan.getOrgId(), SecurityConstants.INNER);
|
|
|
+ SysOrg sysOrg1 = remoteOrgService.selectSysOrgById(SecurityUtils.getLoginUser().getOrgId(), SecurityConstants.INNER);
|
|
|
+ boolean isEdit = false;
|
|
|
+ if (plan.getParentId()!=null) {
|
|
|
+ isEdit = true;
|
|
|
+ }
|
|
|
+ tMonitoringRetrievalPlanVO.setIsEdit(isEdit);
|
|
|
+ return tMonitoringRetrievalPlanVO;
|
|
|
}
|
|
|
|
|
|
@Transactional
|
|
|
@@ -154,72 +161,60 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
throw new ServiceException("请勿重复下发");
|
|
|
}
|
|
|
SysOrg topOrg = remoteOrgService.selectSysOrgById(tMonitoringRetrievalPlan.getOrgId(), SecurityConstants.INNER);
|
|
|
- SysOrg org = new SysOrg();
|
|
|
- org.setType(3);
|
|
|
- org.setPath(topOrg.getPath());
|
|
|
- //查询符合的机构,需求是先把行社加入
|
|
|
- List<SysOrg> list = remoteOrgService.listByParentIdAndType(org, SecurityConstants.INNER);
|
|
|
- Integer i = ZERO;
|
|
|
+ //判断当前登录人下发是母还是子,母生成行社子计划,子直接下发任务
|
|
|
+ //如果顶级
|
|
|
List<TMonitoringRetrievalPlan> tMonitoringRetrievalPlans = new ArrayList<>();
|
|
|
- for (SysOrg l : list) {
|
|
|
- TMonitoringRetrievalPlan monitoringRetrievalPlan = new TMonitoringRetrievalPlan();
|
|
|
- BeanUtils.copyProperties(tMonitoringRetrievalPlan, monitoringRetrievalPlan);
|
|
|
- monitoringRetrievalPlan.setPlanName(tMonitoringRetrievalPlan.getPlanName());
|
|
|
- monitoringRetrievalPlan.setOrgId(l.getId());
|
|
|
- monitoringRetrievalPlan.setOrgName(l.getShortName());
|
|
|
- monitoringRetrievalPlan.setRoleId(tMonitoringRetrievalPlan.getRoleId());
|
|
|
- monitoringRetrievalPlan.setRoleName(tMonitoringRetrievalPlan.getRoleName());
|
|
|
- monitoringRetrievalPlan.setOrgPath(l.getPath());
|
|
|
- monitoringRetrievalPlan.setOrgType(tMonitoringRetrievalPlan.getOrgType());
|
|
|
- monitoringRetrievalPlan.setPlanCycle(tMonitoringRetrievalPlan.getPlanCycle());
|
|
|
- monitoringRetrievalPlan.setPlanFrequency(tMonitoringRetrievalPlan.getPlanFrequency());
|
|
|
- monitoringRetrievalPlan.setPlanStatus(ZERO);
|
|
|
- monitoringRetrievalPlan.setCreateBy(SecurityUtils.getUsername());
|
|
|
- monitoringRetrievalPlan.setUpdateTime(DateUtils.getNowDate());
|
|
|
- monitoringRetrievalPlan.setUpdateBy(SecurityUtils.getUsername());
|
|
|
- monitoringRetrievalPlan.setCreateTime(DateUtils.getNowDate());
|
|
|
- monitoringRetrievalPlan.setDescription(tMonitoringRetrievalPlan.getDescription());
|
|
|
- monitoringRetrievalPlan.setCreateType(ZERO);
|
|
|
- monitoringRetrievalPlan.setId(IdWorker.getId());
|
|
|
- monitoringRetrievalPlan.setParentId(tMonitoringRetrievalPlan.getId());
|
|
|
- monitoringRetrievalPlan.setIsDistribute("1");
|
|
|
- i = tMonitoringRetrievalPlanMapper.insert(monitoringRetrievalPlan);
|
|
|
- //如果是行社直接新增,如果不是就要查询下面的机构
|
|
|
- if (tMonitoringRetrievalPlan.getOrgType().equals("3")) {
|
|
|
- tMonitoringRetrievalPlans.add(monitoringRetrievalPlan);
|
|
|
- } 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(monitoringRetrievalPlan, 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(IdWorker.getId());
|
|
|
- plan.setParentId(tMonitoringRetrievalPlan.getId());
|
|
|
- plan.setIsDistribute("1");
|
|
|
- i = tMonitoringRetrievalPlanMapper.insert(plan);
|
|
|
- tMonitoringRetrievalPlans.add(plan);
|
|
|
+ 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);
|
|
|
}
|
|
|
- if (i < ZERO) {
|
|
|
- return i;
|
|
|
+ } 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");
|
|
|
+ // i = tMonitoringRetrievalPlanMapper.insert(plan);
|
|
|
+ tMonitoringRetrievalPlans.add(plan);
|
|
|
}
|
|
|
}
|
|
|
if (tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) && CollectionUtils.isNotEmpty(tMonitoringRetrievalPlans)) {
|
|
|
@@ -253,9 +248,16 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
public int insertTMonitoringRetrievalPlan(TMonitoringRetrievalPlan tMonitoringRetrievalPlan) {
|
|
|
tMonitoringRetrievalPlan.setCreateTime(DateUtils.getNowDate());
|
|
|
SysUser sysUser = remoteUserService.getUserById(SecurityUtils.getUserId(), SecurityConstants.INNER);
|
|
|
- SysOrg data = remoteOrgService.selectSysOrgById(sysUser.getOrgId(), SecurityConstants.INNER);
|
|
|
+ SysOrg data;
|
|
|
+ if (null != tMonitoringRetrievalPlan.getOrgId()) {
|
|
|
+ data = remoteOrgService.selectSysOrgById(tMonitoringRetrievalPlan.getOrgId(), SecurityConstants.INNER);
|
|
|
+ } else {
|
|
|
+ data = remoteOrgService.selectSysOrgById(sysUser.getOrgId(), SecurityConstants.INNER);
|
|
|
+ }
|
|
|
tMonitoringRetrievalPlan.setOrgName(data.getShortName());
|
|
|
- tMonitoringRetrievalPlan.setOrgId(sysUser.getOrgId());
|
|
|
+ if (null == tMonitoringRetrievalPlan.getOrgId()) {
|
|
|
+ tMonitoringRetrievalPlan.setOrgId(sysUser.getOrgId());
|
|
|
+ }
|
|
|
tMonitoringRetrievalPlan.setCreateBy(SecurityUtils.getUsername());
|
|
|
tMonitoringRetrievalPlan.setUpdateTime(DateUtils.getNowDate());
|
|
|
tMonitoringRetrievalPlan.setUpdateBy(SecurityUtils.getUsername());
|
|
|
@@ -265,47 +267,12 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
tMonitoringRetrievalPlan.setId(id);
|
|
|
tMonitoringRetrievalPlan.setOrgPath(data.getPath());
|
|
|
SysOrg sysOrg1 = remoteOrgService.selectSysOrgById(sysUser.getOrgId(), SecurityConstants.INNER);
|
|
|
-
|
|
|
- if (sysOrg1.getType() == 1) {
|
|
|
- tMonitoringRetrievalPlan.setCreateType(ZERO);
|
|
|
- tMonitoringRetrievalPlan.setIsDistribute(ZERO.toString());
|
|
|
- } else {
|
|
|
- tMonitoringRetrievalPlan.setIsDistribute("1");
|
|
|
+ if (sysOrg1.getType() == 3) {
|
|
|
tMonitoringRetrievalPlan.setCreateType(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 l : sysOrgs) {
|
|
|
- TMonitoringRetrievalPlan monitoringRetrievalPlan = new TMonitoringRetrievalPlan();
|
|
|
- BeanUtils.copyProperties(tMonitoringRetrievalPlan, monitoringRetrievalPlan);
|
|
|
- monitoringRetrievalPlan.setOrgId(l.getId());
|
|
|
- monitoringRetrievalPlan.setOrgName(l.getShortName());
|
|
|
- monitoringRetrievalPlan.setRoleId(tMonitoringRetrievalPlan.getRoleId());
|
|
|
- monitoringRetrievalPlan.setRoleName(tMonitoringRetrievalPlan.getRoleName());
|
|
|
- monitoringRetrievalPlan.setOrgPath(l.getPath());
|
|
|
- monitoringRetrievalPlan.setOrgType("6");
|
|
|
- monitoringRetrievalPlan.setRoleId(tMonitoringRetrievalPlan.getRoleId());
|
|
|
- monitoringRetrievalPlan.setPlanCycle(tMonitoringRetrievalPlan.getPlanCycle());
|
|
|
- monitoringRetrievalPlan.setPlanFrequency(tMonitoringRetrievalPlan.getPlanFrequency());
|
|
|
- monitoringRetrievalPlan.setPlanStatus(ZERO);
|
|
|
- monitoringRetrievalPlan.setCreateBy(SecurityUtils.getUsername());
|
|
|
- monitoringRetrievalPlan.setUpdateTime(DateUtils.getNowDate());
|
|
|
- monitoringRetrievalPlan.setUpdateBy(SecurityUtils.getUsername());
|
|
|
- monitoringRetrievalPlan.setCreateTime(DateUtils.getNowDate());
|
|
|
- monitoringRetrievalPlan.setDescription(tMonitoringRetrievalPlan.getDescription());
|
|
|
- monitoringRetrievalPlan.setCreateType(1);
|
|
|
- monitoringRetrievalPlan.setId(IdWorker.getId());
|
|
|
- monitoringRetrievalPlan.setParentId(tMonitoringRetrievalPlan.getId());
|
|
|
- tMonitoringRetrievalPlanMapper.insert(monitoringRetrievalPlan);
|
|
|
- tMonitoringRetrievalPlans.add(monitoringRetrievalPlan);
|
|
|
-
|
|
|
- }
|
|
|
- if (tMonitoringRetrievalPlan.getPlanCycle().equals(ZERO.toString()) && tMonitoringRetrievalPlan.getPlanStatus() == 0) {
|
|
|
- iCoreMonitoringRetrievalTaskService.noCycleTask(tMonitoringRetrievalPlans);
|
|
|
- }
|
|
|
+ } else {
|
|
|
+ tMonitoringRetrievalPlan.setCreateType(ZERO);
|
|
|
}
|
|
|
+ tMonitoringRetrievalPlan.setIsDistribute(ZERO.toString());
|
|
|
return tMonitoringRetrievalPlanMapper.insert(tMonitoringRetrievalPlan);
|
|
|
}
|
|
|
|
|
|
@@ -317,31 +284,38 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
*/
|
|
|
@Override
|
|
|
public int updateTMonitoringRetrievalPlan(TMonitoringRetrievalPlan tMonitoringRetrievalPlan) {
|
|
|
+ List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks = iCoreMonitoringRetrievalTaskService.selectComplete(tMonitoringRetrievalPlan.getId());
|
|
|
+ if (CollectionUtils.isNotEmpty(coreMonitoringRetrievalTasks)) {
|
|
|
+ throw new ServiceException("下发任务已做完,不能修改");
|
|
|
+ }
|
|
|
+ iCoreMonitoringRetrievalTaskService.updateDeleteTaskByPlanId(tMonitoringRetrievalPlan.getId(), 1);
|
|
|
tMonitoringRetrievalPlan.setUpdateTime(DateUtils.getNowDate());
|
|
|
tMonitoringRetrievalPlan.setUpdateBy(SecurityUtils.getUsername());
|
|
|
TMonitoringRetrievalPlan plan = baseMapper.selectById(tMonitoringRetrievalPlan.getId());
|
|
|
- if (plan.getPlanStatus() != tMonitoringRetrievalPlan.getPlanStatus()) {
|
|
|
+/* if (plan.getPlanStatus() != tMonitoringRetrievalPlan.getPlanStatus()) {
|
|
|
if (tMonitoringRetrievalPlan.getPlanStatus() == 1) {
|
|
|
//删除任务
|
|
|
iCoreMonitoringRetrievalTaskService.updateDeleteTaskByPlanId(tMonitoringRetrievalPlan.getId(), 1);
|
|
|
//禁用子任务
|
|
|
- if(null==plan.getParentId()){
|
|
|
- baseMapper.updatePlanStatus(1,tMonitoringRetrievalPlan.getId());
|
|
|
+ if (null == plan.getParentId()) {
|
|
|
+ baseMapper.updatePlanStatus(1, tMonitoringRetrievalPlan.getId());
|
|
|
}
|
|
|
} else {
|
|
|
//还原任务
|
|
|
iCoreMonitoringRetrievalTaskService.updateDeleteTaskByPlanId(tMonitoringRetrievalPlan.getId(), 0);
|
|
|
- if(null==plan.getParentId()){
|
|
|
- baseMapper.updatePlanStatus(0,tMonitoringRetrievalPlan.getId());
|
|
|
+ if (null == plan.getParentId()) {
|
|
|
+ baseMapper.updatePlanStatus(0, tMonitoringRetrievalPlan.getId());
|
|
|
}
|
|
|
}
|
|
|
- }
|
|
|
- if (tMonitoringRetrievalPlan.getOrgType().equals("1")) {
|
|
|
+ }*/
|
|
|
+ BeanUtils.copyProperties(tMonitoringRetrievalPlan, plan);
|
|
|
+ /* if (tMonitoringRetrievalPlan.getOrgType().equals("1")) {
|
|
|
tMonitoringRetrievalPlan.setCreateType(ZERO);
|
|
|
} else {
|
|
|
tMonitoringRetrievalPlan.setCreateType(1);
|
|
|
- }
|
|
|
- return tMonitoringRetrievalPlanMapper.updateById(tMonitoringRetrievalPlan);
|
|
|
+ }*/
|
|
|
+ plan.setIsDistribute("0");
|
|
|
+ return tMonitoringRetrievalPlanMapper.updateById(plan);
|
|
|
}
|
|
|
|
|
|
/**
|
|
|
@@ -358,40 +332,20 @@ public class TMonitoringRetrievalPlanServiceImpl extends ServiceImpl<TMonitoring
|
|
|
tMonitoringRetrievalPlan.setIsDeleted(2L);
|
|
|
tMonitoringRetrievalPlan.setId(id);
|
|
|
TMonitoringRetrievalPlan monitoringRetrievalPlan = tMonitoringRetrievalPlanMapper.selectById(id);
|
|
|
+ List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks = iCoreMonitoringRetrievalTaskService.selectComplete(id);
|
|
|
+ if (CollectionUtils.isNotEmpty(coreMonitoringRetrievalTasks)) {
|
|
|
+ throw new ServiceException("下发任务已做完,不能删除");
|
|
|
+ }
|
|
|
//如果是下发的任务
|
|
|
- if (monitoringRetrievalPlan.getParentId() != null) {
|
|
|
+ /* if (monitoringRetrievalPlan.getParentId() != null) {
|
|
|
//不能删除
|
|
|
throw new ServiceException("子任务,不能删除");
|
|
|
- } else {
|
|
|
- if (monitoringRetrievalPlan.getCreateType() == 0) {
|
|
|
-// QueryWrapper queryWrapper = new QueryWrapper();
|
|
|
-// queryWrapper.eq(PARENT_ID, monitoringRetrievalPlan.getId());
|
|
|
-// List<TMonitoringRetrievalPlan> list = tMonitoringRetrievalPlanMapper.selectList(queryWrapper);
|
|
|
-// list.add(monitoringRetrievalPlan);
|
|
|
-// List<Long> planIds = new ArrayList<>();
|
|
|
-// for (TMonitoringRetrievalPlan p : list) {
|
|
|
-// CoreMonitoringRetrievalTask coreMonitoringRetrievalTask = new CoreMonitoringRetrievalTask();
|
|
|
-// coreMonitoringRetrievalTask.setPlanId(p.getId());
|
|
|
-// coreMonitoringRetrievalTask.setStatus("0");
|
|
|
-// //根据计划查询未完成的任务
|
|
|
-// List<CoreMonitoringRetrievalTask> coreMonitoringRetrievalTasks = iCoreMonitoringRetrievalTaskService.selectCoreMonitoringRetrievalTaskList(coreMonitoringRetrievalTask);
|
|
|
-// List<Long> collect = coreMonitoringRetrievalTasks.stream().map(CoreMonitoringRetrievalTask::getId).distinct().collect(Collectors.toList());
|
|
|
-// if (CollectionUtils.isNotEmpty(collect)) {
|
|
|
-// planIds.addAll(collect);
|
|
|
-// }
|
|
|
-// p.setIsDeleted(2L);
|
|
|
-// i = tMonitoringRetrievalPlanMapper.updateTMonitoringRetrievalPlan(p);
|
|
|
-// if (i < 1) {
|
|
|
-// return i;
|
|
|
-// }
|
|
|
-// }
|
|
|
-// Long[] arr = new Long[planIds.size()];
|
|
|
-// planIds.toArray(arr);
|
|
|
-// iCoreMonitoringRetrievalTaskService.deleteCoreMonitoringRetrievalTaskByIds(arr);
|
|
|
- i = tMonitoringRetrievalPlanMapper.updatePlan(monitoringRetrievalPlan);
|
|
|
- iCoreMonitoringRetrievalTaskService.deleteWaitTaskByPlanId(id);
|
|
|
- }
|
|
|
- }
|
|
|
+ } else {*/
|
|
|
+ // if (monitoringRetrievalPlan.getCreateType() == 0) {
|
|
|
+ i = tMonitoringRetrievalPlanMapper.updatePlan(monitoringRetrievalPlan);
|
|
|
+ iCoreMonitoringRetrievalTaskService.deleteWaitTaskByPlanId(id);
|
|
|
+ // }
|
|
|
+ // }
|
|
|
}
|
|
|
return i;
|
|
|
}
|