From eae705971534fc4e38b27e094ca8495844a1a1cc Mon Sep 17 00:00:00 2001 From: haungxing <1203316822@qq.com> Date: Fri, 28 Jul 2023 17:10:17 +0800 Subject: [PATCH] =?UTF-8?q?#=20=E5=B7=A1=E6=A3=80=E5=AF=B9=E8=B1=A1?= =?UTF-8?q?=E8=AE=BE=E5=A4=87=E6=A0=91-=E6=9C=BA=E6=9E=84=E5=B1=82?= =?UTF-8?q?=E7=BA=A7=E6=8E=A5=E5=8F=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../hnac/hzinfo/inspect/obj/web/ProjectController.java | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java index bf4cfa5..2e2aabd 100644 --- a/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java +++ b/hzims-service/inspect/src/main/java/com/hnac/hzinfo/inspect/obj/web/ProjectController.java @@ -32,6 +32,8 @@ import org.springblade.core.tool.api.R; import org.springblade.core.tool.constant.BladeConstant; import org.springblade.core.tool.utils.CollectionUtil; import org.springblade.core.tool.utils.Func; +import org.springblade.system.entity.Dept; +import org.springblade.system.feign.ISysClient; import org.springframework.beans.factory.annotation.Autowired; import org.springframework.transaction.annotation.Transactional; import org.springframework.web.bind.annotation.*; @@ -41,6 +43,7 @@ import javax.validation.constraints.NotNull; import java.util.HashMap; import java.util.List; import java.util.Map; +import java.util.Optional; import java.util.stream.Collectors; import java.util.stream.Stream; @@ -59,6 +62,8 @@ public class ProjectController { private TemplateProjectService templateProjectService; @Autowired private ProjectContentServiceImpl projectContentService; + @Autowired + private ISysClient sysClient; /** * 巡检项目列表 @@ -178,4 +183,17 @@ public class ProjectController { public R> getProjectAndContentByEmCodes(@RequestParam String emCodes) { return R.data(projectService.getProjectAndContentByEmCodes(emCodes)); } + + @GetMapping("/getProjectDept") + @ApiOperation(value = "获取巡检项目下的机构") + @ApiOperationSupport(order = 9) + public R getProjectDept() { + QueryWrapper queryWrapper = Wrappers.query().select("distinct create_dept deptId"); + List deptIdList = projectService.listObjs(queryWrapper, Func::toLong); + List result = deptIdList.stream().map(deptId -> new HashMap() {{ + put("deptId", deptId); + put("deptName", Optional.ofNullable(sysClient.getDept(deptId).getData()).map(Dept::getDeptName).orElse(deptId.toString())); + }}).collect(Collectors.toList()); + return R.data(result); + } }