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