新增接口 机构用户数据封装

This commit is contained in:
ly19960718 2021-06-10 16:07:15 +08:00
parent 1281f5d796
commit eaf839fd31
5 changed files with 99 additions and 10 deletions

View File

@ -2,24 +2,37 @@ package com.tenlion.twoduty.controller.api.departmentbase;
import ink.wgink.common.base.DefaultBaseController;
import ink.wgink.common.component.SecurityComponent;
import ink.wgink.interfaces.consts.ISystemConstant;
import ink.wgink.pojo.dtos.department.DepartmentDTO;
import ink.wgink.interfaces.department.IDepartmentBaseService;
import ink.wgink.pojo.ListPage;
import ink.wgink.pojo.dtos.department.DepartmentUserDTO;
import ink.wgink.pojo.dtos.role.RoleDTO;
import ink.wgink.pojo.dtos.user.UserDTO;
import ink.wgink.pojo.pos.DepartmentPO;
import ink.wgink.pojo.pos.RolePO;
import ink.wgink.pojo.result.ErrorResult;
import ink.wgink.pojo.result.SuccessResultList;
import ink.wgink.service.department.service.IDepartmentService;
import ink.wgink.service.department.service.IDepartmentUserService;
import ink.wgink.service.position.service.IPositionService;
import ink.wgink.service.role.service.IRoleService;
import ink.wgink.service.role.service.IRoleUserService;
import ink.wgink.service.user.service.IUserService;
import io.swagger.annotations.*;
import org.apache.poi.hssf.record.ArrayRecord;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
/**
* 组织机构数据封装
* @author xwangs
* @author liuyang
* @create 2021-03-29 15:31
* @description
*/
@ -29,9 +42,39 @@ import java.util.List;
public class departmentBaseController extends DefaultBaseController {
@Autowired
private IDepartmentService departmentService;
protected SecurityComponent securityComponent;
@Autowired
private IDepartmentBaseService departmentBaseService;
@Autowired
private IDepartmentUserService departmentUserService;
@Autowired
private IRoleService roleService;
@Autowired
private IRoleUserService roleUserService;
@Autowired
private IUserService userService;
/**
* 组织机构默认ID
*/
private final static String GENGID = "0";
/**
* 领导角色ID
*/
private final static String ROLE_BOSS_ID = "1c482ced-c13a-4646-825a-6c14c2e6b305";
/**
* 市局角色
*/
private final static String ROLE_1_CODE = "0001";
/**
* 旗县角色
*/
private final static String ROLE_2_CODE = "0002";
@ -40,7 +83,54 @@ public class departmentBaseController extends DefaultBaseController {
@GetMapping("list-jur")
public List<DepartmentPO> listJur(){
List<DepartmentPO> list = new ArrayList<>();
list = departmentService.listByParentId(GENGID);
List<RolePO> roles = securityComponent.getCurrentUser().getRoles();
// for (RolePO role : roles) {
// //市局角色
// if(ROLE_1_CODE.equals(role.getRoleCode())){
// list = departmentBaseService.listByParentId(GENGID);
// break;
// }
// //旗县区角色
// if(ROLE_2_CODE.equals(role.getRoleCode())){
// for (DepartmentPO department : securityComponent.getCurrentUser().getDepartments()) {
// DepartmentPO po = departmentBaseService.getPO(department.getDepartmentId());
// if(po != null){
// list.add(po);
// }
// }
// break;
// }
// }
list = departmentBaseService.listByParentId(GENGID);
return list;
}
@ApiOperation(value = "组织机构领导用户列表", notes = "组织机构领导用户列表")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-user-boss/{departmentId}")
public List<UserDTO> listUserBoss(@PathVariable("departmentId") String departmentId){
List<UserDTO> list = new ArrayList<>();
RoleDTO roleDTO = roleService.get(ROLE_BOSS_ID);
if(roleDTO == null){
return list;
}
List<String> listUsers = roleUserService.listUserId(roleDTO.getRoleId());
//
List<String> userIds = departmentUserService.listUserId(departmentId, listUsers);
list = userService.listByUserIds(userIds);
return list;
}
@ApiOperation(value = "组织机构用户列表", notes = "组织机构用户列表")
@ApiResponses({@ApiResponse(code = 400, message = "请求失败", response = ErrorResult.class)})
@GetMapping("list-user/{departmentId}")
public List<UserDTO> listUser(@PathVariable("departmentId") String departmentId){
List<UserDTO> list = new ArrayList<>();
List<String> userIds = departmentUserService.listUserId(departmentId);
list = userService.listByUserIds(userIds);
return list;
}
@ -51,5 +141,4 @@ public class departmentBaseController extends DefaultBaseController {
}

View File

@ -64,7 +64,7 @@
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">指标说明</label>
<div class="layui-input-block">
<textarea id="indexLibRemark" name="indexLibRemark" placeholder="请输入指标说明" class="layui-textarea" maxlength="500"></textarea>

View File

@ -64,7 +64,7 @@
</select>
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">指标说明</label>
<div class="layui-input-block">
<textarea id="indexLibRemark" name="indexLibRemark" placeholder="请输入指标说明" class="layui-textarea" maxlength="500"></textarea>

View File

@ -67,7 +67,7 @@
</select>
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">模板说明</label>
<div class="layui-input-block">
<textarea id="indexTemplateRemark" name="indexTemplateRemark" placeholder="请输入模板说明" class="layui-textarea" maxlength="500"></textarea>

View File

@ -67,7 +67,7 @@
</select>
</div>
</div>
<div class="layui-form-item">
<div class="layui-form-item layui-form-text">
<label class="layui-form-label">模板说明</label>
<div class="layui-input-block">
<textarea id="indexTemplateRemark" name="indexTemplateRemark" placeholder="请输入模板说明" class="layui-textarea" maxlength="500"></textarea>