|
|
|
@ -1,6 +1,5 @@ |
|
|
|
package org.springblade.hzinfo_inspect.plan.service.impl; |
|
|
|
package org.springblade.hzinfo_inspect.plan.service.impl; |
|
|
|
|
|
|
|
|
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
|
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSON; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONArray; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
import com.alibaba.fastjson.JSONObject; |
|
|
|
@ -9,7 +8,12 @@ import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.conditions.update.UpdateWrapper; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.baomidou.mybatisplus.core.toolkit.Wrappers; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
import com.google.common.collect.Lists; |
|
|
|
//import com.hnac.hzims.operational.duty.feign.IDutyClassClient;
|
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
|
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.BeanUtil; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.SpringUtil; |
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.ObjectEntity; |
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.ObjectEntity; |
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.TemplateEntity; |
|
|
|
import org.springblade.hzinfo_inspect.obj.entity.TemplateEntity; |
|
|
|
import org.springblade.hzinfo_inspect.obj.services.ObjectService; |
|
|
|
import org.springblade.hzinfo_inspect.obj.services.ObjectService; |
|
|
|
@ -28,12 +32,7 @@ import org.springblade.hzinfo_inspect.task.job.service.ITaskJobService; |
|
|
|
import org.springblade.hzinfo_inspect.task.job.service.impl.ConcurrentTaskServcie; |
|
|
|
import org.springblade.hzinfo_inspect.task.job.service.impl.ConcurrentTaskServcie; |
|
|
|
import org.springblade.hzinfo_inspect.task.job.service.impl.SeizeTaskService; |
|
|
|
import org.springblade.hzinfo_inspect.task.job.service.impl.SeizeTaskService; |
|
|
|
import org.springblade.hzinfo_inspect.task.service.ITaskService; |
|
|
|
import org.springblade.hzinfo_inspect.task.service.ITaskService; |
|
|
|
import org.springblade.core.log.exception.ServiceException; |
|
|
|
import org.springblade.system.feign.ISysClient; |
|
|
|
import org.springblade.core.mp.base.BaseServiceImpl; |
|
|
|
|
|
|
|
import org.springblade.core.secure.utils.AuthUtil; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.BeanUtil; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.Func; |
|
|
|
|
|
|
|
import org.springblade.core.tool.utils.SpringUtil; |
|
|
|
|
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
import org.springblade.system.user.cache.UserCache; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springblade.system.user.entity.User; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
import org.springframework.beans.factory.annotation.Autowired; |
|
|
|
@ -86,20 +85,20 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
// private static final String TASK_END_REMIND_KEY = "taskEndRemind";
|
|
|
|
// private static final String TASK_END_REMIND_KEY = "taskEndRemind";
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 删除巡检计划,删除巡检计划相关的所有信息 |
|
|
|
* 删除巡检计划,删除巡检计划相关的所有信息 |
|
|
|
|
|
|
|
* |
|
|
|
* @param id |
|
|
|
* @param id |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Boolean deletePlanAndRelatives(Long id){ |
|
|
|
public Boolean deletePlanAndRelatives(Long id) { |
|
|
|
taskService.deleteTaskByPlanId(id); |
|
|
|
taskService.deleteTaskByPlanId(id); |
|
|
|
planUserService.remove(Wrappers.<PlanUserEntity>lambdaQuery().eq(PlanUserEntity::getPlanId,id)); |
|
|
|
planUserService.remove(Wrappers.<PlanUserEntity>lambdaQuery().eq(PlanUserEntity::getPlanId, id)); |
|
|
|
planOrgService.remove(Wrappers.<PlanOrgEntity>lambdaQuery().eq(PlanOrgEntity::getPlanId,id)); |
|
|
|
planOrgService.remove(Wrappers.<PlanOrgEntity>lambdaQuery().eq(PlanOrgEntity::getPlanId, id)); |
|
|
|
planPositionService.remove(Wrappers.<PlanPositionEntity>lambdaQuery().eq(PlanPositionEntity::getPlanId,id)); |
|
|
|
planPositionService.remove(Wrappers.<PlanPositionEntity>lambdaQuery().eq(PlanPositionEntity::getPlanId, id)); |
|
|
|
planObjectTemplateService.remove(Wrappers.<PlanObjectTemplateEntity>lambdaQuery().eq(PlanObjectTemplateEntity::getPlanId,id)); |
|
|
|
planObjectTemplateService.remove(Wrappers.<PlanObjectTemplateEntity>lambdaQuery().eq(PlanObjectTemplateEntity::getPlanId, id)); |
|
|
|
return remove(Wrappers.<PlanEntity>lambdaQuery().eq(PlanEntity::getId,id)); |
|
|
|
return remove(Wrappers.<PlanEntity>lambdaQuery().eq(PlanEntity::getId, id)); |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
@ -107,16 +106,16 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Boolean submit(PlanVO plan){ |
|
|
|
public Boolean submit(PlanVO plan) { |
|
|
|
checkInputParam(plan); |
|
|
|
checkInputParam(plan); |
|
|
|
boolean modify = plan.getId()!=null; |
|
|
|
boolean modify = plan.getId() != null; |
|
|
|
PlanEntity entity = BeanUtil.copy(plan, PlanEntity.class); |
|
|
|
PlanEntity entity = BeanUtil.copy(plan, PlanEntity.class); |
|
|
|
//不管是新增还是修改成功后都为待提交状态
|
|
|
|
//不管是新增还是修改成功后都为待提交状态
|
|
|
|
entity.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.PLAN_SUBMIT.getStatus())); |
|
|
|
entity.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.PLAN_SUBMIT.getStatus())); |
|
|
|
boolean success = this.saveOrUpdate(entity); |
|
|
|
boolean success = this.saveOrUpdate(entity); |
|
|
|
if(success){ |
|
|
|
if (success) { |
|
|
|
plan.setId(entity.getId()); |
|
|
|
plan.setId(entity.getId()); |
|
|
|
success = insertPlanRelations(modify,plan); |
|
|
|
success = insertPlanRelations(modify, plan); |
|
|
|
} |
|
|
|
} |
|
|
|
return success; |
|
|
|
return success; |
|
|
|
} |
|
|
|
} |
|
|
|
@ -124,23 +123,24 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 新增巡检计划 并审核、生成任务 |
|
|
|
* 新增巡检计划 并审核、生成任务 |
|
|
|
|
|
|
|
* |
|
|
|
* @param plan |
|
|
|
* @param plan |
|
|
|
* @return 返回taskId list |
|
|
|
* @return 返回taskId list |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public List<Long> addAndChecked(PlanVO plan){ |
|
|
|
public List<Long> addAndChecked(PlanVO plan) { |
|
|
|
List<Long> taskIds = new ArrayList<>(); |
|
|
|
List<Long> taskIds = new ArrayList<>(); |
|
|
|
checkInputParam(plan); |
|
|
|
checkInputParam(plan); |
|
|
|
boolean modify = plan.getId()!=null; |
|
|
|
boolean modify = plan.getId() != null; |
|
|
|
PlanEntity entity = BeanUtil.copy(plan, PlanEntity.class); |
|
|
|
PlanEntity entity = BeanUtil.copy(plan, PlanEntity.class); |
|
|
|
//不管是新增还是修改成功后都为待提交状态
|
|
|
|
//不管是新增还是修改成功后都为待提交状态
|
|
|
|
entity.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.CHECK_STATUS.getStatus())); |
|
|
|
entity.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.CHECK_STATUS.getStatus())); |
|
|
|
boolean success = this.save(entity); |
|
|
|
boolean success = this.save(entity); |
|
|
|
if(success){ |
|
|
|
if (success) { |
|
|
|
plan.setId(entity.getId()); |
|
|
|
plan.setId(entity.getId()); |
|
|
|
success = insertPlanRelations(modify,plan); |
|
|
|
success = insertPlanRelations(modify, plan); |
|
|
|
if(success){ |
|
|
|
if (success) { |
|
|
|
taskIds = genPresentTaskReturnTaskId(entity.getId()); |
|
|
|
taskIds = genPresentTaskReturnTaskId(entity.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -149,54 +149,56 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 校验提交参数 |
|
|
|
* 校验提交参数 |
|
|
|
|
|
|
|
* |
|
|
|
* @param plan |
|
|
|
* @param plan |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void checkInputParam(PlanVO plan){ |
|
|
|
private void checkInputParam(PlanVO plan) { |
|
|
|
if(plan.getId()==null && Func.isEmpty(plan.getCode())){ |
|
|
|
if (plan.getId() == null && Func.isEmpty(plan.getCode())) { |
|
|
|
plan.setCode(CodeUtils.randomCode()); |
|
|
|
plan.setCode(CodeUtils.randomCode()); |
|
|
|
LocalDate now = LocalDate.now(); |
|
|
|
LocalDate now = LocalDate.now(); |
|
|
|
if(plan.getStartTime().isBefore(now)){ |
|
|
|
if (plan.getStartTime().isBefore(now)) { |
|
|
|
throw new ServiceException("新增计划时开始时间不能早于当前时间"); |
|
|
|
throw new ServiceException("新增计划时开始时间不能早于当前时间"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(plan.getEndTime().isBefore(plan.getStartTime())){ |
|
|
|
if (plan.getEndTime().isBefore(plan.getStartTime())) { |
|
|
|
throw new ServiceException("结束时间不能早于开始时间"); |
|
|
|
throw new ServiceException("结束时间不能早于开始时间"); |
|
|
|
} |
|
|
|
} |
|
|
|
if(!plan.getType().equals(PlanContants.PlanTypeEnum.FREE_TYPE.getType()) && Func.isEmpty(plan.getRouteData())){ |
|
|
|
if (!plan.getType().equals(PlanContants.PlanTypeEnum.FREE_TYPE.getType()) && Func.isEmpty(plan.getRouteData())) { |
|
|
|
throw new ServiceException("巡检路径数据不能为空"); |
|
|
|
throw new ServiceException("巡检路径数据不能为空"); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 插入巡检计划相关表 |
|
|
|
* 插入巡检计划相关表 |
|
|
|
|
|
|
|
* |
|
|
|
* @param modify 是否是修改 |
|
|
|
* @param modify 是否是修改 |
|
|
|
* @param plan |
|
|
|
* @param plan |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean insertPlanRelationsOld(boolean modify,PlanVO plan){ |
|
|
|
private boolean insertPlanRelationsOld(boolean modify, PlanVO plan) { |
|
|
|
boolean success = false; |
|
|
|
boolean success = false; |
|
|
|
//添加巡检计划对象模板(一个对象在一个计划只能出现一次)
|
|
|
|
//添加巡检计划对象模板(一个对象在一个计划只能出现一次)
|
|
|
|
List<PlanObjectTemplateVO> obtList = plan.getPlanObjectTemplates().stream().filter(objectEntity->objectEntity.getId()==null).collect(Collectors.toList()); |
|
|
|
List<PlanObjectTemplateVO> obtList = plan.getPlanObjectTemplates().stream().filter(objectEntity -> objectEntity.getId() == null).collect(Collectors.toList()); |
|
|
|
if(obtList.size()>0){ |
|
|
|
if (obtList.size() > 0) { |
|
|
|
List<Long> planObjectIds = planObjectTemplateService.list(Wrappers.<PlanObjectTemplateEntity>lambdaQuery() |
|
|
|
List<Long> planObjectIds = planObjectTemplateService.list(Wrappers.<PlanObjectTemplateEntity>lambdaQuery() |
|
|
|
.eq(PlanObjectTemplateEntity::getPlanId,plan.getId())).stream().map(objEntity->objEntity.getObjectId()).distinct().collect(Collectors.toList()); |
|
|
|
.eq(PlanObjectTemplateEntity::getPlanId, plan.getId())).stream().map(objEntity -> objEntity.getObjectId()).distinct().collect(Collectors.toList()); |
|
|
|
planObjectIds.addAll(obtList.stream().map(planObjectVO->planObjectVO.getObjectId()).collect(Collectors.toList())); |
|
|
|
planObjectIds.addAll(obtList.stream().map(planObjectVO -> planObjectVO.getObjectId()).collect(Collectors.toList())); |
|
|
|
Set<Long> planObjectIdsSet = new HashSet<>(planObjectIds); |
|
|
|
Set<Long> planObjectIdsSet = new HashSet<>(planObjectIds); |
|
|
|
boolean repeat = planObjectIds.size()!=planObjectIdsSet.size(); |
|
|
|
boolean repeat = planObjectIds.size() != planObjectIdsSet.size(); |
|
|
|
if(repeat){ |
|
|
|
if (repeat) { |
|
|
|
throw new ServiceException("一个对象在一个计划只能出现一次"); |
|
|
|
throw new ServiceException("一个对象在一个计划只能出现一次"); |
|
|
|
} |
|
|
|
} |
|
|
|
List<PlanObjectTemplateEntity> pteList = Lists.newArrayList(); |
|
|
|
List<PlanObjectTemplateEntity> pteList = Lists.newArrayList(); |
|
|
|
for(PlanObjectTemplateVO tvo :obtList){ |
|
|
|
for (PlanObjectTemplateVO tvo : obtList) { |
|
|
|
PlanObjectTemplateEntity pte = PlanObjectTemplateEntity.builder().objectId(tvo.getObjectId()).templateId(tvo.getTemplateId()).planId(plan.getId()).build(); |
|
|
|
PlanObjectTemplateEntity pte = PlanObjectTemplateEntity.builder().objectId(tvo.getObjectId()).templateId(tvo.getTemplateId()).planId(plan.getId()).build(); |
|
|
|
pte.setId(tvo.getId()); |
|
|
|
pte.setId(tvo.getId()); |
|
|
|
pteList.add(pte); |
|
|
|
pteList.add(pte); |
|
|
|
} |
|
|
|
} |
|
|
|
if(pteList.size()>0){ |
|
|
|
if (pteList.size() > 0) { |
|
|
|
success = planObjectTemplateService.saveOrUpdateBatch(pteList); |
|
|
|
success = planObjectTemplateService.saveOrUpdateBatch(pteList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
if(modify){//修改先要删除
|
|
|
|
if (modify) {//修改先要删除
|
|
|
|
//巡检计划模式人员
|
|
|
|
//巡检计划模式人员
|
|
|
|
UpdateWrapper<PlanUserEntity> ew = new UpdateWrapper<>(); |
|
|
|
UpdateWrapper<PlanUserEntity> ew = new UpdateWrapper<>(); |
|
|
|
ew.lambda().eq(PlanUserEntity::getPlanId, plan.getId()); |
|
|
|
ew.lambda().eq(PlanUserEntity::getPlanId, plan.getId()); |
|
|
|
@ -212,36 +214,36 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
} |
|
|
|
} |
|
|
|
//巡检计划模式人员
|
|
|
|
//巡检计划模式人员
|
|
|
|
List<Long> uVoList = plan.getPlanUsers(); |
|
|
|
List<Long> uVoList = plan.getPlanUsers(); |
|
|
|
if(Func.isNotEmpty(uVoList)){ |
|
|
|
if (Func.isNotEmpty(uVoList)) { |
|
|
|
List<PlanUserEntity> uList = Lists.newArrayList(); |
|
|
|
List<PlanUserEntity> uList = Lists.newArrayList(); |
|
|
|
for(Long uId:uVoList){ |
|
|
|
for (Long uId : uVoList) { |
|
|
|
uList.add(PlanUserEntity.builder().planId(plan.getId()).userId(uId).build()); |
|
|
|
uList.add(PlanUserEntity.builder().planId(plan.getId()).userId(uId).build()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(uList.size()>0){ |
|
|
|
if (uList.size() > 0) { |
|
|
|
success = planUserService.saveBatch(uList); |
|
|
|
success = planUserService.saveBatch(uList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//巡检计划模式岗位
|
|
|
|
//巡检计划模式岗位
|
|
|
|
List<Long> pVoList = plan.getPlanPosts(); |
|
|
|
List<Long> pVoList = plan.getPlanPosts(); |
|
|
|
if(Func.isNotEmpty(pVoList)){ |
|
|
|
if (Func.isNotEmpty(pVoList)) { |
|
|
|
List<PlanPositionEntity> pList = Lists.newArrayList(); |
|
|
|
List<PlanPositionEntity> pList = Lists.newArrayList(); |
|
|
|
for(Long pId:pVoList){ |
|
|
|
for (Long pId : pVoList) { |
|
|
|
pList.add(PlanPositionEntity.builder().planId(plan.getId()).positionId(pId).build()); |
|
|
|
pList.add(PlanPositionEntity.builder().planId(plan.getId()).positionId(pId).build()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(pList.size()>0){ |
|
|
|
if (pList.size() > 0) { |
|
|
|
success = planPositionService.saveBatch(pList); |
|
|
|
success = planPositionService.saveBatch(pList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//巡检计划模式机构
|
|
|
|
//巡检计划模式机构
|
|
|
|
List<Long> oVoList = plan.getPlanOrgs(); |
|
|
|
List<Long> oVoList = plan.getPlanOrgs(); |
|
|
|
if(Func.isNotEmpty(oVoList)){ |
|
|
|
if (Func.isNotEmpty(oVoList)) { |
|
|
|
List<PlanOrgEntity> oList = Lists.newArrayList(); |
|
|
|
List<PlanOrgEntity> oList = Lists.newArrayList(); |
|
|
|
for(Long oId:oVoList){ |
|
|
|
for (Long oId : oVoList) { |
|
|
|
oList.add(PlanOrgEntity.builder().planId(plan.getId()).orgId(oId).build()); |
|
|
|
oList.add(PlanOrgEntity.builder().planId(plan.getId()).orgId(oId).build()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(oList.size()>0){ |
|
|
|
if (oList.size() > 0) { |
|
|
|
success = planOrgService.saveBatch(oList); |
|
|
|
success = planOrgService.saveBatch(oList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -252,16 +254,17 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 插入巡检计划相关表 |
|
|
|
* 插入巡检计划相关表 |
|
|
|
* 对象模板信息来源于路径 |
|
|
|
* 对象模板信息来源于路径 |
|
|
|
|
|
|
|
* |
|
|
|
* @param modify 是否是修改 |
|
|
|
* @param modify 是否是修改 |
|
|
|
* @param plan |
|
|
|
* @param plan |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
public boolean insertPlanRelations(boolean modify,PlanVO plan){ |
|
|
|
public boolean insertPlanRelations(boolean modify, PlanVO plan) { |
|
|
|
boolean success = false; |
|
|
|
boolean success = false; |
|
|
|
//添加巡检计划对象模板(一个对象在一个计划只能出现一次)
|
|
|
|
//添加巡检计划对象模板(一个对象在一个计划只能出现一次)
|
|
|
|
List<PlanObjectTemplateEntity> obtList = new ArrayList<>(); |
|
|
|
List<PlanObjectTemplateEntity> obtList = new ArrayList<>(); |
|
|
|
if(!plan.getType().equals(PlanContants.PlanTypeEnum.FREE_TYPE.getType())){ |
|
|
|
if (!plan.getType().equals(PlanContants.PlanTypeEnum.FREE_TYPE.getType())) { |
|
|
|
if(Func.isNotBlank(plan.getRouteData())){ |
|
|
|
if (Func.isNotBlank(plan.getRouteData())) { |
|
|
|
JSONArray routeJson = JSON.parseArray(plan.getRouteData()); |
|
|
|
JSONArray routeJson = JSON.parseArray(plan.getRouteData()); |
|
|
|
int len = routeJson.size(); |
|
|
|
int len = routeJson.size(); |
|
|
|
for (int i = 0; i < len; i++) { |
|
|
|
for (int i = 0; i < len; i++) { |
|
|
|
@ -278,7 +281,7 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(modify){//修改先要删除
|
|
|
|
if (modify) {//修改先要删除
|
|
|
|
//巡检计划模式人员
|
|
|
|
//巡检计划模式人员
|
|
|
|
UpdateWrapper<PlanUserEntity> ew = new UpdateWrapper<>(); |
|
|
|
UpdateWrapper<PlanUserEntity> ew = new UpdateWrapper<>(); |
|
|
|
ew.lambda().eq(PlanUserEntity::getPlanId, plan.getId()); |
|
|
|
ew.lambda().eq(PlanUserEntity::getPlanId, plan.getId()); |
|
|
|
@ -304,41 +307,41 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
|
|
|
|
|
|
|
|
//巡检计划模式人员
|
|
|
|
//巡检计划模式人员
|
|
|
|
List<Long> uVoList = plan.getPlanUsers(); |
|
|
|
List<Long> uVoList = plan.getPlanUsers(); |
|
|
|
if(Func.isNotEmpty(uVoList)){ |
|
|
|
if (Func.isNotEmpty(uVoList)) { |
|
|
|
List<PlanUserEntity> uList = Lists.newArrayList(); |
|
|
|
List<PlanUserEntity> uList = Lists.newArrayList(); |
|
|
|
for(Long uId:uVoList){ |
|
|
|
for (Long uId : uVoList) { |
|
|
|
uList.add(PlanUserEntity.builder().planId(plan.getId()).userId(uId).build()); |
|
|
|
uList.add(PlanUserEntity.builder().planId(plan.getId()).userId(uId).build()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(uList.size()>0){ |
|
|
|
if (uList.size() > 0) { |
|
|
|
success = planUserService.saveBatch(uList); |
|
|
|
success = planUserService.saveBatch(uList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//巡检计划模式岗位
|
|
|
|
//巡检计划模式岗位
|
|
|
|
List<Long> pVoList = plan.getPlanPosts(); |
|
|
|
List<Long> pVoList = plan.getPlanPosts(); |
|
|
|
if(Func.isNotEmpty(pVoList)){ |
|
|
|
if (Func.isNotEmpty(pVoList)) { |
|
|
|
List<PlanPositionEntity> pList = Lists.newArrayList(); |
|
|
|
List<PlanPositionEntity> pList = Lists.newArrayList(); |
|
|
|
for(Long pId:pVoList){ |
|
|
|
for (Long pId : pVoList) { |
|
|
|
pList.add(PlanPositionEntity.builder().planId(plan.getId()).positionId(pId).build()); |
|
|
|
pList.add(PlanPositionEntity.builder().planId(plan.getId()).positionId(pId).build()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(pList.size()>0){ |
|
|
|
if (pList.size() > 0) { |
|
|
|
success = planPositionService.saveBatch(pList); |
|
|
|
success = planPositionService.saveBatch(pList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
//巡检计划模式机构
|
|
|
|
//巡检计划模式机构
|
|
|
|
List<Long> oVoList = plan.getPlanOrgs(); |
|
|
|
List<Long> oVoList = plan.getPlanOrgs(); |
|
|
|
if(Func.isNotEmpty(oVoList)){ |
|
|
|
if (Func.isNotEmpty(oVoList)) { |
|
|
|
List<PlanOrgEntity> oList = Lists.newArrayList(); |
|
|
|
List<PlanOrgEntity> oList = Lists.newArrayList(); |
|
|
|
for(Long oId:oVoList){ |
|
|
|
for (Long oId : oVoList) { |
|
|
|
oList.add(PlanOrgEntity.builder().planId(plan.getId()).orgId(oId).build()); |
|
|
|
oList.add(PlanOrgEntity.builder().planId(plan.getId()).orgId(oId).build()); |
|
|
|
} |
|
|
|
} |
|
|
|
if(oList.size()>0){ |
|
|
|
if (oList.size() > 0) { |
|
|
|
success = planOrgService.saveBatch(oList); |
|
|
|
success = planOrgService.saveBatch(oList); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
if(plan.getType().equals(PlanTypeEnum.CLASS_TYPE.getType()) ){ |
|
|
|
if (plan.getType().equals(PlanTypeEnum.CLASS_TYPE.getType())) { |
|
|
|
success = true; |
|
|
|
success = true; |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@ -347,45 +350,46 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* hld 保存巡检计划 |
|
|
|
* hld 保存巡检计划 |
|
|
|
|
|
|
|
* |
|
|
|
* @param plan |
|
|
|
* @param plan |
|
|
|
* @return |
|
|
|
* @return |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public Boolean submitForHld(PlanVO plan){ |
|
|
|
public Boolean submitForHld(PlanVO plan) { |
|
|
|
boolean modify = plan.getId()!=null; |
|
|
|
boolean modify = plan.getId() != null; |
|
|
|
PlanEntity entity = BeanUtil.copy(plan, PlanEntity.class); |
|
|
|
PlanEntity entity = BeanUtil.copy(plan, PlanEntity.class); |
|
|
|
//不管是新增还是修改成功后都为已审核状态
|
|
|
|
//不管是新增还是修改成功后都为已审核状态
|
|
|
|
entity.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.CHECK_STATUS.getStatus())); |
|
|
|
entity.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.CHECK_STATUS.getStatus())); |
|
|
|
|
|
|
|
|
|
|
|
//临时任务
|
|
|
|
//临时任务
|
|
|
|
if(plan.getPlanType() != null && plan.getPlanType().equals(PlanContants.PlanContentTypeEnum.TEMP.getDesc())){ |
|
|
|
if (plan.getPlanType() != null && plan.getPlanType().equals(PlanContants.PlanContentTypeEnum.TEMP.getDesc())) { |
|
|
|
/*add for huanglongdai 20190927 生成临时任务*/ |
|
|
|
/*add for huanglongdai 20190927 生成临时任务*/ |
|
|
|
entity.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.FINISH_STATUS.getStatus())); |
|
|
|
entity.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.FINISH_STATUS.getStatus())); |
|
|
|
} else { |
|
|
|
} else { |
|
|
|
entity.setPlanType(PlanContants.PlanContentTypeEnum.COMMON.getDesc()); |
|
|
|
entity.setPlanType(PlanContants.PlanContentTypeEnum.COMMON.getDesc()); |
|
|
|
if(plan.getTaskFlg() != null && plan.getTaskFlg() == PlanContants.GenTaskImmediateEnum.YES.getFlag()){ |
|
|
|
if (plan.getTaskFlg() != null && plan.getTaskFlg() == PlanContants.GenTaskImmediateEnum.YES.getFlag()) { |
|
|
|
if (plan.getCycle().equals(PlanContants.PlanCycleEnum.NEVER_CYCLE.getCycle())){ |
|
|
|
if (plan.getCycle().equals(PlanContants.PlanCycleEnum.NEVER_CYCLE.getCycle())) { |
|
|
|
entity.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.FINISH_STATUS.getStatus())); |
|
|
|
entity.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.FINISH_STATUS.getStatus())); |
|
|
|
}else{ |
|
|
|
} else { |
|
|
|
entity.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.UNDERWAY_STATUS.getStatus())); |
|
|
|
entity.setStatus(Integer.valueOf(PlanContants.PlanStatusEnum.UNDERWAY_STATUS.getStatus())); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
boolean success = this.saveOrUpdate(entity); |
|
|
|
boolean success = this.saveOrUpdate(entity); |
|
|
|
if(success){ |
|
|
|
if (success) { |
|
|
|
plan.setId(entity.getId()); |
|
|
|
plan.setId(entity.getId()); |
|
|
|
success = insertPlanRelations(modify,plan); |
|
|
|
success = insertPlanRelations(modify, plan); |
|
|
|
|
|
|
|
|
|
|
|
//立即生成任务 或者 临时任务 hld
|
|
|
|
//立即生成任务 或者 临时任务 hld
|
|
|
|
if(plan.getTaskFlg() == PlanContants.GenTaskImmediateEnum.YES.getFlag() |
|
|
|
if (plan.getTaskFlg() == PlanContants.GenTaskImmediateEnum.YES.getFlag() |
|
|
|
|| plan.getPlanType().equals(PlanContants.PlanContentTypeEnum.TEMP.getDesc())){ |
|
|
|
|| plan.getPlanType().equals(PlanContants.PlanContentTypeEnum.TEMP.getDesc())) { |
|
|
|
|
|
|
|
|
|
|
|
ITaskJobService taskJobService = null; |
|
|
|
ITaskJobService taskJobService = null; |
|
|
|
if(PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(plan.getMethod())){ |
|
|
|
if (PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(plan.getMethod())) { |
|
|
|
taskJobService = SpringUtil.getBean(SeizeTaskService.class); |
|
|
|
taskJobService = SpringUtil.getBean(SeizeTaskService.class); |
|
|
|
}else if(PlanContants.PlanMethodEnum.CONCURRENT.getMethod().equals(plan.getMethod())){ |
|
|
|
} else if (PlanContants.PlanMethodEnum.CONCURRENT.getMethod().equals(plan.getMethod())) { |
|
|
|
taskJobService = SpringUtil.getBean(ConcurrentTaskServcie.class); |
|
|
|
taskJobService = SpringUtil.getBean(ConcurrentTaskServcie.class); |
|
|
|
} |
|
|
|
} |
|
|
|
taskJobService.sendTask(entity); |
|
|
|
taskJobService.sendTask(entity); |
|
|
|
@ -395,18 +399,18 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public Boolean modifyPlanStatus(Long planId, Integer status){ |
|
|
|
public Boolean modifyPlanStatus(Long planId, Integer status) { |
|
|
|
boolean re; |
|
|
|
boolean re; |
|
|
|
LambdaUpdateWrapper<PlanEntity> uw = new UpdateWrapper<PlanEntity>().lambda(); |
|
|
|
LambdaUpdateWrapper<PlanEntity> uw = new UpdateWrapper<PlanEntity>().lambda(); |
|
|
|
uw.set(PlanEntity::getStatus, status); |
|
|
|
uw.set(PlanEntity::getStatus, status); |
|
|
|
if(PlanContants.PlanStatusEnum.CHECK_STATUS.getStatus().equals(String.valueOf(status))|| |
|
|
|
if (PlanContants.PlanStatusEnum.CHECK_STATUS.getStatus().equals(String.valueOf(status)) || |
|
|
|
PlanContants.PlanStatusEnum.AUTH_STOP.getStatus().equals(String.valueOf(status))){//通过、驳回时需要填审核信息
|
|
|
|
PlanContants.PlanStatusEnum.AUTH_STOP.getStatus().equals(String.valueOf(status))) {//通过、驳回时需要填审核信息
|
|
|
|
uw.set(PlanEntity::getApprover, AuthUtil.getUserId()).set(PlanEntity::getApproveTime, LocalDateTime.now()); |
|
|
|
uw.set(PlanEntity::getApprover, AuthUtil.getUserId()).set(PlanEntity::getApproveTime, LocalDateTime.now()); |
|
|
|
} |
|
|
|
} |
|
|
|
uw.eq(PlanEntity::getId, planId); |
|
|
|
uw.eq(PlanEntity::getId, planId); |
|
|
|
re = update(uw); |
|
|
|
re = update(uw); |
|
|
|
if(re){ |
|
|
|
if (re) { |
|
|
|
if(PlanContants.PlanStatusEnum.CHECK_STATUS.getStatus().equals(String.valueOf(status))){ |
|
|
|
if (PlanContants.PlanStatusEnum.CHECK_STATUS.getStatus().equals(String.valueOf(status))) { |
|
|
|
genPresentTask(planId); |
|
|
|
genPresentTask(planId); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
@ -416,17 +420,18 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
/** |
|
|
|
/** |
|
|
|
* 生成当天任务 |
|
|
|
* 生成当天任务 |
|
|
|
* 如果计划开始时间小于等于当天则产生当天任务 |
|
|
|
* 如果计划开始时间小于等于当天则产生当天任务 |
|
|
|
|
|
|
|
* |
|
|
|
* @param planId 计划id |
|
|
|
* @param planId 计划id |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public void genPresentTask(Long planId){ |
|
|
|
public void genPresentTask(Long planId) { |
|
|
|
PlanEntity plan = this.baseMapper.selectById(planId); |
|
|
|
PlanEntity plan = this.baseMapper.selectById(planId); |
|
|
|
//立即生成任务 或者 临时任务 hld
|
|
|
|
//立即生成任务 或者 临时任务 hld
|
|
|
|
if(plan.getStartTime().isBefore(LocalDate.now()) || plan.getStartTime().isEqual(LocalDate.now()) ){ |
|
|
|
if (plan.getStartTime().isBefore(LocalDate.now()) || plan.getStartTime().isEqual(LocalDate.now())) { |
|
|
|
ITaskJobService taskJobService = null; |
|
|
|
ITaskJobService taskJobService = null; |
|
|
|
if(PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(plan.getMethod())){ |
|
|
|
if (PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(plan.getMethod())) { |
|
|
|
taskJobService = SpringUtil.getBean(SeizeTaskService.class); |
|
|
|
taskJobService = SpringUtil.getBean(SeizeTaskService.class); |
|
|
|
}else if(PlanContants.PlanMethodEnum.CONCURRENT.getMethod().equals(plan.getMethod())){ |
|
|
|
} else if (PlanContants.PlanMethodEnum.CONCURRENT.getMethod().equals(plan.getMethod())) { |
|
|
|
taskJobService = SpringUtil.getBean(ConcurrentTaskServcie.class); |
|
|
|
taskJobService = SpringUtil.getBean(ConcurrentTaskServcie.class); |
|
|
|
} |
|
|
|
} |
|
|
|
taskJobService.sendTask(plan); |
|
|
|
taskJobService.sendTask(plan); |
|
|
|
@ -436,15 +441,15 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
@Transactional(rollbackFor = Exception.class) |
|
|
|
public List<Long> genPresentTaskReturnTaskId(Long planId){ |
|
|
|
public List<Long> genPresentTaskReturnTaskId(Long planId) { |
|
|
|
List<Long> taskIds = new ArrayList<>(); |
|
|
|
List<Long> taskIds = new ArrayList<>(); |
|
|
|
PlanEntity plan = this.baseMapper.selectById(planId); |
|
|
|
PlanEntity plan = this.baseMapper.selectById(planId); |
|
|
|
//立即生成任务 或者 临时任务 hld
|
|
|
|
//立即生成任务 或者 临时任务 hld
|
|
|
|
if(plan.getStartTime().isBefore(LocalDate.now()) || plan.getStartTime().isEqual(LocalDate.now()) ){ |
|
|
|
if (plan.getStartTime().isBefore(LocalDate.now()) || plan.getStartTime().isEqual(LocalDate.now())) { |
|
|
|
ITaskJobService taskJobService = null; |
|
|
|
ITaskJobService taskJobService = null; |
|
|
|
if(PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(plan.getMethod())){ |
|
|
|
if (PlanContants.PlanMethodEnum.SEIZE.getMethod().equals(plan.getMethod())) { |
|
|
|
taskJobService = SpringUtil.getBean(SeizeTaskService.class); |
|
|
|
taskJobService = SpringUtil.getBean(SeizeTaskService.class); |
|
|
|
}else if(PlanContants.PlanMethodEnum.CONCURRENT.getMethod().equals(plan.getMethod())){ |
|
|
|
} else if (PlanContants.PlanMethodEnum.CONCURRENT.getMethod().equals(plan.getMethod())) { |
|
|
|
taskJobService = SpringUtil.getBean(ConcurrentTaskServcie.class); |
|
|
|
taskJobService = SpringUtil.getBean(ConcurrentTaskServcie.class); |
|
|
|
} |
|
|
|
} |
|
|
|
taskIds = taskJobService.sendTaskReturnTaskId(plan); |
|
|
|
taskIds = taskJobService.sendTaskReturnTaskId(plan); |
|
|
|
@ -456,27 +461,28 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 查看巡检计划 |
|
|
|
* 查看巡检计划 |
|
|
|
|
|
|
|
* |
|
|
|
* @param id |
|
|
|
* @param id |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
@Override |
|
|
|
@Override |
|
|
|
public PlanVO detail(Long id){ |
|
|
|
public PlanVO detail(Long id) { |
|
|
|
PlanEntity entity = this.getById(id); |
|
|
|
PlanEntity entity = this.getById(id); |
|
|
|
PlanVO plan = BeanUtil.copy(entity, PlanVO.class); |
|
|
|
PlanVO plan = BeanUtil.copy(entity, PlanVO.class); |
|
|
|
//巡检计划对象模板
|
|
|
|
//巡检计划对象模板
|
|
|
|
QueryWrapper<PlanObjectTemplateEntity> qw = new QueryWrapper<>(); |
|
|
|
QueryWrapper<PlanObjectTemplateEntity> qw = new QueryWrapper<>(); |
|
|
|
qw.lambda().eq(PlanObjectTemplateEntity::getPlanId, id); |
|
|
|
qw.lambda().eq(PlanObjectTemplateEntity::getPlanId, id); |
|
|
|
List<PlanObjectTemplateEntity> pteList = planObjectTemplateService.list(qw); |
|
|
|
List<PlanObjectTemplateEntity> pteList = planObjectTemplateService.list(qw); |
|
|
|
if(pteList!=null && pteList.size()>0){ |
|
|
|
if (pteList != null && pteList.size() > 0) { |
|
|
|
List<Long> objIds = Lists.newArrayList(); |
|
|
|
List<Long> objIds = Lists.newArrayList(); |
|
|
|
List<Long> tmpIds = Lists.newArrayList(); |
|
|
|
List<Long> tmpIds = Lists.newArrayList(); |
|
|
|
for(PlanObjectTemplateEntity pote:pteList){ |
|
|
|
for (PlanObjectTemplateEntity pote : pteList) { |
|
|
|
objIds.add(pote.getObjectId()); |
|
|
|
objIds.add(pote.getObjectId()); |
|
|
|
tmpIds.add(pote.getTemplateId()); |
|
|
|
tmpIds.add(pote.getTemplateId()); |
|
|
|
} |
|
|
|
} |
|
|
|
Map<Long,String> objMap = objectService.listByIds(objIds).stream().collect(Collectors.toMap(ObjectEntity::getId, ObjectEntity::getName)); |
|
|
|
Map<Long, String> objMap = objectService.listByIds(objIds).stream().collect(Collectors.toMap(ObjectEntity::getId, ObjectEntity::getName)); |
|
|
|
Map<Long,String> tmpMap = templateService.listByIds(tmpIds).stream().collect(Collectors.toMap(TemplateEntity::getId, TemplateEntity::getName)); |
|
|
|
Map<Long, String> tmpMap = templateService.listByIds(tmpIds).stream().collect(Collectors.toMap(TemplateEntity::getId, TemplateEntity::getName)); |
|
|
|
List<PlanObjectTemplateVO> planObjectTemplates = Lists.newArrayList(); |
|
|
|
List<PlanObjectTemplateVO> planObjectTemplates = Lists.newArrayList(); |
|
|
|
for(PlanObjectTemplateEntity pote:pteList){ |
|
|
|
for (PlanObjectTemplateEntity pote : pteList) { |
|
|
|
planObjectTemplates.add(PlanObjectTemplateVO.builder().id(pote.getId()).objectId(pote.getObjectId()).objectName(objMap.get(pote.getObjectId())) |
|
|
|
planObjectTemplates.add(PlanObjectTemplateVO.builder().id(pote.getId()).objectId(pote.getObjectId()).objectName(objMap.get(pote.getObjectId())) |
|
|
|
.templateId(pote.getTemplateId()).templateName(tmpMap.get(pote.getTemplateId())) |
|
|
|
.templateId(pote.getTemplateId()).templateName(tmpMap.get(pote.getTemplateId())) |
|
|
|
.build()); |
|
|
|
.build()); |
|
|
|
@ -486,13 +492,13 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
//人员||自由模式
|
|
|
|
//人员||自由模式
|
|
|
|
List<String> planUserNames = Lists.newArrayList(); |
|
|
|
List<String> planUserNames = Lists.newArrayList(); |
|
|
|
List<Long> planUserIds = Lists.newArrayList(); |
|
|
|
List<Long> planUserIds = Lists.newArrayList(); |
|
|
|
if(PlanTypeEnum.USER_TYPE.getType().equals(plan.getType()) || PlanTypeEnum.FREE_TYPE.getType().equals(plan.getType())){ |
|
|
|
if (PlanTypeEnum.USER_TYPE.getType().equals(plan.getType()) || PlanTypeEnum.FREE_TYPE.getType().equals(plan.getType())) { |
|
|
|
UpdateWrapper<PlanUserEntity> ew = new UpdateWrapper<>(); |
|
|
|
UpdateWrapper<PlanUserEntity> ew = new UpdateWrapper<>(); |
|
|
|
ew.lambda().eq(PlanUserEntity::getPlanId, entity.getId()); |
|
|
|
ew.lambda().eq(PlanUserEntity::getPlanId, entity.getId()); |
|
|
|
List<PlanUserEntity> list = planUserService.list(ew); |
|
|
|
List<PlanUserEntity> list = planUserService.list(ew); |
|
|
|
list.forEach(e->{ |
|
|
|
list.forEach(e -> { |
|
|
|
User user = UserCache.getUser(e.getUserId()); |
|
|
|
User user = UserCache.getUser(e.getUserId()); |
|
|
|
if(user!=null){ |
|
|
|
if (user != null) { |
|
|
|
planUserNames.add(user.getRealName()); |
|
|
|
planUserNames.add(user.getRealName()); |
|
|
|
planUserIds.add(user.getId()); |
|
|
|
planUserIds.add(user.getId()); |
|
|
|
} |
|
|
|
} |
|
|
|
@ -503,12 +509,12 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
//岗位
|
|
|
|
//岗位
|
|
|
|
List<String> planPostNames = Lists.newArrayList(); |
|
|
|
List<String> planPostNames = Lists.newArrayList(); |
|
|
|
List<Long> planPostIds = Lists.newArrayList(); |
|
|
|
List<Long> planPostIds = Lists.newArrayList(); |
|
|
|
if(PlanTypeEnum.POSITION_TYPE.getType().equals(plan.getType())){ |
|
|
|
if (PlanTypeEnum.POSITION_TYPE.getType().equals(plan.getType())) { |
|
|
|
UpdateWrapper<PlanPositionEntity> ew = new UpdateWrapper<>(); |
|
|
|
UpdateWrapper<PlanPositionEntity> ew = new UpdateWrapper<>(); |
|
|
|
ew.lambda().eq(PlanPositionEntity::getPlanId, entity.getId()); |
|
|
|
ew.lambda().eq(PlanPositionEntity::getPlanId, entity.getId()); |
|
|
|
List<PlanPositionEntity> list = planPositionService.list(ew); |
|
|
|
List<PlanPositionEntity> list = planPositionService.list(ew); |
|
|
|
planPostIds = list.stream().map(e->e.getPositionId()).collect(Collectors.toList()); |
|
|
|
planPostIds = list.stream().map(e -> e.getPositionId()).collect(Collectors.toList()); |
|
|
|
String postIds = String.join(",", list.stream().map(e->String.valueOf(e.getPositionId())).collect(Collectors.toList())); |
|
|
|
String postIds = String.join(",", list.stream().map(e -> String.valueOf(e.getPositionId())).collect(Collectors.toList())); |
|
|
|
planPostNames.addAll(sysClient.getPostNames(postIds).getData()); |
|
|
|
planPostNames.addAll(sysClient.getPostNames(postIds).getData()); |
|
|
|
} |
|
|
|
} |
|
|
|
plan.setPlanPosts(planPostIds); |
|
|
|
plan.setPlanPosts(planPostIds); |
|
|
|
@ -516,12 +522,12 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
//机构
|
|
|
|
//机构
|
|
|
|
List<String> planOrgNames = Lists.newArrayList(); |
|
|
|
List<String> planOrgNames = Lists.newArrayList(); |
|
|
|
List<Long> planOrgIds = Lists.newArrayList(); |
|
|
|
List<Long> planOrgIds = Lists.newArrayList(); |
|
|
|
if(PlanTypeEnum.ORG_TYPE.getType().equals(plan.getType())){ |
|
|
|
if (PlanTypeEnum.ORG_TYPE.getType().equals(plan.getType())) { |
|
|
|
UpdateWrapper<PlanOrgEntity> ew = new UpdateWrapper<>(); |
|
|
|
UpdateWrapper<PlanOrgEntity> ew = new UpdateWrapper<>(); |
|
|
|
ew.lambda().eq(PlanOrgEntity::getPlanId, entity.getId()); |
|
|
|
ew.lambda().eq(PlanOrgEntity::getPlanId, entity.getId()); |
|
|
|
List<PlanOrgEntity> list = planOrgService.list(ew); |
|
|
|
List<PlanOrgEntity> list = planOrgService.list(ew); |
|
|
|
planOrgIds = list.stream().map(e->e.getOrgId()).collect(Collectors.toList()); |
|
|
|
planOrgIds = list.stream().map(e -> e.getOrgId()).collect(Collectors.toList()); |
|
|
|
String orgIds = String.join(",", list.stream().map(e->String.valueOf(e.getOrgId())).collect(Collectors.toList())); |
|
|
|
String orgIds = String.join(",", list.stream().map(e -> String.valueOf(e.getOrgId())).collect(Collectors.toList())); |
|
|
|
planOrgNames.addAll(sysClient.getDeptNames(orgIds).getData()); |
|
|
|
planOrgNames.addAll(sysClient.getDeptNames(orgIds).getData()); |
|
|
|
} |
|
|
|
} |
|
|
|
plan.setPlanOrgs(planOrgIds); |
|
|
|
plan.setPlanOrgs(planOrgIds); |
|
|
|
@ -534,9 +540,9 @@ public class PlanServiceImpl extends BaseServiceImpl<PlanMapper, PlanEntity> imp |
|
|
|
}*/ |
|
|
|
}*/ |
|
|
|
|
|
|
|
|
|
|
|
//任务
|
|
|
|
//任务
|
|
|
|
List<TaskEntity> taskList = taskService.list(Wrappers.<TaskEntity>lambdaQuery().eq(TaskEntity::getPlanId,plan.getId())); |
|
|
|
List<TaskEntity> taskList = taskService.list(Wrappers.<TaskEntity>lambdaQuery().eq(TaskEntity::getPlanId, plan.getId())); |
|
|
|
List<PlanTaskListVO> planTaskVO = Lists.newArrayList(); |
|
|
|
List<PlanTaskListVO> planTaskVO = Lists.newArrayList(); |
|
|
|
taskList.forEach(entityTask->{ |
|
|
|
taskList.forEach(entityTask -> { |
|
|
|
planTaskVO.add(PlanTaskListVO.builder().taskId(entityTask.getId()).batchNumber(entityTask.getBatchNumber()).planStartTime(entityTask.getPlanStartTime()).planEndTime(entityTask.getPlanEndTime()).status(entityTask.getStatus()).build()); |
|
|
|
planTaskVO.add(PlanTaskListVO.builder().taskId(entityTask.getId()).batchNumber(entityTask.getBatchNumber()).planStartTime(entityTask.getPlanStartTime()).planEndTime(entityTask.getPlanEndTime()).status(entityTask.getStatus()).build()); |
|
|
|
}); |
|
|
|
}); |
|
|
|
plan.setTasks(planTaskVO); |
|
|
|
plan.setTasks(planTaskVO); |
|
|
|
|