12-17-人员管理大屏-修复循环注入版-修复timeType版-消息回复-完善-修复版
This commit is contained in:
@ -50,6 +50,7 @@ import org.dromara.project.service.*;
|
|||||||
import org.dromara.system.domain.SysUser;
|
import org.dromara.system.domain.SysUser;
|
||||||
import org.dromara.system.domain.vo.SysOssVo;
|
import org.dromara.system.domain.vo.SysOssVo;
|
||||||
import org.dromara.system.domain.vo.SysUserVo;
|
import org.dromara.system.domain.vo.SysUserVo;
|
||||||
|
import org.dromara.system.mapper.SysUserMapper;
|
||||||
import org.dromara.system.service.ISysOssService;
|
import org.dromara.system.service.ISysOssService;
|
||||||
import org.dromara.system.service.ISysUserService;
|
import org.dromara.system.service.ISysUserService;
|
||||||
import org.dromara.websocket.ChatServerHandler;
|
import org.dromara.websocket.ChatServerHandler;
|
||||||
@ -63,6 +64,7 @@ import java.math.BigDecimal;
|
|||||||
import java.math.RoundingMode;
|
import java.math.RoundingMode;
|
||||||
import java.time.*;
|
import java.time.*;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
|
import java.time.temporal.ChronoUnit;
|
||||||
import java.time.temporal.TemporalAdjusters;
|
import java.time.temporal.TemporalAdjusters;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
import java.util.concurrent.CompletableFuture;
|
import java.util.concurrent.CompletableFuture;
|
||||||
@ -111,6 +113,8 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
|||||||
|
|
||||||
private final ISysUserService userService;
|
private final ISysUserService userService;
|
||||||
|
|
||||||
|
private final SysUserMapper userMapper;
|
||||||
|
|
||||||
private final ChatServerHandler chatServerHandler;
|
private final ChatServerHandler chatServerHandler;
|
||||||
|
|
||||||
// private final ISubUserSalaryDetailService userSalaryDetailService;
|
// private final ISubUserSalaryDetailService userSalaryDetailService;
|
||||||
@ -2788,6 +2792,8 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
|||||||
List<SubConstructionUser> list = constructionUserService.list(lqw);
|
List<SubConstructionUser> list = constructionUserService.list(lqw);
|
||||||
//再去从聊天服务中获取在线的ID
|
//再去从聊天服务中获取在线的ID
|
||||||
List<String> onlineUserList = ChatServerHandler.getOnlineUserList();
|
List<String> onlineUserList = ChatServerHandler.getOnlineUserList();
|
||||||
|
//先查询出用户列表
|
||||||
|
List<SysUserVo> users = userMapper.selectVoList(Wrappers.lambdaQuery());
|
||||||
//构建将要返回的 数据
|
//构建将要返回的 数据
|
||||||
List<SysUserVo> info = new ArrayList<>();
|
List<SysUserVo> info = new ArrayList<>();
|
||||||
long zx = 0; //在线
|
long zx = 0; //在线
|
||||||
@ -2803,26 +2809,46 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
|||||||
zx++;
|
zx++;
|
||||||
//此项目 在线的 userId 去获取缓存的坐标信息 GpsEquipmentServiceImpl.setData()
|
//此项目 在线的 userId 去获取缓存的坐标信息 GpsEquipmentServiceImpl.setData()
|
||||||
String key = "rydw_userId_:" + constructionUser.getSysUserId();
|
String key = "rydw_userId_:" + constructionUser.getSysUserId();
|
||||||
SysUserVo cacheUserVo = RedisUtils.getCacheObject(key);
|
org.dromara.gps.domain.bo.GpsEquipmentSonBo cache = RedisUtils.getCacheObject(key);
|
||||||
if (cacheUserVo == null){
|
if (cache == null){
|
||||||
continue;
|
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());
|
||||||
//去判断是什么种类的用户
|
//去判断是什么种类的用户
|
||||||
list.stream().filter(item -> item.getSysUserId().equals(constructionUser.getSysUserId()))
|
// list.stream().filter(item -> item.getSysUserId().equals(constructionUser.getSysUserId()))
|
||||||
.findFirst().ifPresent(item -> {
|
// .findFirst().ifPresent(item -> {
|
||||||
SysUserVo sysUserVo = userService.queryById(item.getSysUserId());
|
// //app用户类型 0-施工人员 1-管理人员 2-分包人员
|
||||||
if (sysUserVo != null){
|
// 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);
|
||||||
|
// }
|
||||||
|
// });
|
||||||
//app用户类型 0-施工人员 1-管理人员 2-分包人员
|
//app用户类型 0-施工人员 1-管理人员 2-分包人员
|
||||||
if (sysUserVo.getAppUserType().equals("0")){
|
if (cacheSysUserVo.getAppUserType().equals("0")){
|
||||||
cacheUserVo.setJslx("施工");
|
cacheSysUserVo.setJslx("施工");
|
||||||
sg.set(sg.getAndIncrement()+1);
|
sg.set(sg.getAndIncrement()+1);
|
||||||
}else if (sysUserVo.getAppUserType().equals("2")){
|
}else if (cacheSysUserVo.getAppUserType().equals("2")){
|
||||||
cacheUserVo.setJslx("分包");
|
cacheSysUserVo.setJslx("分包");
|
||||||
fb.set(fb.getAndIncrement()+1);
|
fb.set(fb.getAndIncrement()+1);
|
||||||
}
|
}
|
||||||
}
|
info.add(cacheSysUserVo);
|
||||||
});
|
|
||||||
info.add(cacheUserVo);
|
|
||||||
}else {
|
}else {
|
||||||
lx++;
|
lx++;
|
||||||
}
|
}
|
||||||
@ -2849,16 +2875,28 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
|||||||
LambdaQueryWrapper<SubConstructionUser> lqw = new LambdaQueryWrapper<>();
|
LambdaQueryWrapper<SubConstructionUser> lqw = new LambdaQueryWrapper<>();
|
||||||
lqw.eq(SubConstructionUser::getProjectId, projectId);
|
lqw.eq(SubConstructionUser::getProjectId, projectId);
|
||||||
List<SubConstructionUser> list = constructionUserService.list(lqw);
|
List<SubConstructionUser> list = constructionUserService.list(lqw);
|
||||||
|
//先查询出用户列表
|
||||||
|
List<SysUserVo> users = userMapper.selectVoList(Wrappers.lambdaQuery());
|
||||||
//根据分包和班组的id进行分类 统计都有多少人 未入场人员没有两项数据 无法统计 仅能计算为总数
|
//根据分包和班组的id进行分类 统计都有多少人 未入场人员没有两项数据 无法统计 仅能计算为总数
|
||||||
List<RyglWebSocketVo> fbList = new ArrayList<>();
|
List<RyglWebSocketVo> fbList = new ArrayList<>();
|
||||||
List<RyglWebSocketVo> bzList = new ArrayList<>();
|
List<RyglWebSocketVo> bzList = new ArrayList<>();
|
||||||
|
|
||||||
for (SubConstructionUser constructionUser : list) {
|
for (SubConstructionUser constructionUser : list) {
|
||||||
//统计该项目下的分包和班组各应有多少人
|
//统计该项目下的分包和班组各应有多少人
|
||||||
SysUserVo sysUserVo = userService.queryById(constructionUser.getSysUserId());
|
SysUserVo sysUserVo = null;
|
||||||
|
for (SysUserVo user : users) {
|
||||||
|
if (user.getUserId().equals(constructionUser.getSysUserId())){
|
||||||
|
sysUserVo = user;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
}
|
||||||
if (sysUserVo == null){
|
if (sysUserVo == null){
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
|
// SysUserVo sysUserVo = userService.queryById(constructionUser.getSysUserId());
|
||||||
|
// if (sysUserVo == null){
|
||||||
|
// continue;
|
||||||
|
// }
|
||||||
//判断userType app用户类型 0-施工人员 1-管理人员 2-分包人员
|
//判断userType app用户类型 0-施工人员 1-管理人员 2-分包人员
|
||||||
if (sysUserVo.getAppUserType().equals("0")){
|
if (sysUserVo.getAppUserType().equals("0")){
|
||||||
checkAndSetValue(bzList,constructionUser,0,timeType,projectId);
|
checkAndSetValue(bzList,constructionUser,0,timeType,projectId);
|
||||||
@ -2898,12 +2936,23 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
|||||||
}
|
}
|
||||||
|
|
||||||
//总人数
|
//总人数
|
||||||
|
if (timeType == 2L) {
|
||||||
|
// 获取本周一到今天的天数
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
LocalDate monday = today.with(DayOfWeek.MONDAY);
|
||||||
|
timeType = ChronoUnit.DAYS.between(monday, today) + 1;
|
||||||
|
} else if (timeType == 3L) {
|
||||||
|
// 获取本月1日到今天的天数
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
LocalDate firstDay = today.withDayOfMonth(1);
|
||||||
|
timeType = ChronoUnit.DAYS.between(firstDay, today) + 1;
|
||||||
|
}
|
||||||
zrs = (long) list.size() * timeType;
|
zrs = (long) list.size() * timeType;
|
||||||
//总出勤人
|
//总出勤人
|
||||||
cqr = fbcqr + bzcqr;
|
cqr = fbcqr + bzcqr;
|
||||||
//出勤率
|
//出勤率
|
||||||
if (zrs != 0L){
|
if (zrs != 0L){
|
||||||
cql = (BigDecimal.valueOf(fbcqr).add(BigDecimal.valueOf(bzcqr))).divide(BigDecimal.valueOf(zrs),2,RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
|
cql = ((BigDecimal.valueOf(fbcqr).add(BigDecimal.valueOf(bzcqr)))).divide(BigDecimal.valueOf(zrs),2,RoundingMode.HALF_UP).multiply(BigDecimal.valueOf(100));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@ -2919,10 +2968,16 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
|
|||||||
*/
|
*/
|
||||||
private void checkAndSetValue(List<RyglWebSocketVo> ryglWebSocketVoList, SubConstructionUser info,int type,Long time,Long projectId){
|
private void checkAndSetValue(List<RyglWebSocketVo> ryglWebSocketVoList, SubConstructionUser info,int type,Long time,Long projectId){
|
||||||
//timeType 1:今天 2:本周 3:本月 此参数的校验放在连接时获取参数进行校验
|
//timeType 1:今天 2:本周 3:本月 此参数的校验放在连接时获取参数进行校验
|
||||||
if (time == 2L){
|
if (time == 2L) {
|
||||||
time = 7L;
|
// 获取本周一到今天的天数
|
||||||
}else if (time == 3L){
|
LocalDate today = LocalDate.now();
|
||||||
time = 30L;
|
LocalDate monday = today.with(DayOfWeek.MONDAY);
|
||||||
|
time = ChronoUnit.DAYS.between(monday, today) + 1;
|
||||||
|
} else if (time == 3L) {
|
||||||
|
// 获取本月1日到今天的天数
|
||||||
|
LocalDate today = LocalDate.now();
|
||||||
|
LocalDate firstDay = today.withDayOfMonth(1);
|
||||||
|
time = ChronoUnit.DAYS.between(firstDay, today) + 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
Long finalTime = time;
|
Long finalTime = time;
|
||||||
|
|||||||
Reference in New Issue
Block a user