Browse Source

巡查自检-巡检计划-新增/修改弹窗的地点数据查询 调整

jichaobo 2 years ago
parent
commit
cada94f9cd

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionPlanController.java

@@ -102,7 +102,7 @@ public class PatrolInspectionPlanController {
      * @return
      */
     @GetMapping("patrolInspectionSiteVoList")
-    public ApiResult<List<PatrolInspectionSiteVo>> patrolInspectionSiteVoList(@RequestParam(value = "planId") Integer planId,
+    public ApiResult<List<PatrolInspectionSiteVo>> patrolInspectionSiteVoList(@RequestParam(value = "planId", required = false, defaultValue = "0") Integer planId,
                                                                               @RequestParam(value = "areaId") Integer areaId) {
         return ApiResult.success(patrolInspectionPlanService.patrolInspectionSiteVoList(planId, areaId));
     }

+ 12 - 9
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanServiceImpl.java

@@ -68,7 +68,7 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
     public List<PatrolInspectionAreaVo> planLeftList() {
         LoginUser loginUser = SecurityUtils.getLoginUser();
         String userType = null;
-        if (loginUser!=null&&!"".equals(loginUser)){
+        if (loginUser != null && !"".equals(loginUser)) {
             userType = loginUser.getUserType();
         }
         LambdaQueryWrapper<PatrolInspectionArea> queryWrapper = Wrappers.lambdaQuery();
@@ -512,7 +512,7 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
     public CommonPage<PatrolInspectionPlanDataVo> patrolInspectionPlanList(String planName, Integer planType, Integer areaId, Integer pageNum, Integer pageSize, Integer id) {
         LoginUser loginUser = SecurityUtils.getLoginUser();
         String userType = null;
-        if (loginUser!=null&&!"".equals(loginUser)){
+        if (loginUser != null && !"".equals(loginUser)) {
             userType = loginUser.getUserType();
         }
         LambdaQueryWrapper<PatrolInspectionPlan> queryWrapper = Wrappers.lambdaQuery();
@@ -540,7 +540,7 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
         queryWrapper.orderByDesc(PatrolInspectionPlan::getId);
         if (pageNum != null && pageNum != 0 && pageSize != null && pageSize != 0) {
             Integer startFate = OnlineMethod.getStartFate(pageNum, pageSize);
-            queryWrapper.last("limit " + startFate + ","+pageSize);
+            queryWrapper.last("limit " + startFate + "," + pageSize);
         }
         List<PatrolInspectionPlan> patrolInspectionPlanSonList = this.list(queryWrapper);
         List<PatrolInspectionPlanSchedule> planScheduleList = planScheduleService.list();
@@ -552,7 +552,7 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
             planScheduleVo.setPersonnelId(planScheduleList.get(i).getPersonnelId());
             planScheduleVo.setPlanId(planScheduleList.get(i).getPlanId());
             for (int j = 0; j < personnelList.size(); j++) {
-                if (planScheduleList.get(i).getPersonnelId()==personnelList.get(j).getId()){
+                if (planScheduleList.get(i).getPersonnelId() == personnelList.get(j).getId()) {
                     planScheduleVo.setPersonnelName(personnelList.get(j).getName());
                 }
             }
@@ -594,7 +594,7 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
                     }
                 }
                 patrolInspectionPlanDataVo.setChildrenList(list2);
-            }else  if (planType == 2){
+            } else if (planType == 2) {
                 for (int j = 0; j < list.size(); j++) {
                     if (patrolInspectionPlanSonList.get(i).getId() == list.get(j).getPlanId()) {
                         patrolInspectionPlanDataVo.setPersonneName(list.get(j).getPersonnelName());
@@ -614,7 +614,7 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
     public List<PatrolInspectionSiteVo> patrolInspectionSiteVoList(Integer planId, Integer areaId) {
         LoginUser loginUser = SecurityUtils.getLoginUser();
         String userType = null;
-        if (loginUser!=null&&!"".equals(loginUser)){
+        if (loginUser != null && !"".equals(loginUser)) {
             userType = loginUser.getUserType();
         }
         LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
@@ -625,9 +625,12 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
             queryWrapper.eq(PatrolInspectionSite::getCreator, SecurityUtils.getUsername());
         }
         List<PatrolInspectionSite> patrolInspectionSiteList = patrolInspectionSiteService.list();
-        LambdaQueryWrapper<PatrolInspectionPlanSite> queryWrapperOne = Wrappers.lambdaQuery();
-        queryWrapperOne.eq(PatrolInspectionPlanSite::getPlanId, planId);
-        List<PatrolInspectionPlanSite> planSiteList = planSiteService.list(queryWrapperOne);
+        List<PatrolInspectionPlanSite> planSiteList = new ArrayList<>();
+        if (planId != 0 && planId != null) {
+            LambdaQueryWrapper<PatrolInspectionPlanSite> queryWrapperOne = Wrappers.lambdaQuery();
+            queryWrapperOne.eq(PatrolInspectionPlanSite::getPlanId, planId);
+            planSiteList = planSiteService.list(queryWrapperOne);
+        }
         LambdaQueryWrapper<PatrolInspectionArea> queryWrapperTwo = Wrappers.lambdaQuery();
         queryWrapperTwo.eq(PatrolInspectionArea::getEnable, 1)
                 .eq(PatrolInspectionArea::getTenantId, SecurityUtils.getTenantId());