|
@@ -35,9 +35,9 @@ import java.util.stream.Collectors;
|
|
|
* @date 2021/4/6
|
|
|
*/
|
|
|
@Slf4j
|
|
|
-@Api(tags ="数据授权API")
|
|
|
+@Api(tags = "数据授权API")
|
|
|
@RestController
|
|
|
-@RequestMapping("authsvr/"+ VersionUtils.VERSION_UID +"/dataauth")
|
|
|
+@RequestMapping("authsvr/" + VersionUtils.VERSION_UID + "/dataauth")
|
|
|
public class DataAuthController {
|
|
|
|
|
|
@Autowired
|
|
@@ -50,11 +50,10 @@ public class DataAuthController {
|
|
|
IDataResourceFacade dataResourceFacade;
|
|
|
|
|
|
|
|
|
-
|
|
|
@ApiOperation(value = "获取属性列表,树形结构:警种1-业务域N")
|
|
|
@ApiImplicitParam(name = "name", value = "查询条件")
|
|
|
@GetMapping(value = "businessTreeList", produces = "application/json;charset=UTF-8")
|
|
|
- public Result<List<LabelTreeVO>> businessTreeList(){
|
|
|
+ public Result<List<LabelTreeVO>> businessTreeList() {
|
|
|
LabelSearchDTO labelSearchDTO = new LabelSearchDTO();
|
|
|
labelSearchDTO.setShowAll(false);
|
|
|
List<LabelTreeVO> labelTreeList = userCenterApiFacade.labelTreeList(labelSearchDTO);
|
|
@@ -63,18 +62,18 @@ public class DataAuthController {
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "获取所有数据资源,返回树结构")
|
|
|
- @ApiImplicitParam(name = "attrType",value = "数据属性类型 TABLE:表 COLUMN:列")
|
|
|
+ @ApiImplicitParam(name = "attrType", value = "数据属性类型 TABLE:表 COLUMN:列")
|
|
|
@GetMapping(value = "allDataTree", produces = "application/json;charset=UTF-8")
|
|
|
- public Result<List<DataResourceClassifyVo>> getAllDataResource(@RequestParam(value = "attrType", required = false) String attrType){
|
|
|
+ public Result<List<DataResourceClassifyVo>> getAllDataResource(@RequestParam(value = "attrType", required = false) String attrType) {
|
|
|
log.info("allDataTree >> attrType:{}", attrType);
|
|
|
List<DataResourceClassifyVo> dataResourceTree = dataResourceFacade.getAllDataResourceTree(attrType);
|
|
|
return Result.success(dataResourceTree);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "获取数据资源,返回树结构")
|
|
|
- @ApiImplicitParam(name = "typeCode",value = "typeCode类型(数据分级:DATA_CLASSIFY;数据资源分类:DATA_RESOURCE_CLASSIFY;数据安全级别:DATA_SECURITY_LEVEL;字段分类:COLUMN_CLASSIFY)")
|
|
|
+ @ApiImplicitParam(name = "typeCode", value = "typeCode类型(数据分级:DATA_CLASSIFY;数据资源分类:DATA_RESOURCE_CLASSIFY;数据安全级别:DATA_SECURITY_LEVEL;字段分类:COLUMN_CLASSIFY)")
|
|
|
@GetMapping(value = "getDataResourceTree")
|
|
|
- public Result<DataResourceClassifyVo> getDataResource(@RequestParam("typeCode") String typeCode){
|
|
|
+ public Result<DataResourceClassifyVo> getDataResource(@RequestParam("typeCode") String typeCode) {
|
|
|
log.info("dataTree >> typeCode:{}", typeCode);
|
|
|
DataResourceClassifyVo dataResourceTree = dataResourceFacade.getDataResourceTree(typeCode);
|
|
|
return Result.success(dataResourceTree);
|
|
@@ -90,9 +89,9 @@ public class DataAuthController {
|
|
|
|
|
|
@ApiOperation(value = "人员数据授权接口")
|
|
|
@PostMapping(value = "userDataAuth", produces = "application/json;charset=UTF-8")
|
|
|
- public Result<Boolean> userDataAuth(@RequestBody UserDataAuthAcceptVo vo){
|
|
|
+ public Result<Boolean> userDataAuth(@RequestBody UserDataAuthAcceptVo vo) {
|
|
|
List<DataAuthAcceptVo> authVoList = vo.getAuthVoList();
|
|
|
- log.info("userDataAuth >> userDataAuthAcceptVo:{}",JSON.toJSONString(vo));
|
|
|
+ log.info("userDataAuth >> userDataAuthAcceptVo:{}", JSON.toJSONString(vo));
|
|
|
SubDataAuthDTO subDataAuthDTO = convertToSubAuthDTO(vo.getIdcard(), SubDataAuthTypeEnum.SUB_DATA_AUTH_USER.getValue(), vo.getAuthType(), authVoList);
|
|
|
dataAuthFacade.subDataAuthAdd(subDataAuthDTO);
|
|
|
return Result.success(true);
|
|
@@ -100,9 +99,9 @@ public class DataAuthController {
|
|
|
|
|
|
@ApiOperation(value = "机构数据授权接口")
|
|
|
@PostMapping(value = "orgDataAuth", produces = "application/json;charset=UTF-8")
|
|
|
- public Result<Boolean> orgDataAuth(@RequestBody OrgDataAuthAcceptVo vo){
|
|
|
+ public Result<Boolean> orgDataAuth(@RequestBody OrgDataAuthAcceptVo vo) {
|
|
|
List<DataAuthAcceptVo> authVoList = vo.getAuthVoList();
|
|
|
- log.info("orgDataAuth>>orgDataAuthAcceptVo:{}",JSON.toJSONString(vo));
|
|
|
+ log.info("orgDataAuth>>orgDataAuthAcceptVo:{}", JSON.toJSONString(vo));
|
|
|
SubDataAuthDTO subDataAuthDTO = convertToSubAuthDTO(vo.getOrgCode(), SubDataAuthTypeEnum.SUB_DATA_AUTH_ORG.getValue(), vo.getAuthType(), authVoList);
|
|
|
dataAuthFacade.subDataAuthAdd(subDataAuthDTO);
|
|
|
return Result.success(true);
|
|
@@ -111,9 +110,9 @@ public class DataAuthController {
|
|
|
|
|
|
@ApiOperation(value = "业务域标签数据授权接口")
|
|
|
@PostMapping(value = "labelDataAuth", produces = "application/json;charset=UTF-8")
|
|
|
- public Result<Boolean> labelDataAuth(@RequestBody LabelDataAuthAcceptVo vo){
|
|
|
+ public Result<Boolean> labelDataAuth(@RequestBody LabelDataAuthAcceptVo vo) {
|
|
|
List<DataAuthAcceptVo> authVoList = vo.getAuthVoList();
|
|
|
- log.info("labelDataAuth >> labelDataAuthAcceptVo:{}",JSON.toJSONString(vo));
|
|
|
+ log.info("labelDataAuth >> labelDataAuthAcceptVo:{}", JSON.toJSONString(vo));
|
|
|
SubDataAuthDTO subDataAuthDTO = convertToSubAuthDTO(vo.getBusinessCode(), SubDataAuthTypeEnum.SUB_DATA_AUTH_BUSINESS.getValue(), vo.getAuthType(), authVoList);
|
|
|
dataAuthFacade.subDataAuthAdd(subDataAuthDTO);
|
|
|
return Result.success(true);
|
|
@@ -125,7 +124,7 @@ public class DataAuthController {
|
|
|
List<SubDataAuthQueryDTO> dtos = new ArrayList<>();
|
|
|
for (SubDataAuthQueryVo vo : queryVoList) {
|
|
|
SubDataAuthQueryDTO dto = new SubDataAuthQueryDTO();
|
|
|
- BeanUtils.copyProperties(vo,dto);
|
|
|
+ BeanUtils.copyProperties(vo, dto);
|
|
|
}
|
|
|
List<DataClassifyDTO> classifyDTOS = dataAuthFacade.subDataAuthList(dtos);
|
|
|
List<DataClassifyVo> vos = convertToVos(classifyDTOS);
|
|
@@ -133,11 +132,11 @@ public class DataAuthController {
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "查询单个主体数据权限")
|
|
|
- @PostMapping(value = "getSubDataAuth" , produces = "application/json;charset=UTF-8")
|
|
|
- public Result<List<DataClassifyVo>> getSubDataAuth(@RequestBody SubDataAuthQueryVo queryVo){
|
|
|
- log.info("getSubDataAuth >> vo:{}",JSON.toJSONString(queryVo));
|
|
|
+ @PostMapping(value = "getSubDataAuth", produces = "application/json;charset=UTF-8")
|
|
|
+ public Result<List<DataClassifyVo>> getSubDataAuth(@RequestBody SubDataAuthQueryVo queryVo) {
|
|
|
+ log.info("getSubDataAuth >> vo:{}", JSON.toJSONString(queryVo));
|
|
|
SubDataAuthQueryDTO queryDTO = new SubDataAuthQueryDTO();
|
|
|
- BeanUtils.copyProperties(queryVo,queryDTO);
|
|
|
+ BeanUtils.copyProperties(queryVo, queryDTO);
|
|
|
List<DataClassifyDTO> dtos = dataAuthFacade.getSubDataAuth(queryDTO);
|
|
|
List<DataClassifyVo> vos = convertToVos(dtos);
|
|
|
return Result.success(vos);
|
|
@@ -146,12 +145,12 @@ public class DataAuthController {
|
|
|
|
|
|
@ApiOperation(value = "人员视角数据权限查询-根据人员id查询")
|
|
|
@ApiImplicitParams(value = {
|
|
|
- @ApiImplicitParam(name = "userId",value = "人员id"),
|
|
|
- @ApiImplicitParam(name = "authType",value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
|
|
|
+ @ApiImplicitParam(name = "userId", value = "人员id"),
|
|
|
+ @ApiImplicitParam(name = "authType", value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
|
|
|
})
|
|
|
- @GetMapping(value = "dataAuthInfoByUserId" , produces = "application/json;charset=UTF-8")
|
|
|
+ @GetMapping(value = "dataAuthInfoByUserId", produces = "application/json;charset=UTF-8")
|
|
|
public Result<List<DataClassifyVo>> userDataAuthInfoById(@RequestParam("userId") String userId,
|
|
|
- @RequestParam(value = "authType", required = false) String authType){
|
|
|
+ @RequestParam(value = "authType", required = false) String authType) {
|
|
|
log.info("dataAuthInfoByUserId >> userId:{},authType:{}", userId, authType);
|
|
|
List<DataClassifyDTO> dtos = dataAuthFacade.userDataAuthInfoByUserId(userId, authType);
|
|
|
List<DataClassifyVo> vos = convertToVos(dtos);
|
|
@@ -160,12 +159,12 @@ public class DataAuthController {
|
|
|
|
|
|
@ApiOperation(value = "人员视角数据权限查询-根据人员身份证号查询")
|
|
|
@ApiImplicitParams(value = {
|
|
|
- @ApiImplicitParam(name = "idcard",value = "身份证号"),
|
|
|
- @ApiImplicitParam(name = "authType",value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
|
|
|
+ @ApiImplicitParam(name = "idcard", value = "身份证号"),
|
|
|
+ @ApiImplicitParam(name = "authType", value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
|
|
|
})
|
|
|
- @GetMapping(value = "dataAuthInfoByIdcard" , produces = "application/json;charset=UTF-8")
|
|
|
+ @GetMapping(value = "dataAuthInfoByIdcard", produces = "application/json;charset=UTF-8")
|
|
|
public Result<List<DataClassifyVo>> userDataAuthInfoByIdcard(@RequestParam("idcard") String idcard,
|
|
|
- @RequestParam(value = "authType",required = false) String authType){
|
|
|
+ @RequestParam(value = "authType", required = false) String authType) {
|
|
|
List<DataClassifyDTO> dtos = dataAuthFacade.userDataAuthInfoByIdcard(idcard, authType);
|
|
|
List<DataClassifyVo> vos = convertToVos(dtos);
|
|
|
return Result.success(vos);
|
|
@@ -173,11 +172,11 @@ public class DataAuthController {
|
|
|
|
|
|
@ApiOperation(value = "人员视角-有权限的数据资源查询(树结构)-根据身份证号查询")
|
|
|
@ApiImplicitParams(value = {
|
|
|
- @ApiImplicitParam(name = "idcard",value = "身份证号"),
|
|
|
- @ApiImplicitParam(name = "authType",value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
|
|
|
+ @ApiImplicitParam(name = "idcard", value = "身份证号"),
|
|
|
+ @ApiImplicitParam(name = "authType", value = "数据属性授权类型 TABLE:表授权 COLUMN:列授权")
|
|
|
})
|
|
|
- @GetMapping(value = "userDataTreeByIdcard" , produces = "application/json;charset=UTF-8")
|
|
|
- public Result<List<DataResourceClassifyVo>> userDataAuthTreeByIdcard(@RequestParam("idcard") String idcard, @RequestParam(value = "authType",required = false) String authType){
|
|
|
+ @GetMapping(value = "userDataTreeByIdcard", produces = "application/json;charset=UTF-8")
|
|
|
+ public Result<List<DataResourceClassifyVo>> userDataAuthTreeByIdcard(@RequestParam("idcard") String idcard, @RequestParam(value = "authType", required = false) String authType) {
|
|
|
List<DataResourceDTO> dtos = dataAuthFacade.userDataTreeByIdcard(idcard, authType);
|
|
|
//树节点dto转vo多层次拷贝,使用JSONString序列化
|
|
|
//字段key值要能对应上
|
|
@@ -189,22 +188,22 @@ public class DataAuthController {
|
|
|
|
|
|
@ApiOperation(value = "分级分类清单数据")
|
|
|
@PostMapping(value = "dataDetailList")
|
|
|
- public Result dataDetailList(SearchDTO searchDTO){
|
|
|
+ public Result dataDetailList(SearchDTO searchDTO) {
|
|
|
BusResultVO busResultVO = dataAuthFacade.dataDetailList(searchDTO);
|
|
|
- return Result.success((long) busResultVO.getResultData().getTotalCount(),busResultVO.getResultData().getDataList());
|
|
|
+ return Result.success((long) busResultVO.getResultData().getTotalCount(), busResultVO.getResultData().getDataList());
|
|
|
}
|
|
|
|
|
|
private List<DataClassifyVo> convertToVos(List<DataClassifyDTO> classifyDTOS) {
|
|
|
return classifyDTOS.stream().map(item -> {
|
|
|
DataClassifyVo vo = new DataClassifyVo();
|
|
|
- BeanUtils.copyProperties(item, vo,"tickedDatas");
|
|
|
+ BeanUtils.copyProperties(item, vo, "tickedDatas");
|
|
|
List<SubDataDTO> tickedDatas = item.getTickedDatas();
|
|
|
List<SubDataVo> dataVoList = tickedDatas.stream()
|
|
|
- .map(dto->{
|
|
|
+ .map(dto -> {
|
|
|
//拼接dataId给前端使用,保证dataId是唯一值
|
|
|
dto.setDataId(dto.getDataId());
|
|
|
SubDataVo subDataVo = new SubDataVo();
|
|
|
- BeanUtils.copyProperties(dto,subDataVo);
|
|
|
+ BeanUtils.copyProperties(dto, subDataVo);
|
|
|
return subDataVo;
|
|
|
}).collect(Collectors.toList());
|
|
|
vo.setTickedDatas(dataVoList);
|
|
@@ -212,8 +211,8 @@ public class DataAuthController {
|
|
|
}).collect(Collectors.toList());
|
|
|
}
|
|
|
|
|
|
- private SubDataAuthDTO convertToSubAuthDTO(String subId, String subType, String authType,List<DataAuthAcceptVo> authVoList) {
|
|
|
- SubDataAuthDTO subDataAuthDTO = new SubDataAuthDTO(subId,subType,authType);
|
|
|
+ private SubDataAuthDTO convertToSubAuthDTO(String subId, String subType, String authType, List<DataAuthAcceptVo> authVoList) {
|
|
|
+ SubDataAuthDTO subDataAuthDTO = new SubDataAuthDTO(subId, subType, authType);
|
|
|
List<SubDataDTO> dataDTOList = new ArrayList<>();
|
|
|
for (DataAuthAcceptVo vo : authVoList) {
|
|
|
SubDataDTO subDataDTO = new SubDataDTO();
|