Commit 842c1a15298f9d041709b7235407b95d3776000d

Authored by 王富生
1 parent 1de76112

app养护计划明细提交

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 10  
11 11 import java.time.LocalDate;
12 12 import java.util.List;
  13 +import java.util.Set;
13 14  
14 15 @Schema(description = "App管理 - 巡检计划汇总新增/修改 Request VO")
15 16 @Data
... ... @@ -24,13 +25,10 @@ public class AppInspectionPlanPageReqVO extends PageParam {
24 25 @Max(value = 3, message = "状态不能大于4")
25 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 30 @Hidden
33   - private List<Long> roleIds;
  31 + private Set<String> batchNos;
34 32  
35 33 @Schema(description = "业务线")
36 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 17 public class AppMaintainPlanDetailListByRoadPageReqVO extends PageParam {
18 18  
19 19  
20   - @Schema(description = "道路名称")
  20 + @Schema(description = "道路ID")
21 21 @NotNull
22 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 92 public List<AppInspectionPlanDetailRespVO> getInspectionPlanDetailForApp(AppInspectionPlanDetailReqVO pageReqVO) {
93 93 String busiLine = SecurityFrameworkUtils.getBusiLine();
94 94 Long companyId = SecurityFrameworkUtils.getCompanyId();
95   - Long deptId = SecurityFrameworkUtils.getDeptId();
96 95 if (StringUtils.isNotEmpty(busiLine)) {
97 96 pageReqVO.setBusiLineList(Arrays.asList(busiLine.split(",")));
98 97 }
99 98 pageReqVO.setCompanyId(companyId);
100   -
101 99 pageReqVO.setLocalDateTime(LocalDateTime.now());
102 100  
103 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 336 @Override
337 337 public PageResult<AppInspectionPlanRespVO> getInspectionPlanAppPage(AppInspectionPlanPageReqVO pageReqVO) {
338 338 String busiLine = SecurityFrameworkUtils.getBusiLine();
339   - Long companyId = SecurityFrameworkUtils.getCompanyId();
340 339 if (StringUtils.isNotEmpty(busiLine)) {
341 340 pageReqVO.setBusiLineList(Arrays.asList(busiLine.split(",")));
342 341 }
343   - pageReqVO.setCompanyId(companyId);
344 342  
345 343 /*1.查询登录用户角色*/
346   - List<Long> roleIds = roleApi.getRoleIdsByUserId(SecurityFrameworkUtils.getLoginUserId());
347   - pageReqVO.setRoleIds(roleIds);
  344 + Set<String> batchNos = getBatchNosByLoginUserId();
  345 + pageReqVO.setBatchNos(batchNos);
348 346 pageReqVO.setLocalDate(LocalDate.now());
349 347 /*2.分页*/
350 348 IPage<AppInspectionPlanRespVO> mpPage = MyBatisUtils.buildPage(pageReqVO);
... ... @@ -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 396 \ No newline at end of file
... ...
urbanops-module-garden/src/main/resources/mapper/inspectionplan/InspectionPlanMapper.xml
... ... @@ -24,20 +24,15 @@
24 24 a.begin_time,
25 25 a.end_time
26 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 29 <if test="req.roadName != null and req.roadName !=''">
35 30 AND a.road_name LIKE CONCAT('%',#{req.roadName},'%')
36 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 36 </foreach>
42 37 </if>
43 38 <if test="req.busiLineList != null and req.busiLineList.size() > 0">
... ... @@ -57,13 +52,5 @@
57 52 and a.finish_state = #{req.finishState}
58 53 <![CDATA[and a.end_time >= #{req.localDate}]]>
59 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 55 </select>
69 56 </mapper>
70 57 \ No newline at end of file
... ...