From d13f93d3f7c452e35aceaa8db18c17521873144a Mon Sep 17 00:00:00 2001 From: tyty Date: Mon, 14 Aug 2023 20:17:26 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E6=AD=A3=E6=99=BA=E8=83=BD=E8=AF=8A?= =?UTF-8?q?=E6=96=AD=E7=BB=9F=E8=AE=A1=E4=BB=BB=E5=8A=A1=E5=B1=95=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hzims/fdp/service/impl/FdpTaskServiceImpl.java | 21 +++++++++++++++++++-- .../com/hnac/hzims/fdp/wrapper/FdpTaskWrapper.java | 1 + 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java index caf4b49..03411c0 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/service/impl/FdpTaskServiceImpl.java @@ -20,7 +20,6 @@ import com.hnac.hzims.operational.defect.feign.IOperPhenomenonClient; import com.hnac.hzims.operational.defect.vo.OperPhenomenonVO; import com.hnac.hzims.util.HttpClientUtils; import com.hnac.hzims.util.pojo.HttpResponse; -import lombok.AllArgsConstructor; import lombok.RequiredArgsConstructor; import lombok.extern.slf4j.Slf4j; import org.springblade.core.mp.base.BaseServiceImpl; @@ -32,6 +31,8 @@ import org.springblade.core.tool.utils.Func; import org.springblade.core.tool.utils.ObjectUtil; import org.springblade.core.tool.utils.StringUtil; import org.springblade.system.feign.ISysClient; +import org.springblade.system.user.entity.User; +import org.springblade.system.user.feign.IUserClient; import org.springframework.beans.factory.annotation.Value; import org.springframework.stereotype.Service; @@ -39,6 +40,7 @@ import java.math.BigDecimal; import java.util.ArrayList; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; /** @@ -51,6 +53,8 @@ import java.util.stream.Collectors; public class FdpTaskServiceImpl extends BaseServiceImpl implements IFdpTaskService { private final IOperPhenomenonClient operPhenomenonClient; private final ISysClient sysClient; + + private final IUserClient userClient; private IDiagnoseProxy diagnoseProxy; @Value("${url.submitResult}") @@ -75,7 +79,20 @@ public class FdpTaskServiceImpl extends BaseServiceImpl detail(Long id) { FdpTaskEntity detail = super.getById(id); - return R.data(FdpTaskWrapper.build().entityVO(detail)); + FdpTaskVO data = FdpTaskWrapper.build().entityVO(detail); + if (StringUtil.isEmpty(data.getCreateUserName())){ + R userR = userClient.userInfoById(detail.getCreateUser().longValue()); + if (userR.isSuccess()&&Func.isNotEmpty(userR.getData())){ + data.setCreateUserName(Optional.ofNullable(userR.getData()).map(User::getName).orElse(null)); + } + } + if (StringUtil.isEmpty(data.getUpdateUser())){ + R userR = userClient.userInfoById(detail.getUpdateUser().longValue()); + if (userR.isSuccess()&&Func.isNotEmpty(userR.getData())){ + data.setUpdateUserName(Optional.ofNullable(userR.getData()).map(User::getName).orElse(null)); + } + } + return R.data(data); } @Override diff --git a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/wrapper/FdpTaskWrapper.java b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/wrapper/FdpTaskWrapper.java index 0590858..8e3e22e 100644 --- a/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/wrapper/FdpTaskWrapper.java +++ b/hzims-service/equipment/src/main/java/com/hnac/hzims/fdp/wrapper/FdpTaskWrapper.java @@ -26,6 +26,7 @@ public class FdpTaskWrapper extends BaseEntityWrapper @Override public FdpTaskVO entityVO(FdpTaskEntity entity) { FdpTaskVO vo = BeanUtil.copy(entity, FdpTaskVO.class); + User createUser = UserCache.getUser(entity.getCreateUser()); User updateUser = UserCache.getUser(entity.getUpdateUser()); vo.setCreateUserName(Optional.ofNullable(createUser).map(User::getName).orElse(null));