Browse Source

#风电

zhongwei
yang_shj 1 year ago
parent
commit
0b7b06876c
  1. 6
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml
  2. 39
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java
  3. 1
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java

6
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/mapper/OperAccessMaterialMapper.xml

@ -30,12 +30,12 @@
</resultMap>
<select id="getList" resultType="com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity">
SELECT * FROM HZIMS_OPER_ACCESS_MATERIAL
WHERE
WHERE IS_DELETE = 0
<if test="planId !=null and planId != ''">
PLAN_ID = #{planId,jdbcType=BIGINT}
AND PLAN_ID = #{planId,jdbcType=BIGINT}
</if>
<if test="taskId !=null and taskId != ''">
TASK_ID = #{taskId,jdbcType=BIGINT}
AND TASK_ID = #{taskId,jdbcType=BIGINT}
</if>
</select>

39
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java

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

1
hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java

@ -146,6 +146,7 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service {
detailService.deleteLogic(exists.stream().map(OperAccessTaskDetailEntity::getId).collect(Collectors.toList()));
}
for (OperAccessTaskDetailDTO detail : entity.getAccessTaskDetails()){
detail.setId(null);
detail.setTaskId(entity.getId());
detailService.save(detail);
}

Loading…
Cancel
Save