|
|
@ -8,7 +8,6 @@ import com.hnac.hzims.message.MessageConstants; |
|
|
|
import com.hnac.hzims.message.dto.BusinessMessageDTO; |
|
|
|
import com.hnac.hzims.message.dto.BusinessMessageDTO; |
|
|
|
import com.hnac.hzims.message.fegin.IMessageClient; |
|
|
|
import com.hnac.hzims.message.fegin.IMessageClient; |
|
|
|
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; |
|
|
|
import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse; |
|
|
|
import com.hnac.hzims.operational.access.dto.AccessPlanV4DTO; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO; |
|
|
|
import com.hnac.hzims.operational.access.dto.AccessTaskV4DTO; |
|
|
|
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO; |
|
|
|
import com.hnac.hzims.operational.access.dto.OperAccessStatisticsDTO; |
|
|
|
import com.hnac.hzims.operational.access.dto.OperAccessTaskDetailDTO; |
|
|
|
import com.hnac.hzims.operational.access.dto.OperAccessTaskDetailDTO; |
|
|
@ -78,7 +77,6 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service { |
|
|
|
// 步骤1.保存检修任务
|
|
|
|
// 步骤1.保存检修任务
|
|
|
|
this.save(entity); |
|
|
|
this.save(entity); |
|
|
|
|
|
|
|
|
|
|
|
log.error("start_task_processV4 : {}",entity.getId()); |
|
|
|
|
|
|
|
// 步骤2.保存检修材料
|
|
|
|
// 步骤2.保存检修材料
|
|
|
|
this.saveMaterial(entity); |
|
|
|
this.saveMaterial(entity); |
|
|
|
|
|
|
|
|
|
|
@ -122,11 +120,10 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service { |
|
|
|
* @param entity |
|
|
|
* @param entity |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private void saveMaterial(AccessTaskV4DTO entity) { |
|
|
|
private void saveMaterial(AccessTaskV4DTO entity) { |
|
|
|
if (CollectionUtil.isNotEmpty(entity.getAccessMaterials())) { |
|
|
|
if (CollectionUtil.isEmpty(entity.getAccessMaterials())) { |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
materialService.saveOrUpdateBatch(entity.getAccessMaterials().stream().peek(material -> { |
|
|
|
materialService.saveOrUpdateBatch(entity.getAccessMaterials().stream().peek(material -> { |
|
|
|
material.setId(null); |
|
|
|
|
|
|
|
material.setPlanId(entity.getPlanId()); |
|
|
|
material.setPlanId(entity.getPlanId()); |
|
|
|
material.setTaskId(entity.getId()); |
|
|
|
material.setTaskId(entity.getId()); |
|
|
|
}).collect(Collectors.toList())); |
|
|
|
}).collect(Collectors.toList())); |
|
|
@ -141,25 +138,16 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service { |
|
|
|
if(CollectionUtil.isEmpty(entity.getAccessTaskDetails())){ |
|
|
|
if(CollectionUtil.isEmpty(entity.getAccessTaskDetails())){ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// 查询检修任务关联的检修对象
|
|
|
|
List<OperAccessTaskDetailEntity> exists = detailService.list(new LambdaQueryWrapper<OperAccessTaskDetailEntity>() {{ |
|
|
|
List<OperAccessTaskDetailEntity> existsDetails = detailService.list(new LambdaQueryWrapper<OperAccessTaskDetailEntity>() {{ |
|
|
|
|
|
|
|
eq(OperAccessTaskDetailEntity::getTaskId, entity.getId()); |
|
|
|
eq(OperAccessTaskDetailEntity::getTaskId, entity.getId()); |
|
|
|
eq(OperAccessTaskDetailEntity::getIsDeleted, 0L); |
|
|
|
eq(OperAccessTaskDetailEntity::getIsDeleted, 0L); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
Set<Long> detailIds = entity.getAccessTaskDetails().stream().map(OperAccessTaskDetailDTO::getId).filter(Objects::nonNull).collect(Collectors.toSet()); |
|
|
|
if(CollectionUtil.isNotEmpty(exists)){ |
|
|
|
List<Long> ids = existsDetails.stream().map(OperAccessTaskDetailEntity::getId).filter(id -> !detailIds.contains(id)).collect(Collectors.toList()); |
|
|
|
detailService.deleteLogic(exists.stream().map(OperAccessTaskDetailEntity::getId).collect(Collectors.toList())); |
|
|
|
if (!CollectionUtils.isEmpty(ids)) { |
|
|
|
|
|
|
|
detailService.deleteLogic(ids); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 检修任务对象
|
|
|
|
for (OperAccessTaskDetailDTO detail : entity.getAccessTaskDetails()){ |
|
|
|
Set<Long> existsIds = existsDetails.stream().map(OperAccessTaskDetailEntity::getId).collect(Collectors.toSet()); |
|
|
|
detail.setTaskId(entity.getId()); |
|
|
|
for (OperAccessTaskDetailDTO details : entity.getAccessTaskDetails()) { |
|
|
|
detailService.save(detail); |
|
|
|
details.setTaskId(entity.getId()); |
|
|
|
|
|
|
|
if (ObjectUtil.isNotEmpty(entity.getId())) { |
|
|
|
|
|
|
|
detailService.updateById(details); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
detailService.doSave(details); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -194,8 +182,6 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service { |
|
|
|
this.taskService.updateById(entity); |
|
|
|
this.taskService.updateById(entity); |
|
|
|
// 保存检修材料
|
|
|
|
// 保存检修材料
|
|
|
|
this.saveMaterial(entity); |
|
|
|
this.saveMaterial(entity); |
|
|
|
// 保存检修详情
|
|
|
|
|
|
|
|
this.saveDetails(entity); |
|
|
|
|
|
|
|
// 发送消息
|
|
|
|
// 发送消息
|
|
|
|
String content = "您有一条检修任务待处理/审核,检修任务名称:".concat(entity.getName()) |
|
|
|
String content = "您有一条检修任务待处理/审核,检修任务名称:".concat(entity.getName()) |
|
|
|
.concat(",当前环节:") |
|
|
|
.concat(",当前环节:") |
|
|
@ -235,15 +221,16 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service { |
|
|
|
|
|
|
|
|
|
|
|
/** |
|
|
|
/** |
|
|
|
* 检修台账保存 |
|
|
|
* 检修台账保存 |
|
|
|
|
|
|
|
* |
|
|
|
* @param entity |
|
|
|
* @param entity |
|
|
|
*/ |
|
|
|
*/ |
|
|
|
private boolean statiticsSave(AccessTaskV4DTO entity) { |
|
|
|
private void statiticsSave(AccessTaskV4DTO entity) { |
|
|
|
// 查询台账记录
|
|
|
|
// 查询台账记录
|
|
|
|
List<OperAccessStatisticsEntity> statistics = statisticsService.list(new LambdaQueryWrapper<OperAccessStatisticsEntity>() {{ |
|
|
|
List<OperAccessStatisticsEntity> statistics = statisticsService.list(new LambdaQueryWrapper<OperAccessStatisticsEntity>() {{ |
|
|
|
eq(OperAccessStatisticsEntity::getTaskId, entity.getId()); |
|
|
|
eq(OperAccessStatisticsEntity::getTaskId, entity.getId()); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
if(CollectionUtil.isEmpty(statistics)){ |
|
|
|
if(CollectionUtil.isNotEmpty(statistics)){ |
|
|
|
return true; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
OperAccessStatisticsDTO statisticsDTO = BeanUtil.copy(entity, OperAccessStatisticsDTO.class); |
|
|
|
OperAccessStatisticsDTO statisticsDTO = BeanUtil.copy(entity, OperAccessStatisticsDTO.class); |
|
|
|
statisticsDTO.setId(null); |
|
|
|
statisticsDTO.setId(null); |
|
|
@ -253,6 +240,6 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service { |
|
|
|
if (ObjectUtil.isNotEmpty(content)) { |
|
|
|
if (ObjectUtil.isNotEmpty(content)) { |
|
|
|
statisticsDTO.setPid(content.getLibraryId()); |
|
|
|
statisticsDTO.setPid(content.getLibraryId()); |
|
|
|
} |
|
|
|
} |
|
|
|
return statisticsService.save(statisticsDTO); |
|
|
|
statisticsService.save(statisticsDTO); |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |