|
|
@ -8,6 +8,7 @@ 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.*; |
|
|
|
import com.hnac.hzims.operational.access.dto.*; |
|
|
|
|
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessContentDetailEntity; |
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessContentEntity; |
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessContentEntity; |
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity; |
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity; |
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessTaskDetailEntity; |
|
|
|
import com.hnac.hzims.operational.access.entity.OperAccessTaskDetailEntity; |
|
|
@ -51,6 +52,8 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{ |
|
|
|
|
|
|
|
|
|
|
|
private final IOperAccessContentService contentService; |
|
|
|
private final IOperAccessContentService contentService; |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private final IOperAccessContentDetailService contentDetailService; |
|
|
|
|
|
|
|
|
|
|
|
private final AccessTaskV4Service accessTaskV4Service; |
|
|
|
private final AccessTaskV4Service accessTaskV4Service; |
|
|
|
|
|
|
|
|
|
|
|
private final ISysClient sysClient; |
|
|
|
private final ISysClient sysClient; |
|
|
@ -105,23 +108,18 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{ |
|
|
|
return; |
|
|
|
return; |
|
|
|
} |
|
|
|
} |
|
|
|
// 查询计划是否绑定检修材料
|
|
|
|
// 查询计划是否绑定检修材料
|
|
|
|
List<OperAccessMaterialEntity> existsDetails = materialService.list(new LambdaQueryWrapper<OperAccessMaterialEntity>() {{ |
|
|
|
List<OperAccessMaterialEntity> materials = materialService.list(new LambdaQueryWrapper<OperAccessMaterialEntity>() {{ |
|
|
|
eq(OperAccessMaterialEntity::getPlanId, entity.getId()); |
|
|
|
eq(OperAccessMaterialEntity::getPlanId, entity.getId()); |
|
|
|
eq(OperAccessMaterialEntity::getIsDeleted, 0L); |
|
|
|
eq(OperAccessMaterialEntity::getIsDeleted, 0L); |
|
|
|
}}); |
|
|
|
}}); |
|
|
|
Set<Long> detailIds = entity.getAccessMaterials().stream().map(OperAccessMaterialDTO::getId).filter(Objects::nonNull).collect(Collectors.toSet()); |
|
|
|
log.error("save_access_material : {}",materials); |
|
|
|
List<Long> ids = existsDetails.stream().map(OperAccessMaterialEntity::getId).filter(id -> !detailIds.contains(id)).collect(Collectors.toList()); |
|
|
|
if(CollectionUtil.isNotEmpty(materials)){ |
|
|
|
if (!CollectionUtils.isEmpty(ids)) { |
|
|
|
materialService.deleteLogic(materials.stream().map(OperAccessMaterialEntity::getId).collect(Collectors.toList())); |
|
|
|
materialService.deleteLogic(ids); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
// 材料添加/修改
|
|
|
|
|
|
|
|
for (OperAccessMaterialDTO material : entity.getAccessMaterials()){ |
|
|
|
for (OperAccessMaterialDTO material : entity.getAccessMaterials()){ |
|
|
|
|
|
|
|
material.setId(null); |
|
|
|
material.setPlanId(entity.getId()); |
|
|
|
material.setPlanId(entity.getId()); |
|
|
|
if (ObjectUtil.isEmpty(material.getId())) { |
|
|
|
materialService.save(material); |
|
|
|
materialService.doSave(material); |
|
|
|
|
|
|
|
continue; |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
materialService.updateById(material); |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -143,7 +141,23 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{ |
|
|
|
} |
|
|
|
} |
|
|
|
for (OperAccessContentDTO detail : entity.getAccessContents()){ |
|
|
|
for (OperAccessContentDTO detail : entity.getAccessContents()){ |
|
|
|
detail.setPlanId(entity.getId()); |
|
|
|
detail.setPlanId(entity.getId()); |
|
|
|
|
|
|
|
detail.setId(null); |
|
|
|
contentService.save(detail); |
|
|
|
contentService.save(detail); |
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(detail.getAccessContentDetails())){ |
|
|
|
|
|
|
|
for (OperAccessContentDetailDTO contentDetail : detail.getAccessContentDetails()){ |
|
|
|
|
|
|
|
List<OperAccessContentDetailEntity> contentDetails = contentDetailService.list(new LambdaQueryWrapper<OperAccessContentDetailEntity>() {{ |
|
|
|
|
|
|
|
eq(OperAccessContentDetailEntity::getContentId, detail.getId()); |
|
|
|
|
|
|
|
}}); |
|
|
|
|
|
|
|
// 先删除
|
|
|
|
|
|
|
|
if(CollectionUtil.isNotEmpty(contentDetails)){ |
|
|
|
|
|
|
|
contentDetailService.deleteLogic(contentDetails.stream().map(OperAccessContentDetailEntity::getId).collect(Collectors.toList())); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
// 再保存
|
|
|
|
|
|
|
|
contentDetail.setId(null); |
|
|
|
|
|
|
|
contentDetail.setContentId(detail.getId()); |
|
|
|
|
|
|
|
contentDetailService.save(contentDetail); |
|
|
|
|
|
|
|
} |
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
@ -221,10 +235,12 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{ |
|
|
|
task.setPlanId(entity.getId()); |
|
|
|
task.setPlanId(entity.getId()); |
|
|
|
task.setContentId(item.getId()); |
|
|
|
task.setContentId(item.getId()); |
|
|
|
task.setEmCode(item.getEmCode()); |
|
|
|
task.setEmCode(item.getEmCode()); |
|
|
|
|
|
|
|
task.setCreateUser(item.getManager()); |
|
|
|
// 任务详情
|
|
|
|
// 任务详情
|
|
|
|
if(CollectionUtil.isNotEmpty(item.getAccessContentDetails())){ |
|
|
|
if(CollectionUtil.isNotEmpty(item.getAccessContentDetails())){ |
|
|
|
task.setAccessTaskDetails(item.getAccessContentDetails().stream().map(content -> { |
|
|
|
task.setAccessTaskDetails(item.getAccessContentDetails().stream().map(content -> { |
|
|
|
OperAccessTaskDetailDTO detail = BeanUtil.copy(content, OperAccessTaskDetailDTO.class); |
|
|
|
OperAccessTaskDetailDTO detail = BeanUtil.copy(content, OperAccessTaskDetailDTO.class); |
|
|
|
|
|
|
|
detail.setCreateUser(entity.getCreateUser()); |
|
|
|
detail.setContentDetailId(content.getId()); |
|
|
|
detail.setContentDetailId(content.getId()); |
|
|
|
detail.setContent(content.getContent()); |
|
|
|
detail.setContent(content.getContent()); |
|
|
|
detail.setName(content.getName()); |
|
|
|
detail.setName(content.getName()); |
|
|
|