You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
79 lines
2.7 KiB
79 lines
2.7 KiB
package com.epmet.controller;
|
|
|
|
import com.epmet.commons.tools.annotation.LoginUser;
|
|
import com.epmet.commons.tools.security.dto.TokenDto;
|
|
import com.epmet.commons.tools.utils.ConvertUtils;
|
|
import com.epmet.commons.tools.utils.Result;
|
|
import com.epmet.dto.RoleDTO;
|
|
import com.epmet.dto.form.GovStaffRoleFormDTO;
|
|
import com.epmet.dto.form.IssueInitiatorFormDTO;
|
|
import com.epmet.dto.result.GovStaffRoleResultDTO;
|
|
import com.epmet.dto.result.GovStaffRoleTemplateDTO;
|
|
import com.epmet.dto.result.IssueInitiatorResultDTO;
|
|
import com.epmet.dto.result.ResiGovRoleListResultDTO;
|
|
import com.epmet.entity.GovStaffRoleEntity;
|
|
import com.epmet.service.GovStaffRoleService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.util.CollectionUtils;
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.List;
|
|
import java.util.stream.Collectors;
|
|
|
|
@RequestMapping("govstaffrole")
|
|
@RestController
|
|
public class GovStaffRoleController {
|
|
|
|
@Autowired
|
|
private GovStaffRoleService govStaffRoleService;
|
|
|
|
/**
|
|
* 根据客户ID查询该客户的角色列表
|
|
* @param customerId
|
|
* @return
|
|
*/
|
|
@PostMapping("rolesbycustomer/{customerId}")
|
|
public Result listGovStaffRolesByCustomer(@PathVariable("customerId") String customerId) {
|
|
List<GovStaffRoleResultDTO> roleEntities = govStaffRoleService.listRolesByCustomer(customerId);
|
|
return new Result().ok(roleEntities);
|
|
}
|
|
|
|
/**
|
|
* 查询角色模板列表
|
|
* @return
|
|
*/
|
|
@PostMapping("roletemplates")
|
|
public Result listGovStaffRoleTemplates() {
|
|
List<GovStaffRoleTemplateDTO> roleTemplates = govStaffRoleService.listRoleTemplates();
|
|
return new Result().ok(roleTemplates);
|
|
}
|
|
|
|
/**
|
|
* 使用id列表查询角色列表
|
|
* @param form
|
|
* @return
|
|
*/
|
|
@PostMapping("getbyids")
|
|
public Result<List<GovStaffRoleResultDTO>> getByIds(@RequestBody GovStaffRoleFormDTO form) {
|
|
List<GovStaffRoleResultDTO> roleDTOS = new ArrayList<>();
|
|
List<String> roleIdList = form.getRoleIdList();
|
|
if (!CollectionUtils.isEmpty(roleIdList)) {
|
|
roleDTOS = roleIdList.stream().map(roleId -> govStaffRoleService.getDTOById(roleId)).collect(Collectors.toList());
|
|
}
|
|
|
|
return new Result<List<GovStaffRoleResultDTO>>().ok(roleDTOS);
|
|
}
|
|
|
|
/**
|
|
* @param tokenDTO
|
|
* @return ResiGovRoleListResultDTO
|
|
* @author sun
|
|
* @Description 获取居民端、工作端人员角色列表
|
|
*/
|
|
@PostMapping("resigovrolelist")
|
|
public Result<ResiGovRoleListResultDTO> resiGovRoleList(@LoginUser TokenDto tokenDTO){
|
|
return new Result<ResiGovRoleListResultDTO>().ok(govStaffRoleService.resiGovRoleList());
|
|
}
|
|
|
|
}
|
|
|