| | |
| | | |
| | | import com.ruoyi.common.annotation.Log; |
| | | import com.ruoyi.common.basic.PageInfo; |
| | | import com.ruoyi.common.core.domain.BaseModel; |
| | | import com.ruoyi.common.core.domain.R; |
| | | import com.ruoyi.common.core.domain.entity.SysUser; |
| | | import com.ruoyi.common.enums.BusinessType; |
| | |
| | | import com.ruoyi.system.service.*; |
| | | import com.ruoyi.system.vo.system.AppealDetailVO; |
| | | import com.ruoyi.system.vo.system.AppealListVO; |
| | | import com.tencentcloudapi.es.v20180416.models.TaskDetail; |
| | | import io.swagger.annotations.Api; |
| | | import io.swagger.annotations.ApiOperation; |
| | | import org.springframework.util.CollectionUtils; |
| | |
| | | List<SysUser> sysUsers = sysUserService.selectAllList(); |
| | | List<TLocation> locationList = locationService.list(); |
| | | if (StringUtils.hasLength(query.getDeptName())){ |
| | | List<String> projectIds = projectDeptService.lambdaQuery().like(TProjectDept::getProjectName, query.getDeptName()).list() |
| | | List<TProjectDept> list = projectDeptService.lambdaQuery().like(TProjectDept::getProjectName, query.getDeptName()).list(); |
| | | List<String> listIds = projectDeptService.lambdaQuery().like(TProjectDept::getProjectName, query.getDeptName()).list() |
| | | .stream().map(TProjectDept::getId).collect(Collectors.toList()); |
| | | for (TProjectDept tProjectDept : list) { |
| | | if (tProjectDept.getParentId().equals("0")){ |
| | | List<String> collect = projectDeptService.lambdaQuery().eq(TProjectDept::getParentId, tProjectDept.getId()).list() |
| | | .stream().map(TProjectDept::getId).collect(Collectors.toList()); |
| | | listIds.addAll(collect); |
| | | } |
| | | } |
| | | List<String> deptIds = deptService.lambdaQuery().like(TDept::getDeptName, query.getDeptName()).list() |
| | | .stream().map(TDept::getId).collect(Collectors.toList()); |
| | | projectIds.addAll(deptIds); |
| | | if (projectIds.isEmpty()){ |
| | | return R.ok(new PageInfo<>()); |
| | | listIds.addAll(deptIds); |
| | | if (listIds.isEmpty()){ |
| | | listIds.add("0"); |
| | | } |
| | | query.setPatrolInspectorIds(sysUsers.stream().filter(e->listIds.contains(e.getDeptId())).map(SysUser::getUserId) |
| | | .collect(Collectors.toList())); |
| | | if (StringUtils.hasLength(query.getPhonenumber())){ |
| | | List<Long> patrolInspectorIds = sysUsers.stream().filter(sysUser -> |
| | | sysUser.getPhonenumber().equals(query.getPhonenumber()) |
| | | && projectIds.contains(sysUser.getDeptId()) |
| | | && listIds.contains(sysUser.getDeptId()) |
| | | ).map(SysUser::getUserId).collect(Collectors.toList()); |
| | | if (patrolInspectorIds.isEmpty()){ |
| | | return R.ok(new PageInfo<>()); |
| | |
| | | } |
| | | if (query.getClearStatus()!=null){ |
| | | List<String> collect = tTaskDetailService.lambdaQuery().eq(TTaskDetail::getClearStatus, query.getClearStatus()) |
| | | .list().stream().distinct().map(TTaskDetail::getTaskId).collect(Collectors.toList()); |
| | | .eq(TTaskDetail::getHandleType,1) |
| | | .groupBy(TTaskDetail::getTaskId) |
| | | .orderByDesc(BaseModel::getCreateTime) |
| | | .list().stream().map(TTaskDetail::getTaskId).collect(Collectors.toList()); |
| | | |
| | | query.setTaskIds(collect); |
| | | if (collect.isEmpty()){ |
| | | return R.ok(new PageInfo<>()); |
| | |
| | | query.setLocationIds(collect); |
| | | return R.ok(new PageInfo<>()); |
| | | }else{ |
| | | collect = collect.stream().filter(query.getLocationIds()::contains).collect(Collectors.toList()); |
| | | if (collect.isEmpty()){ |
| | | return R.ok(new PageInfo<>()); |
| | | if (query.getLocationIds()!=null){ |
| | | collect = collect.stream().filter(query.getLocationIds()::contains).collect(Collectors.toList()); |
| | | if (collect.isEmpty()){ |
| | | return R.ok(new PageInfo<>()); |
| | | } |
| | | } |
| | | query.setLocationIds(collect); |
| | | } |
| | |
| | | TTask task = taskCleanService.getById(appeal.getTaskId()); |
| | | TLocation location = locationService.getById(task.getLocationId()); |
| | | TNotice tNotice = new TNotice(); |
| | | tNotice.setUserId(dto.getAppealPerson()); |
| | | tNotice.setUserId(appeal.getAppealPerson()); |
| | | tNotice.setStatus(1); |
| | | tNotice.setDataId(dto.getId()); |
| | | dto.setAuditTime(LocalDateTime.now()); |
| | | TTaskDetail taskDetail = new TTaskDetail(); |
| | | taskDetail.setTaskId(appeal.getTaskId()); |
| | | Long count = tTaskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, appeal.getTaskId()) |
| | | .eq(TTaskDetail::getHandleType, 1).count(); |
| | | if (dto.getStatus()==2){ |
| | | taskDetail.setClearStatus(1); |
| | | taskDetail.setAuditTime(LocalDateTime.now()); |
| | | taskDetail.setAuditPerson(tokenService.getLoginUser().getUserId()+""); |
| | | taskDetail.setAuditStatus(1); |
| | | taskDetail.setAuditRemark(dto.getAuditRemark()); |
| | | taskDetail.setHandleType(5); |
| | | taskDetail.setAppealId(dto.getId()); |
| | | // 通过 |
| | | TTask byId = taskCleanService.getById(dto.getTaskId()); |
| | | byId.setStatus(6); |
| | | if (count>1){ |
| | | byId.setStatus(5); |
| | | }else{ |
| | | byId.setStatus(6); |
| | | |
| | | } |
| | | |
| | | taskCleanService.updateById(byId); |
| | | tNotice.setNoticeType(5); |
| | | tNotice.setNoticeContent("【"+location.getLocationName()+"】任务申诉通过"); |
| | | }else{ |
| | | taskDetail.setClearStatus(2); |
| | | taskDetail.setAuditTime(LocalDateTime.now()); |
| | | taskDetail.setAuditPerson(tokenService.getLoginUser().getUserId()+""); |
| | | taskDetail.setAuditStatus(2); |
| | | taskDetail.setAuditRemark(dto.getAuditRemark()); |
| | | taskDetail.setHandleType(6); |
| | | taskDetail.setAppealId(dto.getId()); |
| | | tNotice.setNoticeType(4); |
| | | tNotice.setNoticeContent("【"+location.getLocationName()+"】任务申诉驳回"); |
| | | } |
| | | noticeService.save(tNotice); |
| | | dto.setAuditPerson(tokenService.getLoginUser().getUserId()+""); |
| | | appealService.updateById(dto); |
| | | tTaskDetailService.save(taskDetail); |
| | | return R.ok(); |
| | | } |
| | | } |