考勤
This commit is contained in:
		| @ -5,6 +5,7 @@ import lombok.Data; | |||||||
|  |  | ||||||
| import java.io.Serial; | import java.io.Serial; | ||||||
| import java.io.Serializable; | import java.io.Serializable; | ||||||
|  | import java.math.BigDecimal; | ||||||
| import java.time.LocalDate; | import java.time.LocalDate; | ||||||
| import java.util.Date; | import java.util.Date; | ||||||
|  |  | ||||||
| @ -43,4 +44,20 @@ public class BusAttendanceClockDateForTwoWeekVo implements Serializable { | |||||||
|      */ |      */ | ||||||
|     private Integer leave; |     private Integer leave; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 应到人数 | ||||||
|  |      */ | ||||||
|  |     private Integer allUserNum; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 实际打卡人数 | ||||||
|  |      */ | ||||||
|  |     private Integer clockNum; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 考勤率 | ||||||
|  |      */ | ||||||
|  |     private BigDecimal attendanceRate; | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -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.PageQuery; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | import org.dromara.common.mybatis.core.page.TableDataInfo; | ||||||
| import org.dromara.common.satoken.utils.LoginHelper; | import org.dromara.common.satoken.utils.LoginHelper; | ||||||
|  | import org.dromara.common.utils.BigDecimalUtil; | ||||||
| import org.dromara.common.utils.IdCardEncryptorUtil; | import org.dromara.common.utils.IdCardEncryptorUtil; | ||||||
| import org.dromara.common.utils.JSTUtil; | import org.dromara.common.utils.JSTUtil; | ||||||
| import org.dromara.contractor.domain.SubConstructionUser; | import org.dromara.contractor.domain.SubConstructionUser; | ||||||
| @ -1152,8 +1153,14 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|             .ne(SubConstructionUser::getUserRole, "0") |             .ne(SubConstructionUser::getUserRole, "0") | ||||||
|         ).stream().map(SubConstructionUser::getSysUserId).toList(); |         ).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天,包含今天 |         // 往前14天,包含今天 | ||||||
|         LocalDate startDate = now.minusDays(13); |         LocalDate startDate = now.minusDays(14); | ||||||
|         List<BusAttendance> list = list(Wrappers.<BusAttendance>lambdaQuery() |         List<BusAttendance> list = list(Wrappers.<BusAttendance>lambdaQuery() | ||||||
|             .eq(BusAttendance::getProjectId, projectId) |             .eq(BusAttendance::getProjectId, projectId) | ||||||
|             .notIn(CollectionUtil.isNotEmpty(excludeUserIds),BusAttendance::getUserId, excludeUserIds) |             .notIn(CollectionUtil.isNotEmpty(excludeUserIds),BusAttendance::getUserId, excludeUserIds) | ||||||
| @ -1206,6 +1213,13 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|             vo.setAttendance(full); |             vo.setAttendance(full); | ||||||
|             vo.setHalfAttendance(half); |             vo.setHalfAttendance(half); | ||||||
|             vo.setAbsenteeism(absent); |             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); |             result.add(vo); | ||||||
|             currentDate = currentDate.plusDays(1); |             currentDate = currentDate.plusDays(1); | ||||||
|  | |||||||
| @ -21,6 +21,8 @@ import org.dromara.common.core.utils.ObjectUtils; | |||||||
| import org.dromara.common.core.utils.StringUtils; | import org.dromara.common.core.utils.StringUtils; | ||||||
| import org.dromara.common.mybatis.core.page.PageQuery; | import org.dromara.common.mybatis.core.page.PageQuery; | ||||||
| import org.dromara.common.mybatis.core.page.TableDataInfo; | 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.contractor.service.ISubUserSalaryDetailService; | ||||||
| import org.dromara.project.domain.*; | import org.dromara.project.domain.*; | ||||||
| import org.dromara.project.domain.dto.reissuecard.BusReissueCardAddReq; | import org.dromara.project.domain.dto.reissuecard.BusReissueCardAddReq; | ||||||
| @ -84,6 +86,9 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper, | |||||||
|     private  ISubUserSalaryDetailService userSalaryDetailService; |     private  ISubUserSalaryDetailService userSalaryDetailService; | ||||||
|     @Resource |     @Resource | ||||||
|     private ChatServerHandler chatServerHandler; |     private ChatServerHandler chatServerHandler; | ||||||
|  |  | ||||||
|  |     @Resource | ||||||
|  |     private ISubConstructionUserService constructionUserService; | ||||||
|     /** |     /** | ||||||
|      * 查询施工人员补卡申请 |      * 查询施工人员补卡申请 | ||||||
|      * |      * | ||||||
| @ -370,6 +375,11 @@ public class BusReissueCardServiceImpl extends ServiceImpl<BusReissueCardMapper, | |||||||
|         if (CollUtil.isNotEmpty(busReissueCards)) { |         if (CollUtil.isNotEmpty(busReissueCards)) { | ||||||
|             throw new ServiceException("已提交该申请"); |             throw new ServiceException("已提交该申请"); | ||||||
|         } |         } | ||||||
|  |         //插入班组 | ||||||
|  |         SubConstructionUser bySysUserId = constructionUserService.getBySysUserId(req.getUserId()); | ||||||
|  |         if (bySysUserId != null) { | ||||||
|  |             bean.setTeamId(bySysUserId.getTeamId()); | ||||||
|  |         } | ||||||
|         save(bean); |         save(bean); | ||||||
|         //修改为已处理 |         //修改为已处理 | ||||||
|         attendanceService.update(Wrappers.<BusAttendance>lambdaUpdate() |         attendanceService.update(Wrappers.<BusAttendance>lambdaUpdate() | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 zt
					zt