Commit 842c1a15298f9d041709b7235407b95d3776000d
1 parent
1de76112
app养护计划明细提交
Showing
5 changed files
with
32 additions
and
31 deletions
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/inspectionplan/vo/AppInspectionPlanPageReqVO.java
| @@ -10,6 +10,7 @@ import lombok.Data; | @@ -10,6 +10,7 @@ import lombok.Data; | ||
| 10 | 10 | ||
| 11 | import java.time.LocalDate; | 11 | import java.time.LocalDate; |
| 12 | import java.util.List; | 12 | import java.util.List; |
| 13 | +import java.util.Set; | ||
| 13 | 14 | ||
| 14 | @Schema(description = "App管理 - 巡检计划汇总新增/修改 Request VO") | 15 | @Schema(description = "App管理 - 巡检计划汇总新增/修改 Request VO") |
| 15 | @Data | 16 | @Data |
| @@ -24,13 +25,10 @@ public class AppInspectionPlanPageReqVO extends PageParam { | @@ -24,13 +25,10 @@ public class AppInspectionPlanPageReqVO extends PageParam { | ||
| 24 | @Max(value = 3, message = "状态不能大于4") | 25 | @Max(value = 3, message = "状态不能大于4") |
| 25 | private Integer finishState; | 26 | private Integer finishState; |
| 26 | 27 | ||
| 27 | - @Schema(description = "公司ID") | ||
| 28 | - @Hidden | ||
| 29 | - private Long companyId; | ||
| 30 | 28 | ||
| 31 | - @Schema(description = "角色IDS") | 29 | + @Schema(description = "批次号列表") |
| 32 | @Hidden | 30 | @Hidden |
| 33 | - private List<Long> roleIds; | 31 | + private Set<String> batchNos; |
| 34 | 32 | ||
| 35 | @Schema(description = "业务线") | 33 | @Schema(description = "业务线") |
| 36 | @Hidden | 34 | @Hidden |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/controller/app/maintainplan/vo/AppMaintainPlanDetailListByRoadPageReqVO.java
| @@ -17,7 +17,7 @@ import java.util.Set; | @@ -17,7 +17,7 @@ import java.util.Set; | ||
| 17 | public class AppMaintainPlanDetailListByRoadPageReqVO extends PageParam { | 17 | public class AppMaintainPlanDetailListByRoadPageReqVO extends PageParam { |
| 18 | 18 | ||
| 19 | 19 | ||
| 20 | - @Schema(description = "道路名称") | 20 | + @Schema(description = "道路ID") |
| 21 | @NotNull | 21 | @NotNull |
| 22 | private Long roadId; | 22 | private Long roadId; |
| 23 | 23 |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanDetailServiceImpl.java
| @@ -92,12 +92,10 @@ public class InspectionPlanDetailServiceImpl implements InspectionPlanDetailServ | @@ -92,12 +92,10 @@ public class InspectionPlanDetailServiceImpl implements InspectionPlanDetailServ | ||
| 92 | public List<AppInspectionPlanDetailRespVO> getInspectionPlanDetailForApp(AppInspectionPlanDetailReqVO pageReqVO) { | 92 | public List<AppInspectionPlanDetailRespVO> getInspectionPlanDetailForApp(AppInspectionPlanDetailReqVO pageReqVO) { |
| 93 | String busiLine = SecurityFrameworkUtils.getBusiLine(); | 93 | String busiLine = SecurityFrameworkUtils.getBusiLine(); |
| 94 | Long companyId = SecurityFrameworkUtils.getCompanyId(); | 94 | Long companyId = SecurityFrameworkUtils.getCompanyId(); |
| 95 | - Long deptId = SecurityFrameworkUtils.getDeptId(); | ||
| 96 | if (StringUtils.isNotEmpty(busiLine)) { | 95 | if (StringUtils.isNotEmpty(busiLine)) { |
| 97 | pageReqVO.setBusiLineList(Arrays.asList(busiLine.split(","))); | 96 | pageReqVO.setBusiLineList(Arrays.asList(busiLine.split(","))); |
| 98 | } | 97 | } |
| 99 | pageReqVO.setCompanyId(companyId); | 98 | pageReqVO.setCompanyId(companyId); |
| 100 | - | ||
| 101 | pageReqVO.setLocalDateTime(LocalDateTime.now()); | 99 | pageReqVO.setLocalDateTime(LocalDateTime.now()); |
| 102 | 100 | ||
| 103 | /*2.明细*/ | 101 | /*2.明细*/ |
urbanops-module-garden/src/main/java/com/zteits/urbanops/module/garden/service/inspectionplan/InspectionPlanServiceImpl.java
| @@ -336,15 +336,13 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | @@ -336,15 +336,13 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | ||
| 336 | @Override | 336 | @Override |
| 337 | public PageResult<AppInspectionPlanRespVO> getInspectionPlanAppPage(AppInspectionPlanPageReqVO pageReqVO) { | 337 | public PageResult<AppInspectionPlanRespVO> getInspectionPlanAppPage(AppInspectionPlanPageReqVO pageReqVO) { |
| 338 | String busiLine = SecurityFrameworkUtils.getBusiLine(); | 338 | String busiLine = SecurityFrameworkUtils.getBusiLine(); |
| 339 | - Long companyId = SecurityFrameworkUtils.getCompanyId(); | ||
| 340 | if (StringUtils.isNotEmpty(busiLine)) { | 339 | if (StringUtils.isNotEmpty(busiLine)) { |
| 341 | pageReqVO.setBusiLineList(Arrays.asList(busiLine.split(","))); | 340 | pageReqVO.setBusiLineList(Arrays.asList(busiLine.split(","))); |
| 342 | } | 341 | } |
| 343 | - pageReqVO.setCompanyId(companyId); | ||
| 344 | 342 | ||
| 345 | /*1.查询登录用户角色*/ | 343 | /*1.查询登录用户角色*/ |
| 346 | - List<Long> roleIds = roleApi.getRoleIdsByUserId(SecurityFrameworkUtils.getLoginUserId()); | ||
| 347 | - pageReqVO.setRoleIds(roleIds); | 344 | + Set<String> batchNos = getBatchNosByLoginUserId(); |
| 345 | + pageReqVO.setBatchNos(batchNos); | ||
| 348 | pageReqVO.setLocalDate(LocalDate.now()); | 346 | pageReqVO.setLocalDate(LocalDate.now()); |
| 349 | /*2.分页*/ | 347 | /*2.分页*/ |
| 350 | IPage<AppInspectionPlanRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO); | 348 | IPage<AppInspectionPlanRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO); |
| @@ -374,4 +372,24 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | @@ -374,4 +372,24 @@ public class InspectionPlanServiceImpl implements InspectionPlanService { | ||
| 374 | }); | 372 | }); |
| 375 | } | 373 | } |
| 376 | 374 | ||
| 375 | + /** | ||
| 376 | + * 获取登录用户批次号List | ||
| 377 | + */ | ||
| 378 | + private Set<String> getBatchNosByLoginUserId() { | ||
| 379 | + Long companyId = SecurityFrameworkUtils.getCompanyId(); | ||
| 380 | + Long deptId = SecurityFrameworkUtils.getDeptId(); | ||
| 381 | + /*1.查询登录用户角色*/ | ||
| 382 | + List<Long> roleIds = roleApi.getRoleIdsByUserId(SecurityFrameworkUtils.getLoginUserId()); | ||
| 383 | + QueryWrapper<InspectionPlanRoleDO> roleSql = new QueryWrapper<>(); | ||
| 384 | + roleSql.select("batch_no"); | ||
| 385 | + roleSql.lambda().in(InspectionPlanRoleDO::getRoleId, roleIds). | ||
| 386 | + eq(InspectionPlanRoleDO::getCompanyId, companyId) | ||
| 387 | + .eq(InspectionPlanRoleDO::getDeptId, deptId); | ||
| 388 | + List<InspectionPlanRoleDO> roleList = inspectionPlanRoleMapper.selectList(roleSql); | ||
| 389 | + if (CollectionUtils.isEmpty(roleList)) { | ||
| 390 | + return Collections.emptySet(); | ||
| 391 | + } | ||
| 392 | + return roleList.stream().map(InspectionPlanRoleDO::getBatchNo).collect(Collectors.toSet()); | ||
| 393 | + } | ||
| 394 | + | ||
| 377 | } | 395 | } |
| 378 | \ No newline at end of file | 396 | \ No newline at end of file |
urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanMapper.xml
| @@ -24,20 +24,15 @@ | @@ -24,20 +24,15 @@ | ||
| 24 | a.begin_time, | 24 | a.begin_time, |
| 25 | a.end_time | 25 | a.end_time |
| 26 | FROM | 26 | FROM |
| 27 | - garden_inspection_plan a, | ||
| 28 | - garden_inspection_plan_role b | ||
| 29 | - WHERE | ||
| 30 | - a.batch_no = b.batch_no | ||
| 31 | - AND a.dept_id =b.dept_id | ||
| 32 | - AND a.deleted=0 | ||
| 33 | - AND a.company_id = #{req.companyId} | 27 | + garden_inspection_plan a |
| 28 | + WHERE a.deleted=0 | ||
| 34 | <if test="req.roadName != null and req.roadName !=''"> | 29 | <if test="req.roadName != null and req.roadName !=''"> |
| 35 | AND a.road_name LIKE CONCAT('%',#{req.roadName},'%') | 30 | AND a.road_name LIKE CONCAT('%',#{req.roadName},'%') |
| 36 | </if> | 31 | </if> |
| 37 | - <if test="req.roleIds != null and req.roleIds.size() > 0"> | ||
| 38 | - AND b.role_id IN | ||
| 39 | - <foreach collection="req.roleIds" item="roleId" open="(" separator="," close=")"> | ||
| 40 | - #{roleId} | 32 | + <if test="req.batchNos != null and req.batchNos.size() > 0"> |
| 33 | + AND a.batch_no IN | ||
| 34 | + <foreach collection="req.batchNos" item="batchNo" open="(" separator="," close=")"> | ||
| 35 | + #{batchNo} | ||
| 41 | </foreach> | 36 | </foreach> |
| 42 | </if> | 37 | </if> |
| 43 | <if test="req.busiLineList != null and req.busiLineList.size() > 0"> | 38 | <if test="req.busiLineList != null and req.busiLineList.size() > 0"> |
| @@ -57,13 +52,5 @@ | @@ -57,13 +52,5 @@ | ||
| 57 | and a.finish_state = #{req.finishState} | 52 | and a.finish_state = #{req.finishState} |
| 58 | <![CDATA[and a.end_time >= #{req.localDate}]]> | 53 | <![CDATA[and a.end_time >= #{req.localDate}]]> |
| 59 | </if> | 54 | </if> |
| 60 | - GROUP BY | ||
| 61 | - a.batch_no, | ||
| 62 | - a.road_id, | ||
| 63 | - a.road_name, | ||
| 64 | - a.plan_type_id, | ||
| 65 | - a.level_id, | ||
| 66 | - a.begin_time, | ||
| 67 | - a.end_time | ||
| 68 | </select> | 55 | </select> |
| 69 | </mapper> | 56 | </mapper> |
| 70 | \ No newline at end of file | 57 | \ No newline at end of file |