From d3767d594de66cb5f9d1294931acefea1866f783 Mon Sep 17 00:00:00 2001
From: renkang <8417338+k94314517@user.noreply.gitee.com>
Date: 星期五, 24 一月 2025 18:24:25 +0800
Subject: [PATCH] 客户资料 巡检任务业务

---
 server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwDeviceServiceImpl.java |   41 +++++++++++++++++++++++++++++++----------
 1 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwDeviceServiceImpl.java b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwDeviceServiceImpl.java
index 5aa6aef..dda5508 100644
--- a/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwDeviceServiceImpl.java
+++ b/server/visits/dmvisit_service/src/main/java/com/doumee/service/business/impl/YwDeviceServiceImpl.java
@@ -11,10 +11,7 @@
 import com.doumee.core.utils.Utils;
 import com.doumee.dao.business.YwDeviceMapper;
 import com.doumee.dao.business.YwDeviceRecordMapper;
-import com.doumee.dao.business.model.Category;
-import com.doumee.dao.business.model.Company;
-import com.doumee.dao.business.model.YwDevice;
-import com.doumee.dao.business.model.YwDeviceRecord;
+import com.doumee.dao.business.model.*;
 import com.doumee.dao.business.vo.YwDeviceCateDataVO;
 import com.doumee.dao.business.vo.YwDeviceDataVO;
 import com.doumee.dao.business.vo.YwDeviceParentCateDataVO;
@@ -103,7 +100,7 @@
                 }
                 multifile.setCreateDate(ywDevice.getCreateDate());
                 multifile.setEditDate(ywDevice.getCreateDate());
-                multifile.setCreator(ywDevice.getEditor());
+                multifile.setCreator(ywDevice.getCreator());
                 multifile.setIsdeleted(Constants.ZERO);
                 multifile.setObjId(ywDevice.getId());
                 multifile.setEditor(ywDevice.getCreator());
@@ -226,7 +223,28 @@
 
     @Override
     public YwDevice getDetail(Integer id) {
-        YwDevice ywDevice = ywDeviceMapper.selectById(id);
+        YwDevice ywDevice = ywDeviceMapper.selectJoinOne(YwDevice.class,
+                new MPJLambdaWrapper<YwDevice>()
+                .selectAll(YwDevice.class)
+                        .select("c.name",YwDevice::getCategoryName)
+                        .select("c1.name",YwDevice::getCategoryParentName)
+                        .select("s.realname",YwDevice::getRealName)
+                        .select("s1.realname",YwDevice::getMaintenanceUserName)
+                        .selectAs(YwProject::getName,YwDevice::getProjectName)
+                        .selectAs(YwFloor::getName,YwDevice::getFloorName)
+                        .selectAs(YwBuilding::getName,YwDevice::getBuildingName)
+                        .selectAs(YwRoom::getCode,YwDevice::getRoomName)
+                        .leftJoin(YwRoom.class,YwRoom::getId,YwDevice::getRoomId)
+                        .leftJoin(YwFloor.class,YwFloor::getId,YwRoom::getFloor)
+                        .leftJoin(YwProject.class,YwProject::getId,YwRoom::getProjectId)
+                        .leftJoin(YwBuilding.class,YwBuilding::getId,YwRoom::getBuildingId)
+                        .leftJoin("category c on t.CATE_ID = c.id")
+                        .leftJoin("category c1 on c.PARENT_ID = c1.id")
+                        .leftJoin("system_user s on t.user_id = s.id")
+                        .leftJoin("system_user s1 on t.MAINTENANCE_USER_ID = s1.id")
+                        .eq(YwDevice::getId,id)
+                        .last(" limit 1 ")
+        );
         Multifile multifile = multifileMapper.selectOne(new QueryWrapper<Multifile>().lambda()
                 .eq(Multifile::getObjId,id).eq(Multifile::getObjType,Constants.MultiFile.FN_DEVICE_FILE.getKey()).last(" limit 1"));
         if(Objects.nonNull(multifile)){
@@ -303,10 +321,12 @@
         queryWrapper.selectAll(YwDevice.class)
                 .select("c.name",YwDevice::getCategoryName)
                 .select("c1.name",YwDevice::getCategoryParentName)
-                .selectAs(SystemUser::getRealname,YwDevice::getRealName)
-                .leftJoin(SystemUser.class,SystemUser::getId,YwDevice::getUserId)
+                .select("s.realname",YwDevice::getRealName)
+                .select("s1.realname",YwDevice::getMaintenanceUserName)
                 .leftJoin("category c on t.CATE_ID = c.id")
                 .leftJoin("category c1 on c.PARENT_ID = c1.id")
+                .leftJoin("system_user s on t.user_id = s.id")
+                .leftJoin("system_user s1 on t.MAINTENANCE_USER_ID = s1.id")
                 .and(Objects.nonNull(model)&&StringUtils.isNotBlank(model.getName()),i->i.like(YwDevice::getName,model.getName()).or().like(YwDevice::getCode,model.getName()))
                 .eq(Objects.nonNull(model.getStatus()),YwDevice::getStatus,model.getStatus())
                 .eq(Objects.nonNull(model.getRoomId()),YwDevice::getRoomId,model.getRoomId())
@@ -343,7 +363,7 @@
     }
 
     @Override
-    public Set<YwDeviceCateDataVO> getDeviceCateData(YwDevice model){
+    public Set<YwDeviceParentCateDataVO> getDeviceCateData(YwDevice model){
         MPJLambdaWrapper<YwDevice> queryWrapper = new MPJLambdaWrapper<YwDevice>();
         queryWrapper.selectAll(YwDevice.class)
                 .select("c.name",YwDevice::getCategoryName)
@@ -370,6 +390,7 @@
             ywDeviceCateDataVO.setCateName(y.getCategoryName());
             ywDeviceCateDataVO.setCateParentId(y.getCateParentId());
             ywDeviceCateDataVOSet.add(ywDeviceCateDataVO);
+
             YwDeviceParentCateDataVO ywDeviceParentCateDataVO = new YwDeviceParentCateDataVO();
             ywDeviceParentCateDataVO.setCateId(y.getCateParentId());
             ywDeviceParentCateDataVO.setCateName(y.getCategoryParentName());
@@ -390,7 +411,7 @@
                     ywDeviceCateDataVOSet.stream().filter(i->Constants.equalsInteger(i.getCateParentId(),ywDeviceParentCateDataVO.getCateId())).collect(Collectors.toList())
             );
         }
-        return ywDeviceCateDataVOSet;
+        return ywDeviceParentCateDataVOSet;
     }
 
 

--
Gitblit v1.9.3