Просмотр исходного кода

更新文件 SmartAuthorGroupController.java

陈士柏 2 лет назад
Родитель
Сommit
0c7f23439a

+ 25 - 0
src/main/java/com/template/controller/SmartAuthorGroupController.java

@@ -10,6 +10,7 @@ import com.template.common.utils.TreeRecordsUtil;
 import com.template.common.utils.UUIDUtil;
 import com.template.model.pojo.SmartAuthorGroup;
 import com.template.model.pojo.SmartAuthority;
+import com.template.model.pojo.SmartUser;
 import com.template.model.result.CommonResult;
 import com.template.model.weixin.AuthorAndGroup;
 import com.template.model.weixin.AuthorAndGroup2;
@@ -17,6 +18,7 @@ import com.template.model.weixin.AuthorListGroup;
 import com.template.model.weixin.userAuthor;
 import com.template.services.SmartAuthorGroupService;
 import com.template.services.SmartAuthorityService;
+import com.template.services.SmartUserService;
 import org.springframework.beans.factory.annotation.Autowired;
 
 import org.springframework.web.bind.annotation.RestController;
@@ -40,6 +42,8 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
     private SmartAuthorGroupService smartAuthorGroupService;
     @Autowired
     public SmartAuthorityService smartAuthorityService;
+    @Autowired
+    public SmartUserService smartUserService;
 
     /**
      * 新增权限组
@@ -354,6 +358,27 @@ public class SmartAuthorGroupController implements SmartAuthorGroupControllerAPI
         return CommonResult.errorMsg("参数格式错误");
     }
 
+    @PassToken
+    @Override
+    public CommonResult queryUserAuthor(String userId){
+        QueryWrapper<SmartAuthority> queryWrapper1 = new QueryWrapper<>();
+        queryWrapper1.eq("deleted", 0);
+        queryWrapper1.eq("user_id", userId);
+        List<SmartAuthority> userAuthor = smartAuthorityService.getAuthorByKey(queryWrapper1);
+        if (userAuthor.size()<=0){
+            return CommonResult.ok(new ArrayList<>());
+        }
+        SmartAuthority smartAuthority = userAuthor.get(0);
+        Integer groupId = smartAuthority.getGroupId();
+        SmartAuthorGroup smartAuthorGroup = smartAuthorGroupService.getSmartById(groupId);
+        JSONObject jsonObject = new JSONObject();
+        jsonObject.put("departmentViewAuthor", smartAuthority.getDepartmentView());
+        jsonObject.put("departmentManageAuthor", smartAuthority.getDepartmentManage());
+        if (smartAuthorGroup.getDeleted()==0){
+            jsonObject.put("treAuthor", smartAuthorGroup.getApplyId());
+        }
+        return CommonResult.ok(jsonObject);
+    }
     /**
      * 查看权限列表
      * @return