Commit c48256dc3a61aae0adb0cb3df9158ce610b78a5a
1 parent
e86c4eda
app巡查汇总查询提交
Showing
12 changed files
with
304 additions
and
8 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/inspectionplan/AppInspectionPlanController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.app.inspectionplan; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.framework.common.pojo.CommonResult; | ||
| 4 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 5 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.InspectionPlanRespVO; | ||
| 6 | +import com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanPageReqVO; | ||
| 7 | +import com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanRespVO; | ||
| 8 | +import com.zteits.urbanops.module.garden.service.inspectionplan.InspectionPlanService; | ||
| 9 | +import io.swagger.v3.oas.annotations.Operation; | ||
| 10 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 11 | +import jakarta.annotation.Resource; | ||
| 12 | +import jakarta.validation.Valid; | ||
| 13 | +import lombok.extern.slf4j.Slf4j; | ||
| 14 | +import org.springframework.security.access.prepost.PreAuthorize; | ||
| 15 | +import org.springframework.validation.annotation.Validated; | ||
| 16 | +import org.springframework.web.bind.annotation.*; | ||
| 17 | +import static com.zteits.urbanops.framework.common.pojo.CommonResult.success; | ||
| 18 | + | ||
| 19 | +@Tag(name = "App管理 - 巡检计划汇总") | ||
| 20 | +@RestController | ||
| 21 | +@RequestMapping("/app/garden/inspection-plan") | ||
| 22 | +@Validated | ||
| 23 | +@Slf4j | ||
| 24 | +public class AppInspectionPlanController { | ||
| 25 | + | ||
| 26 | + @Resource | ||
| 27 | + private InspectionPlanService inspectionPlanService; | ||
| 28 | + | ||
| 29 | + | ||
| 30 | + @GetMapping("/page") | ||
| 31 | + @Operation(summary = "app-巡检计划汇总分页") | ||
| 32 | + @PreAuthorize("@ss.hasPermission('app:garden:inspection-plan:query')") | ||
| 33 | + public CommonResult<PageResult<AppInspectionPlanRespVO>> getInspectionPlanAppPage(@Valid AppInspectionPlanPageReqVO pageReqVO) { | ||
| 34 | + PageResult<AppInspectionPlanRespVO> pageResult = inspectionPlanService.getInspectionPlanAppPage(pageReqVO); | ||
| 35 | + return success(pageResult); | ||
| 36 | + } | ||
| 37 | + | ||
| 38 | +} | ||
| 0 | \ No newline at end of file | 39 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/inspectionplan/AppInspectionPlanDetailController.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.app.inspectionplan; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.module.garden.service.inspectionplan.InspectionPlanDetailService; | ||
| 4 | +import io.swagger.v3.oas.annotations.tags.Tag; | ||
| 5 | +import jakarta.annotation.Resource; | ||
| 6 | +import org.springframework.validation.annotation.Validated; | ||
| 7 | +import org.springframework.web.bind.annotation.RequestMapping; | ||
| 8 | +import org.springframework.web.bind.annotation.RestController; | ||
| 9 | + | ||
| 10 | + | ||
| 11 | +@Tag(name = "APP管理 - 巡检计划") | ||
| 12 | +@RestController | ||
| 13 | +@RequestMapping("/app/garden/inspection-plan-detail") | ||
| 14 | +@Validated | ||
| 15 | +public class AppInspectionPlanDetailController { | ||
| 16 | + | ||
| 17 | + @Resource | ||
| 18 | + private InspectionPlanDetailService inspectionPlanDetailService; | ||
| 19 | + | ||
| 20 | + | ||
| 21 | + | ||
| 22 | +} | ||
| 0 | \ No newline at end of file | 23 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/inspectionplan/vo/AppInspectionPlanPageReqVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo; | ||
| 2 | + | ||
| 3 | +import com.zteits.urbanops.framework.common.pojo.PageParam; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import jakarta.validation.constraints.Max; | ||
| 6 | +import jakarta.validation.constraints.Min; | ||
| 7 | +import jakarta.validation.constraints.NotNull; | ||
| 8 | +import lombok.Data; | ||
| 9 | + | ||
| 10 | +import java.time.LocalDate; | ||
| 11 | +import java.util.List; | ||
| 12 | + | ||
| 13 | +@Schema(description = "App管理 - 巡检计划汇总新增/修改 Request VO") | ||
| 14 | +@Data | ||
| 15 | +public class AppInspectionPlanPageReqVO extends PageParam { | ||
| 16 | + | ||
| 17 | + @Schema(description = "道路名称", example = "赵六") | ||
| 18 | + private String roadName; | ||
| 19 | + | ||
| 20 | + @Schema(description = "状态 1:未完成;3:已完成;4:已失效") | ||
| 21 | + @NotNull | ||
| 22 | + @Min(value = 1, message = "状态最小为1") | ||
| 23 | + @Max(value = 4, message = "状态不能大于4") | ||
| 24 | + private Integer finishState; | ||
| 25 | + | ||
| 26 | + @Schema(description = "公司ID") | ||
| 27 | + private Long companyId; | ||
| 28 | + | ||
| 29 | + @Schema(description = "角色IDS") | ||
| 30 | + private List<Long> roleIds; | ||
| 31 | + | ||
| 32 | + @Schema(description = "业务线") | ||
| 33 | + private List<String> busiLineList; | ||
| 34 | + | ||
| 35 | + @Schema(description = "系统时间") | ||
| 36 | + private LocalDate localDate; | ||
| 37 | +} |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/inspectionplan/vo/AppInspectionPlanRespVO.java
0 → 100644
| 1 | +package com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo; | ||
| 2 | + | ||
| 3 | +import cn.idev.excel.annotation.ExcelIgnoreUnannotated; | ||
| 4 | +import io.swagger.v3.oas.annotations.media.Schema; | ||
| 5 | +import lombok.Data; | ||
| 6 | +import org.springframework.format.annotation.DateTimeFormat; | ||
| 7 | + | ||
| 8 | +import java.time.LocalDateTime; | ||
| 9 | + | ||
| 10 | +import static com.zteits.urbanops.framework.common.util.date.DateUtils.FORMAT_YEAR_MONTH_DAY; | ||
| 11 | + | ||
| 12 | +@Schema(description = "App管理 - 巡检计划 Response VO") | ||
| 13 | +@Data | ||
| 14 | +@ExcelIgnoreUnannotated | ||
| 15 | +public class AppInspectionPlanRespVO { | ||
| 16 | + | ||
| 17 | + | ||
| 18 | + @Schema(description = "道路ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "32704") | ||
| 19 | + private Long roadId; | ||
| 20 | + | ||
| 21 | + @Schema(description = "道路名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "32704") | ||
| 22 | + private Long roadName; | ||
| 23 | + | ||
| 24 | + @Schema(description = "街道ID", requiredMode = Schema.RequiredMode.REQUIRED, example = "8439") | ||
| 25 | + private String streetId; | ||
| 26 | + | ||
| 27 | + @Schema(description = "街道名称", requiredMode = Schema.RequiredMode.REQUIRED, example = "芋艿") | ||
| 28 | + private String streetName; | ||
| 29 | + | ||
| 30 | + @Schema(description = "养护级别: 10:特级;11:一级:12:二级;13:三级", requiredMode = Schema.RequiredMode.REQUIRED, example = "8588") | ||
| 31 | + private Integer levelId; | ||
| 32 | + | ||
| 33 | + @Schema(description = "养护类型:2001:浇水;2002:施肥;2003:有害生物防治;2004:修剪;2005:中耕除草;2006:打孔梳草;2007:绿地保洁;2008:园林废弃物收集运输 ;2009:补植;3001:绿地巡视;", requiredMode = Schema.RequiredMode.REQUIRED, example = "24742") | ||
| 34 | + private Integer planTypeId; | ||
| 35 | + | ||
| 36 | + @Schema(description = "执行开始时间") | ||
| 37 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) | ||
| 38 | + private LocalDateTime beginTime; | ||
| 39 | + | ||
| 40 | + @Schema(description = "执行时间") | ||
| 41 | + @DateTimeFormat(pattern = FORMAT_YEAR_MONTH_DAY) | ||
| 42 | + private LocalDateTime endTime; | ||
| 43 | + | ||
| 44 | + @Schema(description = "完成状态 1:未完成;2:进行中;3:已完成", requiredMode = Schema.RequiredMode.REQUIRED) | ||
| 45 | + private Integer finishState; | ||
| 46 | + | ||
| 47 | +} |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/dal/mysql/inspectionplan/InspectionPlanMapper.java
| 1 | package com.zteits.urbanops.module.garden.dal.mysql.inspectionplan; | 1 | package com.zteits.urbanops.module.garden.dal.mysql.inspectionplan; |
| 2 | 2 | ||
| 3 | 3 | ||
| 4 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
| 4 | import com.zteits.urbanops.framework.common.pojo.PageResult; | 5 | import com.zteits.urbanops.framework.common.pojo.PageResult; |
| 5 | import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; | 6 | import com.zteits.urbanops.framework.mybatis.core.query.LambdaQueryWrapperX; |
| 6 | import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; | 7 | import com.zteits.urbanops.framework.mybatis.core.mapper.BaseMapperX; |
| 8 | +import com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanPageReqVO; | ||
| 9 | +import com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanRespVO; | ||
| 7 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO; | 10 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO; |
| 8 | import org.apache.ibatis.annotations.Mapper; | 11 | import org.apache.ibatis.annotations.Mapper; |
| 9 | import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; | 12 | import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; |
| @@ -33,4 +36,14 @@ public interface InspectionPlanMapper extends BaseMapperX<InspectionPlanDO> { | @@ -33,4 +36,14 @@ public interface InspectionPlanMapper extends BaseMapperX<InspectionPlanDO> { | ||
| 33 | 36 | ||
| 34 | int deleteByBatchNo(@Param("batchNo") String batchNo); | 37 | int deleteByBatchNo(@Param("batchNo") String batchNo); |
| 35 | 38 | ||
| 39 | + /** | ||
| 40 | + * 获取巡检计划列表-app | ||
| 41 | + * | ||
| 42 | + * @param page | ||
| 43 | + * @param req | ||
| 44 | + * @return 列表 | ||
| 45 | + */ | ||
| 46 | + IPage<AppInspectionPlanRespVO> getInspectionPlanAppPage(@Param("page") IPage<AppInspectionPlanRespVO> page, @Param("req") AppInspectionPlanPageReqVO req); | ||
| 47 | + | ||
| 48 | + | ||
| 36 | } | 49 | } |
| 37 | \ No newline at end of file | 50 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanService.java
| @@ -3,6 +3,8 @@ package com.zteits.urbanops.module.garden.service.inspectionplan; | @@ -3,6 +3,8 @@ package com.zteits.urbanops.module.garden.service.inspectionplan; | ||
| 3 | import java.util.*; | 3 | import java.util.*; |
| 4 | 4 | ||
| 5 | import com.zteits.urbanops.framework.common.pojo.CommonResult; | 5 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 6 | +import com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanPageReqVO; | ||
| 7 | +import com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanRespVO; | ||
| 6 | import jakarta.validation.*; | 8 | import jakarta.validation.*; |
| 7 | import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; | 9 | import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; |
| 8 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO; | 10 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO; |
| @@ -72,4 +74,11 @@ public interface InspectionPlanService { | @@ -72,4 +74,11 @@ public interface InspectionPlanService { | ||
| 72 | */ | 74 | */ |
| 73 | void stopPlanInspectionPlan(String batchNo); | 75 | void stopPlanInspectionPlan(String batchNo); |
| 74 | 76 | ||
| 77 | + /** | ||
| 78 | + * app-获取巡检计划列表 | ||
| 79 | + * @param pageReqVO 分页查询 | ||
| 80 | + * @return 巡检计划列表 | ||
| 81 | + */ | ||
| 82 | + PageResult<AppInspectionPlanRespVO> getInspectionPlanAppPage(AppInspectionPlanPageReqVO pageReqVO); | ||
| 83 | + | ||
| 75 | } | 84 | } |
| 76 | \ No newline at end of file | 85 | \ No newline at end of file |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
| @@ -3,14 +3,25 @@ package com.zteits.urbanops.module.garden.service.inspectionplan; | @@ -3,14 +3,25 @@ package com.zteits.urbanops.module.garden.service.inspectionplan; | ||
| 3 | import cn.hutool.core.thread.ThreadUtil; | 3 | import cn.hutool.core.thread.ThreadUtil; |
| 4 | import cn.hutool.core.util.RandomUtil; | 4 | import cn.hutool.core.util.RandomUtil; |
| 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; | 5 | import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper; |
| 6 | +import com.baomidou.mybatisplus.core.metadata.IPage; | ||
| 6 | import com.zteits.urbanops.framework.common.pojo.CommonResult; | 7 | import com.zteits.urbanops.framework.common.pojo.CommonResult; |
| 8 | +import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 9 | +import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 7 | import com.zteits.urbanops.framework.dict.core.DictFrameworkUtils; | 10 | import com.zteits.urbanops.framework.dict.core.DictFrameworkUtils; |
| 11 | +import com.zteits.urbanops.framework.mybatis.core.util.MyBatisUtils; | ||
| 8 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; | 12 | import com.zteits.urbanops.framework.security.core.util.SecurityFrameworkUtils; |
| 13 | +import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; | ||
| 14 | +import com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanPageReqVO; | ||
| 15 | +import com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanRespVO; | ||
| 16 | +import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO; | ||
| 9 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO; | 17 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDetailDO; |
| 10 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanRoleDO; | 18 | import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanRoleDO; |
| 19 | +import com.zteits.urbanops.module.garden.dal.dataobject.road.RoadDO; | ||
| 11 | import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanDetailMapper; | 20 | import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanDetailMapper; |
| 12 | import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanInterceptMapper; | 21 | import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanInterceptMapper; |
| 22 | +import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanMapper; | ||
| 13 | import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanRoleMapper; | 23 | import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanRoleMapper; |
| 24 | +import com.zteits.urbanops.module.garden.dal.mysql.road.RoadMapper; | ||
| 14 | import com.zteits.urbanops.module.garden.enums.FinishStateEnum; | 25 | import com.zteits.urbanops.module.garden.enums.FinishStateEnum; |
| 15 | import com.zteits.urbanops.module.garden.enums.PlanConstants; | 26 | import com.zteits.urbanops.module.garden.enums.PlanConstants; |
| 16 | import com.zteits.urbanops.module.garden.util.timeinterval.PeriodResult; | 27 | import com.zteits.urbanops.module.garden.util.timeinterval.PeriodResult; |
| @@ -19,10 +30,11 @@ import com.zteits.urbanops.module.system.api.dept.DeptApi; | @@ -19,10 +30,11 @@ import com.zteits.urbanops.module.system.api.dept.DeptApi; | ||
| 19 | import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; | 30 | import com.zteits.urbanops.module.system.api.dept.dto.DeptRespDTO; |
| 20 | import com.zteits.urbanops.module.system.api.permission.RoleApi; | 31 | import com.zteits.urbanops.module.system.api.permission.RoleApi; |
| 21 | import com.zteits.urbanops.module.system.dal.dataobject.permission.RoleDO; | 32 | import com.zteits.urbanops.module.system.dal.dataobject.permission.RoleDO; |
| 33 | +import jakarta.annotation.Resource; | ||
| 22 | import jodd.util.StringUtil; | 34 | import jodd.util.StringUtil; |
| 23 | import lombok.extern.slf4j.Slf4j; | 35 | import lombok.extern.slf4j.Slf4j; |
| 36 | +import org.apache.commons.lang3.StringUtils; | ||
| 24 | import org.springframework.stereotype.Service; | 37 | import org.springframework.stereotype.Service; |
| 25 | -import jakarta.annotation.Resource; | ||
| 26 | import org.springframework.transaction.annotation.Transactional; | 38 | import org.springframework.transaction.annotation.Transactional; |
| 27 | import org.springframework.util.CollectionUtils; | 39 | import org.springframework.util.CollectionUtils; |
| 28 | import org.springframework.validation.annotation.Validated; | 40 | import org.springframework.validation.annotation.Validated; |
| @@ -32,13 +44,6 @@ import java.time.format.DateTimeFormatter; | @@ -32,13 +44,6 @@ import java.time.format.DateTimeFormatter; | ||
| 32 | import java.util.*; | 44 | import java.util.*; |
| 33 | import java.util.stream.Collectors; | 45 | import java.util.stream.Collectors; |
| 34 | 46 | ||
| 35 | -import com.zteits.urbanops.module.garden.controller.admin.inspectionplan.vo.*; | ||
| 36 | -import com.zteits.urbanops.module.garden.dal.dataobject.inspectionplan.InspectionPlanDO; | ||
| 37 | -import com.zteits.urbanops.framework.common.pojo.PageResult; | ||
| 38 | -import com.zteits.urbanops.framework.common.util.object.BeanUtils; | ||
| 39 | - | ||
| 40 | -import com.zteits.urbanops.module.garden.dal.mysql.inspectionplan.InspectionPlanMapper; | ||
| 41 | - | ||
| 42 | import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; | 47 | import static com.zteits.urbanops.framework.common.exception.util.ServiceExceptionUtil.exception; |
| 43 | import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.*; | 48 | import static com.zteits.urbanops.module.garden.enums.ErrorCodeConstants.*; |
| 44 | 49 | ||
| @@ -65,11 +70,18 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | @@ -65,11 +70,18 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | ||
| 65 | private InspectionPlanRoleMapper inspectionPlanRoleMapper; | 70 | private InspectionPlanRoleMapper inspectionPlanRoleMapper; |
| 66 | 71 | ||
| 67 | @Resource | 72 | @Resource |
| 73 | + private RoadMapper roadMapper; | ||
| 74 | + | ||
| 75 | + | ||
| 76 | + @Resource | ||
| 68 | private DeptApi deptApi; | 77 | private DeptApi deptApi; |
| 69 | 78 | ||
| 70 | @Resource | 79 | @Resource |
| 71 | private RoleApi roleApi; | 80 | private RoleApi roleApi; |
| 72 | 81 | ||
| 82 | + @Resource | ||
| 83 | + private RoleApi poleApi; | ||
| 84 | + | ||
| 73 | @Transactional(rollbackFor = Exception.class) | 85 | @Transactional(rollbackFor = Exception.class) |
| 74 | @Override | 86 | @Override |
| 75 | public CommonResult<Integer> createInspectionPlan(InspectionPlanSaveReqVO createReqVO) { | 87 | public CommonResult<Integer> createInspectionPlan(InspectionPlanSaveReqVO createReqVO) { |
| @@ -310,4 +322,44 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | @@ -310,4 +322,44 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | ||
| 310 | inspectionPlanRoleMapper.delete(InspectionPlanRoleDO::getBatchNo, batchNo); | 322 | inspectionPlanRoleMapper.delete(InspectionPlanRoleDO::getBatchNo, batchNo); |
| 311 | } | 323 | } |
| 312 | 324 | ||
| 325 | + @Override | ||
| 326 | + public PageResult<AppInspectionPlanRespVO> getInspectionPlanAppPage(AppInspectionPlanPageReqVO pageReqVO) { | ||
| 327 | + String busiLine = SecurityFrameworkUtils.getBusiLine(); | ||
| 328 | + Long companyId = SecurityFrameworkUtils.getCompanyId(); | ||
| 329 | + if (StringUtils.isNotEmpty(busiLine)) { | ||
| 330 | + pageReqVO.setBusiLineList(Arrays.asList(busiLine.split(","))); | ||
| 331 | + } | ||
| 332 | + pageReqVO.setCompanyId(companyId); | ||
| 333 | + | ||
| 334 | + /*1.查询登录用户角色*/ | ||
| 335 | + List<Long> roleIds = poleApi.getRoleIdsByUserId(SecurityFrameworkUtils.getLoginUserId()); | ||
| 336 | + pageReqVO.setRoleIds(roleIds); | ||
| 337 | + /*2.分页*/ | ||
| 338 | + IPage<AppInspectionPlanRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO); | ||
| 339 | + IPage<AppInspectionPlanRespVO> page = inspectionPlanMapper.getInspectionPlanAppPage(mpPage, pageReqVO); | ||
| 340 | + addStreetInfo(page.getRecords()); | ||
| 341 | + // 转换返回 | ||
| 342 | + return new PageResult<>(page.getRecords(), page.getTotal()); | ||
| 343 | + } | ||
| 344 | + | ||
| 345 | + private void addStreetInfo(List<AppInspectionPlanRespVO> list){ | ||
| 346 | + if(CollectionUtils.isEmpty(list)){ | ||
| 347 | + return ; | ||
| 348 | + } | ||
| 349 | + Set<Long> roadIds = list.stream().map(AppInspectionPlanRespVO::getRoadId).collect(Collectors.toSet()); | ||
| 350 | + | ||
| 351 | + | ||
| 352 | + List<RoadDO> roadList = roadMapper.selectList(new QueryWrapper<RoadDO>().lambda().in(RoadDO::getId, roadIds)); | ||
| 353 | + //list转map | ||
| 354 | + Map<Long, RoadDO> roadMap = roadList.stream().collect(Collectors.toMap(RoadDO::getId, road -> road)); | ||
| 355 | + | ||
| 356 | + list.forEach(plan -> { | ||
| 357 | + RoadDO road = roadMap.get(plan.getRoadId()); | ||
| 358 | + if(road != null){ | ||
| 359 | + plan.setStreetId(road.getStreetId()); | ||
| 360 | + plan.setStreetName(road.getStreetName()); | ||
| 361 | + } | ||
| 362 | + }); | ||
| 363 | + } | ||
| 364 | + | ||
| 313 | } | 365 | } |
| 314 | \ No newline at end of file | 366 | \ No newline at end of file |
urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanMapper.xml
| @@ -13,4 +13,48 @@ | @@ -13,4 +13,48 @@ | ||
| 13 | delete from garden_inspection_plan where batch_no =#{batchNo} | 13 | delete from garden_inspection_plan where batch_no =#{batchNo} |
| 14 | </delete> | 14 | </delete> |
| 15 | 15 | ||
| 16 | + <select id="getInspectionPlanAppPage" resultType="com.zteits.urbanops.module.garden.controller.app.inspectionplan.vo.AppInspectionPlanRespVO"> | ||
| 17 | + SELECT | ||
| 18 | + a.road_id, | ||
| 19 | + a.road_name, | ||
| 20 | + a.plan_type_id, | ||
| 21 | + a.level_id, | ||
| 22 | + a.begin_time, | ||
| 23 | + a.end_time | ||
| 24 | + FROM | ||
| 25 | + garden_inspection_plan a, | ||
| 26 | + garden_inspection_plan_role b | ||
| 27 | + WHERE | ||
| 28 | + a.batch_no = b.batch_no | ||
| 29 | + AND a.company_id = #{req.companyId} | ||
| 30 | + <if test="req.roadName != null and req.roadName !=''"> | ||
| 31 | + AND a.road_name LIKE CONCAT('%',#{req.roadName},'%') | ||
| 32 | + </if> | ||
| 33 | + <if test="req.roleIds != null and req.roleIds.size() > 0"> | ||
| 34 | + AND b.role_id IN | ||
| 35 | + <foreach collection="req.roleIds" item="roleId" open="(" separator="," close=")"> | ||
| 36 | + #{roleId} | ||
| 37 | + </foreach> | ||
| 38 | + </if> | ||
| 39 | + <if test="req.busiLineList != null and req.busiLineList.size() > 0"> | ||
| 40 | + AND a.busi_line IN | ||
| 41 | + <foreach collection="req.busiLineList" item="busiLine" open="(" separator="," close=")"> | ||
| 42 | + #{busiLine} | ||
| 43 | + </foreach> | ||
| 44 | + </if> | ||
| 45 | + <!--状态 1:未完成;3:已完成;4:已失效--> | ||
| 46 | + <if test="req.finishState == 4"> | ||
| 47 | + <![CDATA[and a.end_time < #{req.localDate}]]> | ||
| 48 | + </if> | ||
| 49 | + <if test="req.finishState == 3 or req.finishState == 1"> | ||
| 50 | + and a.finish_state = #{req.finishState} | ||
| 51 | + </if> | ||
| 52 | + GROUP BY | ||
| 53 | + a.road_id, | ||
| 54 | + a.road_name, | ||
| 55 | + a.plan_type_id, | ||
| 56 | + a.level_id, | ||
| 57 | + a.begin_time, | ||
| 58 | + a.end_time | ||
| 59 | + </select> | ||
| 16 | </mapper> | 60 | </mapper> |
| 17 | \ No newline at end of file | 61 | \ No newline at end of file |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/api/permission/RoleApi.java
| @@ -36,4 +36,12 @@ public interface RoleApi { | @@ -36,4 +36,12 @@ public interface RoleApi { | ||
| 36 | * @return | 36 | * @return |
| 37 | */ | 37 | */ |
| 38 | List<RoleRespVO> getRoleListByBusiLine(String busiLine); | 38 | List<RoleRespVO> getRoleListByBusiLine(String busiLine); |
| 39 | + | ||
| 40 | + /** | ||
| 41 | + * 通过用户编号,获得角色ID列表 | ||
| 42 | + * | ||
| 43 | + * @param userId 用户编号 | ||
| 44 | + * @return 角色ID列表 | ||
| 45 | + */ | ||
| 46 | + List<Long> getRoleIdsByUserId(Long userId); | ||
| 39 | } | 47 | } |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/api/permission/RoleApiImpl.java
| @@ -34,4 +34,9 @@ public class RoleApiImpl implements RoleApi { | @@ -34,4 +34,9 @@ public class RoleApiImpl implements RoleApi { | ||
| 34 | public List<RoleRespVO> getRoleListByBusiLine(String busiLine) { | 34 | public List<RoleRespVO> getRoleListByBusiLine(String busiLine) { |
| 35 | return roleService.getRoleListByBusiLine(busiLine); | 35 | return roleService.getRoleListByBusiLine(busiLine); |
| 36 | } | 36 | } |
| 37 | + | ||
| 38 | + @Override | ||
| 39 | + public List<Long> getRoleIdsByUserId(Long userId) { | ||
| 40 | + return roleService.getRoleIdsByUserId(userId); | ||
| 41 | + } | ||
| 37 | } | 42 | } |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/permission/RoleService.java
| @@ -135,4 +135,9 @@ public interface RoleService { | @@ -135,4 +135,9 @@ public interface RoleService { | ||
| 135 | * @return | 135 | * @return |
| 136 | */ | 136 | */ |
| 137 | List<RoleRespVO> getRoleListByBusiLine(String busiLine); | 137 | List<RoleRespVO> getRoleListByBusiLine(String busiLine); |
| 138 | + | ||
| 139 | + /** | ||
| 140 | + * 通过用户编号,获得角色列表 | ||
| 141 | + */ | ||
| 142 | + List<Long> getRoleIdsByUserId(Long userId); | ||
| 138 | } | 143 | } |
urbanops-module-system/src/main/java/com/zteits/urbanops/module/system/service/permission/RoleServiceImpl.java
| @@ -14,7 +14,9 @@ import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.Rol | @@ -14,7 +14,9 @@ import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.Rol | ||
| 14 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleRespVO; | 14 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleRespVO; |
| 15 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleSaveReqVO; | 15 | import com.zteits.urbanops.module.system.controller.admin.permission.vo.role.RoleSaveReqVO; |
| 16 | import com.zteits.urbanops.module.system.dal.dataobject.permission.RoleDO; | 16 | import com.zteits.urbanops.module.system.dal.dataobject.permission.RoleDO; |
| 17 | +import com.zteits.urbanops.module.system.dal.dataobject.permission.UserRoleDO; | ||
| 17 | import com.zteits.urbanops.module.system.dal.mysql.permission.RoleMapper; | 18 | import com.zteits.urbanops.module.system.dal.mysql.permission.RoleMapper; |
| 19 | +import com.zteits.urbanops.module.system.dal.mysql.permission.UserRoleMapper; | ||
| 18 | import com.zteits.urbanops.module.system.dal.redis.RedisKeyConstants; | 20 | import com.zteits.urbanops.module.system.dal.redis.RedisKeyConstants; |
| 19 | import com.zteits.urbanops.module.system.enums.permission.DataScopeEnum; | 21 | import com.zteits.urbanops.module.system.enums.permission.DataScopeEnum; |
| 20 | import com.zteits.urbanops.module.system.enums.permission.RoleCodeEnum; | 22 | import com.zteits.urbanops.module.system.enums.permission.RoleCodeEnum; |
| @@ -53,6 +55,9 @@ public class RoleServiceImpl implements RoleService { | @@ -53,6 +55,9 @@ public class RoleServiceImpl implements RoleService { | ||
| 53 | @Resource | 55 | @Resource |
| 54 | private RoleMapper roleMapper; | 56 | private RoleMapper roleMapper; |
| 55 | 57 | ||
| 58 | + @Resource | ||
| 59 | + private UserRoleMapper userRoleMapper; | ||
| 60 | + | ||
| 56 | @Override | 61 | @Override |
| 57 | @Transactional(rollbackFor = Exception.class) | 62 | @Transactional(rollbackFor = Exception.class) |
| 58 | @LogRecord(type = SYSTEM_ROLE_TYPE, subType = SYSTEM_ROLE_CREATE_SUB_TYPE, bizNo = "{{#role.id}}", | 63 | @LogRecord(type = SYSTEM_ROLE_TYPE, subType = SYSTEM_ROLE_CREATE_SUB_TYPE, bizNo = "{{#role.id}}", |
| @@ -272,6 +277,17 @@ public class RoleServiceImpl implements RoleService { | @@ -272,6 +277,17 @@ public class RoleServiceImpl implements RoleService { | ||
| 272 | return BeanUtils.toBean(roleDOS, RoleRespVO.class); | 277 | return BeanUtils.toBean(roleDOS, RoleRespVO.class); |
| 273 | } | 278 | } |
| 274 | 279 | ||
| 280 | + @Override | ||
| 281 | + public List<Long> getRoleIdsByUserId(Long userId) { | ||
| 282 | + QueryWrapper<UserRoleDO> sql = new QueryWrapper<>(); | ||
| 283 | + sql.select("role_id"); | ||
| 284 | + List<UserRoleDO> list = userRoleMapper.selectList(sql.lambda().eq(UserRoleDO::getUserId, userId)); | ||
| 285 | + if (CollectionUtil.isEmpty(list)) { | ||
| 286 | + return Collections.emptyList(); | ||
| 287 | + } | ||
| 288 | + return list.stream().map(UserRoleDO::getRoleId).toList(); | ||
| 289 | + } | ||
| 290 | + | ||
| 275 | /** | 291 | /** |
| 276 | * 获得自身的代理对象,解决 AOP 生效问题 | 292 | * 获得自身的代理对象,解决 AOP 生效问题 |
| 277 | * | 293 | * |