|
@@ -1,16 +1,11 @@
|
|
package com.dragoninfo.dcuc.authweb.restcontroller.sub;
|
|
package com.dragoninfo.dcuc.authweb.restcontroller.sub;
|
|
|
|
|
|
-import com.alibaba.fastjson.JSON;
|
|
|
|
-import com.alibaba.fastjson.TypeReference;
|
|
|
|
import com.dragoninfo.dcuc.app.entity.ApplyInfo;
|
|
import com.dragoninfo.dcuc.app.entity.ApplyInfo;
|
|
-import com.dragoninfo.dcuc.auth.sub.dto.AttrInfoTreeDTO;
|
|
|
|
-import com.dragoninfo.dcuc.auth.sub.dto.AttrRelAcceptDTO;
|
|
|
|
import com.dragoninfo.dcuc.auth.sub.dto.RelSearchDTO;
|
|
import com.dragoninfo.dcuc.auth.sub.dto.RelSearchDTO;
|
|
-import com.dragoninfo.dcuc.auth.sub.enumresource.AttrBelongTypeEnum;
|
|
|
|
-import com.dragoninfo.dcuc.auth.sub.enumresource.AttrTypeEnum;
|
|
|
|
import com.dragoninfo.dcuc.auth.sub.facade.IAttrFacade;
|
|
import com.dragoninfo.dcuc.auth.sub.facade.IAttrFacade;
|
|
-import com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.attr.AttrInfoTreeVo;
|
|
|
|
-import com.dragoninfo.dcuc.authweb.restcontroller.sub.vo.attr.AttrRelAcceptVo;
|
|
|
|
|
|
+import com.dragoninfo.dcuc.auth.sub.vo.AttrInfoAddVo;
|
|
|
|
+import com.dragoninfo.dcuc.auth.sub.vo.AttrInfoTreeVo;
|
|
|
|
+import com.dragoninfo.dcuc.auth.sub.vo.AttrRelAcceptVo;
|
|
import com.dragoninfo.dcuc.authweb.util.VersionUtils;
|
|
import com.dragoninfo.dcuc.authweb.util.VersionUtils;
|
|
import com.dragoninfo.duceap.core.response.Result;
|
|
import com.dragoninfo.duceap.core.response.Result;
|
|
import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
@@ -18,10 +13,8 @@ import com.dragonsoft.duceap.core.search.Searchable;
|
|
import com.dragonsoft.duceap.core.search.filter.Condition;
|
|
import com.dragonsoft.duceap.core.search.filter.Condition;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.Api;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
import io.swagger.annotations.ApiImplicitParam;
|
|
-import io.swagger.annotations.ApiImplicitParams;
|
|
|
|
import io.swagger.annotations.ApiOperation;
|
|
import io.swagger.annotations.ApiOperation;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
import lombok.extern.slf4j.Slf4j;
|
|
-import org.springframework.beans.BeanUtils;
|
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.data.domain.Page;
|
|
import org.springframework.web.bind.annotation.*;
|
|
import org.springframework.web.bind.annotation.*;
|
|
@@ -46,12 +39,8 @@ public class AttrController {
|
|
@ApiOperation(value = "添加主客体属性")
|
|
@ApiOperation(value = "添加主客体属性")
|
|
@ApiImplicitParam(name = "AttrInfoTreeVo", value = "主客体属性Vo")
|
|
@ApiImplicitParam(name = "AttrInfoTreeVo", value = "主客体属性Vo")
|
|
@PostMapping(value = "attrAdds")
|
|
@PostMapping(value = "attrAdds")
|
|
- public Result attrAdds(@RequestBody AttrInfoTreeVo vo){
|
|
|
|
- String voStr = JSON.toJSONString(vo);
|
|
|
|
- AttrInfoTreeDTO dto = JSON.parseObject(voStr, new TypeReference<AttrInfoTreeDTO>() {{
|
|
|
|
- }});
|
|
|
|
- BeanUtils.copyProperties(vo,dto);
|
|
|
|
- ResponseStatus response = attrFacade.attrSave(dto);
|
|
|
|
|
|
+ public Result attrAdds(@RequestBody AttrInfoAddVo vo){
|
|
|
|
+ ResponseStatus response = attrFacade.attrSave(vo);
|
|
if (ResponseStatus.SUCCESS_CODE.equals(response.getStatusCode())) {
|
|
if (ResponseStatus.SUCCESS_CODE.equals(response.getStatusCode())) {
|
|
return Result.success();
|
|
return Result.success();
|
|
} else {
|
|
} else {
|
|
@@ -60,16 +49,10 @@ public class AttrController {
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "根据id,删除本级下的所有主客体属性,包括本级")
|
|
@ApiOperation(value = "根据id,删除本级下的所有主客体属性,包括本级")
|
|
- @ApiImplicitParams(value = {
|
|
|
|
- @ApiImplicitParam(name = "id", value = "本级id"),
|
|
|
|
- @ApiImplicitParam(name = "attrType", value = "属性类别 SUB:主体属性 OBJ:客体属性"),
|
|
|
|
- @ApiImplicitParam(name = "attrBelongType", value = "属性所属的主客体类别 USER:人员 ORG:机构 APP:应用 FUN:功能 SER:服务")
|
|
|
|
- })
|
|
|
|
|
|
+ @ApiImplicitParam(name = "id", value = "本级id")
|
|
@GetMapping(value = "deleteAllById")
|
|
@GetMapping(value = "deleteAllById")
|
|
- public Result deleteAllById(@RequestParam("id") String id,
|
|
|
|
- @RequestParam("attrType") String attrType,
|
|
|
|
- @RequestParam("attrBelongType") String attrBelongType) {
|
|
|
|
- Boolean b = attrFacade.deleteAllById(id,attrBelongType,attrType);
|
|
|
|
|
|
+ public Result deleteAllById(@RequestParam("id") String id) {
|
|
|
|
+ Boolean b = attrFacade.deleteAllById(id);
|
|
if (b) {
|
|
if (b) {
|
|
return Result.success();
|
|
return Result.success();
|
|
} else {
|
|
} else {
|
|
@@ -78,23 +61,18 @@ public class AttrController {
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "根据属性所属类别获取属性列表,返回树结构")
|
|
@ApiOperation(value = "根据属性所属类别获取属性列表,返回树结构")
|
|
- @ApiImplicitParam(name = "attrType", value = "属性类别 SUB:主体属性 OBJ:客体属性")
|
|
|
|
|
|
+ @ApiImplicitParam(name = "attrSubType", value = "属性类别 SUB:主体属性 OBJ:客体属性")
|
|
@GetMapping(value = "getAttrTreeList")
|
|
@GetMapping(value = "getAttrTreeList")
|
|
- public Result getAttrTreeList(@RequestParam("attrType") String attrType) {
|
|
|
|
- List<AttrInfoTreeDTO> list = attrFacade.getAttrTreeList(attrType);
|
|
|
|
- String dtoStr = JSON.toJSONString(list);
|
|
|
|
- List<AttrInfoTreeVo> voList = JSON.parseObject(dtoStr, new TypeReference<List<AttrInfoTreeVo>>() {{
|
|
|
|
- }});
|
|
|
|
- return Result.success(voList);
|
|
|
|
|
|
+ public Result getAttrTreeList(@RequestParam("attrSubType") String attrSubType) {
|
|
|
|
+ List<AttrInfoTreeVo> list = attrFacade.getAttrTreeList(attrSubType);
|
|
|
|
+ return Result.success(list);
|
|
}
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "属性关联主客体关系添加")
|
|
@ApiOperation(value = "属性关联主客体关系添加")
|
|
@ApiImplicitParam(name = "attrRelAcceptVo", value = "主客体-属性关联关系添加对象")
|
|
@ApiImplicitParam(name = "attrRelAcceptVo", value = "主客体-属性关联关系添加对象")
|
|
@PostMapping(value = "attrRelAdd")
|
|
@PostMapping(value = "attrRelAdd")
|
|
public Result attrRelAdd(@RequestBody AttrRelAcceptVo vo) {
|
|
public Result attrRelAdd(@RequestBody AttrRelAcceptVo vo) {
|
|
- AttrRelAcceptDTO dto = new AttrRelAcceptDTO();
|
|
|
|
- BeanUtils.copyProperties(vo,dto);
|
|
|
|
- Boolean b = attrFacade.relAdd(dto);
|
|
|
|
|
|
+ Boolean b = attrFacade.relAdd(vo);
|
|
if (b) {
|
|
if (b) {
|
|
return Result.success();
|
|
return Result.success();
|
|
} else {
|
|
} else {
|
|
@@ -102,20 +80,6 @@ public class AttrController {
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
|
|
- @ApiOperation(value = "查询属性关联的id集合")
|
|
|
|
- @ApiImplicitParams(value = {
|
|
|
|
- @ApiImplicitParam(name = "attrId", value = "parentId属性父类id"),
|
|
|
|
- @ApiImplicitParam(name = "attrType", value = "属性类别 SUB:主体属性 OBJ:客体属性"),
|
|
|
|
- @ApiImplicitParam(name = "attrBelongType", value = "属性所属的主客体类别 USER:人员 ORG:机构 APP:应用 FUN:功能 SER:服务")
|
|
|
|
- })
|
|
|
|
- @GetMapping(value = "attrRelToIds")
|
|
|
|
- public Result<List<String>> attrRelToIds(@RequestParam("attrId") String attrId,
|
|
|
|
- @RequestParam("attrType") String attrType,
|
|
|
|
- @RequestParam("attrBelongType") String attrBelongType) {
|
|
|
|
- List<String> relIds = attrFacade.attrRelToIds(attrId, attrType, attrBelongType);
|
|
|
|
- return Result.success(relIds);
|
|
|
|
- }
|
|
|
|
-
|
|
|
|
@ApiOperation(value = "查询属性关联的应用列表")
|
|
@ApiOperation(value = "查询属性关联的应用列表")
|
|
@ApiImplicitParam(name = "RelSearchVo",
|
|
@ApiImplicitParam(name = "RelSearchVo",
|
|
value = "searchable 应用列表查询条件[attrId: 属性id op: eq] [name: 应用名称 op:like][status: 在用状态 op: eq]")
|
|
value = "searchable 应用列表查询条件[attrId: 属性id op: eq] [name: 应用名称 op:like][status: 在用状态 op: eq]")
|
|
@@ -126,12 +90,21 @@ public class AttrController {
|
|
return Result.success(page.getTotalElements(),page.getContent());
|
|
return Result.success(page.getTotalElements(),page.getContent());
|
|
}
|
|
}
|
|
|
|
|
|
|
|
+ @ApiOperation(value = "查询属性未关联的应用列表")
|
|
|
|
+ @ApiImplicitParam(name = "RelSearchVo",
|
|
|
|
+ value = "searchable 应用列表查询条件[attrId: 属性id op: eq] [name: 应用名称 op:like][status: 在用状态 op: eq]")
|
|
|
|
+ @PostMapping(value = "notRelAppPage")
|
|
|
|
+ public Result notRelAppPage(Searchable searchable) {
|
|
|
|
+ RelSearchDTO dto = convertToRelSearch(searchable);
|
|
|
|
+ Page<ApplyInfo> page = attrFacade.notRelAppPage(dto);
|
|
|
|
+ return Result.success(page.getTotalElements(),page.getContent());
|
|
|
|
+ }
|
|
|
|
+
|
|
private RelSearchDTO convertToRelSearch(Searchable searchable) {
|
|
private RelSearchDTO convertToRelSearch(Searchable searchable) {
|
|
Condition nameCondition = searchable.getSearchFilterByKey("name_like");
|
|
Condition nameCondition = searchable.getSearchFilterByKey("name_like");
|
|
Condition attrIdEq = searchable.getSearchFilterByKey("attrId_eq");
|
|
Condition attrIdEq = searchable.getSearchFilterByKey("attrId_eq");
|
|
- RelSearchDTO dto = new RelSearchDTO(attrIdEq.getValue().toString(),
|
|
|
|
- AttrTypeEnum.OBJ.getCode(),
|
|
|
|
- AttrBelongTypeEnum.APP.getCode());
|
|
|
|
|
|
+ RelSearchDTO dto = new RelSearchDTO();
|
|
|
|
+ dto.setAttrId(attrIdEq.getValue().toString());
|
|
if(null != nameCondition) {
|
|
if(null != nameCondition) {
|
|
dto.setName(nameCondition.getValue().toString());
|
|
dto.setName(nameCondition.getValue().toString());
|
|
}
|
|
}
|
|
@@ -143,4 +116,5 @@ public class AttrController {
|
|
dto.setSize(searchable.getPageSize());
|
|
dto.setSize(searchable.getPageSize());
|
|
return dto;
|
|
return dto;
|
|
}
|
|
}
|
|
|
|
+
|
|
}
|
|
}
|