From 53d014edd19f57125c355abe71ec5b478500e610 Mon Sep 17 00:00:00 2001 From: 无关风月 <443237572@qq.com> Date: 星期二, 05 八月 2025 09:57:40 +0800 Subject: [PATCH] 保洁巡检所有代码 --- ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java | 286 +++++++++++++++++++++++++++++++++++--------------------- 1 files changed, 179 insertions(+), 107 deletions(-) diff --git a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java index aeda7ff..a78e71c 100644 --- a/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java +++ b/ruoyi-applet/src/main/java/com/ruoyi/web/controller/api/TUserController.java @@ -12,6 +12,7 @@ import com.ruoyi.common.core.domain.entity.SysUser; import com.ruoyi.common.enums.BusinessType; import com.ruoyi.common.redis.service.RedisService; +import com.ruoyi.common.utils.CodeGenerateUtils; import com.ruoyi.common.utils.DateUtils; import com.ruoyi.common.utils.bean.BeanUtils; import com.ruoyi.framework.web.service.TokenService; @@ -124,6 +125,8 @@ private MsgUtils msgUtils; @Resource private TemplateMessageSendUtil templateMessageSendUtil; + @Resource + private TInspectorDetailService inspectorDetailService; @ApiOperation(value = "通过code获得openid,获取用户信息",tags = {"微信小程序登录"}) @GetMapping("/openIdByJsCode") public R<String> openIdByJsCode(@RequestParam String code) { @@ -377,100 +380,151 @@ @ApiOperation(value = "详情任务") @GetMapping(value = "/detail") public R<TaskDetailVO> detail(@RequestParam String id) { - List<TTaskDetail> list = taskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, id) - .orderByDesc(BaseModel::getCreateTime).list(); - TaskDetailVO taskDetailVO = new TaskDetailVO(); TTask byId = taskCleanerService.getById(id); - BeanUtils.copyProperties(byId, taskDetailVO); - TLocation byId1 = locationService.getById(byId.getLocationId()); - TLocationType byId2 = locationTypeService.getById(byId1.getLocationType()); - taskDetailVO.setLocationName(byId1.getLocationName()); - taskDetailVO.setLocationAddress(byId1.getLocationAddress()); - taskDetailVO.setLocationAddressEnd(byId1.getLocationAddressEnd()); - taskDetailVO.setLocationIcon(byId2.getLocationIcon()); - taskDetailVO.setLocationTypeName(byId2.getLocationName()); - taskDetailVO.setLocationLon(byId1.getLocationLon()); - taskDetailVO.setLocationLat(byId1.getLocationLat()); - taskDetailVO.setLocationLatEnd(byId1.getLocationLatEnd()); - taskDetailVO.setLocationLonEnd(byId1.getLocationLonEnd()); - TTaskDetail tTaskDetail = list.stream().filter(e -> e.getHandleType() == 1).findFirst().orElse(null); - if (tTaskDetail != null && tTaskDetail.getUnqualified() != null) { - TDictData byId3 = dictDataService.getById(tTaskDetail.getUnqualified()); - if (byId3 != null) { - tTaskDetail.setUnqualifiedName(byId3.getDataContent()); - } - } - if (tTaskDetail != null) { - tTaskDetail.setFinishTime(tTaskDetail.getCreateTime()); - } - taskDetailVO.setTaskDetail(tTaskDetail); - taskDetailVO.setRecords(list); - if (byId.getStatus()==4){ - TTaskDetail reject = taskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, id) - .eq(TTaskDetail::getHandleType,3) - .orderByDesc(BaseModel::getCreateTime).last("limit 1").one(); - if (reject!=null){ - taskDetailVO.setRejectRemark(reject.getAuditRemark()); - } - } - return R.ok(taskDetailVO); - } - @ApiOperation(value = "督察任务-详情任务") - @GetMapping(value = "/detaiInspectorl") - public R<InspectorDetailVO> detaiInspectorl(@RequestParam String id) { - InspectorDetailVO taskDetailVO = new InspectorDetailVO(); TInspector inspector = inspectorService.getById(id); - TLocation location = locationService.getById(inspector.getLocationId()); - TLocationType locationType = locationTypeService.getById(location.getLocationType()); - taskDetailVO.setLocationAddress(location.getLocationAddress()); - taskDetailVO.setLocationAddressEnd(location.getLocationAddressEnd()); - taskDetailVO.setLocationIcon(locationType.getLocationIcon()); - taskDetailVO.setLocationName(locationType.getLocationName()); - taskDetailVO.setLocationTypeName(locationType.getLocationName()); - taskDetailVO.setLocationLonEnd(location.getLocationLonEnd()); - taskDetailVO.setLocationLatEnd(location.getLocationLatEnd()); - taskDetailVO.setLocationLon(location.getLocationLon()); - taskDetailVO.setLocationLat(location.getLocationLat()); - taskDetailVO.setLocationName(location.getLocationName()); - taskDetailVO.setId(inspector.getId()); - taskDetailVO.setClearStatus(inspector.getClearStatus()); - taskDetailVO.setUnqualified(inspector.getUnqualified()); - taskDetailVO.setRemark(inspector.getAuditRemark()); - taskDetailVO.setPicture(inspector.getPicture()); - taskDetailVO.setAudioUrl(inspector.getAudioUrl()); - taskDetailVO.setStatus(inspector.getStatus()); - taskDetailVO.setAuditPerson(inspector.getAuditPerson()); - taskDetailVO.setAuditTime(inspector.getAuditTime()); - taskDetailVO.setAuditStatus(inspector.getAuditStatus()); - taskDetailVO.setAuditRemark(inspector.getAuditRemark()); - return R.ok(taskDetailVO); + + if (byId!=null){ + List<TTaskDetail> list = taskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, id) + .orderByDesc(BaseModel::getCreateTime).list(); + TaskDetailVO taskDetailVO = new TaskDetailVO(); + BeanUtils.copyProperties(byId, taskDetailVO); + TLocation byId1 = locationService.getById(byId.getLocationId()); + TLocationType byId2 = locationTypeService.getById(byId1.getLocationType()); + taskDetailVO.setLocationName(byId1.getLocationName()); + taskDetailVO.setLocationAddress(byId1.getLocationAddress()); + taskDetailVO.setLocationAddressEnd(byId1.getLocationAddressEnd()); + taskDetailVO.setLocationIcon(byId2.getLocationIcon()); + taskDetailVO.setLocationTypeName(byId2.getLocationName()); + taskDetailVO.setLocationLon(byId1.getLocationLon()); + taskDetailVO.setLocationLat(byId1.getLocationLat()); + taskDetailVO.setLocationLatEnd(byId1.getLocationLatEnd()); + taskDetailVO.setLocationLonEnd(byId1.getLocationLonEnd()); + TTaskDetail tTaskDetail = list.stream().filter(e -> e.getHandleType() == 1).findFirst().orElse(null); + if (tTaskDetail != null && tTaskDetail.getUnqualified() != null) { + TDictData byId3 = dictDataService.getById(tTaskDetail.getUnqualified()); + if (byId3 != null) { + tTaskDetail.setUnqualifiedName(byId3.getDataContent()); + } + } + if (tTaskDetail != null) { + tTaskDetail.setFinishTime(tTaskDetail.getCreateTime()); + } + taskDetailVO.setTaskDetail(tTaskDetail); + taskDetailVO.setRecords(list); + if (byId.getStatus()==4){ + TTaskDetail reject = taskDetailService.lambdaQuery().eq(TTaskDetail::getTaskId, id) + .eq(TTaskDetail::getHandleType,3) + .orderByDesc(BaseModel::getCreateTime).last("limit 1").one(); + if (reject!=null){ + taskDetailVO.setRejectRemark(reject.getAuditRemark()); + } + } + return R.ok(taskDetailVO); + + }else{ + List<TInspectorDetail> list = inspectorDetailService.lambdaQuery().eq(TInspectorDetail::getInspectorId, id) + .orderByDesc(BaseModel::getCreateTime).list(); + TaskDetailVO taskDetailVO = new TaskDetailVO(); + BeanUtils.copyProperties(inspector, taskDetailVO); + TLocation byId1 = locationService.getById(inspector.getLocationId()); + TLocationType byId2 = locationTypeService.getById(byId1.getLocationType()); + taskDetailVO.setLocationName(byId1.getLocationName()); + taskDetailVO.setLocationAddress(byId1.getLocationAddress()); + taskDetailVO.setLocationAddressEnd(byId1.getLocationAddressEnd()); + taskDetailVO.setLocationIcon(byId2.getLocationIcon()); + taskDetailVO.setLocationTypeName(byId2.getLocationName()); + taskDetailVO.setLocationLon(byId1.getLocationLon()); + taskDetailVO.setLocationLat(byId1.getLocationLat()); + taskDetailVO.setLocationLatEnd(byId1.getLocationLatEnd()); + taskDetailVO.setLocationLonEnd(byId1.getLocationLonEnd()); + TInspectorDetail inspectorDetail = list.stream().filter(e -> e.getHandleType() == 1).findFirst().orElse(null); + if (inspectorDetail != null && inspectorDetail.getUnqualified() != null) { + TTaskDetail temp = new TTaskDetail(); + BeanUtils.copyProperties(inspectorDetail, temp); + taskDetailVO.setTaskDetail(temp); + + TDictData byId3 = dictDataService.getById(inspectorDetail.getUnqualified()); + if (byId3 != null) { + inspectorDetail.setUnqualifiedName(byId3.getDataContent()); + } + } + if (inspectorDetail != null) { + inspectorDetail.setFinishTime(inspectorDetail.getCreateTime()); + } + List<TTaskDetail> tTaskDetails = new ArrayList<>(); + for (TInspectorDetail tInspectorDetail : list) { + TTaskDetail tTaskDetail = new TTaskDetail(); + BeanUtils.copyProperties(tInspectorDetail, tTaskDetail); + tTaskDetails.add(tTaskDetail); + } + taskDetailVO.setRecords(tTaskDetails); + if (inspector.getStatus()==2){ + TInspectorDetail reject = inspectorDetailService.lambdaQuery().eq(TInspectorDetail::getInspectorId, id) + .eq(TInspectorDetail::getHandleType,3) + .orderByDesc(BaseModel::getCreateTime).last("limit 1").one(); + if (reject!=null){ + taskDetailVO.setRejectRemark(reject.getAuditRemark()); + } + } + return R.ok(taskDetailVO); + } + } + @ApiOperation(value = "详情任务-操作记录-详情") @GetMapping(value = "/detailRecord") public R<TaskRecordDetailVO> detailRecord(@RequestParam String id) { TaskRecordDetailVO taskDetailVO = new TaskRecordDetailVO(); - TTaskDetail byId4 = taskDetailService.getById(id); - TTask byId = taskCleanerService.getById(byId4.getTaskId()); - BeanUtils.copyProperties(byId, taskDetailVO); - TLocation byId1 = locationService.getById(byId.getLocationId()); - TLocationType byId2 = locationTypeService.getById(byId1.getLocationType()); - taskDetailVO.setLocationAddress(byId1.getLocationAddress()); - taskDetailVO.setLocationIcon(byId2.getLocationIcon()); - taskDetailVO.setLocationName(byId2.getLocationName()); - if (byId4.getUnqualified() != null) { - TDictData byId3 = dictDataService.getById(byId4.getUnqualified()); - if (byId3 != null) { - byId4.setUnqualifiedName(byId3.getDataContent()); + TTaskDetail taskDetail = taskDetailService.getById(id); + TInspectorDetail inspectorDetail = inspectorDetailService.getById(id); + + if (taskDetail!=null){ + TTask byId = taskCleanerService.getById(taskDetail.getTaskId()); + BeanUtils.copyProperties(byId, taskDetailVO); + TLocation byId1 = locationService.getById(byId.getLocationId()); + TLocationType byId2 = locationTypeService.getById(byId1.getLocationType()); + taskDetailVO.setLocationAddress(byId1.getLocationAddress()); + taskDetailVO.setLocationIcon(byId2.getLocationIcon()); + taskDetailVO.setLocationName(byId2.getLocationName()); + if (taskDetail.getUnqualified() != null) { + TDictData byId3 = dictDataService.getById(taskDetail.getUnqualified()); + if (byId3 != null) { + taskDetail.setUnqualifiedName(byId3.getDataContent()); + } } + taskDetail.setFinishTime(taskDetail.getCreateTime()); + SysUser sysUser = sysUserService.selectUserById(Long.valueOf(taskDetail.getAuditPerson())); + if (sysUser != null) { + taskDetail.setAuditPersonName(sysUser.getUserName()); + } + taskDetailVO.setTaskDetail(taskDetail); + return R.ok(taskDetailVO); + }else{ + TInspector byId = inspectorService.getById(inspectorDetail.getInspectorId()); + BeanUtils.copyProperties(byId, taskDetailVO); + TLocation byId1 = locationService.getById(byId.getLocationId()); + TLocationType byId2 = locationTypeService.getById(byId1.getLocationType()); + taskDetailVO.setLocationAddress(byId1.getLocationAddress()); + taskDetailVO.setLocationIcon(byId2.getLocationIcon()); + taskDetailVO.setLocationName(byId2.getLocationName()); + if (inspectorDetail.getUnqualified() != null) { + TDictData byId3 = dictDataService.getById(inspectorDetail.getUnqualified()); + if (byId3 != null) { + inspectorDetail.setUnqualifiedName(byId3.getDataContent()); + } + } + inspectorDetail.setFinishTime(inspectorDetail.getCreateTime()); + SysUser sysUser = sysUserService.selectUserById(Long.valueOf(inspectorDetail.getAuditPerson())); + if (sysUser != null) { + inspectorDetail.setAuditPersonName(sysUser.getUserName()); + } + TTaskDetail tTaskDetail = new TTaskDetail(); + BeanUtils.copyProperties(inspectorDetail, tTaskDetail); + taskDetailVO.setTaskDetail(tTaskDetail); + return R.ok(taskDetailVO); } - byId4.setFinishTime(byId4.getCreateTime()); - SysUser sysUser = sysUserService.selectUserById(Long.valueOf(byId4.getAuditPerson())); - if (sysUser != null) { - byId4.setAuditPersonName(sysUser.getUserName()); - } - taskDetailVO.setTaskDetail(byId4); - return R.ok(taskDetailVO); + } @ApiOperation(value = "申诉记录分页列表") @@ -527,7 +581,12 @@ List<TaskListAllVO> res = appealService.listAllTask(appealListDTO); return R.ok(res); } - + @ApiOperation(value = "点位列表") + @PostMapping(value = "/locationList") + public R<List<TaskListAllVO>> locationList(@RequestBody AppealListDTO appealListDTO) { + List<TaskListAllVO> locations = appealService.locationList(appealListDTO); + return R.ok(locations); + } @ApiOperation(value = "不合格原因列表") @PostMapping(value = "/unqualifiedList") public R<List<TDictData>> unqualifiedList() { @@ -537,32 +596,14 @@ ); return R.ok(list); } - @ApiOperation(value = "点位列表") - @PostMapping(value = "/locationList") - public R<List<TLocation>> locationList() { - List<TLocation> locations = locationService.list(); - return R.ok(locations); - } + @ApiOperation(value = "上传督察任务") @PostMapping(value = "/addInspector") public R<Boolean> addInspector(@RequestBody InspectorAddDTO dto) throws Exception { - 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); - - } - inspectorService.save(dto); - return R.ok(); - -// TLocation location = locationService.getById(dto.getLocationId()); -// SysUser sysUser = sysUserService.selectUserById(Long.valueOf(location.getLocationLeader())); +// 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) { @@ -573,6 +614,32 @@ // } // inspectorService.save(dto); // return R.ok(); + + TLocation location = locationService.getById(dto.getLocationId()); + SysUser sysUser = sysUserService.selectUserById(Long.valueOf(location.getLocationLeader())); + dto.setCommitPerson(tokenService.getLoginUserApplet().getUserId() + ""); + + if (dto.getClearStatus() == 1) { + dto.setStatus(4); + } else { + dto.setStatus(2); + + } + String nameAndCode = CodeGenerateUtils.generateVolumeSn(); + dto.setTaskCode(nameAndCode); + dto.setTaskName(nameAndCode); + inspectorService.save(dto); + TInspectorDetail tInspectorDetail = new TInspectorDetail(); + tInspectorDetail.setInspectorId(dto.getId()); + tInspectorDetail.setClearStatus(dto.getClearStatus()); + tInspectorDetail.setUnqualified(dto.getUnqualified()); + tInspectorDetail.setRemark(dto.getRemark()); + tInspectorDetail.setPicture(dto.getPicture()); + tInspectorDetail.setAudioUrl(dto.getAudioUrl()); + tInspectorDetail.setHandleType(1); + + inspectorDetailService.save(tInspectorDetail); + return R.ok(); } @ApiOperation(value = "上传意见反馈") @@ -748,6 +815,11 @@ leaveDTO.setCode(format + RandomUtil.randomNumbers(6)); leaveDTO.setTemplateId(user.getTemplateId()); leaveDTO.setLeavePerson(userId + ""); + LocalDateTime endTime1 = leaveDTO.getEndTime(); + endTime1.withHour(23); + endTime1.withMinute(59); + endTime1.withSecond(59); + leaveDTO.setEndTime(endTime1); leaveService.save(leaveDTO); TNoticeSet noticeSet = noticeSetService.lambdaQuery().eq(TNoticeSet::getType, 2).last("limit 1") .one(); -- Gitblit v1.7.1