Browse Source

#检修流程

zhongwei
yang_shj 2 years ago
parent
commit
a3c9e3d2c9
  1. 22
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java
  2. 37
      hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java
  3. 31
      hzims-service/operational/src/main/resources/banner.txt

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

@ -10,6 +10,7 @@ import com.hnac.hzims.middle.process.to.ProcessWorkFlowResponse;
import com.hnac.hzims.operational.access.dto.*;
import com.hnac.hzims.operational.access.entity.OperAccessContentEntity;
import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity;
import com.hnac.hzims.operational.access.entity.OperAccessTaskDetailEntity;
import com.hnac.hzims.operational.access.service.*;
import lombok.RequiredArgsConstructor;
import lombok.extern.slf4j.Slf4j;
@ -133,23 +134,16 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
return;
}
// 查询计划是否绑定任务明细
List<OperAccessContentEntity> existsDetails = contentService.list(new LambdaQueryWrapper<OperAccessContentEntity>() {{
List<OperAccessContentEntity> exists = contentService.list(new LambdaQueryWrapper<OperAccessContentEntity>() {{
eq(OperAccessContentEntity::getPlanId, entity.getId());
eq(OperAccessContentEntity::getIsDeleted, 0L);
}});
Set<Long> detailIds = entity.getAccessContents().stream().map(OperAccessContentDTO::getId).filter(Objects::nonNull).collect(Collectors.toSet());
List<Long> ids = existsDetails.stream().map(OperAccessContentEntity::getId).filter(id -> !detailIds.contains(id)).collect(Collectors.toList());
if (!CollectionUtils.isEmpty(ids)) {
contentService.deleteLogic(ids);
if(CollectionUtil.isNotEmpty(exists)){
contentService.deleteLogic(exists.stream().map(OperAccessContentEntity::getId).collect(Collectors.toList()));
}
// 明细添加/修改
for (OperAccessContentDTO content : entity.getAccessContents()) {
content.setPlanId(entity.getId());
if (ObjectUtil.isEmpty(content.getId())) {
contentService.doSave(content);
continue;
}
contentService.doUpdateById(content);
for (OperAccessContentDTO detail : entity.getAccessContents()){
detail.setPlanId(entity.getId());
contentService.save(detail);
}
}
@ -230,7 +224,7 @@ public class AccessPlanV4ServiceImpl implements AccessPlanV4Service{
// 任务详情
if(CollectionUtil.isNotEmpty(item.getAccessContentDetails())){
task.setAccessTaskDetails(item.getAccessContentDetails().stream().map(content -> {
OperAccessTaskDetailDTO detail = new OperAccessTaskDetailDTO();
OperAccessTaskDetailDTO detail = BeanUtil.copy(content, OperAccessTaskDetailDTO.class);
detail.setContentDetailId(content.getId());
detail.setContent(content.getContent());
detail.setName(content.getName());

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

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

31
hzims-service/operational/src/main/resources/banner.txt

@ -1,7 +1,24 @@
_ _ ____ ___ __ __ ___ _ _ ___ _ _ ___
| || | |_ / |_ _| | \/ | / __| o O O | | | | | _ \ o O O | | | | | _ \
| __ | / / | | | |\/| | \__ \ o | |_| | | _/ o | |_| | | _/
|_||_| /___| |___| |_|__|_| |___/ TS__[O] \___/ _|_|_ TS__[O] \___/ _|_|_
_|"""""|_|"""""|_|"""""|_|"""""|_|"""""| {======|_|"""""|_| """ | {======|_|"""""|_| """ |
"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'./o--000'"`-0-0-'"`-0-0-'
,-.. _. ,. ,._
.-' . '.
/ . /_./.
' '.
. '
' =\ : , \ \
' '` ` ` = '
|,. _\ ', \
/ \ ." ',. /
|| ,' ` , ' \_.'
|\ -. / , `'":, /
,-= . ,' '_ `;. |
/ / -' "'` ,:,
_,/|,' , '
___,--' | | ( /
_,-'` . . . , '- _' .-.
,' \ . `,'"`';/. ,' )
,` .' : / ';\\ '. ,' .'
,' |.\ ';.'.,. .;.\\ ,..:_'_ .
/ . '. .'';_:;'` '_( ' '-.
| . '.'.,-' , ( '" - ._ )
/ . ` '. _,'-._ ` (
/ . [大丑怪] _ | ' .' '. ' . _ )
(:) ' ' ' '
Loading…
Cancel
Save