package com.estate.expert.admin.controller.app; import com.estate.expert.admin.domain.business.device.DeviceType; import com.estate.expert.admin.domain.common.mapper.EntityRefMapper; import com.estate.expert.admin.service.CheckTaskService; import com.estate.expert.common.rpc.Result; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import lombok.extern.slf4j.Slf4j; import org.springframework.validation.annotation.Validated; import org.springframework.web.bind.annotation.GetMapping; import org.springframework.web.bind.annotation.RequestMapping; import org.springframework.web.bind.annotation.RequestParam; import org.springframework.web.bind.annotation.RestController; import javax.annotation.Resource; @Slf4j @Api(tags = "个人/任务") @RequestMapping("/personal/task") @RestController @Validated public class TaskHierarchyController { @Resource private CheckTaskService checkTaskService; @Resource private EntityRefMapper entityRefMapper; @ApiOperation(value = "获取综合体系") @GetMapping("/system/hierarchy") public Result getSystemTree(@RequestParam("taskId") Integer taskId) { return Result.success(checkTaskService.getSystemTree(taskId)); } @ApiOperation(value = "获取设备体系") @GetMapping("/device/hierarchy") public Result getDeviceTree(@RequestParam("taskId") Integer taskId, @RequestParam("deviceType") DeviceType deviceType) { return Result.success(checkTaskService.getDeviceTree(taskId, deviceType)); } @ApiOperation(value = "综合问题") @GetMapping("/system/problems") public Result systemProblems(@RequestParam("taskId") Integer taskId, @RequestParam("hierarchyPath") String hierarchyPath) { return Result.success(entityRefMapper.toReference(checkTaskService.getSystemProblems(taskId, hierarchyPath))); } @ApiOperation(value = "设备问题") @GetMapping("/device/problems") public Result deviceProblems(@RequestParam("taskId") Integer taskId, @RequestParam("hierarchyPath") String hierarchyPath) { return Result.success(entityRefMapper.toReference(checkTaskService.getDeviceProblems(taskId, hierarchyPath))); } }