From e87d9f3de8d80ccdca1aaad4c5ff75abf9801428 Mon Sep 17 00:00:00 2001
From: fengjin <1435304038@qq.com>
Date: 星期三, 16 十一月 2022 17:19:41 +0800
Subject: [PATCH] 1.添加智能质询访问表实体类 2.添加智能质询访问相关功能并统计数据 3.修改门户网搜索结果

---
 flower_city/src/main/java/com/dg/core/controller/ReplyTemplateController.java |   35 +++++++++++++++++++++++++++++++----
 1 files changed, 31 insertions(+), 4 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..fb1fc73 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,7 +6,9 @@
 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.PermissionUtil;
 import com.dg.core.util.TableDataInfo;
 import io.swagger.annotations.Api;
 import io.swagger.annotations.ApiOperation;
@@ -25,6 +27,10 @@
     @Autowired
     IReplyTemplateService iReplyTemplateService;
 
+    @Autowired
+    IOrganizationChartService iOrganizationChartService;
+
+
     /**
      * 获取模板列表
      * @return
@@ -34,11 +40,18 @@
     @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=PermissionUtil.getPermission(sysUser,iOrganizationChartService);
+        List<ReplyTemplateEntity> list;
+        if (sysUser.getUserType().equals("2")){
+              list = iReplyTemplateService.selectConfigList(pageParam,pageSize,Name,ids,sysUser.getUserId());}
+        else {
+            list = iReplyTemplateService.selectConfigList(pageParam,pageSize,Name,ids,null);
+        }
+        int num=iReplyTemplateService.countNum(Name,ids);
         return getDataTable(list,num);
     }
 
@@ -79,8 +92,21 @@
             return ResultData.error("模板名称不能为空");
         }
 
+        if(StringUtils.isEmpty(entity.getDepartmentId()))
+        {
+            return ResultData.error("部门id不能为空  请分配部门id");
+        }
+
+        List<String> ids=iOrganizationChartService.getIds(entity.getDepartmentId());
+        int num=iReplyTemplateService.countNum(entity.getName(),ids);
+
+        if(num>0)
+        {
+            return ResultData.error("部门里办事名称重复!");
+        }
+
         entity.setId(null);
-        entity.setDepartmentId(sysUser.getDepartmentId());
+        entity.setDepartmentId(entity.getDepartmentId());
         entity.setCreateUserId(sysUser.getUserId()+"");
 
         return toAjax(iReplyTemplateService.insertConfig(entity));
@@ -143,6 +169,7 @@
         {
             return ResultData.error("模板不存在!");
         }
+        entity.setName(entity.getName()+"(副本)");
         entity.setId(null);
         return toAjax(iReplyTemplateService.insertConfig(entity));
     }

--
Gitblit v1.7.1