Commit dcbf3fe95376c629b377ec724ad9eed2d7d268ec
1 parent
612fc4ea
养护计划优化提交
Showing
3 changed files
with
31 additions
and
3 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/inspectionplan/InspectionPlanController.java
| ... | ... | @@ -5,6 +5,7 @@ import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 5 | 5 | import com.zteits.urbanops.framework.common.pojo.PageParam; |
| 6 | 6 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 7 | 7 | import com.zteits.urbanops.framework.common.util.object.BeanUtils; |
| 8 | +import com.zteits.urbanops.framework.datapermission.core.util.DataPermissionUtils; | |
| 8 | 9 | import com.zteits.urbanops.framework.excel.core.util.ExcelUtils; |
| 9 | 10 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| 10 | 11 | import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanPageReqVO; |
| ... | ... | @@ -13,6 +14,7 @@ import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.Insp |
| 13 | 14 | import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanUpdateReqVO; |
| 14 | 15 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO; |
| 15 | 16 | import com.zteits.urbanops.module.garden.service.inspectionplan.InspectionPlanService; |
| 17 | +import com.zteits.urbanops.module.system.api.permission.PermissionApi; | |
| 16 | 18 | import io.swagger.v3.oas.annotations.Operation; |
| 17 | 19 | import io.swagger.v3.oas.annotations.Parameter; |
| 18 | 20 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -43,6 +45,9 @@ public class InspectionPlanController { |
| 43 | 45 | @Resource |
| 44 | 46 | private InspectionPlanService inspectionPlanService; |
| 45 | 47 | |
| 48 | + @Resource | |
| 49 | + private PermissionApi permissionApi; | |
| 50 | + | |
| 46 | 51 | @PostMapping("/create") |
| 47 | 52 | @Operation(summary = "创建巡检计划汇总") |
| 48 | 53 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan:create')") |
| ... | ... | @@ -118,8 +123,13 @@ public class InspectionPlanController { |
| 118 | 123 | @Operation(summary = "获得巡检计划汇总分页") |
| 119 | 124 | @PreAuthorize("@ss.hasPermission('garden:inspection-plan:query')") |
| 120 | 125 | public CommonResult<PageResult<InspectionPlanRespVO>> getInspectionPlanPage(@Valid InspectionPlanPageReqVO pageReqVO) { |
| 126 | + Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); | |
| 121 | 127 | if(pageReqVO.getCompanyId() == null){ |
| 122 | - pageReqVO.setCompanyId(SecurityFrameworkUtils.getCompanyId()); | |
| 128 | + if(permissionApi.hasAnyRoles(loginUserId, "super_admin")){ | |
| 129 | + pageReqVO.setCompanyId( null); | |
| 130 | + }else{ | |
| 131 | + pageReqVO.setCompanyId(SecurityFrameworkUtils.getCompanyId()); | |
| 132 | + } | |
| 123 | 133 | } |
| 124 | 134 | PageResult<InspectionPlanRespVO> pageResult = inspectionPlanService.getInspectionPlanPage(pageReqVO); |
| 125 | 135 | return success(pageResult); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/maintainplan/MaintainPlanController.java
| ... | ... | @@ -13,6 +13,7 @@ import com.zteits.urbanops.module.garden.controller.admin.maintainplan.vo.Mainta |
| 13 | 13 | import com.zteits.urbanops.module.garden.controller.admin.maintainplan.vo.MaintainPlanUpdateReqVO; |
| 14 | 14 | import com.zteits.urbanops.module.garden.dal.dataobject.maintainplan.MaintainPlanDO; |
| 15 | 15 | import com.zteits.urbanops.module.garden.service.maintainplan.MaintainPlanService; |
| 16 | +import com.zteits.urbanops.module.system.api.permission.PermissionApi; | |
| 16 | 17 | import io.swagger.v3.oas.annotations.Operation; |
| 17 | 18 | import io.swagger.v3.oas.annotations.Parameter; |
| 18 | 19 | import io.swagger.v3.oas.annotations.tags.Tag; |
| ... | ... | @@ -43,6 +44,9 @@ public class MaintainPlanController { |
| 43 | 44 | @Resource |
| 44 | 45 | private MaintainPlanService maintainPlanService; |
| 45 | 46 | |
| 47 | + @Resource | |
| 48 | + private PermissionApi permissionApi; | |
| 49 | + | |
| 46 | 50 | @PostMapping("/create") |
| 47 | 51 | @Operation(summary = "创建养护计划汇总") |
| 48 | 52 | @PreAuthorize("@ss.hasPermission('garden:maintain-plan:create')") |
| ... | ... | @@ -119,7 +123,12 @@ public class MaintainPlanController { |
| 119 | 123 | @PreAuthorize("@ss.hasPermission('garden:maintain-plan:query')") |
| 120 | 124 | public CommonResult<PageResult<MaintainPlanRespVO>> getMaintainPlanPage(@Valid MaintainPlanPageReqVO pageReqVO) { |
| 121 | 125 | if(pageReqVO.getCompanyId() == null){ |
| 122 | - pageReqVO.setCompanyId(SecurityFrameworkUtils.getCompanyId()); | |
| 126 | + Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); | |
| 127 | + if(permissionApi.hasAnyRoles(loginUserId, "super_admin")){ | |
| 128 | + pageReqVO.setCompanyId( null); | |
| 129 | + }else{ | |
| 130 | + pageReqVO.setCompanyId(SecurityFrameworkUtils.getCompanyId()); | |
| 131 | + } | |
| 123 | 132 | } |
| 124 | 133 | PageResult<MaintainPlanRespVO> pageResult = maintainPlanService.getMaintainPlanPage(pageReqVO); |
| 125 | 134 | return success(pageResult); | ... | ... |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/admin/road/RoadController.java
| 1 | 1 | package com.zteits.urbanops.module.garden.controller.admin.road; |
| 2 | 2 | |
| 3 | 3 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| 4 | +import com.zteits.urbanops.module.system.api.permission.PermissionApi; | |
| 4 | 5 | import org.springframework.web.bind.annotation.*; |
| 5 | 6 | import jakarta.annotation.Resource; |
| 6 | 7 | import org.springframework.validation.annotation.Validated; |
| ... | ... | @@ -38,6 +39,9 @@ public class RoadController { |
| 38 | 39 | @Resource |
| 39 | 40 | private RoadService roadService; |
| 40 | 41 | |
| 42 | + @Resource | |
| 43 | + private PermissionApi permissionApi; | |
| 44 | + | |
| 41 | 45 | @PostMapping("/create") |
| 42 | 46 | @Operation(summary = "创建道路管理") |
| 43 | 47 | @PreAuthorize("@ss.hasPermission('garden:road:create')") |
| ... | ... | @@ -84,7 +88,12 @@ public class RoadController { |
| 84 | 88 | @PreAuthorize("@ss.hasPermission('garden:road:query')") |
| 85 | 89 | public CommonResult<PageResult<RoadRespVO>> getRoadPage(@Valid RoadPageReqVO pageReqVO) { |
| 86 | 90 | if(pageReqVO.getCompanyId() == null){ |
| 87 | - pageReqVO.setCompanyId(SecurityFrameworkUtils.getCompanyId()); | |
| 91 | + Long loginUserId = SecurityFrameworkUtils.getLoginUserId(); | |
| 92 | + if(permissionApi.hasAnyRoles(loginUserId, "super_admin")){ | |
| 93 | + pageReqVO.setCompanyId( null); | |
| 94 | + }else{ | |
| 95 | + pageReqVO.setCompanyId(SecurityFrameworkUtils.getCompanyId()); | |
| 96 | + } | |
| 88 | 97 | } |
| 89 | 98 | PageResult<RoadRespVO> pageResult = roadService.getRoadPage(pageReqVO); |
| 90 | 99 | return success(pageResult); | ... | ... |