|
@@ -20,9 +20,7 @@ import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.domain.Page;
|
|
|
import org.springframework.web.bind.annotation.*;
|
|
|
|
|
|
-import java.util.Calendar;
|
|
|
-import java.util.Date;
|
|
|
-import java.util.List;
|
|
|
+import java.util.*;
|
|
|
import java.util.stream.Collectors;
|
|
|
|
|
|
|
|
@@ -64,11 +62,7 @@ public class SelfAuthAppLyController {
|
|
|
@GetMapping(value = "authApplyCancel")
|
|
|
public Result authApplyCancel(@RequestParam("applyOrdNo") String applyOrdNo) {
|
|
|
ResponseStatus status = selfAuthApplyFacade.authApplyCancel(applyOrdNo);
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
|
|
|
- return Result.fail(status.getStatusCode(), status.getMessage());
|
|
|
- } else {
|
|
|
- return Result.success();
|
|
|
- }
|
|
|
+ return dealResult(status);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "权限申请单删除")
|
|
@@ -76,24 +70,25 @@ public class SelfAuthAppLyController {
|
|
|
@DeleteMapping(value = "authApplyDelete")
|
|
|
public Result authApplyDelete(@RequestParam("applyOrdNo") String applyOrdNo) {
|
|
|
ResponseStatus status = selfAuthApplyFacade.authApplyDelete(applyOrdNo);
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
|
|
|
- return Result.fail(status.getStatusCode(), status.getMessage());
|
|
|
- } else {
|
|
|
- return Result.success();
|
|
|
- }
|
|
|
+ return dealResult(status);
|
|
|
}
|
|
|
|
|
|
|
|
|
@ApiOperation(value = "应用功能授权申请保存")
|
|
|
@PostMapping(value = "funApplySave")
|
|
|
public Result funApplySave(@RequestBody AppFunAuthApplyVo vo) {
|
|
|
- AppFunAuthApplyDTO authApplyDTO = convertToAuthApplyDTO(vo);
|
|
|
+ String jsonString = JSON.toJSONString(vo);
|
|
|
+ AppFunAuthApplyDTO authApplyDTO = JSON.parseObject(jsonString, AppFunAuthApplyDTO.class);
|
|
|
WorkFlowDTO workFlow = authApplyDTO.getWorkFlow();
|
|
|
workFlow.setApplySource(WorkFlowSourceEnum.SELF_AUTH_APPLY.getValue());
|
|
|
Date endTime = getEndTime(workFlow.getEndTime());
|
|
|
workFlow.setEndTime(endTime);
|
|
|
ResponseStatus status = selfAuthApplyFacade.funApplySave(authApplyDTO);
|
|
|
- if(!status.getStatusCode().equals(ResponseStatus.SUCCESS_CODE)) {
|
|
|
+ return dealResult(status);
|
|
|
+ }
|
|
|
+
|
|
|
+ private Result dealResult(ResponseStatus status) {
|
|
|
+ if (!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
|
|
|
return Result.fail(status.getStatusCode(), status.getMessage());
|
|
|
} else {
|
|
|
return Result.success();
|
|
@@ -112,11 +107,6 @@ public class SelfAuthAppLyController {
|
|
|
return null;
|
|
|
}
|
|
|
|
|
|
- private AppFunAuthApplyDTO convertToAuthApplyDTO(AppFunAuthApplyVo vo) {
|
|
|
- String jsonString = JSON.toJSONString(vo);
|
|
|
- return JSON.parseObject(jsonString, AppFunAuthApplyDTO.class);
|
|
|
- }
|
|
|
-
|
|
|
@ApiOperation(value = "应用功能权限申请详情")
|
|
|
@ApiImplicitParams({
|
|
|
@ApiImplicitParam(name = "applyOrdNo", value = "工作流审批单号"),
|
|
@@ -140,24 +130,44 @@ public class SelfAuthAppLyController {
|
|
|
BeanUtils.copyProperties(workFlow, workFlowVo);
|
|
|
detailVo.setWorkFlow(workFlowVo);
|
|
|
List<AppFunAuthResourceDTO> resourceInfos = detailDTO.getResourceInfos();
|
|
|
- List<AppFunAuthResourceVo> resourceVoList = resourceInfos.stream().map(item -> {
|
|
|
+ List<AppFunAuthResourceVo> resourceVoList = Optional.ofNullable(resourceInfos).orElse(new ArrayList<>()).stream().map(item -> {
|
|
|
AppFunAuthResourceVo resourceVo = new AppFunAuthResourceVo();
|
|
|
BeanUtils.copyProperties(item, resourceVo);
|
|
|
return resourceVo;
|
|
|
}).collect(Collectors.toList());
|
|
|
detailVo.setResourceInfos(resourceVoList);
|
|
|
+
|
|
|
+ List<AppFunAuthResourceDTO> delResourceInfos = detailDTO.getDelResourceInfos();
|
|
|
+ List<AppFunAuthResourceVo> delVoList = Optional.ofNullable(delResourceInfos).orElse(new ArrayList<>())
|
|
|
+ .stream().map(item -> {
|
|
|
+ AppFunAuthResourceVo resourceVo = new AppFunAuthResourceVo();
|
|
|
+ BeanUtils.copyProperties(item, resourceVo);
|
|
|
+ return resourceVo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ detailVo.setDelResourceInfos(delVoList);
|
|
|
+
|
|
|
+
|
|
|
+ List<AppFunAuthResourceDTO> existResourceInfos = detailDTO.getExistResourceInfos();
|
|
|
+ List<AppFunAuthResourceVo> existVoList = Optional.ofNullable(existResourceInfos).orElse(new ArrayList<>())
|
|
|
+ .stream().map(item -> {
|
|
|
+ AppFunAuthResourceVo resourceVo = new AppFunAuthResourceVo();
|
|
|
+ BeanUtils.copyProperties(item, resourceVo);
|
|
|
+ return resourceVo;
|
|
|
+ }).collect(Collectors.toList());
|
|
|
+ detailVo.setExistResourceInfos(existVoList);
|
|
|
+
|
|
|
return detailVo;
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "应用功能权限申请修改")
|
|
|
@PostMapping(value = "funApplyUpdate")
|
|
|
public Result funApplyUpdate(@RequestBody AppFunApplyUpdateVo vo){
|
|
|
- AppFunApplyUpdateDTO updateDTO = new AppFunApplyUpdateDTO();
|
|
|
- BeanUtils.copyProperties(vo, updateDTO);
|
|
|
+ String jsonString = JSON.toJSONString(vo);
|
|
|
+ AppFunApplyUpdateDTO updateDTO = JSON.parseObject(jsonString, AppFunApplyUpdateDTO.class);
|
|
|
Date endTime = getEndTime(updateDTO.getEndTime());
|
|
|
updateDTO.setEndTime(endTime);
|
|
|
- selfAuthApplyFacade.funApplyUpdate(updateDTO);
|
|
|
- return Result.success();
|
|
|
+ ResponseStatus status = selfAuthApplyFacade.funApplyUpdate(updateDTO);
|
|
|
+ return dealResult(status);
|
|
|
}
|
|
|
|
|
|
@ApiOperation(value = "应用功能权限结果列表")
|
|
@@ -251,20 +261,4 @@ public class SelfAuthAppLyController {
|
|
|
return Result.success(vo);
|
|
|
}
|
|
|
}
|
|
|
-
|
|
|
- @ApiOperation(value = "功能菜单权限重复申请校验")
|
|
|
- @PostMapping("funApplyRepeatCheck")
|
|
|
- public Result funAuthRepeatCheck(@RequestBody FunAuthRepeatCheckVo vo) {
|
|
|
- FunAuthRepeatCheckDTO dto = new FunAuthRepeatCheckDTO();
|
|
|
- BeanUtils.copyProperties(vo, dto);
|
|
|
- ResponseStatus status = selfAuthApplyFacade.funAuthRepeatCheck(dto);
|
|
|
- if(!ResponseStatus.SUCCESS_CODE.equals(status.getStatusCode())) {
|
|
|
- return Result.fail(status.getStatusCode(), status.getMessage());
|
|
|
- } else {
|
|
|
- return Result.success();
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
-
|
|
|
-
|
|
|
}
|