无关风月
2025-07-02 f287dfb5249618bf821626e76b7ce8d8f74d6b99
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));
        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
     */
@@ -189,7 +199,9 @@
            }
        }else{
            TDept tDept = deptService.getById(sysUser.getDeptId());
            if (tDept != null) {
            userIndexVO.setDeptName(tDept.getDeptName());
            }
        }
        // 查询请假状态
        List<TLeave> list = leaveService.lambdaQuery().eq(TLeave::getLeavePerson, userId)
@@ -242,6 +254,7 @@
        userIndexVO.setRanking(0);
        return R.ok(userIndexVO);
    }
    @ApiOperation(value = "任务记录分页列表")
    @PostMapping(value = "/taskList")
    public R<PageInfo<TaskUserListVO>> pageList(@RequestBody TaskUserListQuery query) {
@@ -278,6 +291,7 @@
        taskDetailVO.setRecords(list);
        return R.ok(taskDetailVO);
    }
    @ApiOperation(value = "详情任务-操作记录-详情")
    @GetMapping(value = "/detailRecord")
    public R<TaskRecordDetailVO> detailRecord(@RequestParam String id) {
@@ -303,12 +317,14 @@
        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()+"");
        return R.ok(appealService.pageListUser(query));
    }
    @ApiOperation(value = "详情申诉记录")
    @GetMapping(value = "/appealDetail")
    public R<AppealDetailVO> appealDetail(@RequestParam String id) {
@@ -342,12 +358,14 @@
        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() {
@@ -357,18 +375,30 @@
        );
        return R.ok(list);
    }
    @ApiOperation(value = "上传督察任务")
    @PostMapping(value = "/addInspector")
    public R<Boolean> addInspector(@RequestBody InspectorAddDTO dto) {
        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{
            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) {
@@ -376,6 +406,7 @@
        feedbackService.save(dto);
        return R.ok();
    }
    @ApiOperation(value = "上传问题上报")
    @PostMapping(value = "/addProblem")
    public R<Boolean> addProblem(@RequestBody ProblemDTO dto) {
@@ -383,6 +414,7 @@
        problemEscalationService.save(dto);
        return R.ok();
    }
    @ApiOperation(value = "问题类型列表")
    @PostMapping(value = "/problemList")
    public R<List<TDictData>> problemList() {
@@ -415,6 +447,7 @@
        knowledgeService.updateById(byId);
        return R.ok(byId);
    }
    @ApiOperation(value = "发起请假-获取审批流程")
    @GetMapping(value = "/leaveAuditList")
    public R<LeaveAuditListVO> leaveAuditList() {
@@ -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) {
@@ -562,6 +596,14 @@
        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();
    }
@@ -571,14 +613,34 @@
        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.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) {