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 89cef1c..3dff7ec 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 @@ -10,18 +10,19 @@ 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; +import com.hnac.hzims.operational.access.entity.OperAccessContentEntity; import com.hnac.hzims.operational.access.entity.OperAccessMaterialEntity; +import com.hnac.hzims.operational.access.entity.OperAccessStatisticsEntity; import com.hnac.hzims.operational.access.entity.OperAccessTaskDetailEntity; -import com.hnac.hzims.operational.access.service.AccessTaskV4Service; -import com.hnac.hzims.operational.access.service.IOperAccessMaterialService; -import com.hnac.hzims.operational.access.service.IOperAccessTaskDetailService; -import com.hnac.hzims.operational.access.service.IOperAccessTaskService; +import com.hnac.hzims.operational.access.service.*; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.apache.commons.lang3.RandomUtils; import org.springblade.core.log.exception.ServiceException; import org.springblade.core.tool.api.R; +import org.springblade.core.tool.utils.BeanUtil; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.DateUtil; import org.springblade.core.tool.utils.ObjectUtil; @@ -50,10 +51,14 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service { private final IOperAccessTaskService taskService; + private final IOperAccessContentService contentService; + private final IOperAccessMaterialService materialService; private final IOperAccessTaskDetailService detailService; + private final IOperAccessStatisticsService statisticsService; + private final ISysClient sysClient; private final IFlowClient flowClient; @@ -176,6 +181,8 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service { entity.setNextStepOperator("流程结束,无需人员处理"); // 更新任务数据 this.taskService.updateById(entity); + // 检修台账保存 + this.statiticsSave(entity); }else if(ObjectUtil.isEmpty(variables.get("examine")) && !(Boolean) variables.get("examine")){ String content = "您有一条检修任务待处理!检修任务名称:".concat(entity.getName()) .concat(",当前环节:") @@ -222,4 +229,28 @@ public class AccessTaskV4ServiceImpl implements AccessTaskV4Service { message.setUserIds(userId); messageClient.sendAppAndWsMsgByUsers(message); } + + + /** + * 检修台账保存 + * @param entity + */ + private void statiticsSave(AccessTaskV4DTO entity) { + // 查询台账记录 + List statistics = statisticsService.list(new LambdaQueryWrapper() {{ + eq(OperAccessStatisticsEntity::getTaskId, entity.getId()); + }}); + if(CollectionUtil.isEmpty(statistics)){ + return; + } + OperAccessStatisticsDTO statisticsDTO = BeanUtil.copy(entity, OperAccessStatisticsDTO.class); + statisticsDTO.setId(null); + statisticsDTO.setTaskId(entity.getId()); + statisticsDTO.setManager(entity.getHandler()); + OperAccessContentEntity content = contentService.getById(entity.getId()); + if (ObjectUtil.isNotEmpty(content)) { + statisticsDTO.setPid(content.getLibraryId()); + } + statisticsService.doSave(statisticsDTO); + } } \ No newline at end of file