bug修改
This commit is contained in:
		| @ -142,7 +142,9 @@ public class ProjectBigScreenServiceImpl implements ProjectBigScreenService { | |||||||
|         ProjectPeopleVo vo = new ProjectPeopleVo(); |         ProjectPeopleVo vo = new ProjectPeopleVo(); | ||||||
|         // 获取施工人员总数 |         // 获取施工人员总数 | ||||||
|         Long count = constructionUserService.lambdaQuery() |         Long count = constructionUserService.lambdaQuery() | ||||||
|             .eq(SubConstructionUser::getProjectId, projectId).count(); |             .eq(SubConstructionUser::getProjectId, projectId) | ||||||
|  |             .isNotNull(SubConstructionUser::getTeamId) | ||||||
|  |             .count(); | ||||||
|         BigDecimal countDec = BigDecimal.valueOf(count); |         BigDecimal countDec = BigDecimal.valueOf(count); | ||||||
|         vo.setPeopleCount(countDec); |         vo.setPeopleCount(countDec); | ||||||
|         // 获取考勤数据 |         // 获取考勤数据 | ||||||
|  | |||||||
| @ -76,6 +76,8 @@ import java.time.temporal.ChronoUnit; | |||||||
| import java.util.*; | import java.util.*; | ||||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||||
|  |  | ||||||
|  | import static org.dromara.project.domain.enums.BusAttendanceClockStatusEnum.ATTENDANCE_LIST; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 施工人员Service业务层处理 |  * 施工人员Service业务层处理 | ||||||
|  * |  * | ||||||
| @ -1084,18 +1086,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU | |||||||
|     @Override |     @Override | ||||||
|     public Page<SubConstructionUserAttendanceTotalVo> getAttendanceTotalVoPage(SubConstructionUserAttendanceQueryReq req, |     public Page<SubConstructionUserAttendanceTotalVo> getAttendanceTotalVoPage(SubConstructionUserAttendanceQueryReq req, | ||||||
|                                                                                PageQuery pageQuery) { |                                                                                PageQuery pageQuery) { | ||||||
|         LambdaQueryWrapper<SubConstructionUser> lqw = Wrappers.lambdaQuery(); |  | ||||||
|         // 从对象中取值 |  | ||||||
|         String userName = req.getUserName(); |  | ||||||
|         Long projectId = req.getProjectId(); |  | ||||||
|         Long teamId = req.getTeamId(); |  | ||||||
|         String typeOfWork = req.getTypeOfWork(); |  | ||||||
|         String clockMonth = req.getClockDate(); |         String clockMonth = req.getClockDate(); | ||||||
|         // 联表查询 |  | ||||||
|         LambdaQueryWrapper<BusAttendance> attendanceLqw = Wrappers.lambdaQuery(BusAttendance.class) |  | ||||||
|             .eq(BusAttendance::getProjectId, projectId); |  | ||||||
|         if (ObjectUtils.isNotEmpty(clockMonth)) { |  | ||||||
|             // 校验月份格式 |  | ||||||
|         if (!DateConstant.YEAR_MONTH_PATTERN.matcher(clockMonth).matches()) { |         if (!DateConstant.YEAR_MONTH_PATTERN.matcher(clockMonth).matches()) { | ||||||
|             throw new ServiceException("月份格式不正确", HttpStatus.BAD_REQUEST); |             throw new ServiceException("月份格式不正确", HttpStatus.BAD_REQUEST); | ||||||
|         } |         } | ||||||
| @ -1108,13 +1099,38 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU | |||||||
|         // 计算当月第一天 / 最后一天 |         // 计算当月第一天 / 最后一天 | ||||||
|         LocalDate start = yearMonth.atDay(1); |         LocalDate start = yearMonth.atDay(1); | ||||||
|         LocalDate end = yearMonth.atEndOfMonth(); |         LocalDate end = yearMonth.atEndOfMonth(); | ||||||
|             attendanceLqw.between(BusAttendance::getClockDate, start, end); |  | ||||||
|             List<Long> userIdList = attendanceService.list(attendanceLqw) |         LambdaQueryWrapper<SubConstructionUser> lqw = Wrappers.lambdaQuery(); | ||||||
|                 .stream().map(BusAttendance::getUserId).toList(); |         // 从对象中取值 | ||||||
|             if (CollUtil.isNotEmpty(userIdList)) { |         String userName = req.getUserName(); | ||||||
|                 lqw.in(SubConstructionUser::getSysUserId, userIdList); |         Long projectId = req.getProjectId(); | ||||||
|             } |         Long teamId = req.getTeamId(); | ||||||
|         } |         String typeOfWork = req.getTypeOfWork(); | ||||||
|  |  | ||||||
|  |         // 联表查询 | ||||||
|  |         LambdaQueryWrapper<BusAttendance> attendanceLqw = Wrappers.lambdaQuery(BusAttendance.class) | ||||||
|  |             .eq(BusAttendance::getProjectId, projectId); | ||||||
|  | //        if (ObjectUtils.isNotEmpty(clockMonth)) { | ||||||
|  | //            // 校验月份格式 | ||||||
|  | //            if (!DateConstant.YEAR_MONTH_PATTERN.matcher(clockMonth).matches()) { | ||||||
|  | //                throw new ServiceException("月份格式不正确", HttpStatus.BAD_REQUEST); | ||||||
|  | //            } | ||||||
|  | //            // 解析月份 | ||||||
|  | //            YearMonth yearMonth = YearMonth.parse(clockMonth); | ||||||
|  | //            // 判断是否大于当前月份 | ||||||
|  | //            if (yearMonth.isAfter(YearMonth.now())) { | ||||||
|  | //                throw new ServiceException("不能查看大于当前月份的记录", HttpStatus.BAD_REQUEST); | ||||||
|  | //            } | ||||||
|  | //            // 计算当月第一天 / 最后一天 | ||||||
|  | //            LocalDate start = yearMonth.atDay(1); | ||||||
|  | //            LocalDate end = yearMonth.atEndOfMonth(); | ||||||
|  | //            attendanceLqw.between(BusAttendance::getClockDate, start, end); | ||||||
|  | //            List<Long> userIdList = attendanceService.list(attendanceLqw) | ||||||
|  | //                .stream().map(BusAttendance::getUserId).toList(); | ||||||
|  | //            if (CollUtil.isNotEmpty(userIdList)) { | ||||||
|  | //                lqw.in(SubConstructionUser::getSysUserId, userIdList); | ||||||
|  | //            } | ||||||
|  | //        } | ||||||
|         // 模糊查询 |         // 模糊查询 | ||||||
|         lqw.like(StringUtils.isNotBlank(userName), SubConstructionUser::getUserName, userName); |         lqw.like(StringUtils.isNotBlank(userName), SubConstructionUser::getUserName, userName); | ||||||
|         // 精确查询 |         // 精确查询 | ||||||
| @ -1129,6 +1145,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU | |||||||
|         } |         } | ||||||
|         //只查施工人员 |         //只查施工人员 | ||||||
|         lqw.eq(SubConstructionUser::getUserRole, "0"); |         lqw.eq(SubConstructionUser::getUserRole, "0"); | ||||||
|  |         lqw.isNotNull(SubConstructionUser::getTeamId); | ||||||
|         // 分页查询获取数据 |         // 分页查询获取数据 | ||||||
|         Page<SubConstructionUser> constructionUserPage = this.page(pageQuery.build(), lqw); |         Page<SubConstructionUser> constructionUserPage = this.page(pageQuery.build(), lqw); | ||||||
|         List<SubConstructionUser> constructionUserList = constructionUserPage.getRecords(); |         List<SubConstructionUser> constructionUserList = constructionUserPage.getRecords(); | ||||||
| @ -1143,6 +1160,7 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU | |||||||
|         List<Long> userIdList = constructionUserList.stream().map(SubConstructionUser::getSysUserId).toList(); |         List<Long> userIdList = constructionUserList.stream().map(SubConstructionUser::getSysUserId).toList(); | ||||||
|         // 关联查询施工人员考勤列表 |         // 关联查询施工人员考勤列表 | ||||||
|         attendanceLqw.in(BusAttendance::getUserId, userIdList); |         attendanceLqw.in(BusAttendance::getUserId, userIdList); | ||||||
|  |         attendanceLqw.between(BusAttendance::getClockDate, start, end); | ||||||
|         Map<Long, List<BusAttendance>> userIdBusAttendanceListMap = attendanceService.list(attendanceLqw) |         Map<Long, List<BusAttendance>> userIdBusAttendanceListMap = attendanceService.list(attendanceLqw) | ||||||
|             .stream().collect(Collectors.groupingBy(BusAttendance::getUserId)); |             .stream().collect(Collectors.groupingBy(BusAttendance::getUserId)); | ||||||
|         // 填充信息 |         // 填充信息 | ||||||
| @ -1194,8 +1212,12 @@ public class SubConstructionUserServiceImpl extends ServiceImpl<SubConstructionU | |||||||
|                                 unClockDays++; |                                 unClockDays++; | ||||||
|                             } |                             } | ||||||
|                         } |                         } | ||||||
|  |                         if ((clockInStatus != null && ATTENDANCE_LIST.contains(clockInStatus)) | ||||||
|  |                             || (clockOutStatus != null && ATTENDANCE_LIST.contains(clockOutStatus))) { | ||||||
|  |                             attendanceDays++; | ||||||
|  |                         } | ||||||
|  |  | ||||||
|                     } |                     } | ||||||
|                     attendanceDays = dailyMap.size() - leaveDays; |  | ||||||
|                 } |                 } | ||||||
|             } |             } | ||||||
|             constructionUserAttendanceTotalResp.setAttendanceDays(attendanceDays); |             constructionUserAttendanceTotalResp.setAttendanceDays(attendanceDays); | ||||||
|  | |||||||
| @ -148,7 +148,8 @@ public class AttendanceJob { | |||||||
|                     busAttendance.setClockDate(date); |                     busAttendance.setClockDate(date); | ||||||
|                     busAttendance.setClockType(BusAttendanceCommuterEnum.CLOCKIN.getValue()); |                     busAttendance.setClockType(BusAttendanceCommuterEnum.CLOCKIN.getValue()); | ||||||
|                     busAttendance.setRuleTime(rule.getClockInTime()); |                     busAttendance.setRuleTime(rule.getClockInTime()); | ||||||
|                     if (leaveService.isLeave(date, sysUserId)) { |                     LocalDateTime localDateTime = date.atTime(clockInTime); | ||||||
|  |                     if (leaveService.isLeave(localDateTime, sysUserId)) { | ||||||
|                         busAttendance.setClockStatus(BusAttendanceClockStatusEnum.LEAVE.getValue()); |                         busAttendance.setClockStatus(BusAttendanceClockStatusEnum.LEAVE.getValue()); | ||||||
|                     } else { |                     } else { | ||||||
|                         busAttendance.setClockStatus(BusAttendanceClockStatusEnum.UNCLOCK.getValue()); |                         busAttendance.setClockStatus(BusAttendanceClockStatusEnum.UNCLOCK.getValue()); | ||||||
| @ -268,7 +269,8 @@ public class AttendanceJob { | |||||||
|                     busAttendance.setClockDate(date); |                     busAttendance.setClockDate(date); | ||||||
|                     busAttendance.setClockType(BusAttendanceCommuterEnum.CLOCKOUT.getValue()); |                     busAttendance.setClockType(BusAttendanceCommuterEnum.CLOCKOUT.getValue()); | ||||||
|                     busAttendance.setRuleTime(rule.getClockOutTime()); |                     busAttendance.setRuleTime(rule.getClockOutTime()); | ||||||
|                     if (leaveService.isLeave(date, sysUserId)) { |                     LocalDateTime localDateTime = date.atTime(clockOutTime); | ||||||
|  |                     if (leaveService.isLeave(localDateTime, sysUserId)) { | ||||||
|                         busAttendance.setClockStatus(BusAttendanceClockStatusEnum.LEAVE.getValue()); |                         busAttendance.setClockStatus(BusAttendanceClockStatusEnum.LEAVE.getValue()); | ||||||
|                     } else { |                     } else { | ||||||
|                         busAttendance.setClockStatus(BusAttendanceClockStatusEnum.UNCLOCK.getValue()); |                         busAttendance.setClockStatus(BusAttendanceClockStatusEnum.UNCLOCK.getValue()); | ||||||
|  | |||||||
| @ -7,7 +7,10 @@ import jakarta.servlet.http.HttpServletResponse; | |||||||
| import jakarta.validation.constraints.*; | import jakarta.validation.constraints.*; | ||||||
| import cn.dev33.satoken.annotation.SaCheckPermission; | import cn.dev33.satoken.annotation.SaCheckPermission; | ||||||
| import org.dromara.project.domain.dto.attendance.*; | import org.dromara.project.domain.dto.attendance.*; | ||||||
|  | import org.dromara.project.domain.dto.projectteam.BusProjectTeamQueryReq; | ||||||
| import org.dromara.project.domain.vo.attendance.*; | import org.dromara.project.domain.vo.attendance.*; | ||||||
|  | import org.dromara.project.domain.vo.projectteam.BusProjectTeamVo; | ||||||
|  | import org.dromara.project.service.IBusProjectTeamService; | ||||||
| import org.springframework.web.bind.annotation.*; | import org.springframework.web.bind.annotation.*; | ||||||
| import org.springframework.validation.annotation.Validated; | import org.springframework.validation.annotation.Validated; | ||||||
| import org.dromara.common.idempotent.annotation.RepeatSubmit; | import org.dromara.common.idempotent.annotation.RepeatSubmit; | ||||||
| @ -38,6 +41,8 @@ public class BusAttendanceController extends BaseController { | |||||||
|  |  | ||||||
|     private final IBusAttendanceService busAttendanceService; |     private final IBusAttendanceService busAttendanceService; | ||||||
|  |  | ||||||
|  |     private final IBusProjectTeamService projectTeamService; | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 查询考勤列表 |      * 查询考勤列表 | ||||||
|      */ |      */ | ||||||
| @ -114,10 +119,19 @@ public class BusAttendanceController extends BaseController { | |||||||
|         return toAjax(busAttendanceService.deleteWithValidByIds(List.of(ids), true)); |         return toAjax(busAttendanceService.deleteWithValidByIds(List.of(ids), true)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询项目施工人员前14天考勤状况 | ||||||
|  |      */ | ||||||
|     @GetMapping("/list/clockDate/twoWeek") |     @GetMapping("/list/clockDate/twoWeek") | ||||||
|     public R<List<BusAttendanceClockDateForTwoWeekVo>> getClockDateForTwoWeekList(Long projectId) { |     public R<List<BusAttendanceClockDateForTwoWeekVo>> getClockDateForTwoWeekList(TwoWeekDto dto) { | ||||||
|         return R.ok(busAttendanceService.getClockDateForTwoWeekList(projectId)); |         return R.ok(busAttendanceService.getClockDateForTwoWeekList(dto)); | ||||||
|  |     } | ||||||
|  |     /** | ||||||
|  |      * 查询项目施工人员当天考勤状况 | ||||||
|  |      */ | ||||||
|  |     @GetMapping("/list/clockDate/today") | ||||||
|  |     public R<BusAttendanceClockDateForTwoWeekVo> getTodayAttendanceData(TwoWeekDto dto) { | ||||||
|  |         return R.ok(busAttendanceService.getTodayAttendanceData(dto)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @PostMapping("/exportList") |     @PostMapping("/exportList") | ||||||
| @ -125,4 +139,13 @@ public class BusAttendanceController extends BaseController { | |||||||
|         busAttendanceService.getExportList(dto, response); |         busAttendanceService.getExportList(dto, response); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     @GetMapping("/listByProject/{projectid}") | ||||||
|  |     public R<List<BusProjectTeamVo>> listByProject(@NotNull(message = "项目id不能为空") | ||||||
|  |                                                    @PathVariable Long projectid) { | ||||||
|  |         BusProjectTeamQueryReq busProjectTeamQueryReq = new BusProjectTeamQueryReq(); | ||||||
|  |         busProjectTeamQueryReq.setProjectId(projectid); | ||||||
|  |         return R.ok(projectTeamService.queryList(busProjectTeamQueryReq)); | ||||||
|  |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -14,6 +14,9 @@ import org.dromara.common.log.enums.BusinessType; | |||||||
| 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.web.core.BaseController; | import org.dromara.common.web.core.BaseController; | ||||||
|  | import org.dromara.contractor.domain.dto.contractor.SubContractorQueryReq; | ||||||
|  | import org.dromara.contractor.domain.vo.contractor.SubContractorVo; | ||||||
|  | import org.dromara.contractor.service.ISubContractorService; | ||||||
| import org.dromara.project.domain.bo.BusProjectPunchrangeBo; | import org.dromara.project.domain.bo.BusProjectPunchrangeBo; | ||||||
| import org.dromara.project.domain.dto.projectteam.BusProjectTeamCreateReq; | import org.dromara.project.domain.dto.projectteam.BusProjectTeamCreateReq; | ||||||
| import org.dromara.project.domain.dto.projectteam.BusProjectTeamQueryReq; | import org.dromara.project.domain.dto.projectteam.BusProjectTeamQueryReq; | ||||||
| @ -48,6 +51,8 @@ public class BusProjectTeamController extends BaseController { | |||||||
|     private final IBusProjectPunchrangeService busProjectPunchrangeService; |     private final IBusProjectPunchrangeService busProjectPunchrangeService; | ||||||
|  |  | ||||||
|     private final ISysUserService userService; |     private final ISysUserService userService; | ||||||
|  |  | ||||||
|  |     private final ISubContractorService contractorService; | ||||||
|     /** |     /** | ||||||
|      * 查询项目班组列表 |      * 查询项目班组列表 | ||||||
|      */ |      */ | ||||||
| @ -138,8 +143,8 @@ public class BusProjectTeamController extends BaseController { | |||||||
|      * 获取所有分包管理人员 |      * 获取所有分包管理人员 | ||||||
|      */ |      */ | ||||||
|     @GetMapping("/listSubContractor") |     @GetMapping("/listSubContractor") | ||||||
|     public R<List<SysUserVo>> listSubContractor(Long projectId) { |     public R<List<SysUserVo>> listSubContractor(Long projectId,Long contractorId) { | ||||||
|         return R.ok(userService.selectUserListByAppUserType("2",projectId)); |         return R.ok(userService.selectUserListByAppUserType("2",projectId,contractorId)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @ -160,4 +165,12 @@ public class BusProjectTeamController extends BaseController { | |||||||
|         return R.ok(busProjectTeamService.deleteUserId(id,userId)); |         return R.ok(busProjectTeamService.deleteUserId(id,userId)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 查询分包单位列表 | ||||||
|  |      */ | ||||||
|  |     @GetMapping("/contractorList") | ||||||
|  |     public R<List<SubContractorVo>> contractorList(SubContractorQueryReq req) { | ||||||
|  |         return R.ok(contractorService.queryList(req)); | ||||||
|  |     } | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -108,4 +108,9 @@ public class BusAttendance extends BaseEntity { | |||||||
|      * 薪水 |      * 薪水 | ||||||
|      */ |      */ | ||||||
|     private BigDecimal salary; |     private BigDecimal salary; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 代打卡人员Id | ||||||
|  |      */ | ||||||
|  |     private Long replaceId; | ||||||
| } | } | ||||||
|  | |||||||
| @ -140,4 +140,13 @@ public class BusLeave extends BaseEntity { | |||||||
|      */ |      */ | ||||||
|     private String auditStatus; |     private String auditStatus; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 时间类型 1-天 2-小时 | ||||||
|  |      */ | ||||||
|  |     private String timeType; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 时间段类型 1-上午 2-下午 | ||||||
|  |      */ | ||||||
|  |     private String periodType; | ||||||
| } | } | ||||||
|  | |||||||
| @ -57,4 +57,9 @@ public class BusProjectTeam extends BaseEntity { | |||||||
|      * 管理员Id |      * 管理员Id | ||||||
|      */ |      */ | ||||||
|     private String userId; |     private String userId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 分包公司Id | ||||||
|  |      */ | ||||||
|  |     private Long contractorId; | ||||||
| } | } | ||||||
|  | |||||||
| @ -36,4 +36,9 @@ public class BusAttendancePunchCardByFaceReq implements Serializable { | |||||||
|      */ |      */ | ||||||
|     private Long projectId; |     private Long projectId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 用户Id | ||||||
|  |      */ | ||||||
|  |     private Long userId; | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -0,0 +1,27 @@ | |||||||
|  | package org.dromara.project.domain.dto.attendance; | ||||||
|  |  | ||||||
|  | import lombok.Data; | ||||||
|  |  | ||||||
|  | @Data | ||||||
|  | public class TwoWeekDto { | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 人员姓名 | ||||||
|  |      */ | ||||||
|  |     private String userName; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 班组id | ||||||
|  |      */ | ||||||
|  |     private Long teamId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 工种 | ||||||
|  |      */ | ||||||
|  |     private String typeOfWork; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 项目id | ||||||
|  |      */ | ||||||
|  |     private Long projectId; | ||||||
|  | } | ||||||
| @ -51,4 +51,9 @@ public class BusProjectTeamCreateReq implements Serializable { | |||||||
|      * 管理员Id |      * 管理员Id | ||||||
|      */ |      */ | ||||||
|     private String userId; |     private String userId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 分包公司Id | ||||||
|  |      */ | ||||||
|  |     private Long contractorId; | ||||||
| } | } | ||||||
|  | |||||||
| @ -52,4 +52,9 @@ public class BusProjectTeamUpdateReq implements Serializable { | |||||||
|      * 管理员Id |      * 管理员Id | ||||||
|      */ |      */ | ||||||
|     private String userId; |     private String userId; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 分包公司Id | ||||||
|  |      */ | ||||||
|  |     private Long contractorId; | ||||||
| } | } | ||||||
|  | |||||||
| @ -88,4 +88,11 @@ public class BusProjectTeamVo implements Serializable { | |||||||
|      * 打卡范围 |      * 打卡范围 | ||||||
|      */ |      */ | ||||||
|     List<String> punchRangeList; |     List<String> punchRangeList; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 分包公司Id | ||||||
|  |      */ | ||||||
|  |     private Long contractorId; | ||||||
|  |  | ||||||
|  |     private String contractorName; | ||||||
| } | } | ||||||
|  | |||||||
| @ -76,4 +76,9 @@ public class BusProjectTeamMemberVo implements Serializable { | |||||||
|     @ExcelProperty(value = "创建时间") |     @ExcelProperty(value = "创建时间") | ||||||
|     private Date createTime; |     private Date createTime; | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 头像 | ||||||
|  |      */ | ||||||
|  |     private String avatar; | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -1,8 +1,8 @@ | |||||||
| package org.dromara.project.service; | package org.dromara.project.service; | ||||||
|  |  | ||||||
|  | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||||
| import jakarta.servlet.http.HttpServletResponse; | import jakarta.servlet.http.HttpServletResponse; | ||||||
| import jakarta.validation.constraints.NotNull; | import jakarta.validation.constraints.NotNull; | ||||||
| import org.dromara.common.core.domain.R; |  | ||||||
| import org.dromara.project.domain.dto.attendance.*; | import org.dromara.project.domain.dto.attendance.*; | ||||||
| import org.dromara.project.domain.vo.BusAttendanceVo; | import org.dromara.project.domain.vo.BusAttendanceVo; | ||||||
| import org.dromara.project.domain.bo.BusAttendanceBo; | import org.dromara.project.domain.bo.BusAttendanceBo; | ||||||
| @ -13,12 +13,9 @@ import org.dromara.common.mybatis.core.page.PageQuery; | |||||||
| import com.baomidou.mybatisplus.extension.service.IService; | import com.baomidou.mybatisplus.extension.service.IService; | ||||||
| import org.dromara.project.domain.vo.BusMonthAttendanceVo; | import org.dromara.project.domain.vo.BusMonthAttendanceVo; | ||||||
| import org.dromara.project.domain.vo.attendance.*; | import org.dromara.project.domain.vo.attendance.*; | ||||||
| import org.springframework.format.annotation.DateTimeFormat; |  | ||||||
| import org.springframework.web.bind.annotation.PathVariable; | import org.springframework.web.bind.annotation.PathVariable; | ||||||
| import org.springframework.web.bind.annotation.RequestParam; |  | ||||||
| import org.springframework.web.multipart.MultipartFile; | import org.springframework.web.multipart.MultipartFile; | ||||||
|  |  | ||||||
| import java.time.LocalDate; |  | ||||||
| import java.util.Collection; | import java.util.Collection; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| @ -132,9 +129,9 @@ public interface IBusAttendanceService extends IService<BusAttendance>{ | |||||||
|     List<BusMonthAttendanceVo> getMonthAttendance(Long projectId, String  month); |     List<BusMonthAttendanceVo> getMonthAttendance(Long projectId, String  month); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 获取用户指定月份的打卡记录 |      * 获取用户打卡异常记录 | ||||||
|      */ |      */ | ||||||
|     List<BusAttendanceVo> getAbnormalAttendance(@NotNull @PathVariable("projectId") Long projectId); |     TableDataInfo<BusAttendanceVo> getAbnormalAttendance(@NotNull @PathVariable("projectId") Long projectId, PageQuery pageQuery); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 统计指定日期的打卡人员 |      * 统计指定日期的打卡人员 | ||||||
| @ -165,7 +162,12 @@ public interface IBusAttendanceService extends IService<BusAttendance>{ | |||||||
|     /** |     /** | ||||||
|      * 近两周打卡统计 |      * 近两周打卡统计 | ||||||
|      */ |      */ | ||||||
|     List<BusAttendanceClockDateForTwoWeekVo> getClockDateForTwoWeekList(Long projectId); |     List<BusAttendanceClockDateForTwoWeekVo> getClockDateForTwoWeekList(TwoWeekDto dto); | ||||||
|  |  | ||||||
|  |     /** | ||||||
|  |      * 获取项目当天的考勤数据 | ||||||
|  |      */ | ||||||
|  |     BusAttendanceClockDateForTwoWeekVo getTodayAttendanceData(TwoWeekDto dto); | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 获取导出的考勤数据 |      * 获取导出的考勤数据 | ||||||
|  | |||||||
| @ -13,6 +13,7 @@ import org.dromara.project.domain.dto.leave.BusLeaveQueryReq; | |||||||
| import org.dromara.project.domain.vo.leave.BusLeaveVo; | import org.dromara.project.domain.vo.leave.BusLeaveVo; | ||||||
|  |  | ||||||
| import java.time.LocalDate; | import java.time.LocalDate; | ||||||
|  | import java.time.LocalDateTime; | ||||||
| import java.util.Collection; | import java.util.Collection; | ||||||
| import java.util.List; | import java.util.List; | ||||||
|  |  | ||||||
| @ -101,7 +102,7 @@ public interface IBusLeaveService extends IService<BusLeave> { | |||||||
|     /** |     /** | ||||||
|      * 查询是否请假 |      * 查询是否请假 | ||||||
|      */ |      */ | ||||||
|    Boolean isLeave(LocalDate date,Long userId); |    Boolean isLeave(LocalDateTime clockTime, Long userId); | ||||||
|  |  | ||||||
|  |  | ||||||
|    /** |    /** | ||||||
|  | |||||||
| @ -6,6 +6,7 @@ import cn.hutool.core.util.StrUtil; | |||||||
| import cn.hutool.json.JSONArray; | import cn.hutool.json.JSONArray; | ||||||
| import cn.hutool.json.JSONUtil; | import cn.hutool.json.JSONUtil; | ||||||
| import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper; | ||||||
|  | import com.baomidou.mybatisplus.core.metadata.IPage; | ||||||
| import com.baomidou.mybatisplus.core.toolkit.Wrappers; | import com.baomidou.mybatisplus.core.toolkit.Wrappers; | ||||||
| import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; | ||||||
| import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl; | ||||||
| @ -64,6 +65,8 @@ import java.util.*; | |||||||
| import java.util.concurrent.CompletableFuture; | import java.util.concurrent.CompletableFuture; | ||||||
| import java.util.stream.Collectors; | import java.util.stream.Collectors; | ||||||
|  |  | ||||||
|  | import static org.dromara.project.domain.enums.BusAttendanceClockStatusEnum.ATTENDANCE_LIST; | ||||||
|  |  | ||||||
| /** | /** | ||||||
|  * 考勤Service业务层处理 |  * 考勤Service业务层处理 | ||||||
|  * |  * | ||||||
| @ -316,25 +319,37 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|     public Boolean punchCardByFace(MultipartFile file, BusAttendancePunchCardByFaceReq req) { |     public Boolean punchCardByFace(MultipartFile file, BusAttendancePunchCardByFaceReq req) { | ||||||
|         // 获取当前用户 |         // 获取当前用户 | ||||||
|         Long userId = LoginHelper.getUserId(); |         Long userId = LoginHelper.getUserId(); | ||||||
|  |         Long replaceId = null; | ||||||
|  |         if(req.getUserId()!=null){ | ||||||
|  |             userId = req.getUserId(); | ||||||
|  |             replaceId = LoginHelper.getUserId(); | ||||||
|  |         } | ||||||
|         synchronized (userId.toString().intern()) { |         synchronized (userId.toString().intern()) { | ||||||
|             // 记录当前打卡时间 |             // 记录当前打卡时间 | ||||||
|             LocalDateTime now = LocalDateTime.now(); |             LocalDateTime now = LocalDateTime.now(); | ||||||
|  |  | ||||||
|             //打卡范围 |             //打卡范围 | ||||||
|             if (!checkInRange(req)) { |             if (!checkInRange(req)) { | ||||||
|                 throw new ServiceException("打卡位置不在范围内", HttpStatus.BAD_REQUEST); |                 throw new ServiceException("打卡位置不在范围内", HttpStatus.ERROR); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             //用户信息校验 |             //用户信息校验 | ||||||
|             SubConstructionUser constructionUser = constructionUserService.getBySysUserId(userId); |             SubConstructionUser constructionUser = constructionUserService.getBySysUserId(userId); | ||||||
|             final String status = "1"; |             if ("1".equals(constructionUser.getStatus())) { | ||||||
|             if (constructionUser.getStatus().equals(status)) { |                 throw new ServiceException("当前用户已离职", HttpStatus.ERROR); | ||||||
|                 throw new ServiceException("当前用户已离职", HttpStatus.BAD_REQUEST); |  | ||||||
|             } |             } | ||||||
|             final String noClock = "1"; |             if ("1".equals(constructionUser.getClock())) { | ||||||
|             if (constructionUser.getClock().equals(noClock)) { |                 throw new ServiceException("当前用户已被禁止打卡", HttpStatus.ERROR); | ||||||
|                 throw new ServiceException("当前用户已被禁止打卡", HttpStatus.BAD_REQUEST); |  | ||||||
|             } |             } | ||||||
|  |             //施工人员需要判断工资 | ||||||
|  |             if("0".equals(constructionUser.getUserRole())){ | ||||||
|  |                 String typeOfWork = constructionUser.getTypeOfWork(); | ||||||
|  |                 BusWorkWage workWageByWorkType = workWageService.getWorkWageByWorkType(typeOfWork); | ||||||
|  |                 if(constructionUser.getSalary().compareTo(BigDecimal.ZERO)==0 && workWageByWorkType == null){ | ||||||
|  |                     throw new ServiceException("当前用户没有设置工资,禁止打卡", HttpStatus.ERROR); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |  | ||||||
|             // 判断用户是否已经被拉黑 |             // 判断用户是否已经被拉黑 | ||||||
|             constructionBlacklistService.validUserInBlacklist(constructionUser.getSysUserId(), req.getProjectId()); |             constructionBlacklistService.validUserInBlacklist(constructionUser.getSysUserId(), req.getProjectId()); | ||||||
|             Boolean result = false; |             Boolean result = false; | ||||||
| @ -342,30 +357,25 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|             try { |             try { | ||||||
|                 result = constructionUserService.faceComparison(file); |                 result = constructionUserService.faceComparison(file); | ||||||
|             } catch (Exception e) { |             } catch (Exception e) { | ||||||
|                 throw new ServiceException("人脸识别失败,请重新识别", HttpStatus.BAD_REQUEST); |                 throw new ServiceException("人脸识别失败,请重新识别", HttpStatus.ERROR); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             if (!result) { |             if (!result) { | ||||||
|                 throw new ServiceException("人脸识别失败,请重新识别", HttpStatus.BAD_REQUEST); |                 throw new ServiceException("人脸识别失败,请重新识别", HttpStatus.ERROR); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             //打卡规则 |             //打卡规则 | ||||||
|             BusAttendanceRuleVo busAttendanceRuleVo = attendanceRuleService.queryByProjectId(req.getProjectId()); |             BusAttendanceRuleVo busAttendanceRuleVo = attendanceRuleService.queryByProjectId(req.getProjectId()); | ||||||
|  |  | ||||||
|             if (busAttendanceRuleVo == null) { |             if (busAttendanceRuleVo == null) { | ||||||
|                 throw new ServiceException("未设置打卡规则", HttpStatus.BAD_REQUEST); |                 throw new ServiceException("未设置打卡规则", HttpStatus.ERROR); | ||||||
|             } |             } | ||||||
|  |  | ||||||
|             // 考勤时间 |             // 考勤时间 | ||||||
|             //确定考勤日期 |             //确定考勤日期 | ||||||
|             LocalDate localDate = calculateAttendanceDate(now, busAttendanceRuleVo); |             LocalDate localDate = calculateAttendanceDate(now, busAttendanceRuleVo); | ||||||
|  |  | ||||||
|             if (leaveService.isLeave(localDate, userId)) { |  | ||||||
|                 throw new ServiceException("当前用户正在请假中", HttpStatus.BAD_REQUEST); |  | ||||||
|             } |  | ||||||
|  |  | ||||||
|             // 判断当前用户打卡状态 |             // 判断当前用户打卡状态 | ||||||
|  |  | ||||||
|             int clockTypeByTime = getClockTypeByTime(localDate, now, busAttendanceRuleVo); |             int clockTypeByTime = getClockTypeByTime(localDate, now, busAttendanceRuleVo); | ||||||
|  |  | ||||||
|             List<BusAttendance> attendances = this.lambdaQuery() |             List<BusAttendance> attendances = this.lambdaQuery() | ||||||
| @ -390,24 +400,37 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|                 } else { |                 } else { | ||||||
|                     attendance.setClockStatus(BusAttendanceClockStatusEnum.NORMAL.getValue()); |                     attendance.setClockStatus(BusAttendanceClockStatusEnum.NORMAL.getValue()); | ||||||
|                 } |                 } | ||||||
|  |                 //只要请假,直接归为请假 | ||||||
|  |                 LocalDateTime localDateTime = localDate.atTime(busAttendanceRuleVo.getClockInTime()); | ||||||
|  |                 if(leaveService.isLeave(localDateTime,userId)){ | ||||||
|  |                     attendance.setClockStatus(BusAttendanceClockStatusEnum.LEAVE.getValue()); | ||||||
|  |                 } | ||||||
|  |  | ||||||
|                 // 填充信息 |                 // 填充信息 | ||||||
|                 attendance.setUserId(userId); |                 attendance.setUserId(userId); | ||||||
|                 attendance.setProjectId(req.getProjectId()); |                 attendance.setProjectId(req.getProjectId()); | ||||||
|                 attendance.setClockDate(localDate); |                 attendance.setClockDate(localDate); | ||||||
|                 attendance.setClockTime(now); |                 attendance.setClockTime(now); | ||||||
|                 attendance.setUserName(constructionUser.getUserName()); |                 attendance.setUserName(constructionUser.getUserName()); | ||||||
|  |                 attendance.setReplaceId(replaceId); | ||||||
|                 // 记录打卡坐标 |                 // 记录打卡坐标 | ||||||
|                 attendance.setLat(req.getLat()); |                 attendance.setLat(req.getLat()); | ||||||
|                 attendance.setLng(req.getLng()); |                 attendance.setLng(req.getLng()); | ||||||
|  |                 try { | ||||||
|                     attendance.setClockLocation(JSTUtil.getLocationName(req.getLat(), req.getLng())); |                     attendance.setClockLocation(JSTUtil.getLocationName(req.getLat(), req.getLng())); | ||||||
|  |                 }catch (Exception e) { | ||||||
|  |                     log.error("获取打卡位置失败", e); | ||||||
|  |                 } | ||||||
|  |  | ||||||
|                 // 上传人脸照 |                 // 上传人脸照 | ||||||
|                 SysOssVo upload = ossService.upload(file); |                 SysOssVo upload = ossService.upload(file); | ||||||
|                 attendance.setFacePic(upload.getOssId().toString()); |                 attendance.setFacePic(upload.getOssId().toString()); | ||||||
|  |                 Long finalUserId = userId; | ||||||
|                 CompletableFuture.runAsync(() -> { |                 CompletableFuture.runAsync(() -> { | ||||||
|                     try { |                     try { | ||||||
|                         chatServerHandler.sendSystemMessageToUser(userId, "打卡成功", "1"); |                         chatServerHandler.sendSystemMessageToUser(finalUserId, "打卡成功", "1"); | ||||||
|                     } catch (Exception e) { |                     } catch (Exception e) { | ||||||
|                         log.error("异步发送系统消息失败,用户ID: {}, 消息: {}", userId, "打卡成功", e); |                         log.error("异步发送系统消息失败,用户ID: {}, 消息: {}", finalUserId, "打卡成功", e); | ||||||
|                     } |                     } | ||||||
|                 }); |                 }); | ||||||
|                 //计算工资 |                 //计算工资 | ||||||
| @ -431,6 +454,11 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|                         busAttendance.setClockStatus(BusAttendanceClockStatusEnum.NORMAL.getValue()); |                         busAttendance.setClockStatus(BusAttendanceClockStatusEnum.NORMAL.getValue()); | ||||||
|                         busAttendance.setMinuteCount(0); |                         busAttendance.setMinuteCount(0); | ||||||
|                     } |                     } | ||||||
|  |                     //只要请假,直接归为请假 | ||||||
|  |                     LocalDateTime localDateTime = localDate.atTime(busAttendanceRuleVo.getClockInTime()); | ||||||
|  |                     if(leaveService.isLeave(localDateTime,userId)){ | ||||||
|  |                         busAttendance.setClockStatus(BusAttendanceClockStatusEnum.LEAVE.getValue()); | ||||||
|  |                     } | ||||||
|                     updateById(busAttendance); |                     updateById(busAttendance); | ||||||
|                 } else { |                 } else { | ||||||
|                     BusAttendance attendance = new BusAttendance(); |                     BusAttendance attendance = new BusAttendance(); | ||||||
| @ -444,25 +472,36 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|                     } else { |                     } else { | ||||||
|                         attendance.setClockStatus(BusAttendanceClockStatusEnum.NORMAL.getValue()); |                         attendance.setClockStatus(BusAttendanceClockStatusEnum.NORMAL.getValue()); | ||||||
|                     } |                     } | ||||||
|  |                     //只要请假,直接归为请假 | ||||||
|  |                     LocalDateTime localDateTime = localDate.atTime(busAttendanceRuleVo.getClockInTime()); | ||||||
|  |                     if(leaveService.isLeave(localDateTime,userId)){ | ||||||
|  |                         attendance.setClockStatus(BusAttendanceClockStatusEnum.LEAVE.getValue()); | ||||||
|  |                     } | ||||||
|                     // 填充信息 |                     // 填充信息 | ||||||
|                     attendance.setUserId(userId); |                     attendance.setUserId(userId); | ||||||
|                     attendance.setProjectId(req.getProjectId()); |                     attendance.setProjectId(req.getProjectId()); | ||||||
|                     attendance.setClockDate(localDate); |                     attendance.setClockDate(localDate); | ||||||
|                     attendance.setClockTime(now); |                     attendance.setClockTime(now); | ||||||
|                     attendance.setUserName(constructionUser.getUserName()); |                     attendance.setUserName(constructionUser.getUserName()); | ||||||
|  |                     attendance.setReplaceId(replaceId); | ||||||
|                     // 记录打卡坐标 |                     // 记录打卡坐标 | ||||||
|                     attendance.setLat(req.getLat()); |                     attendance.setLat(req.getLat()); | ||||||
|                     attendance.setLng(req.getLng()); |                     attendance.setLng(req.getLng()); | ||||||
|  |                     try { | ||||||
|                         attendance.setClockLocation(JSTUtil.getLocationName(req.getLat(), req.getLng())); |                         attendance.setClockLocation(JSTUtil.getLocationName(req.getLat(), req.getLng())); | ||||||
|  |                     }catch (Exception e) { | ||||||
|  |                         log.error("获取打卡位置失败", e); | ||||||
|  |                     } | ||||||
|                     // 上传人脸照 |                     // 上传人脸照 | ||||||
|                     SysOssVo upload = ossService.upload(file); |                     SysOssVo upload = ossService.upload(file); | ||||||
|                     attendance.setFacePic(upload.getOssId().toString()); |                     attendance.setFacePic(upload.getOssId().toString()); | ||||||
|  |  | ||||||
|  |                     Long finalUserId1 = userId; | ||||||
|                     CompletableFuture.runAsync(() -> { |                     CompletableFuture.runAsync(() -> { | ||||||
|                         try { |                         try { | ||||||
|                             chatServerHandler.sendSystemMessageToUser(userId, "打卡成功", "1"); |                             chatServerHandler.sendSystemMessageToUser(finalUserId1, "打卡成功", "1"); | ||||||
|                         } catch (Exception e) { |                         } catch (Exception e) { | ||||||
|                             log.error("异步发送系统消息失败,用户ID: {}, 消息: {}", userId, "打卡成功", e); |                             log.error("异步发送系统消息失败,用户ID: {}, 消息: {}", finalUserId1, "打卡成功", e); | ||||||
|                         } |                         } | ||||||
|                     }); |                     }); | ||||||
|                     //计算工资 |                     //计算工资 | ||||||
| @ -589,6 +628,8 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|         Long userId = LoginHelper.getUserId(); |         Long userId = LoginHelper.getUserId(); | ||||||
|         Long projectId = req.getProjectId(); |         Long projectId = req.getProjectId(); | ||||||
|  |  | ||||||
|  |         SysUserVo sysUserVo = userService.queryById(userId); | ||||||
|  |  | ||||||
|         //判断是否要求范围内打卡 |         //判断是否要求范围内打卡 | ||||||
|         BusUserProjectRelevancy relevancy = userProjectRelevancyService.getOne(Wrappers.lambdaQuery(BusUserProjectRelevancy.class) |         BusUserProjectRelevancy relevancy = userProjectRelevancyService.getOne(Wrappers.lambdaQuery(BusUserProjectRelevancy.class) | ||||||
|             .eq(BusUserProjectRelevancy::getUserId, userId) |             .eq(BusUserProjectRelevancy::getUserId, userId) | ||||||
| @ -598,7 +639,7 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|             throw new ServiceException("当前用户未加入项目", HttpStatus.BAD_REQUEST); |             throw new ServiceException("当前用户未加入项目", HttpStatus.BAD_REQUEST); | ||||||
|         } |         } | ||||||
|         //判断是否是施工员 管理员返回项目全部打卡范围,施工人员返回班组打卡范围 |         //判断是否是施工员 管理员返回项目全部打卡范围,施工人员返回班组打卡范围 | ||||||
|         boolean isConstruct = "1".equals(relevancy.getUserType()); |         boolean isConstruct = "0".equals(sysUserVo.getAppUserType()); | ||||||
|         List<Long> rangeIds = new ArrayList<>(); |         List<Long> rangeIds = new ArrayList<>(); | ||||||
|         if (isConstruct) { |         if (isConstruct) { | ||||||
|             BusProjectTeamMember one = projectTeamMemberService.getOne(Wrappers.lambdaQuery(BusProjectTeamMember.class) |             BusProjectTeamMember one = projectTeamMemberService.getOne(Wrappers.lambdaQuery(BusProjectTeamMember.class) | ||||||
| @ -636,7 +677,7 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|             .toList(); |             .toList(); | ||||||
|  |  | ||||||
|         if (CollUtil.isEmpty(punchRangeList)) { |         if (CollUtil.isEmpty(punchRangeList)) { | ||||||
|             throw new ServiceException(isConstruct ? "班组未配置考勤范围" : "项目未配置考勤范围", HttpStatus.BAD_REQUEST); |             throw new ServiceException(isConstruct ? "班组未配置考勤范围" : "项目未配置考勤范围", HttpStatus.ERROR); | ||||||
|         } |         } | ||||||
|         List<GeoPoint> matchingRange = JSTUtil.findMatchingRange(req.getLat(), req.getLng(), punchRangeList); |         List<GeoPoint> matchingRange = JSTUtil.findMatchingRange(req.getLat(), req.getLng(), punchRangeList); | ||||||
|         return matchingRange != null; |         return matchingRange != null; | ||||||
| @ -707,7 +748,7 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|  |  | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public List<BusAttendanceVo> getAbnormalAttendance(Long projectId) { |     public TableDataInfo<BusAttendanceVo> getAbnormalAttendance(Long projectId, PageQuery pageQuery) { | ||||||
|  |  | ||||||
|         List<String> abnormalList = Arrays.asList(BusAttendanceClockStatusEnum.LATE.getValue(), |         List<String> abnormalList = Arrays.asList(BusAttendanceClockStatusEnum.LATE.getValue(), | ||||||
|             BusAttendanceClockStatusEnum.LEAVEEARLY.getValue(), |             BusAttendanceClockStatusEnum.LEAVEEARLY.getValue(), | ||||||
| @ -722,16 +763,18 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|  |  | ||||||
|         boolean b = relevancyList.stream().allMatch(relevancy -> "1".equals(relevancy.getUserType())); |         boolean b = relevancyList.stream().allMatch(relevancy -> "1".equals(relevancy.getUserType())); | ||||||
|  |  | ||||||
|         List<BusAttendanceVo> busAttendanceVos = baseMapper.selectVoList(Wrappers.lambdaQuery(BusAttendance.class) |         IPage<BusAttendanceVo> busAttendanceVoIPage = baseMapper.selectVoPage(pageQuery.build(), Wrappers.lambdaQuery(BusAttendance.class) | ||||||
|             .eq(BusAttendance::getUserId, userId) |             .eq(BusAttendance::getUserId, userId) | ||||||
|             .eq(b, BusAttendance::getProjectId, projectId) |             .eq(b, BusAttendance::getProjectId, projectId) | ||||||
|             .in(BusAttendance::getClockStatus, abnormalList) |             .in(BusAttendance::getClockStatus, abnormalList) | ||||||
|  |             .orderByDesc(BusAttendance::getClockDate) | ||||||
|  |             .orderByDesc(BusAttendance::getRuleTime) | ||||||
|         ); |         ); | ||||||
|         //转换星期几 |         //转换星期几 | ||||||
|         for (BusAttendanceVo busAttendanceVo : busAttendanceVos) { |         for (BusAttendanceVo busAttendanceVo : busAttendanceVoIPage.getRecords()) { | ||||||
|             busAttendanceVo.setWeek(busAttendanceVo.getClockDate().getDayOfWeek().getValue()); |             busAttendanceVo.setWeek(busAttendanceVo.getClockDate().getDayOfWeek().getValue()); | ||||||
|         } |         } | ||||||
|         return busAttendanceVos; |         return TableDataInfo.build(busAttendanceVoIPage); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
| @ -1145,28 +1188,37 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public List<BusAttendanceClockDateForTwoWeekVo> getClockDateForTwoWeekList(Long projectId) { |     public List<BusAttendanceClockDateForTwoWeekVo> getClockDateForTwoWeekList(TwoWeekDto dto) { | ||||||
|         LocalDate now = LocalDate.now(); |         LocalDate now = LocalDate.now(); | ||||||
|  |  | ||||||
|         //查询所有管理员和分包人员 排除 |         //查询所有管理员和分包人员 排除 | ||||||
|         List<Long> excludeUserIds = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery() | //        List<Long> excludeUserIds = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery() | ||||||
|             .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() |         List<Long> allUserIds = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery() | ||||||
|             .eq(SubConstructionUser::getUserRole, "0") |             .eq(SubConstructionUser::getUserRole, "0") | ||||||
|             .eq(SubConstructionUser::getProjectId,projectId) |             .eq(SubConstructionUser::getProjectId,dto.getProjectId()) | ||||||
|  |             .eq(dto.getTeamId()!=null,SubConstructionUser::getTeamId,dto.getTeamId()) | ||||||
|  |             .eq(StrUtil.isNotBlank(dto.getTypeOfWork()),SubConstructionUser::getTypeOfWork,dto.getTypeOfWork()) | ||||||
|  |             .like(StrUtil.isNotBlank(dto.getUserName()),SubConstructionUser::getUserName,dto.getUserName()) | ||||||
|  |             .isNotNull(SubConstructionUser::getTeamId) | ||||||
|         ).stream().map(SubConstructionUser::getSysUserId).toList(); |         ).stream().map(SubConstructionUser::getSysUserId).toList(); | ||||||
|  |  | ||||||
|  |  | ||||||
|         // 往前14天,包含今天 |         // 往前14天,包含今天 | ||||||
|         LocalDate startDate = now.minusDays(14); |         LocalDate startDate = now.minusDays(14); | ||||||
|         List<BusAttendance> list = list(Wrappers.<BusAttendance>lambdaQuery() |         LocalDate endDate = now.minusDays(1); | ||||||
|             .eq(BusAttendance::getProjectId, projectId) |         List<BusAttendance> list; | ||||||
|             .notIn(CollectionUtil.isNotEmpty(excludeUserIds),BusAttendance::getUserId, excludeUserIds) |         if(CollectionUtil.isEmpty(allUserIds)){ | ||||||
|             .between(BusAttendance::getClockDate, startDate, now) |             list = new ArrayList<>(); | ||||||
|  |         }else { | ||||||
|  |             list = list(Wrappers.<BusAttendance>lambdaQuery() | ||||||
|  |                 .in(BusAttendance::getUserId, allUserIds) | ||||||
|  |                 .between(BusAttendance::getClockDate, startDate, endDate) | ||||||
|                 .orderByAsc(BusAttendance::getClockDate) |                 .orderByAsc(BusAttendance::getClockDate) | ||||||
|             ); |             ); | ||||||
|  |         } | ||||||
|  |  | ||||||
|         // 按日期分组 |         // 按日期分组 | ||||||
|         Map<LocalDate, List<BusAttendance>> groupedByDate = list.stream() |         Map<LocalDate, List<BusAttendance>> groupedByDate = list.stream() | ||||||
| @ -1183,10 +1235,9 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|  |  | ||||||
|         // 统计全勤、半勤、缺卡人数 |         // 统计全勤、半勤、缺卡人数 | ||||||
|         List<BusAttendanceClockDateForTwoWeekVo> result = new ArrayList<>(); |         List<BusAttendanceClockDateForTwoWeekVo> result = new ArrayList<>(); | ||||||
|         List<String> validStatusList = Arrays.asList("1", "2", "3", "5"); |  | ||||||
|  |  | ||||||
|         LocalDate currentDate = startDate; |         LocalDate currentDate = startDate; | ||||||
|         while (!currentDate.isAfter(now)) { |         while (!currentDate.isAfter(endDate)) { | ||||||
|             Map<Long, List<BusAttendance>> userAttendanceMap = dateUserMap.getOrDefault(currentDate, new HashMap<>()); |             Map<Long, List<BusAttendance>> userAttendanceMap = dateUserMap.getOrDefault(currentDate, new HashMap<>()); | ||||||
|  |  | ||||||
|             int full = 0, half = 0, absent = 0; |             int full = 0, half = 0, absent = 0; | ||||||
| @ -1196,7 +1247,80 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|  |  | ||||||
|                 long validCount = records.stream() |                 long validCount = records.stream() | ||||||
|                     .map(BusAttendance::getClockStatus) |                     .map(BusAttendance::getClockStatus) | ||||||
|                     .filter(validStatusList::contains) |                     .filter(ATTENDANCE_LIST::contains) | ||||||
|  |                     .count(); | ||||||
|  |  | ||||||
|  |                 if (validCount >= 1) { | ||||||
|  |                     full++; | ||||||
|  |                 } else { | ||||||
|  |                     absent++; | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|  |  | ||||||
|  |             BusAttendanceClockDateForTwoWeekVo vo = new BusAttendanceClockDateForTwoWeekVo(); | ||||||
|  |             vo.setClockDate(currentDate); | ||||||
|  |             vo.setAttendance(full); | ||||||
|  |             vo.setHalfAttendance(half); | ||||||
|  |             vo.setAbsenteeism(absent); | ||||||
|  |             result.add(vo); | ||||||
|  |             currentDate = currentDate.plusDays(1); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         return result; | ||||||
|  |     } | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     @Override | ||||||
|  |     public BusAttendanceClockDateForTwoWeekVo getTodayAttendanceData(TwoWeekDto dto) { | ||||||
|  |  | ||||||
|  |         LocalDate now = LocalDate.now(); | ||||||
|  |  | ||||||
|  | //        //查询所有管理员和分包人员 排除 | ||||||
|  | //        List<Long> excludeUserIds = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery() | ||||||
|  | //            .ne(SubConstructionUser::getUserRole, "0") | ||||||
|  | //        ).stream().map(SubConstructionUser::getSysUserId).toList(); | ||||||
|  |  | ||||||
|  |         List<Long> allUserIds = constructionUserService.list(Wrappers.<SubConstructionUser>lambdaQuery() | ||||||
|  |             .eq(SubConstructionUser::getUserRole, "0") | ||||||
|  |             .eq(SubConstructionUser::getProjectId,dto.getProjectId()) | ||||||
|  |             .eq(dto.getTeamId()!=null,SubConstructionUser::getTeamId,dto.getTeamId()) | ||||||
|  |             .eq(StrUtil.isNotBlank(dto.getTypeOfWork()),SubConstructionUser::getTypeOfWork,dto.getTypeOfWork()) | ||||||
|  |             .like(StrUtil.isNotBlank(dto.getUserName()),SubConstructionUser::getUserName,dto.getUserName()) | ||||||
|  |             .isNotNull(SubConstructionUser::getTeamId) | ||||||
|  |         ).stream().map(SubConstructionUser::getSysUserId).toList(); | ||||||
|  |  | ||||||
|  |         //当天请假人数 | ||||||
|  |         String todayStr = now.format(DateTimeFormatter.ISO_LOCAL_DATE); // 结果:"2024-10-10" | ||||||
|  |  | ||||||
|  |         // 2. 拼接 SQL 时添加单引号,确保语法正确 | ||||||
|  |         int count = (int)leaveService.count(Wrappers.<BusLeave>lambdaQuery() | ||||||
|  |             .eq(BusLeave::getTimeType, "2") | ||||||
|  |             // 关键:给日期字符串加单引号,避免 SQL 语法错误 | ||||||
|  |             .apply("DATE(start_time) <= {0}", todayStr) | ||||||
|  |             .apply("DATE(end_time) >= {0}", todayStr) | ||||||
|  |         ); | ||||||
|  |  | ||||||
|  |         List<BusAttendance> list; | ||||||
|  |         if(CollectionUtil.isEmpty(allUserIds)){ | ||||||
|  |             list = new ArrayList<>(); | ||||||
|  |         }else { | ||||||
|  |             list = list(Wrappers.<BusAttendance>lambdaQuery() | ||||||
|  |                 .in(CollectionUtil.isNotEmpty(allUserIds),BusAttendance::getUserId, allUserIds) | ||||||
|  |                 .eq(BusAttendance::getClockDate, now) | ||||||
|  |                 .orderByAsc(BusAttendance::getClockDate) | ||||||
|  |             ); | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         Map<Long, List<BusAttendance>> collect = list.stream().collect(Collectors.groupingBy(BusAttendance::getUserId)); | ||||||
|  |  | ||||||
|  |         int full = 0, half = 0, absent = 0; | ||||||
|  |  | ||||||
|  |         for (Map.Entry<Long, List<BusAttendance>> userEntry : collect.entrySet()) { | ||||||
|  |             List<BusAttendance> records = userEntry.getValue(); | ||||||
|  |  | ||||||
|  |             long validCount = records.stream() | ||||||
|  |                 .map(BusAttendance::getClockStatus) | ||||||
|  |                 .filter(ATTENDANCE_LIST::contains) | ||||||
|                 .count(); |                 .count(); | ||||||
|  |  | ||||||
|             if (validCount >= 2) { |             if (validCount >= 2) { | ||||||
| @ -1209,23 +1333,16 @@ public class BusAttendanceServiceImpl extends ServiceImpl<BusAttendanceMapper, B | |||||||
|         } |         } | ||||||
|  |  | ||||||
|         BusAttendanceClockDateForTwoWeekVo vo = new BusAttendanceClockDateForTwoWeekVo(); |         BusAttendanceClockDateForTwoWeekVo vo = new BusAttendanceClockDateForTwoWeekVo(); | ||||||
|             vo.setClockDate(currentDate); |         vo.setClockDate(now); | ||||||
|         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()- count); | ||||||
|                 vo.setAllUserNum(allUserIds.size()); |  | ||||||
|         vo.setClockNum(full+half); |         vo.setClockNum(full+half); | ||||||
|         vo.setAttendanceRate(BigDecimalUtil.toPercentage(new BigDecimal(full+half), |         vo.setAttendanceRate(BigDecimalUtil.toPercentage(new BigDecimal(full+half), | ||||||
|                     new BigDecimal(allUserIds.size()))); |                 new BigDecimal(vo.getAllUserNum()))); | ||||||
|             } |         return vo; | ||||||
|  |  | ||||||
|             result.add(vo); |  | ||||||
|             currentDate = currentDate.plusDays(1); |  | ||||||
|         } |  | ||||||
|  |  | ||||||
|         return result; |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|  | |||||||
| @ -371,15 +371,13 @@ public class BusLeaveServiceImpl extends ServiceImpl<BusLeaveMapper, BusLeave> | |||||||
|  |  | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public Boolean isLeave(LocalDate date, Long userId) { |     public Boolean isLeave(LocalDateTime clockTime, Long userId) { | ||||||
|         LocalDateTime dateStart = LocalDateTime.of(date, LocalTime.MIN); |  | ||||||
|         LocalDateTime dateEnd = LocalDateTime.of(date, LocalTime.MAX); |  | ||||||
|  |  | ||||||
|         LambdaQueryWrapper<BusLeave> wrappers = new LambdaQueryWrapper<>(); |         LambdaQueryWrapper<BusLeave> wrappers = new LambdaQueryWrapper<>(); | ||||||
|         wrappers.eq(BusLeave::getUserId, userId) |         wrappers.eq(BusLeave::getUserId, userId) | ||||||
|             .eq(BusLeave::getAuditStatus, BusinessStatusEnum.FINISH.getStatus()) |             .eq(BusLeave::getAuditStatus, BusinessStatusEnum.FINISH.getStatus()) | ||||||
|             .le(BusLeave::getStartTime, dateEnd)    // 请假开始时间 <= 当天结束时间 |             .le(BusLeave::getStartTime, clockTime)    // 请假开始时间 <= 当天打卡时间 | ||||||
|             .ge(BusLeave::getEndTime, dateStart);   // 请假结束时间 >= 当天开始时间 |             .ge(BusLeave::getEndTime, clockTime);   // 请假结束时间 >= 当天打卡时间 | ||||||
|  |  | ||||||
|         return count(wrappers) > 0; |         return count(wrappers) > 0; | ||||||
|     } |     } | ||||||
|  | |||||||
| @ -33,8 +33,10 @@ import org.dromara.project.mapper.BusProjectTeamMemberMapper; | |||||||
| import org.dromara.project.service.*; | import org.dromara.project.service.*; | ||||||
| import org.dromara.system.domain.SysUser; | import org.dromara.system.domain.SysUser; | ||||||
| import org.dromara.system.domain.SysUserRole; | import org.dromara.system.domain.SysUserRole; | ||||||
|  | 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.SysUserRoleMapper; | import org.dromara.system.mapper.SysUserRoleMapper; | ||||||
|  | import org.dromara.system.service.ISysOssService; | ||||||
| import org.dromara.system.service.ISysRoleService; | import org.dromara.system.service.ISysRoleService; | ||||||
| import org.dromara.system.service.ISysUserService; | import org.dromara.system.service.ISysUserService; | ||||||
| import org.springframework.beans.BeanUtils; | import org.springframework.beans.BeanUtils; | ||||||
| @ -84,6 +86,9 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM | |||||||
|     @Resource |     @Resource | ||||||
|     private ISysRoleService roleService; |     private ISysRoleService roleService; | ||||||
|  |  | ||||||
|  |     @Resource | ||||||
|  |     private ISysOssService ossService; | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 查询项目班组下的成员 |      * 查询项目班组下的成员 | ||||||
| @ -366,6 +371,13 @@ public class BusProjectTeamMemberServiceImpl extends ServiceImpl<BusProjectTeamM | |||||||
|         SysUserVo userVo = userService.selectUserById(memberId); |         SysUserVo userVo = userService.selectUserById(memberId); | ||||||
|         if (userVo != null) { |         if (userVo != null) { | ||||||
|             projectTeamMemberVo.setMemberName(userVo.getNickName()); |             projectTeamMemberVo.setMemberName(userVo.getNickName()); | ||||||
|  |             Long avatar = userVo.getAvatar(); | ||||||
|  |             if(avatar != null){ | ||||||
|  |                 SysOssVo byId = ossService.getById(avatar); | ||||||
|  |                 if(byId != null){ | ||||||
|  |                     projectTeamMemberVo.setAvatar(byId.getUrl()); | ||||||
|  |                 } | ||||||
|  |             } | ||||||
|         } else { |         } else { | ||||||
|             SubConstructionUser user = constructionUserService.getBySysUserId(memberId); |             SubConstructionUser user = constructionUserService.getBySysUserId(memberId); | ||||||
|             projectTeamMemberVo.setMemberName(user.getUserName()); |             projectTeamMemberVo.setMemberName(user.getUserName()); | ||||||
|  | |||||||
| @ -16,7 +16,10 @@ 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.contractor.domain.SubConstructionUser; | import org.dromara.contractor.domain.SubConstructionUser; | ||||||
|  | import org.dromara.contractor.domain.SubContractor; | ||||||
| import org.dromara.contractor.service.ISubConstructionUserService; | import org.dromara.contractor.service.ISubConstructionUserService; | ||||||
|  | import org.dromara.contractor.service.ISubContractorService; | ||||||
|  | import org.dromara.project.domain.BusProject; | ||||||
| import org.dromara.project.domain.BusProjectPunchrange; | import org.dromara.project.domain.BusProjectPunchrange; | ||||||
| import org.dromara.project.domain.BusProjectTeam; | import org.dromara.project.domain.BusProjectTeam; | ||||||
| import org.dromara.project.domain.BusProjectTeamMember; | import org.dromara.project.domain.BusProjectTeamMember; | ||||||
| @ -70,6 +73,9 @@ public class BusProjectTeamServiceImpl extends ServiceImpl<BusProjectTeamMapper, | |||||||
|     @Resource |     @Resource | ||||||
|     private ISysUserService userService; |     private ISysUserService userService; | ||||||
|  |  | ||||||
|  |     @Resource | ||||||
|  |     private ISubContractorService contractorService; | ||||||
|  |  | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 查询项目班组 |      * 查询项目班组 | ||||||
| @ -345,6 +351,14 @@ public class BusProjectTeamServiceImpl extends ServiceImpl<BusProjectTeamMapper, | |||||||
|             return projectTeamVo; |             return projectTeamVo; | ||||||
|         } |         } | ||||||
|         BeanUtils.copyProperties(projectTeam, projectTeamVo); |         BeanUtils.copyProperties(projectTeam, projectTeamVo); | ||||||
|  |         if (projectTeam.getContractorId() != null) { | ||||||
|  |             SubContractor subContractor = contractorService.getById(projectTeam.getContractorId()); | ||||||
|  |             if (subContractor != null) { | ||||||
|  |                 projectTeamVo.setContractorName(subContractor.getName()); | ||||||
|  |             } | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |  | ||||||
|         // 获取班组人数 |         // 获取班组人数 | ||||||
|         Long peopleNumber = projectTeamMemberService.lambdaQuery() |         Long peopleNumber = projectTeamMemberService.lambdaQuery() | ||||||
|             .eq(BusProjectTeamMember::getTeamId, projectTeam.getId()) |             .eq(BusProjectTeamMember::getTeamId, projectTeam.getId()) | ||||||
| @ -436,7 +450,9 @@ public class BusProjectTeamServiceImpl extends ServiceImpl<BusProjectTeamMapper, | |||||||
|         List<SysUserVo> sysUserVos = userService.selectUserByIds(userIdList, null); |         List<SysUserVo> sysUserVos = userService.selectUserByIds(userIdList, null); | ||||||
|         Map<Long, String> collect = sysUserVos.stream().collect(Collectors.toMap(SysUserVo::getUserId, SysUserVo::getNickName)); |         Map<Long, String> collect = sysUserVos.stream().collect(Collectors.toMap(SysUserVo::getUserId, SysUserVo::getNickName)); | ||||||
|  |  | ||||||
|  |         List<Long> list1 = projectTeamList.stream().map(BusProjectTeam::getContractorId).toList(); | ||||||
|  |         List<SubContractor> subContractors = contractorService.listByIds(list1); | ||||||
|  |         Map<Long, String> contractorMap = subContractors.stream().collect(Collectors.toMap(SubContractor::getId, SubContractor::getName)); | ||||||
|  |  | ||||||
|         // 对象列表 => 封装对象列表 |         // 对象列表 => 封装对象列表 | ||||||
|         List<BusProjectTeamVo> projectTeamVoList = projectTeamList.stream().map(projectTeam -> { |         List<BusProjectTeamVo> projectTeamVoList = projectTeamList.stream().map(projectTeam -> { | ||||||
| @ -449,6 +465,7 @@ public class BusProjectTeamServiceImpl extends ServiceImpl<BusProjectTeamMapper, | |||||||
|                 String[] split = userId.split(","); |                 String[] split = userId.split(","); | ||||||
|                 projectTeamVo.setUserName(Arrays.stream(split).map(s -> collect.getOrDefault(Long.valueOf(s.trim()), "")).collect(Collectors.joining(","))); |                 projectTeamVo.setUserName(Arrays.stream(split).map(s -> collect.getOrDefault(Long.valueOf(s.trim()), "")).collect(Collectors.joining(","))); | ||||||
|             } |             } | ||||||
|  |             projectTeamVo.setContractorName(contractorMap.getOrDefault(projectTeam.getContractorId(), "")); | ||||||
|             return projectTeamVo; |             return projectTeamVo; | ||||||
|         }).toList(); |         }).toList(); | ||||||
|         projectTeamVoPage.setRecords(projectTeamVoList); |         projectTeamVoPage.setRecords(projectTeamVoList); | ||||||
|  | |||||||
| @ -17,6 +17,7 @@ import org.dromara.common.web.core.BaseController; | |||||||
| import org.dromara.system.domain.SysMenu; | import org.dromara.system.domain.SysMenu; | ||||||
| import org.dromara.system.domain.bo.SysMenuBo; | import org.dromara.system.domain.bo.SysMenuBo; | ||||||
| import org.dromara.system.domain.vo.MenuTreeSelectVo; | import org.dromara.system.domain.vo.MenuTreeSelectVo; | ||||||
|  | import org.dromara.system.domain.vo.MetaVo; | ||||||
| import org.dromara.system.domain.vo.RouterVo; | import org.dromara.system.domain.vo.RouterVo; | ||||||
| import org.dromara.system.domain.vo.SysMenuVo; | import org.dromara.system.domain.vo.SysMenuVo; | ||||||
| import org.dromara.system.service.ISysMenuService; | import org.dromara.system.service.ISysMenuService; | ||||||
| @ -56,6 +57,17 @@ public class SysMenuController extends BaseController { | |||||||
|         return R.ok(menuService.buildMenus(menus)); |         return R.ok(menuService.buildMenus(menus)); | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  |     @GetMapping("/getAppRouters/{projectId}") | ||||||
|  |     public R<List<SysMenuVo>> getRoutersList(@NotNull(message = "项目主键不能为空") | ||||||
|  |                                         @PathVariable Long projectId) { | ||||||
|  |         Long userId = LoginHelper.getUserId(); | ||||||
|  |         SysMenuBo sysMenuBo = new SysMenuBo(); | ||||||
|  |         sysMenuBo.setMenuSource("2"); | ||||||
|  |         sysMenuBo.setProjectId(projectId); | ||||||
|  |         List<SysMenuVo> menus = menuService.selectMenuList(sysMenuBo, userId); | ||||||
|  |         return R.ok(menus); | ||||||
|  |     } | ||||||
|  |  | ||||||
|     /** |     /** | ||||||
|      * 获取菜单列表 |      * 获取菜单列表 | ||||||
|      */ |      */ | ||||||
|  | |||||||
| @ -387,7 +387,7 @@ public class SysUserController extends BaseController { | |||||||
|      * 获取分包单位列表 |      * 获取分包单位列表 | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:user:updateFb") |     @SaCheckPermission("system:user:updateFb") | ||||||
|     @PutMapping("/{projectId}") |     @GetMapping("/fb/{projectId}") | ||||||
|     public R<List<SubContractor>> getFbList(@PathVariable("projectId") Long projectId) { |     public R<List<SubContractor>> getFbList(@PathVariable("projectId") Long projectId) { | ||||||
|         List<SubContractor> list = contractorService.list(Wrappers.<SubContractor>lambdaQuery() |         List<SubContractor> list = contractorService.list(Wrappers.<SubContractor>lambdaQuery() | ||||||
|             .select(SubContractor::getId, SubContractor::getName) |             .select(SubContractor::getId, SubContractor::getName) | ||||||
| @ -400,7 +400,7 @@ public class SysUserController extends BaseController { | |||||||
|      * 修改分包单位 |      * 修改分包单位 | ||||||
|      */ |      */ | ||||||
|     @SaCheckPermission("system:user:updateFb") |     @SaCheckPermission("system:user:updateFb") | ||||||
|     @PutMapping("/{userId}/{contractorId}") |     @PutMapping("/fb/{userId}/{contractorId}") | ||||||
|     public R<Boolean> updateFb(@PathVariable("userId") Long userId, |     public R<Boolean> updateFb(@PathVariable("userId") Long userId, | ||||||
|                                @PathVariable("contractorId") Long contractorId) { |                                @PathVariable("contractorId") Long contractorId) { | ||||||
|         return R.ok(userService.updateFb(userId, contractorId)); |         return R.ok(userService.updateFb(userId, contractorId)); | ||||||
|  | |||||||
| @ -113,4 +113,7 @@ public class SysMenuBo extends BaseEntity { | |||||||
|      */ |      */ | ||||||
|     private String menuSource; |     private String menuSource; | ||||||
|  |  | ||||||
|  |  | ||||||
|  |     private Long projectId; | ||||||
|  |  | ||||||
| } | } | ||||||
|  | |||||||
| @ -136,5 +136,5 @@ public interface SysUserMapper extends BaseMapperPlus<SysUser, SysUserVo> { | |||||||
|  |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     List<SysUserVo> selectUserListByAppUserType(@Param("appUserType") String appUserType, @Param("projectId")Long projectId); |     List<SysUserVo> selectUserListByAppUserType(@Param("appUserType") String appUserType, @Param("projectId")Long projectId, @Param("contractorId")Long contractorId); | ||||||
| } | } | ||||||
|  | |||||||
| @ -273,7 +273,7 @@ public interface ISysUserService { | |||||||
|  |  | ||||||
|     Boolean queryProjectRelevancy(Long userId); |     Boolean queryProjectRelevancy(Long userId); | ||||||
|  |  | ||||||
|     List<SysUserVo> selectUserListByAppUserType(String appUserType,Long projectId); |     List<SysUserVo> selectUserListByAppUserType(String appUserType,Long projectId,Long contractorId); | ||||||
|  |  | ||||||
|     Boolean updateFb(Long userId,Long contractorId); |     Boolean updateFb(Long userId,Long contractorId); | ||||||
| } | } | ||||||
|  | |||||||
| @ -77,7 +77,14 @@ public class SysMenuServiceImpl implements ISysMenuService { | |||||||
|                 .orderByAsc(SysMenu::getOrderNum)); |                 .orderByAsc(SysMenu::getOrderNum)); | ||||||
|         } else { |         } else { | ||||||
|             QueryWrapper<SysMenu> wrapper = Wrappers.query(); |             QueryWrapper<SysMenu> wrapper = Wrappers.query(); | ||||||
|             wrapper.inSql("r.role_id", "select role_id from sys_user_role where user_id = " + userId) |             // 构建子查询的基础SQL | ||||||
|  |             StringBuilder subSql = new StringBuilder("select role_id from sys_user_role where user_id = " + userId); | ||||||
|  |  | ||||||
|  |             // 如果projectId有值,追加条件 | ||||||
|  |             if (menu.getProjectId() != null) { | ||||||
|  |                 subSql.append(" and project_id = ").append(menu.getProjectId()); | ||||||
|  |             } | ||||||
|  |             wrapper.inSql("r.role_id", subSql.toString()) | ||||||
|                 .like(StringUtils.isNotBlank(menu.getMenuName()), "m.menu_name", menu.getMenuName()) |                 .like(StringUtils.isNotBlank(menu.getMenuName()), "m.menu_name", menu.getMenuName()) | ||||||
|                 .eq(StringUtils.isNotBlank(menu.getVisible()), "m.visible", menu.getVisible()) |                 .eq(StringUtils.isNotBlank(menu.getVisible()), "m.visible", menu.getVisible()) | ||||||
|                 .eq(StringUtils.isNotBlank(menu.getStatus()), "m.status", menu.getStatus()) |                 .eq(StringUtils.isNotBlank(menu.getStatus()), "m.status", menu.getStatus()) | ||||||
|  | |||||||
| @ -960,8 +960,8 @@ public class SysUserServiceImpl implements ISysUserService, UserService { | |||||||
|     } |     } | ||||||
|  |  | ||||||
|     @Override |     @Override | ||||||
|     public List<SysUserVo> selectUserListByAppUserType(String appUserType,Long projectId) { |     public List<SysUserVo> selectUserListByAppUserType(String appUserType,Long projectId,Long contractorId) { | ||||||
|         return  baseMapper.selectUserListByAppUserType(appUserType,projectId); |         return  baseMapper.selectUserListByAppUserType(appUserType,projectId,contractorId); | ||||||
|  |  | ||||||
|     } |     } | ||||||
|  |  | ||||||
|  | |||||||
| @ -135,6 +135,7 @@ | |||||||
|         WHERE |         WHERE | ||||||
|             bur.project_id = #{projectId} |             bur.project_id = #{projectId} | ||||||
|           AND su.app_user_type = #{appUserType} |           AND su.app_user_type = #{appUserType} | ||||||
|  |           AND su.contractor_id = #{contractorId} | ||||||
|           AND su.del_flag = '0' |           AND su.del_flag = '0' | ||||||
|           AND su.status = '0' |           AND su.status = '0' | ||||||
|     </select> |     </select> | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user
	 zt
					zt