From 124940fc04fb9ef8c4c45442d2dcb63b3bdc32d8 Mon Sep 17 00:00:00 2001 From: wangliwen Date: Mon, 1 Aug 2022 14:36:59 +0800 Subject: [PATCH] =?UTF-8?q?=E8=B6=85=E7=BA=A7=E7=AE=A1=E7=90=86=E5=91=98?= =?UTF-8?q?=E6=8C=82=E8=BD=BD=E8=83=BD=E5=8A=9B=E6=97=B6=20=E6=97=A0?= =?UTF-8?q?=E9=83=A8=E9=97=A8id=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../controller/ResourceMountController.java | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java index 268a1b3f..53f4ae88 100644 --- a/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java +++ b/renren-admin/src/main/java/io/renren/common/controller/ResourceMountController.java @@ -23,17 +23,21 @@ import io.renren.modules.resourceMountApply.dto.TResourceMountApplyDTO; import io.renren.modules.resourceMountApply.dto.TResourceUndercarriageApplyDTO; import io.renren.modules.resourceMountApply.service.TResourceMountApplyService; import io.renren.modules.security.user.SecurityUser; +import io.renren.modules.sys.dto.SysDeptDTO; import io.renren.modules.sys.dto.SysUserDTO; +import io.renren.modules.sys.service.SysDeptService; import io.renren.modules.sys.service.SysUserService; import io.swagger.annotations.Api; import io.swagger.annotations.ApiOperation; import org.activiti.engine.TaskService; import org.activiti.engine.task.Task; import org.activiti.engine.task.TaskQuery; +import org.apache.commons.lang3.StringUtils; import org.codehaus.jackson.map.ObjectMapper; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.springframework.beans.factory.annotation.Autowired; +import org.springframework.beans.factory.annotation.Value; import org.springframework.jdbc.core.JdbcTemplate; import org.springframework.web.bind.annotation.PostMapping; import org.springframework.web.bind.annotation.RequestBody; @@ -65,6 +69,11 @@ public class ResourceMountController { protected TaskService taskService; @Autowired private JdbcTemplate jdbcTemplate; + @Autowired + private SysDeptService sysDeptService; + + @Value("${big_date.name}") + private String bigDateDeptName; // 大数据局名称 private static final String apply_key = "resourcemountapply"; // 资源上架 @@ -114,6 +123,16 @@ public class ResourceMountController { logger.error("资源上架异常", e); } + if (StringUtils.isEmpty(tResourceBatchMountApplyDTO.getDeptId())) { + Optional userDTO = Optional.ofNullable(sysUserService.get(Long.valueOf(tResourceBatchMountApplyDTO.getUserId()))); + userDTO.ifPresent(user -> { + if (user.getSuperAdmin() == 1) { + SysDeptDTO deptDTO = sysDeptService.getByName(bigDateDeptName); + tResourceMountApplyDTO.setDeptId(deptDTO.getId().toString()); + } + }); + } + ValidatorUtils.validateEntity(tResourceMountApplyDTO, AddGroup.class, DefaultGroup.class); tResourceMountApplyService.save(tResourceMountApplyDTO); // 保存单条资源申请记录 if (tResourceMountApplyDTO.getId() == null) {