| | |
| | | package com.estate.expert.admin.controller.admin; |
| | | |
| | | import com.baomidou.mybatisplus.extension.plugins.pagination.Page; |
| | | import com.estate.expert.admin.domain.business.check.Check; |
| | | import com.estate.expert.admin.domain.business.onduty.OnDuty; |
| | | import com.estate.expert.admin.domain.business.position.Position; |
| | | import com.estate.expert.admin.domain.common.request.AddCheckInfoRequest; |
| | | import com.estate.expert.admin.domain.common.request.AddOnDutyRequest; |
| | | import com.estate.expert.admin.domain.common.request.BatchReq; |
| | | import com.estate.expert.admin.domain.common.request.EditCheckInfoRequest; |
| | | import com.estate.expert.admin.domain.common.request.EditOnDutyRequest; |
| | | import com.estate.expert.admin.domain.common.request.PageReq; |
| | | import com.estate.expert.admin.domain.common.request.RecordPageRequest; |
| | | import com.estate.expert.admin.domain.common.response.PageResp; |
| | | import com.estate.expert.admin.domain.common.response.PageRespMp; |
| | | import com.estate.expert.admin.domain.exam.record.error.ErrorRecord; |
| | | import com.estate.expert.admin.domain.exam.record.error.ErrorRecordDto; |
| | | import com.estate.expert.admin.domain.exam.record.info.SetResponsibleDto; |
| | |
| | | import com.estate.expert.admin.domain.exam.record.warning.WarningRecord; |
| | | import com.estate.expert.admin.domain.exam.record.warning.WarningRecordDto; |
| | | import com.estate.expert.admin.domain.user.User; |
| | | import com.estate.expert.admin.service.ErrorRecordService; |
| | | import com.estate.expert.admin.service.WarningRecordService; |
| | | import com.estate.expert.admin.service.*; |
| | | import com.estate.expert.common.domain.Session; |
| | | import com.estate.expert.common.rpc.Result; |
| | | import io.swagger.annotations.Api; |
| | |
| | | |
| | | @Resource |
| | | private WarningRecordService warningRecordService; |
| | | |
| | | @Resource |
| | | private PositionService positionService; |
| | | |
| | | @Resource |
| | | private OnDutyService onDutyService; |
| | | |
| | | @Resource |
| | | private CheckService checkService; |
| | | |
| | | //////// 问题清单 //////// |
| | | |
| | |
| | | return Result.success(); |
| | | } |
| | | |
| | | //////// 在岗情况 //////// |
| | | |
| | | /** |
| | | * 在岗情况列表查询 |
| | | * 支持"全部/我创建的"筛选 |
| | | */ |
| | | @ApiOperation(value = "【APP】在岗情况列表",response = OnDuty.class) |
| | | @PostMapping("/onduty/list") |
| | | public Result< PageRespMp<OnDuty>> listOnDutyRecords(@ApiParam(hidden = true) Session session, |
| | | @RequestParam(value = "checkTaskId") Integer checkTaskId, |
| | | @RequestParam(value = "mine", required = false) Boolean mine, |
| | | @Validated @RequestBody PageReq pageReq) { |
| | | // 根据 mine 参数决定是否筛选"我创建的" |
| | | var creatorId = mine != null && mine ? ((User) session.getUser()).getId() : null; |
| | | |
| | | // 调用 Service 层的 JPA 查询方法 |
| | | return Result.success(onDutyService.listOnDutyRecords(checkTaskId, creatorId, pageReq)); |
| | | } |
| | | |
| | | /** |
| | | * 添加在岗情况 |
| | | */ |
| | | @ApiOperation("【APP】添加在岗情况") |
| | | @PostMapping("/onduty/add") |
| | | public Result addOnDuty(@ApiParam(hidden = true) Session session, |
| | | @Validated @RequestBody AddOnDutyRequest request) { |
| | | onDutyService.add((User) session.getUser(), request); |
| | | return Result.success(); |
| | | } |
| | | |
| | | /** |
| | | * 编辑在岗情况 |
| | | */ |
| | | @ApiOperation("【APP】编辑在岗情况") |
| | | @PostMapping("/onduty/edit") |
| | | public Result editOnDuty(@Validated @RequestBody EditOnDutyRequest request) { |
| | | onDutyService.edit(request); |
| | | return Result.success(); |
| | | } |
| | | |
| | | /** |
| | | * 删除在岗情况 |
| | | */ |
| | | @ApiOperation("【APP】删除在岗情况") |
| | | @PostMapping("/onduty/del") |
| | | public Result deleteOnDuty(@Validated @RequestBody BatchReq request) { |
| | | onDutyService.deleteByIds(request.getIds()); |
| | | return Result.success(); |
| | | } |
| | | |
| | | @ApiOperation(value = "【APP】岗位列表") |
| | | @PostMapping("/position/list") |
| | | public Result<PageRespMp<Position>> list(@Validated @RequestBody PageReq pageReq) { |
| | | Page<Position> page = positionService.lambdaQuery().page(new Page<>(pageReq.getPage(), pageReq.getSize())); |
| | | return Result.success(PageRespMp.of(page)); |
| | | } |
| | | |
| | | /** |
| | | * 岗位详情 |
| | | */ |
| | | @ApiOperation(value = "【APP】岗位详情",response = Position.class) |
| | | @GetMapping("/position/detail") |
| | | public Result<Position> getPositionDetail(@RequestParam("id") Integer id) { |
| | | Position position = positionService.getById(id); |
| | | if (position == null) { |
| | | throw new RuntimeException("岗位不存在"); |
| | | } |
| | | return Result.success(position); |
| | | } |
| | | |
| | | //////// 检查情况 //////// |
| | | |
| | | /** |
| | | * 检查情况列表查询 |
| | | * 支持"全部/我创建的"筛选 |
| | | */ |
| | | @ApiOperation(value = "【APP】检查情况列表",response = Check.class) |
| | | @PostMapping("/checkinfo/list") |
| | | public Result<PageRespMp<Check>> listCheckInfoRecords(@ApiParam(hidden = true) Session session, |
| | | @RequestParam(value = "checkTaskId") Integer checkTaskId, |
| | | @RequestParam(value = "mine", required = false) Boolean mine, |
| | | @Validated @RequestBody PageReq pageReq) { |
| | | // 根据 mine 参数决定是否筛选"我创建的" |
| | | var creatorId = mine != null && mine ? ((User) session.getUser()).getId() : null; |
| | | |
| | | // 调用 Service 层的 JPA 查询方法 |
| | | return Result.success(checkService.listCheckInfoRecords(checkTaskId, creatorId, pageReq)); |
| | | } |
| | | |
| | | /** |
| | | * 添加检查信息 |
| | | */ |
| | | @ApiOperation("【APP】添加检查信息") |
| | | @PostMapping("/checkinfo/add") |
| | | public Result addCheckInfo(@ApiParam(hidden = true) Session session, |
| | | @Validated @RequestBody AddCheckInfoRequest request) { |
| | | checkService.addCheckInfo((User) session.getUser(), request); |
| | | return Result.success(); |
| | | } |
| | | |
| | | /** |
| | | * 检查信息详情 |
| | | */ |
| | | @ApiOperation(value = "【APP】检查信息详情", response = Check.class) |
| | | @GetMapping("/checkinfo/detail") |
| | | public Result<Check> getCheckInfoDetail(@RequestParam("id") Integer id) { |
| | | Check check = checkService.getById(id); |
| | | if (check == null) { |
| | | throw new RuntimeException("检查信息不存在"); |
| | | } |
| | | return Result.success(check); |
| | | } |
| | | |
| | | /** |
| | | * 编辑检查信息 |
| | | */ |
| | | @ApiOperation("【APP】编辑检查信息") |
| | | @PostMapping("/checkinfo/edit") |
| | | public Result editCheckInfo(@Validated @RequestBody EditCheckInfoRequest request) { |
| | | checkService.editCheckInfo(request); |
| | | return Result.success(); |
| | | } |
| | | |
| | | /** |
| | | * 删除检查信息 |
| | | */ |
| | | @ApiOperation("【APP】删除检查信息") |
| | | @PostMapping("/checkinfo/del") |
| | | public Result deleteCheckInfo(@Validated @RequestBody BatchReq request) { |
| | | checkService.deleteCheckInfoByIds(request.getIds()); |
| | | return Result.success(); |
| | | } |
| | | |
| | | } |