Browse Source

手机端-巡检自检-巡检记录-查看巡检项

jichaobo 2 years ago
parent
commit
8622b952c9

+ 14 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/AppPatrolInspectionController.java

@@ -142,4 +142,18 @@ public class AppPatrolInspectionController {
         return ApiResult.success(patrolInspectionPlanSonService.recordList(currentDate, sort, id));
     }
 
+
+    /**
+     * 手机端-巡检自检-巡检记录-查看巡检项
+     *
+     * @param recordId 记录ID
+     * @param siteId   地点ID
+     * @return
+     */
+    @GetMapping("recordOption")
+    public ApiResult<Map<String, Object>> recordOption(@RequestParam(value = "recordId") Integer recordId,
+                                                       @RequestParam(value = "siteId") Integer siteId) {
+        return ApiResult.success(patrolInspectionPlanSonService.recordOption(recordId, siteId));
+    }
+
 }

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

@@ -95,8 +95,16 @@ public interface PatrolInspectionPlanSonService extends CrudService<PatrolInspec
      * @param sort        排序 (正序:ASC 倒序:DESC)
      * @return
      */
-    List<PatrolInspectionRecordVo> recordList(String currentDate, String sort,Integer id);
+    List<PatrolInspectionRecordVo> recordList(String currentDate, String sort, Integer id);
 
+    /**
+     * 手机端-巡检自检-巡检记录-查看巡检项
+     *
+     * @param recordId 记录ID
+     * @param siteId   地点ID
+     * @return
+     */
+    Map<String, Object> recordOption(Integer recordId, Integer siteId);
 
     /**
      * 手机端-根据用户获取巡检人员ID

+ 84 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -341,7 +341,8 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         return list;
     }
 
-    public List<PatrolInspectionRecordVo> recordList(String currentDate, String sort,Integer id) {
+    @Override
+    public List<PatrolInspectionRecordVo> recordList(String currentDate, String sort, Integer id) {
         List<Integer> personnelIdList = this.getpersonId();
         LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.select(PatrolInspectionPlanSchedule::getPlanId)
@@ -358,7 +359,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             queryWrapperOne.in(PatrolInspectionRecord::getPlanId, planIdList)
                     .between(PatrolInspectionRecord::getCreateTime, currentDate + " 00:00:00", currentDate + " 23:59:59");
             if (id != null && id != 0) {
-                queryWrapperOne.eq(PatrolInspectionRecord::getId,id);
+                queryWrapperOne.eq(PatrolInspectionRecord::getId, id);
             }
             if (sort.equals("ASC")) {
                 queryWrapperOne.orderByAsc(PatrolInspectionRecord::getId);
@@ -422,6 +423,87 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
     }
 
 
+    @Override
+    public Map<String, Object> recordOption(Integer recordId, Integer siteId) {
+        LambdaQueryWrapper<PatrolInspectionSiteContent> queryWrapperOne = Wrappers.lambdaQuery();
+        queryWrapperOne.eq(PatrolInspectionSiteContent::getSiteId, siteId);
+        List<PatrolInspectionSiteContent> siteContentList = patrolInspectionSiteContentService.list(queryWrapperOne);
+        List<PatrolInspectionContentVo> list = new ArrayList<>();
+        List<Integer> contentOptionIdList = new ArrayList<>();
+        if (siteContentList.size() > 0) {
+            List<Integer> contentIdList = new ArrayList<>();
+            for (int i = 0; i < siteContentList.size(); i++) {
+                contentIdList.add(siteContentList.get(i).getContentId());
+            }
+            LambdaQueryWrapper<PatrolInspectionContent> queryWrapperTwo = Wrappers.lambdaQuery();
+            queryWrapperTwo.in(PatrolInspectionContent::getId, contentIdList)
+                    .eq(PatrolInspectionContent::getEnable, 1);
+            List<PatrolInspectionContent> contentList = patrolInspectionContentService.list(queryWrapperTwo);
+            if (contentList.size() > 0) {
+                LambdaQueryWrapper<PatrolInspectionContentOption> queryWrapperThree = Wrappers.lambdaQuery();
+                queryWrapperThree.in(PatrolInspectionContentOption::getContentId, contentIdList)
+                        .eq(PatrolInspectionContentOption::getEnable, 1);
+                List<PatrolInspectionContentOption> contentOptionList = patrolInspectionContentOptionService.list(queryWrapperThree);
+
+                LambdaQueryWrapper<PatrolInspectionRecordOption> queryWrapper = Wrappers.lambdaQuery();
+                queryWrapper.eq(PatrolInspectionRecordOption::getRecordId, recordId);
+                List<PatrolInspectionRecordOption> recordOptionList = patrolInspectionRecordOptionService.list(queryWrapper);
+                for (int i = 0; i < recordOptionList.size(); i++) {
+                    contentOptionIdList.add(recordOptionList.get(i).getContentOptionId());
+                }
+
+                List<ContentOptionVo> contentOptionVoList = new ArrayList<>();
+                for (int i = 0; i < contentOptionList.size(); i++) {
+                    ContentOptionVo contentOptionVo = new ContentOptionVo();
+                    contentOptionVo.setId(contentOptionList.get(i).getId());
+                    contentOptionVo.setContentId(contentOptionList.get(i).getContentId());
+                    contentOptionVo.setOptionName(contentOptionList.get(i).getOptionName());
+                    contentOptionVo.setCreateTime(contentOptionList.get(i).getCreateTime());
+                    contentOptionVo.setCreator(contentOptionList.get(i).getCreator());
+                    contentOptionVo.setEnable(contentOptionList.get(i).getEnable());
+                    contentOptionVo.setSelectStatus(false);
+                    for (int j = 0; j < recordOptionList.size(); j++) {
+                        if (contentOptionList.get(i).getId() == recordOptionList.get(j).getContentOptionId()) {
+                            contentOptionVo.setSelectStatus(true);
+                            contentOptionVo.setRemarks(recordOptionList.get(j).getRemarks());
+                        }
+                    }
+                    contentOptionVoList.add(contentOptionVo);
+                }
+
+                List<ContentOptionVo> contentOptionVoListOne = new ArrayList<>();
+                for (int i = 0; i < contentList.size(); i++) {
+                    PatrolInspectionContentVo contentVo = new PatrolInspectionContentVo();
+                    contentVo.setXh(i + 1);
+                    contentVo.setId(contentList.get(i).getId());
+                    contentVo.setContentTitle(contentList.get(i).getContentTitle());
+                    contentVo.setContentDescribe(contentList.get(i).getContentDescribe());
+                    contentVo.setSubmissionMethod(contentList.get(i).getSubmissionMethod());
+                    contentVo.setTenantId(contentList.get(i).getTenantId());
+                    contentVo.setCreator(contentList.get(i).getCreator());
+                    contentVo.setCreateTime(contentList.get(i).getCreateTime());
+                    contentVo.setEnable(contentList.get(i).getEnable());
+                    contentVo.setCompanyId(contentList.get(i).getCompanyId());
+                    for (int j = 0; j < contentOptionVoList.size(); j++) {
+                        if (contentList.get(i).getId() == contentOptionVoList.get(j).getContentId()) {
+                            if (contentOptionVoList.get(j).getRemarks() != null && !"".equals(contentOptionVoList.get(j).getRemarks())) {
+                                contentVo.setRemarks(contentOptionVoList.get(j).getRemarks());
+                            }
+                            contentOptionVoListOne.add(contentOptionVoList.get(j));
+                            contentVo.setContentOptionVoList(contentOptionVoListOne);
+                        }
+                    }
+                    list.add(contentVo);
+                }
+            }
+        }
+        Map<String, Object> map = new HashMap<>();
+        map.put("list", list);
+        map.put("contentOptionIdList", contentOptionIdList);
+        return map;
+    }
+
+
     @Override
     public List<Integer> getpersonId() {
         LambdaQueryWrapper<PatrolInspectionPersonnel> queryWrapper = Wrappers.lambdaQuery();