This commit is contained in:
zt
2025-09-30 17:45:56 +08:00
parent 3371ef9c1c
commit 334ff20129
3 changed files with 42 additions and 1 deletions

View File

@ -5,6 +5,7 @@ import lombok.Data;
import java.io.Serial;
import java.io.Serializable;
import java.math.BigDecimal;
import java.time.LocalDate;
import java.util.Date;
@ -43,4 +44,20 @@ public class BusAttendanceClockDateForTwoWeekVo implements Serializable {
*/
private Integer leave;
/**
* 应到人数
*/
private Integer allUserNum;
/**
* 实际打卡人数
*/
private Integer clockNum;
/**
* 考勤率
*/
private BigDecimal attendanceRate;
}

View File

@ -28,6 +28,7 @@ import org.dromara.common.domain.GeoPoint;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.common.satoken.utils.LoginHelper;
import org.dromara.common.utils.BigDecimalUtil;
import org.dromara.common.utils.IdCardEncryptorUtil;
import org.dromara.common.utils.JSTUtil;
import org.dromara.contractor.domain.SubConstructionUser;
@ -1152,8 +1153,14 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
.ne(SubConstructionUser::getUserRole, "0")
).stream().map(SubConstructionUser::getSysUserId).toList();
List<Long> allUserIds = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery()
.eq(SubConstructionUser::getUserRole, "0")
.eq(SubConstructionUser::getProjectId,projectId)
).stream().map(SubConstructionUser::getSysUserId).toList();
// 往前14天包含今天
LocalDate startDate = now.minusDays(13);
LocalDate startDate = now.minusDays(14);
List<BusAttendance> list = list(Wrappers.<BusAttendance>lambdaQuery()
.eq(BusAttendance::getProjectId, projectId)
.notIn(CollectionUtil.isNotEmpty(excludeUserIds),BusAttendance::getUserId, excludeUserIds)
@ -1206,6 +1213,13 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B
vo.setAttendance(full);
vo.setHalfAttendance(half);
vo.setAbsenteeism(absent);
//如果是当天,则计算考勤率
if (currentDate.equals(now)) {
vo.setAllUserNum(allUserIds.size());
vo.setClockNum(full+half);
vo.setAttendanceRate(BigDecimalUtil.toPercentage(new BigDecimal(full+half),
new BigDecimal(allUserIds.size())));
}
result.add(vo);
currentDate = currentDate.plusDays(1);

View File

@ -21,6 +21,8 @@ import org.dromara.common.core.utils.ObjectUtils;
import org.dromara.common.core.utils.StringUtils;
import org.dromara.common.mybatis.core.page.PageQuery;
import org.dromara.common.mybatis.core.page.TableDataInfo;
import org.dromara.contractor.domain.SubConstructionUser;
import org.dromara.contractor.service.ISubConstructionUserService;
import org.dromara.contractor.service.ISubUserSalaryDetailService;
import org.dromara.project.domain.*;
import org.dromara.project.domain.dto.reissuecard.BusReissueCardAddReq;
@ -84,6 +86,9 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper,
private ISubUserSalaryDetailService userSalaryDetailService;
@Resource
private ChatServerHandler chatServerHandler;
@Resource
private ISubConstructionUserService constructionUserService;
/**
* 查询施工人员补卡申请
*
@ -370,6 +375,11 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper,
if (CollUtil.isNotEmpty(busReissueCards)) {
throw new ServiceException("已提交该申请");
}
//插入班组
SubConstructionUser bySysUserId = constructionUserService.getBySysUserId(req.getUserId());
if (bySysUserId != null) {
bean.setTeamId(bySysUserId.getTeamId());
}
save(bean);
//修改为已处理
attendanceService.update(Wrappers.<BusAttendance>lambdaUpdate()