From fc56ad34e7110c2da5d81459bf9ad37f98988b04 Mon Sep 17 00:00:00 2001
From: lidongdong <1459917685@qq.com>
Date: 星期三, 19 十月 2022 16:39:27 +0800
Subject: [PATCH] 修改角色创建人问题  导办人员筛选  bug

---
 flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java |   27 ++++++++++++++++++++++++---
 1 files changed, 24 insertions(+), 3 deletions(-)

diff --git a/flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java b/flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java
index bfd7e48..d8b2ecc 100644
--- a/flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java
+++ b/flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java
@@ -6,6 +6,7 @@
 import com.dg.core.annotation.CurrentUser;
 import com.dg.core.db.gen.entity.ReplyTemplateEntity;
 import com.dg.core.db.gen.entity.SysUser;
+import com.dg.core.service.IOrganizationChartService;
 import com.dg.core.service.IReplyTemplateService;
 import com.dg.core.util.TableDataInfo;
 import io.swagger.annotations.Api;
@@ -25,6 +26,10 @@
     @Autowired
     IReplyTemplateService iReplyTemplateService;
 
+    @Autowired
+    IOrganizationChartService iOrganizationChartService;
+
+
     /**
      * 获取模板列表
      * @return
@@ -34,11 +39,13 @@
     @Authorization
     public TableDataInfo selectConfigList(@RequestParam(value = "pageNum",required = false) Integer pageNum,
                                           @RequestParam(value = "pageSize",required = false) Integer pageSize,
-                                          @RequestParam(value = "Name",required = false) String Name)
+                                          @RequestParam(value = "name",required = false) String Name,
+                                          @CurrentUser SysUser sysUser)
     {
         Page<ReplyTemplateEntity> pageParam = new Page<>(pageNum,pageSize);
-        List<ReplyTemplateEntity> list = iReplyTemplateService.selectConfigList(pageParam,pageSize,Name);
-        int num=iReplyTemplateService.countNum(Name);
+        List<String> ids=iOrganizationChartService.getIds(sysUser.getDepartmentId());
+        List<ReplyTemplateEntity> list = iReplyTemplateService.selectConfigList(pageParam,pageSize,Name,ids);
+        int num=iReplyTemplateService.countNum(Name,ids);
         return getDataTable(list,num);
     }
 
@@ -77,6 +84,19 @@
         if(StringUtils.isEmpty(entity.getName()))
         {
             return ResultData.error("模板名称不能为空");
+        }
+
+        if(StringUtils.isEmpty(sysUser.getDepartmentId()))
+        {
+            return ResultData.error("部门id不能为空  请分配部门id");
+        }
+
+        List<String> ids=iOrganizationChartService.getIds(sysUser.getDepartmentId());
+        int num=iReplyTemplateService.countNum(entity.getName(),ids);
+
+        if(num>0)
+        {
+            return ResultData.error("部门里办事名称重复!");
         }
 
         entity.setId(null);
@@ -143,6 +163,7 @@
         {
             return ResultData.error("模板不存在!");
         }
+        entity.setName(entity.getName()+"(副本)");
         entity.setId(null);
         return toAjax(iReplyTemplateService.insertConfig(entity));
     }

--
Gitblit v1.7.1