From a3c9e3d2c97513d70a0741f345c20b71d253a2ad Mon Sep 17 00:00:00 2001 From: yang_shj <1069818635@QQ.com> Date: Thu, 29 Jun 2023 17:13:30 +0800 Subject: [PATCH] =?UTF-8?q?#=E6=A3=80=E4=BF=AE=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../service/impl/AccessPlanV4ServiceImpl.java | 22 +++++-------- .../service/impl/AccessTaskV4ServiceImpl.java | 37 +++++++--------------- .../operational/src/main/resources/banner.txt | 31 ++++++++++++++---- 3 files changed, 44 insertions(+), 46 deletions(-) diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java index ca20f56..997314a 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessPlanV4ServiceImpl.java +++ b/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 existsDetails = contentService.list(new LambdaQueryWrapper() {{ + List exists = contentService.list(new LambdaQueryWrapper() {{ eq(OperAccessContentEntity::getPlanId, entity.getId()); eq(OperAccessContentEntity::getIsDeleted, 0L); }}); - Set detailIds = entity.getAccessContents().stream().map(OperAccessContentDTO::getId).filter(Objects::nonNull).collect(Collectors.toSet()); - List 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()); diff --git a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java b/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java index e9e2381..88aca69 100644 --- a/hzims-service/operational/src/main/java/com/hnac/hzims/operational/access/service/impl/AccessTaskV4ServiceImpl.java +++ b/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 existsDetails = detailService.list(new LambdaQueryWrapper() {{ + List exists = detailService.list(new LambdaQueryWrapper() {{ eq(OperAccessTaskDetailEntity::getTaskId, entity.getId()); eq(OperAccessTaskDetailEntity::getIsDeleted, 0L); }}); - Set detailIds = entity.getAccessTaskDetails().stream().map(OperAccessTaskDetailDTO::getId).filter(Objects::nonNull).collect(Collectors.toSet()); - List 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 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 statistics = statisticsService.list(new LambdaQueryWrapper() {{ 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); } } \ No newline at end of file diff --git a/hzims-service/operational/src/main/resources/banner.txt b/hzims-service/operational/src/main/resources/banner.txt index f171d84..24765d6 100644 --- a/hzims-service/operational/src/main/resources/banner.txt +++ b/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-' - + ,-.. _. ,. ,._ + .-' . '. + / . /_./. + ' '. + . ' + ' =\ : , \ \ + ' '` ` ` = ' + |,. _\ ', \ + / \ ." ',. / + || ,' ` , ' \_.' + |\ -. / , `'":, / + ,-= . ,' '_ `;. | + / / -' "'` ,:, + _,/|,' , ' + ___,--' | | ( / + _,-'` . . . , '- _' .-. + ,' \ . `,'"`';/. ,' ) + ,` .' : / ';\\ '. ,' .' + ,' |.\ ';.'.,. .;.\\ ,..:_'_ . + / . '. .'';_:;'` '_( ' '-. + | . '.'.,-' , ( '" - ._ ) + / . ` '. _,'-._ ` ( + / . [大丑怪] _ | ' .' '. ' . _ ) + (:) ' ' ' ' \ No newline at end of file