|
@@ -0,0 +1,92 @@
|
|
|
+package com.dragoninfo.dcuc.authweb.restcontroller.list.controller;
|
|
|
+
|
|
|
+import com.dragoninfo.dcuc.authweb.restcontroller.list.vo.AppFunRedListAddVo;
|
|
|
+import com.dragoninfo.dcuc.authweb.restcontroller.list.vo.FunRedListTreeVo;
|
|
|
+import com.dragoninfo.dcuc.authweb.restcontroller.list.vo.RedListOperateVo;
|
|
|
+import com.dragoninfo.dcuc.list.dto.redwhitelist.AppFunRedListAddDTO;
|
|
|
+import com.dragoninfo.dcuc.list.dto.redwhitelist.FunRedListTreeDTO;
|
|
|
+import com.dragoninfo.dcuc.list.dto.redwhitelist.RedListOperateDTO;
|
|
|
+import com.dragoninfo.dcuc.list.facade.IRedListFacade;
|
|
|
+import com.dragoninfo.duceap.core.response.Result;
|
|
|
+import com.dragonsoft.duceap.commons.util.collections.CollectionUtils;
|
|
|
+import com.dragonsoft.duceap.core.search.Searchable;
|
|
|
+import io.swagger.annotations.Api;
|
|
|
+import io.swagger.annotations.ApiImplicitParam;
|
|
|
+import io.swagger.annotations.ApiOperation;
|
|
|
+import org.springframework.beans.BeanUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.data.domain.Page;
|
|
|
+import org.springframework.web.bind.annotation.*;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+/**
|
|
|
+ * @author mazq
|
|
|
+ * @date 2021/7/12
|
|
|
+ */
|
|
|
+@Api(tags = "权限红名单接口")
|
|
|
+@RestController
|
|
|
+@RequestMapping(value = "/authsvr/v2/redlist")
|
|
|
+public class RedListController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ IRedListFacade redListFacade;
|
|
|
+
|
|
|
+ @ApiOperation(value = "功能红名单列表查询")
|
|
|
+ @ApiImplicitParam(name = "searchable", value = "查询条件 level:= ; appName:like ; appCode:like")
|
|
|
+ @PostMapping(value = "funRedListPage")
|
|
|
+ public Result<List<FunRedListTreeVo>> funRedListPage(Searchable searchable) {
|
|
|
+ Page<FunRedListTreeDTO> treeDTOPage = redListFacade.funRedListPage(searchable.toSearchDTO());
|
|
|
+ List<FunRedListTreeDTO> content = treeDTOPage.getContent();
|
|
|
+ List<FunRedListTreeVo> collect = content.stream().map(item -> {
|
|
|
+ FunRedListTreeVo vo = new FunRedListTreeVo();
|
|
|
+ BeanUtils.copyProperties(item, vo);
|
|
|
+ return vo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return Result.success(treeDTOPage.getTotalElements(), collect);
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "功能红名单添加")
|
|
|
+ @PostMapping("userWhiteListAdd")
|
|
|
+ public Result userWhiteListAdd(@RequestBody List<AppFunRedListAddVo> addVoList) {
|
|
|
+ if(CollectionUtils.isEmpty(addVoList)) {
|
|
|
+ return Result.fail();
|
|
|
+ }
|
|
|
+ List<AppFunRedListAddDTO> collect = addVoList.stream().map(item -> {
|
|
|
+ AppFunRedListAddDTO addDTO = new AppFunRedListAddDTO();
|
|
|
+ BeanUtils.copyProperties(item, addDTO);
|
|
|
+ return addDTO;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ redListFacade.funRedListAdd(collect);
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "红名单批量修改等级")
|
|
|
+ @PostMapping("redListUpdateLevel")
|
|
|
+ public Result redListUpdateLevel(@RequestBody RedListOperateVo vo) {
|
|
|
+ RedListOperateDTO dto = new RedListOperateDTO();
|
|
|
+ BeanUtils.copyProperties(vo, dto);
|
|
|
+ redListFacade.funRedListUpdateLevel(dto);
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "应用功能红名单批量移除")
|
|
|
+ @PostMapping("funRedListBatchDel")
|
|
|
+ public Result funRedListBatchDel(@RequestBody RedListOperateVo vo) {
|
|
|
+ RedListOperateDTO dto = new RedListOperateDTO();
|
|
|
+ BeanUtils.copyProperties(vo, dto);
|
|
|
+ redListFacade.funRedListBatchDel(dto);
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+ @ApiOperation(value = "应用功能红名单单条记录移除")
|
|
|
+ @DeleteMapping(value = "funRedListDel")
|
|
|
+ public Result funRedListDel(@RequestParam("resourceType") String resourceType,
|
|
|
+ @RequestParam("resourceId") String resourceId,
|
|
|
+ @RequestParam("isTreeNode") Boolean isTreeNode) {
|
|
|
+ redListFacade.funRedListDel(resourceType, resourceId, isTreeNode);
|
|
|
+ return Result.success();
|
|
|
+ }
|
|
|
+
|
|
|
+}
|