helixiao пре 1 година
родитељ
комит
64742f0cfa

+ 8 - 0
src/main/java/com/ydtech/modules/admin/model/po/SysPcAddressHistory.java

@@ -83,4 +83,12 @@ public class SysPcAddressHistory implements Serializable {
     @TableField(exist = false)
     private Integer type=2;
 
+    @ApiModelProperty(value = "所属机构")
+    @TableField(exist = false)
+    private String deptName;
+
+    @ApiModelProperty(value = "领导人姓名")
+    @TableField(exist = false)
+    private String leaderName;
+
 }

+ 19 - 13
src/main/java/com/ydtech/modules/admin/service/impl/SysGeographyPositionServiceImpl.java

@@ -70,6 +70,7 @@ public class SysGeographyPositionServiceImpl extends ServiceImpl<SysGeographyPos
         for (SysGeographyPositionInfoVo sysGeographyPositionInfoVo : sysGeographyPositionList) {
             SysUser sysUser = sysUserService.getById(sysGeographyPositionInfoVo.getId());
             if (sysUser == null) continue;
+            sysGeographyPositionInfoVo.setLeaderName(sysUser.getLeaderName());
             SysDept sysDept = sysDeptMapper.selectOne(new LambdaQueryWrapper<SysDept>()
                     .eq(SysDept::getId, sysUser.getDeptId()).eq(SysDept::getDelFlag, 0));
             if (sysDept == null) continue;
@@ -273,8 +274,11 @@ public class SysGeographyPositionServiceImpl extends ServiceImpl<SysGeographyPos
             appGeographyHistoryInfoVo.setList(geographyPosition);
 
             List<SysGeographyPositionRecord> sysGeographyPositionRecords =sysGeographyPositionRecordMapper.getGeographyPositionRecord(startTime,source);
+            extracted(sysGeographyPositionRecords);
             System.out.println("********************" + sysGeographyPositionRecords.size());
             appGeographyHistoryInfoVo.setPositionRecordList(sysGeographyPositionRecords);
+
+
         }else {
             SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
             startTime = startTime + " 00:00:01";
@@ -301,19 +305,7 @@ public class SysGeographyPositionServiceImpl extends ServiceImpl<SysGeographyPos
             appGeographyHistoryInfoVo.setList(geographyPosition);
 
             List<SysGeographyPositionRecord> sysGeographyPositionRecords =sysGeographyPositionRecordMapper.getGeographyPositionHistory(startTime,endTime,source);
-            for (SysGeographyPositionRecord sysGeographyPositionRecord : sysGeographyPositionRecords) {
-
-                SysUser sysUser = sysUserService.getById(sysGeographyPositionRecord.getUserId());
-                if (sysUser == null) continue;
-                SysDept sysDept = sysDeptMapper.selectOne(new LambdaQueryWrapper<SysDept>()
-                        .eq(SysDept::getId, sysUser.getDeptId()).eq(SysDept::getDelFlag, 0));
-                if (sysDept == null) continue;
-                sysGeographyPositionRecord.setDeptName(sysDept.getName());
-
-                SysGeographyPosition sysGeographyPosition = sysGeographyPositionMapper.selectOne(new LambdaQueryWrapper<SysGeographyPosition>()
-                        .eq(SysGeographyPosition::getId,sysGeographyPositionRecord.getUserId()));
-                sysGeographyPositionRecord.setLeaderName(sysGeographyPosition.getLeaderName());
-            }
+            extracted(sysGeographyPositionRecords);
             System.out.println("********************" + sysGeographyPositionRecords.size());
             appGeographyHistoryInfoVo.setPositionRecordList(sysGeographyPositionRecords);
 
@@ -322,6 +314,20 @@ public class SysGeographyPositionServiceImpl extends ServiceImpl<SysGeographyPos
         return appGeographyHistoryInfoVo;
     }
 
+    private void extracted(List<SysGeographyPositionRecord> sysGeographyPositionRecords) {
+        for (SysGeographyPositionRecord sysGeographyPositionRecord : sysGeographyPositionRecords) {
+
+            SysUser sysUser = sysUserService.getById(sysGeographyPositionRecord.getUserId());
+            if (sysUser == null) continue;
+            sysGeographyPositionRecord.setLeaderName(sysUser.getLeaderName());
+            SysDept sysDept = sysDeptMapper.selectById(sysUser.getDeptId());
+            if (sysDept == null) continue;
+            sysGeographyPositionRecord.setDeptName(sysDept.getName());
+
+
+        }
+    }
+
     @Override
     public List<SysGeographyPosition> getOnlinePeople() {
 

+ 22 - 0
src/main/java/com/ydtech/modules/admin/service/impl/SysPcAddressServiceImpl.java

@@ -10,6 +10,7 @@ import com.ydtech.modules.admin.dao.SysDeptMapper;
 import com.ydtech.modules.admin.dao.SysPcAddressHistoryMapper;
 import com.ydtech.modules.admin.dao.SysPcAddressMapper;
 import com.ydtech.modules.admin.model.SysDept;
+import com.ydtech.modules.admin.model.SysGeographyPositionRecord;
 import com.ydtech.modules.admin.model.SysUser;
 import com.ydtech.modules.admin.model.dto.*;
 import com.ydtech.modules.admin.model.po.SysPcAddressHistory;
@@ -99,6 +100,11 @@ public class SysPcAddressServiceImpl extends ServiceImpl<SysPcAddressMapper, Sys
                 .eq(StringUtils.isNotEmpty(sysPcAddressDto.getSource()), SysPcAddress::getSource, sysPcAddressDto.getSource())
                 .eq(sysPcAddressDto.getStatus() != null, SysPcAddress::getStatus, sysPcAddressDto.getStatus())
                 .orderByDesc(SysPcAddress::getOperationTime));
+        for (SysPcAddress sysPcAddress : sysPcAddresses) {
+            SysUser sysUser = sysUserService.getById(sysPcAddress.getUserId());
+            if (sysUser == null) continue;
+            sysPcAddress.setLeaderName(sysUser.getLeaderName());
+        }
 
         return sysPcAddresses;
     }
@@ -233,6 +239,7 @@ public class SysPcAddressServiceImpl extends ServiceImpl<SysPcAddressMapper, Sys
             pcAddressHistoryInfoVo.setList(pcAddress);
 
             List<SysPcAddressHistory> sysPcAddressHistories = sysPcAddressHistoryMapper.getPcAddressInfo(startTime,source);
+            extracted(sysPcAddressHistories);
             System.out.println("********************" + sysPcAddressHistories.size());
             pcAddressHistoryInfoVo.setPcAddressList(sysPcAddressHistories);
 
@@ -263,6 +270,7 @@ public class SysPcAddressServiceImpl extends ServiceImpl<SysPcAddressMapper, Sys
             pcAddressHistoryInfoVo.setList(pcAddress);
 
             List<SysPcAddressHistory> sysPcAddressHistories = sysPcAddressHistoryMapper.getPcAddressHistory(startTime, endTime,source);
+            extracted(sysPcAddressHistories);
             System.out.println("********************" + sysPcAddressHistories.size());
             pcAddressHistoryInfoVo.setPcAddressList(sysPcAddressHistories);
         }
@@ -270,6 +278,20 @@ public class SysPcAddressServiceImpl extends ServiceImpl<SysPcAddressMapper, Sys
         return pcAddressHistoryInfoVo;
     }
 
+    private void extracted(List<SysPcAddressHistory> sysPcAddressHistories) {
+        for (SysPcAddressHistory sysPcAddressHistory : sysPcAddressHistories) {
+
+            SysUser sysUser = sysUserService.getById(sysPcAddressHistory.getUserId());
+            if (sysUser == null) continue;
+            sysPcAddressHistory.setLeaderName(sysUser.getLeaderName());
+            SysDept sysDept = sysDeptMapper.selectById(sysUser.getDeptId());
+            if (sysDept == null) continue;
+            sysPcAddressHistory.setDeptName(sysDept.getName());
+
+
+        }
+    }
+
     @Override
     public List<SysPcAddress> getOnlinePeople() {
         return sysPcAddressMapper.selectList(new LambdaQueryWrapper<SysPcAddress>().eq(SysPcAddress::getStatus, 1));