|
@@ -0,0 +1,75 @@
|
|
|
+package com.dragoninfo.dcuc.authweb.restcontroller.selfauth.controller;
|
|
|
+
|
|
|
+import com.alibaba.fastjson.JSON;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthApplyDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.dto.AppFunAuthResultDTO;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.facade.IFunAuthResultFacade;
|
|
|
+import com.dragoninfo.dcuc.auth.auth.facade.ISelfAuthApplyFacade;
|
|
|
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.AppFunAuthApplyVo;
|
|
|
+import com.dragoninfo.dcuc.authweb.restcontroller.selfauth.vo.AppFunAuthResultVo;
|
|
|
+import com.dragoninfo.duceap.core.response.Result;
|
|
|
+import com.dragonsoft.duceap.base.entity.http.ResponseStatus;
|
|
|
+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.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import java.util.List;
|
|
|
+import java.util.stream.Collectors;
|
|
|
+
|
|
|
+
|
|
|
+
|
|
|
+ * @author mazq
|
|
|
+ * @date 2021/7/7
|
|
|
+ */
|
|
|
+@Api(tags = "权限自助申请接口")
|
|
|
+@RestController
|
|
|
+@RequestMapping(value = "/authsvr/v2/selfauth")
|
|
|
+public class SelfAuthAppLyController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ ISelfAuthApplyFacade selfAuthApplyFacade;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ IFunAuthResultFacade appFunResultFacade;
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "应用功能授权申请保存")
|
|
|
+ @PostMapping(value = "funApplySave")
|
|
|
+ public Result funApplySave(@RequestBody AppFunAuthApplyVo vo) {
|
|
|
+ AppFunAuthApplyDTO authApplyDTO = convertToAuthApplyDTO(vo);
|
|
|
+ ResponseStatus status = selfAuthApplyFacade.funApplySave(authApplyDTO);
|
|
|
+ if(status.getStatusCode().equals(ResponseStatus.SUCCESS_CODE)) {
|
|
|
+ return Result.success();
|
|
|
+ } else {
|
|
|
+ return Result.fail(status.getMessage());
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ private AppFunAuthApplyDTO convertToAuthApplyDTO(AppFunAuthApplyVo vo) {
|
|
|
+ String jsonString = JSON.toJSONString(vo);
|
|
|
+ return JSON.parseObject(jsonString, AppFunAuthApplyDTO.class);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+ @ApiOperation(value = "应用功能权限结果列表")
|
|
|
+ @ApiImplicitParam(name = "searchable", value = "searchable 查询条件")
|
|
|
+ @PostMapping(value = "funAuthList")
|
|
|
+ public Result<List<AppFunAuthResultVo>> funAuthList(Searchable searchable){
|
|
|
+ List<AppFunAuthResultDTO> authResultList = appFunResultFacade.findList(searchable.toSearchDTO());
|
|
|
+ List<AppFunAuthResultVo> resultVos = authResultList.stream().map(item -> {
|
|
|
+ AppFunAuthResultVo resultVo = new AppFunAuthResultVo();
|
|
|
+ BeanUtils.copyProperties(item, resultVo);
|
|
|
+ return resultVo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ return Result.success(resultVos);
|
|
|
+ }
|
|
|
+
|
|
|
+
|
|
|
+}
|