无关风月
2025-07-02 f287dfb5249618bf821626e76b7ce8d8f74d6b99
保洁巡检本周代码
10个文件已修改
304 ■■■■ 已修改文件
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppealController.java 14 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTaskController.java 35 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TIndexController.java 24 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java 194 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/applet/vo/IndexVO.java 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/model/TProjectDept.java 4 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TProjectDeptServiceImpl.java 19 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTaskCleanServiceImpl.java 5 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/java/com/ruoyi/system/vo/system/ProjectDeptListVO.java 3 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-system/src/main/resources/mapper/system/TProjectDeptMapper.xml 2 ●●● 补丁 | 查看 | 原始文档 | blame | 历史
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TAppealController.java
@@ -169,17 +169,31 @@
        appealDetailVO.setTaskCode(byId.getTaskCode());
        return R.ok(appealDetailVO);
    }
    @Resource
    private TNoticeService noticeService;
    @Log(title = "审核申诉记录", businessType = BusinessType.UPDATE)
    @ApiOperation(value = "审核申诉记录")
    @PostMapping(value = "/audit")
    public R<Boolean> audit(@RequestBody @Valid TAppealAuditDTO dto) {
        TTask task = taskCleanService.getById(dto.getTaskId());
        TLocation location = locationService.getById(task.getLocationId());
        TNotice tNotice = new TNotice();
        tNotice.setUserId(dto.getAppealPerson());
        tNotice.setStatus(1);
        tNotice.setDataId(dto.getId());
        dto.setAuditTime(LocalDateTime.now());
        if (dto.getStatus()==2){
            // 通过
            TTask byId = taskCleanService.getById(dto.getTaskId());
            byId.setStatus(6);
            taskCleanService.updateById(byId);
            tNotice.setNoticeType(5);
            tNotice.setNoticeContent("【"+location.getLocationName()+"】任务申诉通过");
        }else{
            tNotice.setNoticeType(4);
            tNotice.setNoticeContent("【"+location.getLocationName()+"】任务申诉驳回");
        }
        noticeService.save(tNotice);
        dto.setAuditPerson(tokenService.getLoginUser().getUserId()+"");
        appealService.updateById(dto);
        return R.ok();
ruoyi-admin/src/main/java/com/ruoyi/web/controller/api/TTaskController.java
@@ -57,7 +57,10 @@
public class TTaskController {
    @Resource
    private TTaskCleanService taskCleanerService;
    @Resource
    private TNoticeService noticeService;
    @Resource
    private TNoticeSetService noticeSetService;
    @Resource
    private TTaskDetailService taskDetailService;
@@ -172,24 +175,40 @@
    @PostMapping(value = "/audit")
    public R<Boolean> audit(@RequestBody  TTaskAuditDTO dto) {
        dto.setAuditTime(LocalDateTime.now());
        TTask byId = taskCleanerService.getById(dto.getTaskId());
        TTask task = taskCleanerService.getById(dto.getTaskId());
        TLocation location = locationService.getById(task.getLocationId());
        TNotice tNotice = new TNotice();
        TNoticeSet noticeSet = noticeSetService.lambdaQuery().eq(TNoticeSet::getType, 2).last("limit 1")
                .one();
        tNotice.setUserId(task.getPatrolInspector());
        tNotice.setStatus(1);
        tNotice.setDataId(task.getId());
        tNotice.setNoticeSetType(noticeSet.getNoticeType());
        if (dto.getAuditStatus()==2){
            dto.setHandleType(3);
            // 将任务修改为待整改
            byId.setStatus(4);
            taskCleanerService.updateById(byId);
            task.setStatus(4);
            taskCleanerService.updateById(task);
            // 增加消息
            tNotice.setNoticeType(1);
            tNotice.setNoticeContent("【"+location.getLocationName()+"】任务不合格,请重新上传!");
        }else{
            dto.setHandleType(2);
            // 如果是初次审核就通过 将状态设置为已完成
            List<TTaskDetail> list = taskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, dto.getTaskId()).list();
            if (list.isEmpty()){
                byId.setStatus(6);
                taskCleanerService.updateById(byId);
                task.setStatus(6);
                taskCleanerService.updateById(task);
            }else{
                byId.setStatus(5);
                taskCleanerService.updateById(byId);
                task.setStatus(5);
                taskCleanerService.updateById(task);
            }
            // 增加消息
            tNotice.setNoticeType(2);
            tNotice.setNoticeContent("【"+location.getLocationName()+"】任务已通过");
        }
        noticeService.save(tNotice);
        dto.setAuditPerson(tokenService.getLoginUser().getUserId()+"");
        taskDetailService.save(dto);
        return R.ok();
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TIndexController.java
@@ -301,7 +301,8 @@
        }
        return R.ok(projectDeptListNoLimitVOS);
    }
@Resource
private TNoticeService noticeService;
    @ApiOperation(value = "首页")
    @PostMapping(value = "/index")
    public R<IndexVO> index(@RequestBody IndexDTO dto) throws IOException {
@@ -309,7 +310,12 @@
//            return R.fail("请上传经纬度");
//        }
        IndexVO res = new IndexVO();
        res.setIsNotice(0);
        Long userId = tokenService.getLoginUserApplet().getUserId();
        Long count = noticeService.lambdaQuery().eq(TNotice::getUserId, userId).eq(TNotice::getStatus, 1).count();
        if (count>0){
            res.setIsNotice(1);
        }
        List<TLocation> locationList = locationService.list();
        List<TLocationType> locationTypeList = locationTypeService.list();
        List<TTask> taskAll = taskCleanerService.lambdaQuery().eq(TTask::getPatrolInspector, userId).list();
@@ -423,6 +429,7 @@
            leaveUserListVO.setCreateTime1(tLeave.getCreateTime());
            leaveUserListVO.setStartTime1(tLeave.getStartTime());
            leaveUserListVO.setEndTime1(tLeave.getEndTime());
            leaveList.add(leaveUserListVO);
        }
        List<TTask> taskList = taskAll.stream().filter(e -> e.getPatrolInspector().equals(userId + "") && e.getStatus() == 4).collect(Collectors.toList());
        List<String> taskIds = taskList.stream().map(TTask::getId).collect(Collectors.toList());
@@ -524,6 +531,21 @@
        }
        Collections.shuffle(tomorrowTask);
        res.setTomorrowTask(tomorrowTask);
        res.setIsLeave(0);
        // 查询请假状态
        List<TLeave> list2 = leaveService.lambdaQuery().eq(TLeave::getLeavePerson, userId)
                .eq(TLeave::getAuditStatus, 2)
                .list();
        for (TLeave tLeave : list2) {
            LocalDate now = LocalDate.now();
            LocalDate startDate = tLeave.getStartTime().toLocalDate();
            LocalDate endDate = tLeave.getStartTime().toLocalDate();
            if (now.isAfter(startDate) && now.isBefore(endDate)) {
                res.setIsLeave(1);
            } else if (now.isEqual(startDate) || now.isEqual(endDate)) {
                res.setIsLeave(1);
            }
        }
        return R.ok(res);
    }
}
ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java
@@ -98,15 +98,25 @@
    private TProblemEscalationService problemEscalationService;
    @Resource
    private TNoticeService noticeService;
    @ApiOperation(value = "消息通知列表")
    @PostMapping(value = "/noticeList")
    public R<PageInfo<NoticeListVO>> noticeList(@RequestBody NoticeListQuery query) {
        Long userId = tokenService.getLoginUserApplet().getUserId();
        query.setUserId(userId+"");
        return R.ok(noticeService.noticeList(query));
        query.setUserId(userId + "");
        PageInfo<NoticeListVO> noticeListVOPageInfo = noticeService.noticeList(query);
        List<NoticeListVO> records = noticeListVOPageInfo.getRecords();
        List<NoticeListVO> noticeListVOS = new ArrayList<>(records);
        for (NoticeListVO noticeListVO : noticeListVOS) {
            noticeListVO.setStatus(2);
            noticeService.updateById(noticeListVO);
        }
        return R.ok(noticeListVOPageInfo);
    }
    /**
     * 生成数据
     *
     * @param id
     * @return
     */
@@ -179,17 +189,19 @@
        userIndexVO.setAvatar(sysUser.getAvatar());
        userIndexVO.setNickName(sysUser.getNickName());
        userIndexVO.setPhonenumber(sysUser.getPhonenumber());
        if (sysUser.getDeptType() == 1){
        if (sysUser.getDeptType() == 1) {
            TProjectDept tProjectDept = projectDeptService.getById(sysUser.getDeptId());
            if (!tProjectDept.getParentId().equals("0")){
            if (!tProjectDept.getParentId().equals("0")) {
                TProjectDept tProjectDept1 = projectDeptService.getById(tProjectDept.getParentId());
                userIndexVO.setDeptName(tProjectDept1.getProjectName()+">"+tProjectDept.getProjectName());
            }else{
                userIndexVO.setDeptName(tProjectDept1.getProjectName() + ">" + tProjectDept.getProjectName());
            } else {
                userIndexVO.setDeptName(tProjectDept.getProjectName());
            }
        }else{
        } else {
            TDept tDept = deptService.getById(sysUser.getDeptId());
            userIndexVO.setDeptName(tDept.getDeptName());
            if (tDept != null) {
                userIndexVO.setDeptName(tDept.getDeptName());
            }
        }
        // 查询请假状态
        List<TLeave> list = leaveService.lambdaQuery().eq(TLeave::getLeavePerson, userId)
@@ -202,7 +214,7 @@
            LocalDate endDate = tLeave.getStartTime().toLocalDate();
            if (now.isAfter(startDate) && now.isBefore(endDate)) {
                userIndexVO.setIsLeave(1);
            }else if (now.isEqual(startDate)|| now.isEqual(endDate)){
            } else if (now.isEqual(startDate) || now.isEqual(endDate)) {
                userIndexVO.setIsLeave(1);
            }
        }
@@ -222,7 +234,7 @@
                .le(TTask::getImplementTime, endOfMonth).list();
        List<String> taskIds = finishTask.stream().map(TTask::getId).collect(Collectors.toList());
        List<TTaskDetail> taskDetails = taskDetailService.lambdaQuery()
                .eq(TTaskDetail::getAuditStatus,1).in(TTaskDetail::getTaskId, taskIds)
                .eq(TTaskDetail::getAuditStatus, 1).in(TTaskDetail::getTaskId, taskIds)
                .isNotNull(TTaskDetail::getClearStatus)
                .groupBy(TTaskDetail::getTaskId)
                .orderByDesc(TTaskDetail::getCreateTime).list();
@@ -231,22 +243,23 @@
        userIndexVO.setFinishCount(size);
        List<TTaskDetail> status1 = taskDetails.stream().filter(e -> e.getClearStatus() == 1).collect(Collectors.toList());
        List<TTaskDetail> status2 = taskDetails.stream().filter(e -> e.getClearStatus() == 2).collect(Collectors.toList());
        if (status1.size()+status2.size()!=0){
            BigDecimal divide = new BigDecimal(status1.size()+status2.size())
        if (status1.size() + status2.size() != 0) {
            BigDecimal divide = new BigDecimal(status1.size() + status2.size())
                    .divide(new BigDecimal(status1.size()), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100));
            userIndexVO.setRate(divide);
        }else{
        } else {
            userIndexVO.setRate(new BigDecimal(0));
        }
        // todo 月排名
        userIndexVO.setRanking(0);
        return R.ok(userIndexVO);
    }
    @ApiOperation(value = "任务记录分页列表")
    @PostMapping(value = "/taskList")
    public R<PageInfo<TaskUserListVO>> pageList(@RequestBody TaskUserListQuery query) {
        Long userId = tokenService.getLoginUserApplet().getUserId();
        query.setUserId(userId+"");
        query.setUserId(userId + "");
        return R.ok(taskCleanerService.pageListUser(query));
    }
@@ -265,19 +278,20 @@
        taskDetailVO.setLocationName(byId2.getLocationName());
        TTaskDetail tTaskDetail = list.stream().filter(e -> e.getHandleType() == 1).findFirst().orElse(null);
        TTaskDetail tTaskDetailFinish = list.stream().filter(e -> e.getHandleType() == 2).findFirst().orElse(null);
        if (tTaskDetail!=null &&  tTaskDetail.getUnqualified()!=null){
        if (tTaskDetail != null && tTaskDetail.getUnqualified() != null) {
            TDictData byId3 = dictDataService.getById(tTaskDetail.getUnqualified());
            if (byId3!=null){
            if (byId3 != null) {
                tTaskDetail.setUnqualifiedName(byId3.getDataContent());
            }
        }
        if (tTaskDetailFinish!=null){
        if (tTaskDetailFinish != null) {
            tTaskDetailFinish.setFinishTime(tTaskDetailFinish.getCreateTime());
        }
        taskDetailVO.setTaskDetail(tTaskDetail);
        taskDetailVO.setRecords(list);
        return R.ok(taskDetailVO);
    }
    @ApiOperation(value = "详情任务-操作记录-详情")
    @GetMapping(value = "/detailRecord")
    public R<TaskRecordDetailVO> detailRecord(@RequestParam String id) {
@@ -290,31 +304,33 @@
        taskDetailVO.setLocationAddress(byId1.getLocationAddress());
        taskDetailVO.setLocationIcon(byId2.getLocationIcon());
        taskDetailVO.setLocationName(byId2.getLocationName());
        if (  byId4.getUnqualified()!=null){
        if (byId4.getUnqualified() != null) {
            TDictData byId3 = dictDataService.getById(byId4.getUnqualified());
            if (byId3!=null){
            if (byId3 != null) {
                byId4.setUnqualifiedName(byId3.getDataContent());
            }
        }
        SysUser sysUser = sysUserService.selectUserById(Long.valueOf(byId4.getAuditPerson()));
        if (sysUser!=null){
        if (sysUser != null) {
            byId4.setAuditPersonName(sysUser.getUserName());
        }
        taskDetailVO.setTaskDetail(byId4);
        return R.ok(taskDetailVO);
    }
    @ApiOperation(value = "申诉记录分页列表")
    @PostMapping(value = "/appealList")
    public R<PageInfo<AppealListVO>> pageListUser(@RequestBody AppealListQuery query) {
        query.setUserId(tokenService.getLoginUserApplet().getUserId()+"");
        query.setUserId(tokenService.getLoginUserApplet().getUserId() + "");
        return R.ok(appealService.pageListUser(query));
    }
    @ApiOperation(value = "详情申诉记录")
    @GetMapping(value = "/appealDetail")
    public R<AppealDetailVO> appealDetail(@RequestParam String id) {
        AppealDetailVO appealDetailVO = new AppealDetailVO();
        TAppeal appeal = appealService.getById(id);
        BeanUtils.copyProperties(appeal,appealDetailVO);
        BeanUtils.copyProperties(appeal, appealDetailVO);
        TTask byId = taskCleanerService.getById(appeal.getTaskId());
        TLocation byId1 = locationService.getById(byId.getLocationId());
        TLocationType byId2 = locationTypeService.getById(byId1.getLocationType());
@@ -322,9 +338,9 @@
        appealDetailVO.setLocationIcon(byId2.getLocationIcon());
        appealDetailVO.setLocationName(byId2.getLocationName());
        appealDetailVO.setTaskId(byId.getId());
        if (StringUtils.hasLength(appeal.getAuditPerson())){
        if (StringUtils.hasLength(appeal.getAuditPerson())) {
            SysUser sysUser = sysUserService.selectUserById(Long.valueOf(appeal.getAuditPerson()));
            if (sysUser!=null){
            if (sysUser != null) {
                appealDetailVO.setAuditPersonName(sysUser.getUserName());
            }
        }
@@ -342,53 +358,69 @@
        appealService.updateById(byId);
        return R.ok();
    }
    @ApiOperation(value = "获取距离最近的任务列表")
    @PostMapping(value = "/listAllTask")
    public R<List<TaskListAllVO>> listAllTask(@RequestBody AppealListDTO appealListDTO) {
        List<TaskListAllVO> res = appealService.listAllTask(appealListDTO);
        return R.ok(res);
    }
    @ApiOperation(value = "不合格原因列表")
    @PostMapping(value = "/unqualifiedList")
    public R<List<TDictData>> unqualifiedList() {
        List<TDictData> list = dictDataService.list(
                new LambdaQueryWrapper<TDictData>()
                        .eq(TDictData::getDataType,2)
                        .eq(TDictData::getDataType, 2)
        );
        return R.ok(list);
    }
    @ApiOperation(value = "上传督察任务")
    @PostMapping(value = "/addInspector")
    public R<Boolean> addInspector(@RequestBody InspectorAddDTO dto) {
        dto.setCommitPerson(tokenService.getLoginUserApplet().getUserId()+"");
        if (dto.getClearStatus()==1){
        TTask task = taskCleanerService.getById(dto.getTaskId());
        TLocation location = locationService.getById(task.getLocationId());
        SysUser sysUser = sysUserService.selectUserById(Long.valueOf(task.getPatrolInspector()));
        dto.setCommitPerson(tokenService.getLoginUserApplet().getUserId() + "");
        if (dto.getClearStatus() == 1) {
            dto.setStatus(4);
        }else{
        } else {
            dto.setStatus(1);
            TNotice tNotice = new TNotice();
            tNotice.setUserId(sysUser.getUserId()+"");
            tNotice.setNoticeContent("【"+location.getLocationName()+"】任务督察不合格,请及时整改!");
            tNotice.setStatus(1);
            tNotice.setDataId(dto.getTaskId());
            tNotice.setNoticeType(8);
            noticeService.save(tNotice);
        }
        inspectorService.save(dto);
        return R.ok();
    }
    @ApiOperation(value = "上传意见反馈")
    @PostMapping(value = "/addFeedback")
    public R<Boolean> addFeedback(@RequestBody FeedbackDTO dto) {
        dto.setFeedbackPerson(tokenService.getLoginUserApplet().getUserId()+"");
        dto.setFeedbackPerson(tokenService.getLoginUserApplet().getUserId() + "");
        feedbackService.save(dto);
        return R.ok();
    }
    @ApiOperation(value = "上传问题上报")
    @PostMapping(value = "/addProblem")
    public R<Boolean> addProblem(@RequestBody ProblemDTO dto) {
        dto.setEscalationId(tokenService.getLoginUserApplet().getUserId()+"");
        dto.setEscalationId(tokenService.getLoginUserApplet().getUserId() + "");
        problemEscalationService.save(dto);
        return R.ok();
    }
    @ApiOperation(value = "问题类型列表")
    @PostMapping(value = "/problemList")
    public R<List<TDictData>> problemList() {
        List<TDictData> list = dictDataService.list(
                new LambdaQueryWrapper<TDictData>()
                        .eq(TDictData::getDataType,3)
                        .eq(TDictData::getDataType, 3)
        );
        return R.ok(list);
    }
@@ -403,7 +435,7 @@
    public R<PageInfo<KnowledgeVO>> pageList(@RequestBody KnowledgeListUserQuery query) {
        return R.ok( knowledgeService.pageListUser(query));
        return R.ok(knowledgeService.pageListUser(query));
    }
    @ApiOperation(value = "详情环卫知识")
@@ -415,6 +447,7 @@
        knowledgeService.updateById(byId);
        return R.ok(byId);
    }
    @ApiOperation(value = "发起请假-获取审批流程")
    @GetMapping(value = "/leaveAuditList")
    public R<LeaveAuditListVO> leaveAuditList() {
@@ -427,42 +460,42 @@
        sysRole.setRoleName("项目负责人");
        SysUser auditPerson = sysUserService.selectUserById(999L);
        //项目负责人、部门负责人、公司成员提交由最终审批人审批;
        if (user.getDeptType()==2 ||sysRole.getRoleName().contains("项目负责人")||sysRole.getRoleName().contains("部门负责人")){
        if (user.getDeptType() == 2 || sysRole.getRoleName().contains("项目负责人") || sysRole.getRoleName().contains("部门负责人")) {
            LeaveAuditVO tLeaveAudit = new LeaveAuditVO();
            tLeaveAudit.setAvatar(auditPerson.getAvatar());
            tLeaveAudit.setNickName(auditPerson.getNickName());
            res.setAuditPerson(tLeaveAudit);
            res.setAuditPersonId("999");
        }else if (!sysRole.getRoleName().equals("部门助理")){
        } else if (!sysRole.getRoleName().equals("部门助理")) {
            // 审批人根据当前角色类型来
            if (sysRole.getRoleName().contains("现场负责人")||sysRole.getRoleName().contains("组长")){
            if (sysRole.getRoleName().contains("现场负责人") || sysRole.getRoleName().contains("组长")) {
                List<SysUser> collect = sysUsers.stream().filter(e -> e.getDeptType() == 1 &&
                        e.getDeptId().equals(user.getDeptId())).collect(Collectors.toList());
                for (SysUser sysUser : collect) {
                    Long userRole1 = sysUserService.getUserRole(sysUser.getUserId());
                    SysRole sysRole1 = roleService.selectRoleById(userRole1);
                    if (sysRole1!=null&&sysRole1.getRoleName().equals("项目负责人")){
                    if (sysRole1 != null && sysRole1.getRoleName().equals("项目负责人")) {
                        LeaveAuditVO tLeaveAudit = new LeaveAuditVO();
                        tLeaveAudit.setAvatar(sysUser.getAvatar());
                        tLeaveAudit.setNickName(sysUser.getNickName());
                        res.setAuditPerson(tLeaveAudit);
                        res.setAuditPersonId(sysUser.getUserId()+"");
                        res.setAuditPersonId(sysUser.getUserId() + "");
                        break;
                    }
                }
            }
        }else{
        } else {
            List<SysUser> collect = sysUsers.stream().filter(e -> e.getDeptType() == 1 &&
                    e.getDeptId().equals(user.getDeptId())).collect(Collectors.toList());
            for (SysUser sysUser : collect) {
                Long userRole1 = sysUserService.getUserRole(sysUser.getUserId());
                SysRole sysRole1 = roleService.selectRoleById(userRole1);
                if (sysRole1!=null&&sysRole1.getRoleName().equals("部门负责人")){
                if (sysRole1 != null && sysRole1.getRoleName().equals("部门负责人")) {
                    LeaveAuditVO tLeaveAudit = new LeaveAuditVO();
                    tLeaveAudit.setAvatar(sysUser.getAvatar());
                    tLeaveAudit.setNickName(sysUser.getNickName());
                    res.setAuditPerson(tLeaveAudit);
                    res.setAuditPersonId(sysUser.getUserId()+"");
                    res.setAuditPersonId(sysUser.getUserId() + "");
                    break;
                }
            }
@@ -488,6 +521,7 @@
        LocalDateTime parse = LocalDateTime.parse(temp, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"));
        System.out.println(parse);
    }
    @ApiOperation(value = "发起请假")
    @PostMapping(value = "/addLeave")
    public R addLeave(@RequestBody LeaveDTO leaveDTO) {
@@ -508,48 +542,48 @@
        SimpleDateFormat simpleDateFormat = new SimpleDateFormat("yyyyMMddHHmmss");
        // 生成随机数字6位
        String format = simpleDateFormat.format(date);
        leaveDTO.setCode(format+ RandomUtil.randomNumbers(6));
        leaveDTO.setCode(format + RandomUtil.randomNumbers(6));
        leaveDTO.setTemplateId(user.getTemplateId());
        leaveDTO.setLeavePerson(userId+"");
        leaveDTO.setLeavePerson(userId + "");
        leaveService.save(leaveDTO);
        sysRole.setRoleName("项目负责人");
        //项目负责人、部门负责人、公司成员提交由最终审批人审批;
        if (user.getDeptType()==2 ||sysRole.getRoleName().contains("项目负责人")||sysRole.getRoleName().contains("部门负责人")){
        if (user.getDeptType() == 2 || sysRole.getRoleName().contains("项目负责人") || sysRole.getRoleName().contains("部门负责人")) {
            TLeaveAudit tLeaveAudit1 = new TLeaveAudit();
            tLeaveAudit1.setLeaveId(leaveDTO.getId());
            tLeaveAudit1.setAuditStatus(1);
            tLeaveAudit1.setAuditId(auditPerson.getUserId()+"");
            tLeaveAudit1.setAuditId(auditPerson.getUserId() + "");
            tLeaveAudit1.setAuditType(1);
            leaveAuditService.save(tLeaveAudit1);
        }else if (!sysRole.getRoleName().equals("部门助理")){
        } else if (!sysRole.getRoleName().equals("部门助理")) {
            // 审批人根据当前角色类型来
            if (sysRole.getRoleName().contains("现场负责人")||sysRole.getRoleName().contains("组长")){
            if (sysRole.getRoleName().contains("现场负责人") || sysRole.getRoleName().contains("组长")) {
                List<SysUser> collect = sysUsers.stream().filter(e -> e.getDeptType() == 1 &&
                        e.getDeptId().equals(user.getDeptId())).collect(Collectors.toList());
                for (SysUser sysUser : collect) {
                    Long userRole1 = sysUserService.getUserRole(sysUser.getUserId());
                    SysRole sysRole1 = roleService.selectRoleById(userRole1);
                    if (sysRole1!=null&&sysRole1.getRoleName().equals("项目负责人")){
                    if (sysRole1 != null && sysRole1.getRoleName().equals("项目负责人")) {
                        TLeaveAudit tLeaveAudit1 = new TLeaveAudit();
                        tLeaveAudit1.setLeaveId(leaveDTO.getId());
                        tLeaveAudit1.setAuditStatus(1);
                        tLeaveAudit1.setAuditId(sysUser.getUserId()+"");
                        tLeaveAudit1.setAuditId(sysUser.getUserId() + "");
                        tLeaveAudit1.setAuditType(1);
                        leaveAuditService.save(tLeaveAudit1);
                    }
                }
            }
        }else{
        } else {
            List<SysUser> collect = sysUsers.stream().filter(e -> e.getDeptType() == 1 &&
                    e.getDeptId().equals(user.getDeptId())).collect(Collectors.toList());
            for (SysUser sysUser : collect) {
                Long userRole1 = sysUserService.getUserRole(sysUser.getUserId());
                SysRole sysRole1 = roleService.selectRoleById(userRole1);
                if (sysRole1!=null&&sysRole1.getRoleName().equals("部门负责人")){
                if (sysRole1 != null && sysRole1.getRoleName().equals("部门负责人")) {
                    TLeaveAudit tLeaveAudit1 = new TLeaveAudit();
                    tLeaveAudit1.setLeaveId(leaveDTO.getId());
                    tLeaveAudit1.setAuditStatus(1);
                    tLeaveAudit1.setAuditId(sysUser.getUserId()+"");
                    tLeaveAudit1.setAuditId(sysUser.getUserId() + "");
                    tLeaveAudit1.setAuditType(1);
                    leaveAuditService.save(tLeaveAudit1);
                }
@@ -558,27 +592,55 @@
        TLeaveAudit tLeaveAudit2 = new TLeaveAudit();
        tLeaveAudit2.setLeaveId(leaveDTO.getId());
        tLeaveAudit2.setAuditStatus(2);
        tLeaveAudit2.setAuditId(user.getUserId()+","+auditPerson.getUserId());
        tLeaveAudit2.setAuditId(user.getUserId() + "," + auditPerson.getUserId());
        tLeaveAudit2.setAuditType(2);
        tLeaveAudit2.setAuditTime(LocalDateTime.now());
        leaveAuditService.save(tLeaveAudit2);
        // 新增消息
        TNotice tNotice = new TNotice();
        tNotice.setUserId(leaveDTO.getAuditId());
        tNotice.setNoticeContent(user.getNickName() + "提交了请假申请,请尽快审核");
        tNotice.setStatus(1);
        tNotice.setDataId(leaveDTO.getId());
        tNotice.setNoticeType(6);
        noticeService.save(tNotice);
        return R.ok();
    }
    @ApiOperation(value = "我的审批-我的申请")
    @PostMapping(value = "/leaveList")
    public R<PageInfo<LeaveUserListVO>> leaveList(@RequestBody LeaveListUserQuery query) {
        query.setUserId(tokenService.getLoginUserApplet().getUserId()+"");
        return R.ok( leaveService.leaveList(query));
        query.setUserId(tokenService.getLoginUserApplet().getUserId() + "");
        return R.ok(leaveService.leaveList(query));
    }
    @ApiOperation(value = "我的审批-审批")
    @PostMapping(value = "/auditLeave")
    public R<Boolean> auditLeave(@RequestBody LeaveAuditDTO dto) {
        dto.setAuditId(tokenService.getLoginUserApplet().getUserId()+"");
        dto.setAuditId(tokenService.getLoginUserApplet().getUserId() + "");
        dto.setAuditTime(LocalDateTime.now());
        leaveService.updateById(dto);
        SysUser sysUser = sysUserService.selectUserById(Long.valueOf(dto.getLeavePerson()));
        TLeaveAudit leaveAudit = leaveAuditService.lambdaQuery().eq(TLeaveAudit::getAuditId, dto.getId())
                .eq(TLeaveAudit::getAuditType, 2).one();
        TNotice tNotice = new TNotice();
        tNotice.setUserId(leaveAudit.getAuditId().split(",")[0]);
        tNotice.setNoticeContent(sysUser.getNickName()+"的请假申请已审核,请查收");
        tNotice.setStatus(1);
        tNotice.setDataId(dto.getId());
        tNotice.setNoticeType(7);
        noticeService.save(tNotice);
        TNotice tNotice1 = new TNotice();
        tNotice1.setUserId(leaveAudit.getAuditId().split(",")[1]);
        tNotice1.setNoticeContent(sysUser.getNickName()+"的请假申请已审核,请查收");
        tNotice1.setStatus(1);
        tNotice1.setDataId(dto.getId());
        tNotice1.setNoticeType(7);
        noticeService.save(tNotice1);
        return R.ok();
    }
    @ApiOperation(value = "我的审批-详情")
    @GetMapping(value = "/leaveDetail")
    public R<LeaveUserDetailVO> leaveDetail(@RequestParam String id) {
@@ -588,24 +650,24 @@
        Long userRole = sysUserService.getUserRole(sysUser.getUserId());
        SysRole sysRole = roleService.selectRoleById(userRole);
        sysRole.setRoleName("项目负责人");
        if (sysRole.getRoleName().contains("现场负责人")||sysRole.getRoleName().equals("组长")){
            if (sysUser.getDeptType() == 1){
        if (sysRole.getRoleName().contains("现场负责人") || sysRole.getRoleName().equals("组长")) {
            if (sysUser.getDeptType() == 1) {
                TProjectDept tProjectDept = projectDeptService.getById(sysUser.getDeptId());
                if (!tProjectDept.getParentId().equals("0")){
                if (!tProjectDept.getParentId().equals("0")) {
                    TProjectDept tProjectDept1 = projectDeptService.getById(tProjectDept.getParentId());
                    leaveUserDetailVO.setDeptName(tProjectDept1.getProjectName()+">"+tProjectDept.getProjectName());
                }else{
                    leaveUserDetailVO.setDeptName(tProjectDept1.getProjectName() + ">" + tProjectDept.getProjectName());
                } else {
                    leaveUserDetailVO.setDeptName(tProjectDept.getProjectName());
                }
            }else{
            } else {
                TDept tDept = deptService.getById(sysUser.getDeptId());
                leaveUserDetailVO.setDeptName(tDept.getDeptName());
            }
        }else if (sysRole.getRoleName().contains("项目负责人")){
        } else if (sysRole.getRoleName().contains("项目负责人")) {
            TProjectDept tProjectDept = projectDeptService.getById(sysUser.getDeptId());
            leaveUserDetailVO.setDeptName(tProjectDept.getProjectName());
        }
        if (sysUser.getDeptType() == 2){
        if (sysUser.getDeptType() == 2) {
            TDept byId = deptService.getById(sysUser.getDeptId());
            leaveUserDetailVO.setDeptName(byId.getDeptName());
        }
@@ -614,17 +676,17 @@
        List<TLeaveAudit> list = leaveAuditService.list(new LambdaQueryWrapper<TLeaveAudit>()
                .eq(TLeaveAudit::getLeaveId, leave.getId()));
        for (TLeaveAudit tLeaveAudit : list) {
            if (tLeaveAudit.getAuditType()==1){
            if (tLeaveAudit.getAuditType() == 1) {
                LeaveAuditVO leaveAuditVO = new LeaveAuditVO();
                SysUser sysUser1 = sysUserService.selectUserById(Long.valueOf(tLeaveAudit.getAuditId()));
                if (sysUser1!=null){
                if (sysUser1 != null) {
                    leaveAuditVO.setAvatar(sysUser1.getAvatar());
                    leaveAuditVO.setNickName(sysUser1.getNickName());
                }
                leaveAuditVO.setCreateTime(tLeaveAudit.getAuditTime());
                leaveAuditVO.setAuditStatus(tLeaveAudit.getAuditStatus());
                leaveAuditListVO.setAuditPerson(leaveAuditVO);
            }else{
            } else {
                List<LeaveAuditVO> leaveAuditVOS = new ArrayList<>();
                // 抄送人
                LeaveAuditVO leaveAuditVO = new LeaveAuditVO();
ruoyi-system/src/main/java/com/ruoyi/system/applet/vo/IndexVO.java
@@ -19,6 +19,10 @@
    private BigDecimal middle;
    @ApiModelProperty(value = "数据预览-合格率")
    private BigDecimal rate;
    @ApiModelProperty(value = "是否请假 0否1是")
    private Integer isLeave;
    @ApiModelProperty(value = "是否有消息通知 0否1是")
    private Integer isNotice;
    @ApiModelProperty(value = "审批列表")
    private List<LeaveUserListVO> leaveList;
    @ApiModelProperty(value = "待整改任务列表")
ruoyi-system/src/main/java/com/ruoyi/system/model/TProjectDept.java
@@ -47,5 +47,7 @@
    @TableField(exist = false)
    private List<TProjectDept> children;
    @ApiModelProperty("部门人数")
    @TableField(exist = false)
    private Integer userCount;
}
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TProjectDeptServiceImpl.java
@@ -1,15 +1,20 @@
package com.ruoyi.system.service.impl;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.ruoyi.common.basic.PageInfo;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.system.mapper.SysUserMapper;
import com.ruoyi.system.mapper.TProjectDeptMapper;
import com.ruoyi.system.model.TProjectDept;
import com.ruoyi.system.query.DeptListQuery;
import com.ruoyi.system.service.TProjectDeptService;
import com.ruoyi.system.vo.system.ProjectDeptListVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.List;
import java.util.stream.Collectors;
/**
 * <p>
@@ -22,10 +27,24 @@
@Service
public class TProjectDeptServiceImpl extends ServiceImpl<TProjectDeptMapper, TProjectDept> implements TProjectDeptService {
    @Autowired
    private SysUserMapper sysUserMapper;
    @Override
    public PageInfo<ProjectDeptListVO> pageList(DeptListQuery query) {
        List<SysUser> sysUsers = sysUserMapper.selectAllList();
        PageInfo<ProjectDeptListVO> pageInfo = new PageInfo<>(query.getPageNum(), query.getPageSize());
        List<ProjectDeptListVO> list = this.baseMapper.pageList(query,pageInfo);
        List<TProjectDept> projectDepts = this.baseMapper.selectList(new LambdaQueryWrapper<TProjectDept>()
                .ne(TProjectDept::getParentId, 0));
        for (ProjectDeptListVO projectDeptListVO : list) {
            List<TProjectDept> collect = projectDepts.stream().filter(e -> e.getParentId().equals(projectDeptListVO.getId()))
                    .collect(Collectors.toList());
            for (TProjectDept tProjectDept : collect) {
                List<SysUser> collect1 = sysUsers.stream().filter(e -> e.getDeptId().equals(tProjectDept.getId())).collect(Collectors.toList());
                tProjectDept.setUserCount(collect1.size());
            }
            projectDeptListVO.setChildren(collect);
        }
        pageInfo.setRecords(list);
        return pageInfo;
    }
ruoyi-system/src/main/java/com/ruoyi/system/service/impl/TTaskCleanServiceImpl.java
@@ -66,7 +66,10 @@
                    }
                }else{
                    TDept tDept = deptMapper.selectById(sysUser.getDeptId());
                    temp.setDeptName(tDept.getDeptName());
                    if (tDept != null){
                        temp.setDeptName(tDept.getDeptName());
                    }
                }
            }
            TTaskDetail tTaskDetail = tTaskDetails.stream().filter(e -> e.getTaskId().equals(temp.getId())).findFirst().orElse(null);
ruoyi-system/src/main/java/com/ruoyi/system/vo/system/ProjectDeptListVO.java
@@ -10,6 +10,5 @@
@ApiModel(value = "项目部门列表不分页VO")
public class ProjectDeptListVO extends TProjectDept {
    @ApiModelProperty("部门人数")
    private Integer userCount;
}
ruoyi-system/src/main/resources/mapper/system/TProjectDeptMapper.xml
@@ -31,7 +31,7 @@
            and t1.status = #{query.status}
        </if>
        and t1.`disabled`  = ${@com.ruoyi.common.enums.DisabledEnum@NO.getCode()}
        and t1.parent_id = 0
        group by t1.id
        order by t1.create_time desc
    </select>