From 385ca2ede6109a09da65d85ae0ba85a764201023 Mon Sep 17 00:00:00 2001
From: lidongdong <1459917685@qq.com>
Date: 星期一, 28 十一月 2022 14:18:52 +0800
Subject: [PATCH] 修改导办工单删除功能

---
 flower_city/src/main/java/com/dg/core/controller/GuideRepairOrderController.java |   65 +++++++++++++++++++-------------
 1 files changed, 39 insertions(+), 26 deletions(-)

diff --git a/flower_city/src/main/java/com/dg/core/controller/GuideRepairOrderController.java b/flower_city/src/main/java/com/dg/core/controller/GuideRepairOrderController.java
index 172674f..ec79767 100644
--- a/flower_city/src/main/java/com/dg/core/controller/GuideRepairOrderController.java
+++ b/flower_city/src/main/java/com/dg/core/controller/GuideRepairOrderController.java
@@ -237,7 +237,7 @@
                 WxUtil wxUtil=new WxUtil();
                 String accessToken="0";
                 try {
-                    accessToken= stringRedisTemplate.boundValueOps("access_token:access_token:" + ConstantPropertiesUtil.WX_OPEN_APP_ID).get().toString();
+                    accessToken= stringRedisTemplate.boundValueOps("access_token:access_token:" + ConstantPropertiesUtil.WX_OPEN_APP_ID).get();
                 } catch (Exception e) {
                     throw new RuntimeException(e);
                 }
@@ -387,18 +387,16 @@
         String userId=null;
         if( StringUtils.equals("2",sysUser.getRoleIds()))
         {
-//            if(StringUtils.equals("1",sysUser.getIsDivisionHead()))
-//            {
-//                userId=null;
-//            }
-//            else
-//            {
-//                ids=null;
-//                userId=sysUser.getUserId()+"";
-//            }
-            userId=sysUser.getUserId()+"";
-//            ids=new ArrayList<>();
-//            ids.add(sysUser.getDepartmentId());
+            if(StringUtils.equals("1",sysUser.getIsDivisionHead()))
+            {
+                ids=PermissionUtil.getPermission(sysUser,iOrganizationChartService);
+            }
+            else
+            {
+                userId=sysUser.getUserId()+"";
+                ids=new ArrayList<>();
+                ids.add(sysUser.getDepartmentId());
+            }
         }
         else
         {
@@ -422,18 +420,16 @@
         String userId=null;
         if( StringUtils.equals("2",sysUser.getRoleIds()))
         {
-//            if(StringUtils.equals("1",sysUser.getIsDivisionHead()))
-//            {
-//                userId=null;
-//            }
-//            else
-//            {
-//                ids=null;
-//                userId=sysUser.getUserId()+"";
-//            }
-            userId=sysUser.getUserId()+"";
-//            ids=new ArrayList<>();
-//            ids.add(sysUser.getDepartmentId());
+            if(StringUtils.equals("1",sysUser.getIsDivisionHead()))
+            {
+                ids=PermissionUtil.getPermission(sysUser,iOrganizationChartService);
+            }
+            else
+            {
+                userId=sysUser.getUserId()+"";
+                ids=new ArrayList<>();
+                ids.add(sysUser.getDepartmentId());
+            }
         }
         else
         {
@@ -467,10 +463,27 @@
     @ApiOperation(value = "删除工单",response = GuideRepairOrder.class)
     @DeleteMapping("/delete/{id}")
     @Authorization
-    public ResultData deleteConfigById(@PathVariable("id") String id)
+    public ResultData deleteConfigById(@PathVariable("id") String id,@CurrentUser SysUser sysUser)
     {
+        if(!StringUtils.equals("1",sysUser.getUserType()) || !StringUtils.equals("1",sysUser.getIsDivisionHead()) )
+        {
+            return error("只有超管或者部门领导才能删除");
+        }
+
         return toAjax(iGuideRepairOrderService.deleteConfigById(id));
     }
 
 
+    /**
+     * 删除评论
+     * @return
+     */
+    @ApiOperation(value = "删除评论",response = GuideRepairOrder.class)
+    @GetMapping("/deleteComment")
+    @Authorization
+    public  ResultData deleteComment(@RequestParam(value = "id",required = false) Integer id,@CurrentUser  SysUser sysUser){
+        return  iGuideRepairOrderService.deleteComment(id,sysUser);
+    }
+
+
 }

--
Gitblit v1.7.1