Browse Source

巡检人员相关接口查询调整

jichaobo 2 years ago
parent
commit
cc808e1eaa

+ 4 - 3
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionAreaController.java

@@ -77,13 +77,14 @@ public class PatrolInspectionAreaController {
     }
 
     /**
-     * 巡查自检-巡检区域-一级区域下拉框
+     * 巡查自检-巡检区域-一级区域下拉框/巡检人员-二级区域查询
      *
+     * @param areaFid 区域父ID
      * @return
      */
     @GetMapping("patrolInspectionAreaSelect")
-    public ApiResult<List<PatrolInspectionArea>> patrolInspectionAreaSelect() {
-        return ApiResult.success(patrolInspectionAreaService.patrolInspectionAreaSelect());
+    public ApiResult<List<PatrolInspectionArea>> patrolInspectionAreaSelect(@RequestParam(value = "areaFid", required = false, defaultValue = "0") Integer areaFid) {
+        return ApiResult.success(patrolInspectionAreaService.patrolInspectionAreaSelect(areaFid));
     }
 
 

+ 18 - 4
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/PatrolInspectionPersonnelController.java

@@ -27,6 +27,7 @@ public class PatrolInspectionPersonnelController {
 
     /**
      * 巡查自检-巡检人员-新增
+     *
      * @param patrolInspectionPersonnel
      * @return
      */
@@ -38,6 +39,7 @@ public class PatrolInspectionPersonnelController {
 
     /**
      * 巡查自检-巡检人员-修改
+     *
      * @param patrolInspectionPersonnel
      * @return
      */
@@ -49,6 +51,7 @@ public class PatrolInspectionPersonnelController {
 
     /**
      * 巡查自检-巡检人员-删除
+     *
      * @param id 人员记录表ID
      * @return
      */
@@ -60,10 +63,11 @@ public class PatrolInspectionPersonnelController {
 
     /**
      * 巡查自检-巡检人员-列表查询
-     * @param areaId 区域ID
-     * @param pageNum 当前页
+     *
+     * @param areaId   区域ID
+     * @param pageNum  当前页
      * @param pageSize 每页条数
-     * @param id 人员记录表ID
+     * @param id       人员记录表ID
      * @return
      */
     @GetMapping("patrolInspectionPersonnelList")
@@ -71,11 +75,12 @@ public class PatrolInspectionPersonnelController {
                                                                                             @RequestParam(value = "pageNum", required = false, defaultValue = "1") Integer pageNum,
                                                                                             @RequestParam(value = "pageSize", required = false, defaultValue = "10") Integer pageSize,
                                                                                             @RequestParam(value = "id", required = false, defaultValue = "0") Integer id) {
-        return ApiResult.success(patrolInspectionPersonnelService.patrolInspectionPersonnelList(areaId,pageNum, pageSize, id));
+        return ApiResult.success(patrolInspectionPersonnelService.patrolInspectionPersonnelList(areaId, pageNum, pageSize, id));
     }
 
     /**
      * 巡查自检-巡检人员-左侧树形数据
+     *
      * @return
      */
     @GetMapping("personnelLeftList")
@@ -83,5 +88,14 @@ public class PatrolInspectionPersonnelController {
         return ApiResult.success(patrolInspectionPersonnelService.personnelLeftList());
     }
 
+    /**
+     * 巡查自检-巡检计划-责任人下拉
+     * @param areaId 区域ID
+     * @return
+     */
+    @GetMapping("patrolInspectionPersonnelSelect")
+    public ApiResult<List<PatrolInspectionPersonnelVo>> patrolInspectionPersonnelSelect(@RequestParam(value = "areaId", required = false) Integer areaId) {
+        return ApiResult.success(patrolInspectionPersonnelService.patrolInspectionPersonnelSelect(areaId));
+    }
 }
 

+ 1 - 1
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionAreaService.java

@@ -25,5 +25,5 @@ public interface PatrolInspectionAreaService extends CrudService<PatrolInspectio
 
     List<PatrolInspectionArea> patrolInspectionAreaList(Integer id, String areaName, Integer pageNum, Integer pageSize);
 
-    List<PatrolInspectionArea> patrolInspectionAreaSelect();
+    List<PatrolInspectionArea> patrolInspectionAreaSelect(Integer areaFid);
 }

+ 2 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/PatrolInspectionPersonnelService.java

@@ -26,6 +26,8 @@ public interface PatrolInspectionPersonnelService extends CrudService<PatrolInsp
 
     CommonPage<PatrolInspectionPersonnelVo> patrolInspectionPersonnelList(Integer areaId,Integer pageNum, Integer pageSize,Integer id);
 
+    List<PatrolInspectionPersonnelVo> patrolInspectionPersonnelSelect(Integer areaId);
+
     List<PatrolInspectionAreaVo> personnelLeftList();
 
 }

+ 2 - 4
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionAreaServiceImpl.java

@@ -129,7 +129,7 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
      *
      * @return
      */
-    public List<PatrolInspectionArea> patrolInspectionAreaSelect() {
+    public List<PatrolInspectionArea> patrolInspectionAreaSelect(Integer areaFid) {
         LoginUser loginUser = SecurityUtils.getLoginUser();
         String userType = null;
         if (loginUser!=null&&!"".equals(loginUser)){
@@ -138,13 +138,11 @@ public class PatrolInspectionAreaServiceImpl extends AbstractCrudService<PatrolI
         LambdaQueryWrapper<PatrolInspectionArea> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(PatrolInspectionArea::getTenantId, SecurityUtils.getTenantId())
                 .eq(PatrolInspectionArea::getEnable, 1)
-                .eq(PatrolInspectionArea::getAreaFid, 0);
+                .eq(PatrolInspectionArea::getAreaFid, areaFid);
         if ("00".equals(userType)) {
             queryWrapper.eq(PatrolInspectionArea::getCreator, SecurityUtils.getUsername());
         }
         queryWrapper.orderByDesc(PatrolInspectionArea::getId);
         return this.list(queryWrapper);
     }
-
-
 }

+ 45 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPersonnelServiceImpl.java

@@ -108,6 +108,9 @@ public class PatrolInspectionPersonnelServiceImpl extends AbstractCrudService<Pa
         if (id != 0 && id != null) {
             queryWrapper.eq(PatrolInspectionPersonnel::getId, id);
         }
+        if (areaId != 0 && areaId != null) {
+            queryWrapper.eq(PatrolInspectionPersonnel::getAreaId, areaId);
+        }
         List<PatrolInspectionPersonnel> list = this.list(queryWrapper);
         List<PatrolInspectionPersonnelVo> list1 = new ArrayList<>();
         if (list.size() > 0) {
@@ -196,4 +199,46 @@ public class PatrolInspectionPersonnelServiceImpl extends AbstractCrudService<Pa
         return patrolInspectionAreaVoListOne;
     }
 
+    @Override
+    public List<PatrolInspectionPersonnelVo> patrolInspectionPersonnelSelect(Integer areaId) {
+        LoginUser loginUser = SecurityUtils.getLoginUser();
+        String userType = null;
+        if (loginUser != null && !"".equals(loginUser)) {
+            userType = loginUser.getUserType();
+        }
+        LambdaQueryWrapper<PatrolInspectionPersonnel> queryWrapper = Wrappers.lambdaQuery();
+        queryWrapper.eq(PatrolInspectionPersonnel::getEnable, 1)
+                .eq(PatrolInspectionPersonnel::getTenantId, SecurityUtils.getTenantId());
+        if ("00".equals(userType)) {
+            queryWrapper.eq(PatrolInspectionPersonnel::getCreator, SecurityUtils.getUsername());
+        }
+        if (areaId != 0 && areaId != null) {
+            queryWrapper.eq(PatrolInspectionPersonnel::getAreaId, areaId);
+        }
+        List<PatrolInspectionPersonnel> list = this.list(queryWrapper);
+        List<PatrolInspectionPersonnelVo> list1 = new ArrayList<>();
+        if (list.size() > 0) {
+            ApiResult<List<SysUser>> userApi = remoteUserService.userList();
+            List<SysUser> userList = userApi.getData();
+            for (int i = 0; i < list.size(); i++) {
+                PatrolInspectionPersonnelVo patrolInspectionPersonnelVo = new PatrolInspectionPersonnelVo();
+                patrolInspectionPersonnelVo.setCreator(list.get(i).getCreator());
+                patrolInspectionPersonnelVo.setCompanyId(list.get(i).getCompanyId());
+                patrolInspectionPersonnelVo.setEnable(list.get(i).getEnable());
+                patrolInspectionPersonnelVo.setCreateTime(list.get(i).getCreateTime());
+                patrolInspectionPersonnelVo.setId(list.get(i).getId());
+                patrolInspectionPersonnelVo.setTenantId(list.get(i).getTenantId());
+                patrolInspectionPersonnelVo.setAreaId(list.get(i).getAreaId());
+                patrolInspectionPersonnelVo.setUserId(list.get(i).getUserId());
+                for (int j = 0; j <userList.size(); j++) {
+                    if (list.get(i).getUserId().longValue()==userList.get(j).getUserId()){
+                        patrolInspectionPersonnelVo.setName(userList.get(j).getNickName());
+                    }
+                }
+                list1.add(patrolInspectionPersonnelVo);
+            }
+        }
+        return list1;
+    }
+
 }

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

@@ -61,6 +61,9 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
     @Autowired
     private PatrolInspectionRecordService patrolInspectionRecordService;
 
+    @Autowired
+    private PatrolInspectionPersonnelService patrolInspectionPersonnelService;
+
     @Override
     public List<PatrolInspectionAreaVo> planLeftList() {
         LoginUser loginUser = SecurityUtils.getLoginUser();
@@ -534,14 +537,18 @@ public class PatrolInspectionPlanServiceImpl extends AbstractCrudService<PatrolI
         queryWrapper.orderByDesc(PatrolInspectionPlan::getId);
         List<PatrolInspectionPlan> patrolInspectionPlanSonList = this.list(queryWrapper);
         List<PlanSchedule> planScheduleList = planScheduleService.list();
-
+        List<PatrolInspectionPersonnelVo> personnelList = patrolInspectionPersonnelService.patrolInspectionPersonnelSelect(areaId);
         List<PlanScheduleVo> list = new ArrayList<>();
         for (int i = 0; i < planScheduleList.size(); i++) {
             PlanScheduleVo planScheduleVo = new PlanScheduleVo();
             planScheduleVo.setTime(planScheduleList.get(i).getStartTime() + "~" + planScheduleList.get(i).getEndTime());
             planScheduleVo.setPersonnelId(planScheduleList.get(i).getPersonnelId());
-            planScheduleVo.setPersonnelName("未定义");
             planScheduleVo.setPlanId(planScheduleList.get(i).getPlanId());
+            for (int j = 0; j < personnelList.size(); j++) {
+                if (planScheduleList.get(i).getPersonnelId()==personnelList.get(j).getId()){
+                    planScheduleVo.setPersonnelName(personnelList.get(j).getName());
+                }
+            }
             list.add(planScheduleVo);
         }
         List<PatrolInspectionPlanDataVo> list1 = new ArrayList<>();