| | |
| | | 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; |
| | |
| | | @Resource |
| | | private TProblemEscalationService problemEscalationService; |
| | | |
| | | /** |
| | | * 生成数据 |
| | | * @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") |
| | | public R<UserIndexVO> userIndex() { |
| | |
| | | List<TTask> finishTask = taskCleanerService.lambdaQuery().eq(TTask::getPatrolInspector, userId) |
| | | .ge(TTask::getImplementTime, startOfMonth) |
| | | .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) |
| | | .isNotNull(TTaskDetail::getClearStatus) |
| | | .groupBy(TTaskDetail::getTaskId) |
| | | .orderByDesc(TTaskDetail::getCreateTime).list(); |
| | | |
| | | int size = (int) finishTask.stream().filter(e -> e.getStatus() == 5 || e.getStatus() == 6).count(); |
| | | userIndexVO.setFinishCount(size); |
| | | BigDecimal divide = new BigDecimal(size).divide(new BigDecimal(finishTask.size()), 2, BigDecimal.ROUND_DOWN); |
| | | userIndexVO.setRate(divide); |
| | | // userIndexVO.setRanking(); |
| | | 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()) |
| | | .divide(new BigDecimal(status1.size()), 2, BigDecimal.ROUND_DOWN).multiply(new BigDecimal(100)); |
| | | userIndexVO.setRate(divide); |
| | | }else{ |
| | | userIndexVO.setRate(new BigDecimal(0)); |
| | | } |
| | | // todo 月排名 |
| | | userIndexVO.setRanking(0); |
| | | return R.ok(userIndexVO); |
| | | } |
| | | @ApiOperation(value = "任务记录分页列表") |
| | |
| | | @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.setCommit_person(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); |
| | |
| | | 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); |
| | | //项目负责人、部门负责人、公司成员提交由最终审批人审批; |
| | | if (user.getDeptType()==2 ||sysRole.getRoleName().contains("项目负责人")||sysRole.getRoleName().contains("部门负责人")){ |
| | |
| | | @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); |
| | | if (sysRole.getRoleName().contains("现场负责人")||sysRole.getRoleName().equals("组长")){ |
| | |
| | | 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>() |