12-22-大屏-人员管理-筛选人数
This commit is contained in:
@ -229,7 +229,7 @@ public interface IBusAttendanceService extends IService<BusAttendance>{
|
||||
*/
|
||||
Long getAttendanceUserCountByDate(Long projectId,LocalDate startDate, LocalDate endDate);
|
||||
|
||||
Map<String, String> getRyglOnlineUserInfoData(Long projectId);
|
||||
Map<String, String> getRyglOnlineUserInfoData(Long projectId,String token);
|
||||
|
||||
void getAttendanceInfo(Long projectId,Long timeType,Map<String, String> map);
|
||||
|
||||
|
||||
@ -2779,18 +2779,37 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
* 获取手机app在线离线数据 + 在线人员坐标 + 分包和施工在线人员数量
|
||||
*/
|
||||
@Override
|
||||
public Map<String, String> getRyglOnlineUserInfoData(Long projectId){
|
||||
public Map<String, String> getRyglOnlineUserInfoData(Long projectId,String token){
|
||||
//获取该项目的在线人员 再分辨出种类
|
||||
//先获取该项目所有人员
|
||||
//先获取该项目所有人员 走现有方法
|
||||
LambdaQueryWrapper<SubConstructionUser> lqw = new LambdaQueryWrapper<>();
|
||||
lqw.eq(SubConstructionUser::getProjectId, projectId);
|
||||
lqw.eq(SubConstructionUser::getStatus,"0");
|
||||
//未入场人员也要统计坐标 打卡不统计(存疑)
|
||||
// lqw.and(lqw1 ->
|
||||
// lqw1.isNotNull(SubConstructionUser::getTeamId)
|
||||
// .or()
|
||||
// .isNotNull(SubConstructionUser::getContractorId));
|
||||
List<SubConstructionUser> list = constructionUserService.list(lqw);
|
||||
|
||||
// SubConstructionUserQueryReq req = new SubConstructionUserQueryReq();
|
||||
// req.setProjectId(projectId);
|
||||
// LoginUser loginUser = LoginHelper.getLoginUser(token);
|
||||
// Long userId = loginUser.getUserId();
|
||||
// SysUserVo sysUserVo = userService.selectUserById(userId);
|
||||
// String appUserType = sysUserVo.getAppUserType();
|
||||
// List<Long> list1 = new ArrayList<>();
|
||||
// if ("2".equals(appUserType)) {
|
||||
// List<BusProjectTeamAppVo> byUserId = projectTeamService.getByUserId(userId, req.getProjectId());
|
||||
//
|
||||
// if (CollectionUtil.isEmpty(byUserId)) {
|
||||
// return new HashMap<>();
|
||||
// }
|
||||
// list1 = byUserId.stream().map(BusProjectTeamAppVo::getId).toList();
|
||||
// }
|
||||
//
|
||||
// // 查询数据库
|
||||
// LambdaQueryWrapper<SubConstructionUser> wrapper = new LambdaQueryWrapper<>();
|
||||
// wrapper.eq(SubConstructionUser::getProjectId, req.getProjectId());
|
||||
// wrapper.in(req.getTeamId() == null && "2".equals(appUserType), SubConstructionUser::getTeamId, list1);
|
||||
// wrapper.eq(SubConstructionUser::getUserRole, "0");
|
||||
// List<SubConstructionUser> list = constructionUserService.list(wrapper);
|
||||
|
||||
//再去从聊天服务中获取在线的ID
|
||||
List<String> onlineUserList = ChatServerHandler.getOnlineUserList();
|
||||
//先查询出用户列表
|
||||
@ -2804,49 +2823,47 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
||||
AtomicLong sg = new AtomicLong(); //施工
|
||||
sg.set(0);
|
||||
//将属于该项目的在线ID过滤出来
|
||||
Long zs = 0L;
|
||||
for (SubConstructionUser constructionUser : list) {
|
||||
//先过滤人种
|
||||
for (SysUserVo user : users) {
|
||||
if (user.getUserId().equals(constructionUser.getSysUserId())){
|
||||
if (user.getAppUserType().equals("0") || user.getAppUserType().equals("2")){
|
||||
//再进行在线判断和人种分类
|
||||
if (onlineUserList.contains(constructionUser.getSysUserId().toString())){
|
||||
//如果是此项目的在线人员 没有缓存信息 应该是还没来得及发送坐标信息进行缓存
|
||||
//此项目 在线的 userId 去获取缓存的坐标信息 GpsEquipmentServiceImpl.setData()
|
||||
String key = "rydw_userId_:" + constructionUser.getSysUserId();
|
||||
org.dromara.gps.domain.bo.GpsEquipmentSonBo cache = RedisUtils.getCacheObject(key);
|
||||
if (cache == null){
|
||||
continue;
|
||||
}
|
||||
SysUserVo cacheSysUserVo = null;
|
||||
for (SysUserVo user : users) {
|
||||
if (user.getUserId().equals(constructionUser.getSysUserId())){
|
||||
cacheSysUserVo = user;
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (cacheSysUserVo == null){
|
||||
continue;
|
||||
}
|
||||
cacheSysUserVo.setJd(cache.getLocLongitude());
|
||||
cacheSysUserVo.setWd(cache.getLocLatitude());
|
||||
cacheSysUserVo.setZhdwsj(cache.getCreateTime());
|
||||
cacheSysUserVo.setAvatarUrl(cache.getAvatar());
|
||||
cacheSysUserVo.setGz(constructionUser.getTypeOfWork());
|
||||
user.setJd(cache.getLocLongitude());
|
||||
user.setWd(cache.getLocLatitude());
|
||||
user.setZhdwsj(cache.getCreateTime());
|
||||
user.setAvatarUrl(cache.getAvatar());
|
||||
user.setGz(constructionUser.getTypeOfWork());
|
||||
//app用户类型 0-施工人员 1-管理人员 2-分包人员
|
||||
if (cacheSysUserVo.getAppUserType().equals("0")){
|
||||
cacheSysUserVo.setJslx("施工");
|
||||
if (user.getAppUserType().equals("0")){
|
||||
user.setJslx("施工");
|
||||
sg.set(sg.getAndIncrement()+1);
|
||||
}else if (cacheSysUserVo.getAppUserType().equals("2")){
|
||||
cacheSysUserVo.setJslx("分包");
|
||||
}else if (user.getAppUserType().equals("2")){
|
||||
user.setJslx("分包");
|
||||
fb.set(fb.getAndIncrement()+1);
|
||||
}
|
||||
zx++;
|
||||
info.add(cacheSysUserVo);
|
||||
info.add(user);
|
||||
}else {
|
||||
lx++;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
//将数据返回
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("zs",String.valueOf(zx + lx)); //总数
|
||||
map.put("zx", String.valueOf(zx)); //在线
|
||||
map.put("lx", String.valueOf(lx)); //离线
|
||||
map.put("zx", String.valueOf(zx));
|
||||
map.put("lx", String.valueOf(lx));
|
||||
map.put("fbsl", String.valueOf(fb.get())); //分包
|
||||
map.put("sg", String.valueOf(sg.get())); //施工
|
||||
map.put("info", JSONUtil.toJsonStr(info)); //jd经度 wd维度 jslx角色类型
|
||||
|
||||
@ -101,12 +101,13 @@ public class BigScreenWebSocketServer {
|
||||
break;
|
||||
case 2:
|
||||
Long timeType = Long.parseLong(params.get("timeType").getFirst());
|
||||
String token = params.get("Authorization").getFirst().split("Bearer ")[1];
|
||||
//判断参数
|
||||
if (timeType != 1L && timeType != 2L && timeType != 3L) {
|
||||
throw new RuntimeException("时间类型参数错误");
|
||||
}
|
||||
//先获取左边坐标得到map
|
||||
Map<String, String> infoData = busAttendanceService.getRyglOnlineUserInfoData(projectId);
|
||||
Map<String, String> infoData = busAttendanceService.getRyglOnlineUserInfoData(projectId,token);
|
||||
//获取右边数据
|
||||
busAttendanceService.getAttendanceInfo(projectId, timeType, infoData);
|
||||
//返回数据
|
||||
@ -182,12 +183,13 @@ public class BigScreenWebSocketServer {
|
||||
break;
|
||||
case 2:
|
||||
String timeType = JSONUtil.parseObj(message).get("timeType").toString();
|
||||
// String token = JSONUtil.parseObj(message).get("token").toString().split("Bearer%20")[0];
|
||||
//判断参数
|
||||
if (Long.parseLong(timeType) != 1L && Long.parseLong(timeType) != 2L && Long.parseLong(timeType) != 3L) {
|
||||
throw new RuntimeException("时间类型参数错误");
|
||||
}
|
||||
//先获取左边坐标得到map
|
||||
Map<String, String> infoData = busAttendanceService.getRyglOnlineUserInfoData(projectId);
|
||||
Map<String, String> infoData = busAttendanceService.getRyglOnlineUserInfoData(projectId,null);
|
||||
//获取右边数据
|
||||
busAttendanceService.getAttendanceInfo(projectId, Long.valueOf(timeType), infoData);
|
||||
//返回数据
|
||||
|
||||
Reference in New Issue
Block a user