| | |
| | | import com.ruoyi.common.utils.bean.BeanUtils; |
| | | import com.ruoyi.framework.web.service.TokenService; |
| | | import com.ruoyi.system.applet.dto.*; |
| | | import com.ruoyi.system.applet.query.AppealListQuery; |
| | | import com.ruoyi.system.applet.query.KnowledgeListUserQuery; |
| | | import com.ruoyi.system.applet.query.LeaveListUserQuery; |
| | | import com.ruoyi.system.applet.query.TaskUserListQuery; |
| | | import com.ruoyi.system.applet.query.*; |
| | | import com.ruoyi.system.applet.vo.*; |
| | | import com.ruoyi.system.dto.KnowledgeDTO; |
| | | import com.ruoyi.system.dto.TTaskAuditBatchDTO; |
| | |
| | | import java.time.LocalDate; |
| | | import java.time.LocalDateTime; |
| | | import java.time.LocalTime; |
| | | import java.time.format.DateTimeFormatter; |
| | | import java.util.ArrayList; |
| | | import java.util.Arrays; |
| | | import java.util.Date; |
| | |
| | | private TFeedbackService feedbackService; |
| | | @Resource |
| | | 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)); |
| | | } |
| | | /** |
| | | * 生成数据 |
| | | * @param id |
| | | * @return |
| | | */ |
| | | @ApiOperation(value = "测试接口不要调") |
| | | |
| | | @GetMapping(value = "/testData") |
| | | public R<AppealDetailVO> testData(@RequestParam String id) { |
| | | // List<TAppeal> tAppeals = new ArrayList<>(); |
| | | // for (int i = 0; i < 25; i++) { |
| | | // TAppeal tAppeal = new TAppeal(); |
| | | // tAppeal.setTaskId("1938536771253641217"); |
| | | // tAppeal.setAppealPerson("152"); |
| | | // tAppeal.setStatus(1); |
| | | // tAppeal.setAppealContent("申诉"); |
| | | // tAppeal.setPictures("https://bjxj.oss-cn-guangzhou.aliyuncs.com/bjxj/88d2d5614fe6492bba5666a7ab01e76b.png"); |
| | | // tAppeals.add(tAppeal); |
| | | // } |
| | | // appealService.saveBatch(tAppeals); |
| | | // List<TAppeal> tAppeals1 = new ArrayList<>(); |
| | | // for (int i = 0; i < 25; i++) { |
| | | // TAppeal tAppeal = new TAppeal(); |
| | | // tAppeal.setTaskId("1938536771253641217"); |
| | | // tAppeal.setAppealPerson("152"); |
| | | // tAppeal.setStatus(2); |
| | | // tAppeal.setAppealContent("申诉"); |
| | | // tAppeal.setPictures("https://bjxj.oss-cn-guangzhou.aliyuncs.com/bjxj/88d2d5614fe6492bba5666a7ab01e76b.png"); |
| | | // tAppeal.setAuditPerson("162"); |
| | | // tAppeal.setAuditRemark("备注"); |
| | | // tAppeal.setAuditTime(LocalDateTime.now()); |
| | | // tAppeals1.add(tAppeal); |
| | | // } |
| | | // appealService.saveBatch(tAppeals1); |
| | | // List<TAppeal> tAppeals2 = new ArrayList<>(); |
| | | // for (int i = 0; i < 25; i++) { |
| | | // TAppeal tAppeal = new TAppeal(); |
| | | // tAppeal.setTaskId("1938536771253641217"); |
| | | // tAppeal.setAppealPerson("152"); |
| | | // tAppeal.setStatus(3); |
| | | // tAppeal.setAppealContent("申诉"); |
| | | // tAppeal.setPictures("https://bjxj.oss-cn-guangzhou.aliyuncs.com/bjxj/88d2d5614fe6492bba5666a7ab01e76b.png"); |
| | | // tAppeal.setAuditPerson("162"); |
| | | // tAppeal.setAuditRemark("备注"); |
| | | // tAppeal.setAuditTime(LocalDateTime.now()); |
| | | // tAppeals2.add(tAppeal); |
| | | // } |
| | | // appealService.saveBatch(tAppeals2); |
| | | // List<TAppeal> tAppeals3 = new ArrayList<>(); |
| | | // for (int i = 0; i < 25; i++) { |
| | | // TAppeal tAppeal = new TAppeal(); |
| | | // tAppeal.setTaskId("1938536771253641217"); |
| | | // tAppeal.setAppealPerson("152"); |
| | | // tAppeal.setStatus(4); |
| | | // tAppeal.setAppealContent("申诉"); |
| | | // tAppeal.setPictures("https://bjxj.oss-cn-guangzhou.aliyuncs.com/bjxj/88d2d5614fe6492bba5666a7ab01e76b.png"); |
| | | // |
| | | // tAppeals3.add(tAppeal); |
| | | // |
| | | // } |
| | | // appealService.saveBatch(tAppeals3); |
| | | return R.ok(); |
| | | } |
| | | |
| | | @ApiOperation(value = "个人中心-首页") |
| | | @PostMapping(value = "/userIndex") |
| | |
| | | taskDetailVO.setLocationIcon(byId2.getLocationIcon()); |
| | | 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){ |
| | | TDictData byId3 = dictDataService.getById(tTaskDetail.getUnqualified()); |
| | | if (byId3!=null){ |
| | | tTaskDetail.setUnqualifiedName(byId3.getDataContent()); |
| | | } |
| | | } |
| | | if (tTaskDetailFinish!=null){ |
| | | tTaskDetailFinish.setFinishTime(tTaskDetailFinish.getCreateTime()); |
| | | } |
| | | taskDetailVO.setTaskDetail(tTaskDetail); |
| | | taskDetailVO.setRecords(list); |
| | |
| | | @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 = "详情申诉记录") |
| | |
| | | appealDetailVO.setLocationIcon(byId2.getLocationIcon()); |
| | | appealDetailVO.setLocationName(byId2.getLocationName()); |
| | | appealDetailVO.setTaskId(byId.getId()); |
| | | SysUser sysUser = sysUserService.selectUserById(Long.valueOf(appeal.getAuditPerson())); |
| | | if (sysUser!=null){ |
| | | appealDetailVO.setAuditPersonName(sysUser.getUserName()); |
| | | if (StringUtils.hasLength(appeal.getAuditPerson())){ |
| | | SysUser sysUser = sysUserService.selectUserById(Long.valueOf(appeal.getAuditPerson())); |
| | | if (sysUser!=null){ |
| | | appealDetailVO.setAuditPersonName(sysUser.getUserName()); |
| | | } |
| | | } |
| | | appealDetailVO.setTaskName(byId.getTaskName()); |
| | | appealDetailVO.setTaskCode(byId.getTaskCode()); |
| | | return R.ok(appealDetailVO); |
| | | } |
| | | |
| | | @Log(title = "取消申诉记录", businessType = BusinessType.OTHER) |
| | | @ApiOperation(value = "取消申诉记录") |
| | | @GetMapping(value = "/cancelAppeal") |
| | |
| | | @ApiOperation(value = "上传督察任务") |
| | | @PostMapping(value = "/addInspector") |
| | | public R<Boolean> addInspector(@RequestBody InspectorAddDTO dto) { |
| | | dto.setCommitPerson(tokenService.getLoginUser().getUserId()+""); |
| | | dto.setCommitPerson(tokenService.getLoginUserApplet().getUserId()+""); |
| | | if (dto.getClearStatus()==1){ |
| | | dto.setStatus(4); |
| | | }else{ |
| | |
| | | @ApiOperation(value = "上传意见反馈") |
| | | @PostMapping(value = "/addFeedback") |
| | | public R<Boolean> addFeedback(@RequestBody FeedbackDTO dto) { |
| | | dto.setFeedbackPerson(tokenService.getLoginUser().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.getLoginUser().getUserId()+""); |
| | | dto.setEscalationId(tokenService.getLoginUserApplet().getUserId()+""); |
| | | problemEscalationService.save(dto); |
| | | return R.ok(); |
| | | } |
| | |
| | | @GetMapping(value = "/leaveAuditList") |
| | | public R<LeaveAuditListVO> leaveAuditList() { |
| | | LeaveAuditListVO res = new LeaveAuditListVO(); |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | SysUser user = sysUserService.selectUserById(userId); |
| | | Long userRole = sysUserService.getUserRole(userId); |
| | | SysRole sysRole = roleService.selectRoleById(userRole); |
| | | List<SysUser> sysUsers = sysUserService.selectAllList(); |
| | | |
| | | sysRole.setRoleName("项目负责人"); |
| | | SysUser auditPerson = sysUserService.selectUserById(999L); |
| | | //项目负责人、部门负责人、公司成员提交由最终审批人审批; |
| | | if (user.getDeptType()==2 ||sysRole.getRoleName().contains("项目负责人")||sysRole.getRoleName().contains("部门负责人")){ |
| | |
| | | tLeaveAudit.setAvatar(auditPerson.getAvatar()); |
| | | tLeaveAudit.setNickName(auditPerson.getNickName()); |
| | | res.setAuditPerson(tLeaveAudit); |
| | | res.setAuditPersonId("999"); |
| | | }else if (!sysRole.getRoleName().equals("部门助理")){ |
| | | // 审批人根据当前角色类型来 |
| | | if (sysRole.getRoleName().contains("现场负责人")||sysRole.getRoleName().contains("组长")){ |
| | |
| | | tLeaveAudit.setAvatar(sysUser.getAvatar()); |
| | | tLeaveAudit.setNickName(sysUser.getNickName()); |
| | | res.setAuditPerson(tLeaveAudit); |
| | | res.setAuditPersonId(sysUser.getUserId()+""); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | |
| | | tLeaveAudit.setAvatar(sysUser.getAvatar()); |
| | | tLeaveAudit.setNickName(sysUser.getNickName()); |
| | | res.setAuditPerson(tLeaveAudit); |
| | | res.setAuditPersonId(sysUser.getUserId()+""); |
| | | break; |
| | | } |
| | | } |
| | | } |
| | |
| | | res.setCopyPerson(leaveAuditVOS); |
| | | return R.ok(res); |
| | | } |
| | | |
| | | public static void main(String[] args) { |
| | | String temp = "2025-06-30 00:00:00"; |
| | | // 轉化爲localdateTime |
| | | 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) { |
| | | Long userId = tokenService.getLoginUser().getUserId(); |
| | | // String startTime1 = leaveDTO.getStartTime1(); |
| | | // // 轉化爲LocalDateTime類型 |
| | | // leaveDTO.setStartTime(LocalDateTime.parse(startTime1, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | // String endTime1 = leaveDTO.getEndTime1(); |
| | | // // 轉化爲LocalDateTime類型 |
| | | // leaveDTO.setStartTime(LocalDateTime.parse(endTime1, DateTimeFormatter.ofPattern("yyyy-MM-dd HH:mm:ss"))); |
| | | Long userId = tokenService.getLoginUserApplet().getUserId(); |
| | | SysUser user = sysUserService.selectUserById(userId); |
| | | Long userRole = sysUserService.getUserRole(userId); |
| | | SysRole sysRole = roleService.selectRoleById(userRole); |
| | |
| | | // 生成随机数字6位 |
| | | String format = simpleDateFormat.format(date); |
| | | leaveDTO.setCode(format+ RandomUtil.randomNumbers(6)); |
| | | leaveDTO.setTemplateId(user.getTemplateId()); |
| | | leaveDTO.setLeavePerson(userId+""); |
| | | leaveService.save(leaveDTO); |
| | | sysRole.setRoleName("项目负责人"); |
| | | //项目负责人、部门负责人、公司成员提交由最终审批人审批; |
| | | if (user.getDeptType()==2 ||sysRole.getRoleName().contains("项目负责人")||sysRole.getRoleName().contains("部门负责人")){ |
| | | TLeaveAudit tLeaveAudit1 = new TLeaveAudit(); |
| | |
| | | @ApiOperation(value = "我的审批-我的申请") |
| | | @PostMapping(value = "/leaveList") |
| | | public R<PageInfo<LeaveUserListVO>> leaveList(@RequestBody LeaveListUserQuery query) { |
| | | query.setUserId(tokenService.getLoginUser().getUserId()+""); |
| | | 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.getLoginUser().getUserId()+""); |
| | | dto.setAuditId(tokenService.getLoginUserApplet().getUserId()+""); |
| | | dto.setAuditTime(LocalDateTime.now()); |
| | | leaveService.updateById(dto); |
| | | return R.ok(); |
| | |
| | | @ApiOperation(value = "我的审批-详情") |
| | | @GetMapping(value = "/leaveDetail") |
| | | public R<LeaveUserDetailVO> leaveDetail(@RequestParam String id) { |
| | | TLeave leave = leaveService.getById(id); |
| | | LeaveUserDetailVO leaveUserDetailVO = new LeaveUserDetailVO(); |
| | | SysUser sysUser = sysUserService.selectUserById(Long.parseLong(leaveUserDetailVO.getLeavePerson())); |
| | | SysUser sysUser = sysUserService.selectUserById(Long.parseLong(leave.getLeavePerson())); |
| | | Long userRole = sysUserService.getUserRole(sysUser.getUserId()); |
| | | SysRole sysRole = roleService.selectRoleById(userRole); |
| | | sysRole.setRoleName("项目负责人"); |
| | | if (sysRole.getRoleName().contains("现场负责人")||sysRole.getRoleName().equals("组长")){ |
| | | if (sysUser.getDeptType() == 1){ |
| | | TProjectDept tProjectDept = projectDeptService.getById(sysUser.getDeptId()); |
| | |
| | | TDept byId = deptService.getById(sysUser.getDeptId()); |
| | | leaveUserDetailVO.setDeptName(byId.getDeptName()); |
| | | } |
| | | TLeave leave = leaveService.getById(id); |
| | | leaveUserDetailVO.setLeavePersonName(sysUser.getNickName()); |
| | | LeaveAuditListVO leaveAuditListVO = new LeaveAuditListVO(); |
| | | List<TLeaveAudit> list = leaveAuditService.list(new LambdaQueryWrapper<TLeaveAudit>() |
| | | .eq(TLeaveAudit::getAuditId, leave.getId())); |
| | | .eq(TLeaveAudit::getLeaveId, leave.getId())); |
| | | for (TLeaveAudit tLeaveAudit : list) { |
| | | if (tLeaveAudit.getAuditType()==1){ |
| | | LeaveAuditVO leaveAuditVO = new LeaveAuditVO(); |