Просмотр исходного кода

移动端-巡检计划检查项查询

jichaobo 2 лет назад
Родитель
Сommit
6a5beac407

+ 18 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionContentOption.java

@@ -1,6 +1,7 @@
 package com.usky.fire.domain;
 
 import com.baomidou.mybatisplus.annotation.IdType;
+import com.baomidou.mybatisplus.annotation.TableField;
 import com.baomidou.mybatisplus.annotation.TableId;
 import java.time.LocalDateTime;
 import java.io.Serializable;
@@ -54,5 +55,22 @@ public class PatrolInspectionContentOption implements Serializable {
      */
     private Integer enable;
 
+    /**
+     * 是否勾选(true 选中 false 未选中)
+     */
+    @TableField(exist = false)
+    private Boolean selectStatus;
+
+    /**
+     * 备注
+     */
+    @TableField(exist = false)
+    private String remarks;
+
+    /**
+     * 内容
+     */
+    @TableField(exist = false)
+    private String content;
 
 }

+ 5 - 0
service-fire/service-fire-biz/src/main/java/com/usky/fire/domain/PatrolInspectionSite.java

@@ -136,5 +136,10 @@ public class PatrolInspectionSite implements Serializable {
     @TableField(exist = false)
     private Integer planSonId;
 
+    /**
+     * 巡检状态(1 未巡检,2 已巡检)
+     */
+    @TableField(exist = false)
+    private Integer inspectionStatus;
 
 }

+ 52 - 48
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -1,5 +1,6 @@
 package com.usky.fire.service.impl;
 
+import cn.hutool.core.collection.CollectionUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.usky.common.core.exception.BusinessException;
@@ -199,21 +200,19 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         if (planSonSiteCount <= 0) {
             throw new BusinessException("此地点尚未采集,请采集该点位");
         }
-//        List<PatrolInspectionRecordPicture> recordPictureList = new ArrayList<>();
-//        if (planSonId != null && planSonId != 0) {
-//            LambdaQueryWrapper<PatrolInspectionRecord> query = Wrappers.lambdaQuery();
-//            query.eq(PatrolInspectionRecord::getSiteId, siteId)
-//                    .eq(PatrolInspectionRecord::getPlanSonId, planSonId);
-//            List<PatrolInspectionRecord> recordList = patrolInspectionRecordMapper.selectList(query);
-//            if (CollectionUtils.isNotEmpty(recordList)) {
-//                siteList.get(0).setRemarks(recordList.get(0).getRemarks());
-//                LambdaQueryWrapper<PatrolInspectionRecordPicture> queryOne = Wrappers.lambdaQuery();
-//                queryOne.eq(PatrolInspectionRecordPicture::getRecordId, recordList.get(0).getId());
-//                recordPictureList = patrolInspectionRecordPictureService.list(queryOne);
-//            }
-//        }
-
-//        siteList.get(0).setRecordPictureList(recordPictureList);
+        Integer siteIdOne = 0;
+        if (siteId != 0 && siteId != null) {
+            siteIdOne = siteId;
+        } else {
+            siteIdOne = siteList.get(0).getId();
+        }
+        LambdaQueryWrapper<PatrolInspectionPlanSiteSon> queryWrapper1 = Wrappers.lambdaQuery();
+        queryWrapper1.eq(PatrolInspectionPlanSiteSon::getPlanId, planSonId)
+                .eq(PatrolInspectionPlanSiteSon::getSiteId, siteIdOne);
+        List<PatrolInspectionPlanSiteSon> siteSonslist = patrolInspectionPlanSiteSonService.list(queryWrapper1);
+        if (CollectionUtil.isNotEmpty(siteSonslist)) {
+            siteList.get(0).setInspectionStatus(siteSonslist.get(0).getInspectionStatus());
+        }
         List<PatrolInspectionContentVo> contentList = this.contentList(siteList.get(0).getId());
         siteList.get(0).setContentCount(contentList.size());
         siteList.get(0).setPlanSonId(planSonId);
@@ -393,16 +392,10 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             }
             LambdaQueryWrapper<PatrolInspectionRecord> queryWrapperOne = Wrappers.lambdaQuery();
             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);
-            }
-            if (planSonId != null && planSonId != 0) {
-                queryWrapperOne.eq(PatrolInspectionRecord::getPlanSonId, planSonId);
-            }
-            if (siteId != null && siteId != 0) {
-                queryWrapperOne.eq(PatrolInspectionRecord::getSiteId, siteId);
-            }
+                    .eq(id != null && id != 0, PatrolInspectionRecord::getId, id)
+                    .eq(planSonId != null && planSonId != 0, PatrolInspectionRecord::getPlanSonId, planSonId)
+                    .eq(siteId != null && siteId != 0, PatrolInspectionRecord::getSiteId, siteId)
+                    .between(StringUtils.isNotBlank(currentDate), PatrolInspectionRecord::getCreateTime, currentDate + " 00:00:00", currentDate + " 23:59:59");
             if (sort.equals("ASC")) {
                 queryWrapperOne.orderByAsc(PatrolInspectionRecord::getId);
             } else {
@@ -461,7 +454,9 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     List<PatrolInspectionRecordPicture> PatrolInspectionRecordPictureList = new ArrayList<>();
                     for (int j = 0; j < recordPictureList.size(); j++) {
                         PatrolInspectionRecordPicture patrolInspectionRecordPicture = new PatrolInspectionRecordPicture();
-                        if (recordList.get(i).getId() == recordPictureList.get(j).getRecordId()) {
+                        int id1 = recordList.get(i).getId();
+                        int recordId1 = recordPictureList.get(j).getRecordId();
+                        if (id1 == recordId1) {
                             patrolInspectionRecordPicture.setRecordId(recordPictureList.get(j).getRecordId());
                             patrolInspectionRecordPicture.setPictureUrl(recordPictureList.get(j).getPictureUrl());
                             patrolInspectionRecordPicture.setId(recordPictureList.get(j).getId());
@@ -470,7 +465,9 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     }
                     record.setRecordPictureList(PatrolInspectionRecordPictureList);
                     for (int j = 0; j < dataCountVoList.size(); j++) {
-                        if (recordList.get(i).getSiteId() == dataCountVoList.get(j).getId()) {
+                        int siteId1 = recordList.get(i).getSiteId();
+                        int siteId2 = dataCountVoList.get(j).getId();
+                        if (siteId1 == siteId2) {
                             record.setContentCount(dataCountVoList.get(j).getListCount());
                         }
                     }
@@ -511,30 +508,34 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     contentOptionIdList.add(recordOptionList.get(i).getContentOptionId());
                 }
 
-                List<ContentOptionVo> contentOptionVoList = new ArrayList<>();
+                List<PatrolInspectionContentOption> 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);
+//                    ContentOptionVo contentOptionVo = new ContentOptionVo();
+                    contentOptionList.get(i).setId(contentOptionList.get(i).getId());
+                    contentOptionList.get(i).setContentId(contentOptionList.get(i).getContentId());
+                    contentOptionList.get(i).setCreateTime(contentOptionList.get(i).getCreateTime());
+                    contentOptionList.get(i).setCreator(contentOptionList.get(i).getCreator());
+                    contentOptionList.get(i).setEnable(contentOptionList.get(i).getEnable());
+                    contentOptionList.get(i).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());
+                        int contentOptionId1 = contentOptionList.get(i).getId();
+                        int contentOptionId2 = recordOptionList.get(j).getContentOptionId();
+                        if (contentOptionId1 == contentOptionId2) {
+                            contentOptionList.get(i).setSelectStatus(true);
+                            contentOptionList.get(i).setRemarks(recordOptionList.get(j).getRemarks());
                         }
-                        if (contentOptionList.get(i).getContentId() == recordOptionList.get(j).getContentId()) {
-                            contentOptionVo.setContent(recordOptionList.get(i).getContent());
+                        int contentId1 = contentOptionList.get(i).getContentId();
+                        int contentId2 = recordOptionList.get(j).getContentId();
+                        if (contentId1 == contentId2) {
+                            contentOptionList.get(i).setContent(recordOptionList.get(i).getContent());
                         }
                     }
-                    contentOptionVoList.add(contentOptionVo);
+                    contentOptionVoList.add(contentOptionList.get(i));
                 }
-
-                List<ContentOptionVo> contentOptionVoListOne = new ArrayList<>();
+//                List<PatrolInspectionContentOption> contentOptionListOne = new ArrayList<>();
+//                contentOptionListOne.addAll(contentOptionVoList);
                 for (int i = 0; i < contentList.size(); i++) {
+                    List<PatrolInspectionContentOption> contentOptionVoListOne = new ArrayList<>();
                     PatrolInspectionContentVo contentVo = new PatrolInspectionContentVo();
                     contentVo.setXh(i + 1);
                     contentVo.setId(contentList.get(i).getId());
@@ -546,13 +547,16 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     contentVo.setCreateTime(contentList.get(i).getCreateTime());
                     contentVo.setEnable(contentList.get(i).getEnable());
                     contentVo.setCompanyId(contentList.get(i).getCompanyId());
+                    contentVo.setContentOptionListValue1(contentOptionIdList);
                     for (int j = 0; j < contentOptionVoList.size(); j++) {
-                        if (contentList.get(i).getId() == contentOptionVoList.get(j).getContentId()) {
+                        int id1 = contentList.get(i).getId();
+                        int id2 = contentOptionVoList.get(j).getContentId();
+                        if (id1 == id2) {
                             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);
+                            contentVo.setContentOptionList(contentOptionVoListOne);
                         }
                     }
                     list.add(contentVo);
@@ -560,8 +564,8 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             }
         }
         Map<String, Object> map = new HashMap<>();
-        map.put("list", list);
-        map.put("contentOptionIdList", contentOptionIdList);
+        map.put("contentList", list);
+//        map.put("contentOptionIdList", contentOptionIdList);
         return map;
     }
 

+ 7 - 2
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/vo/PatrolInspectionContentVo.java

@@ -13,7 +13,7 @@ import java.util.List;
 
 /**
  * <p>
- * 
+ *
  * </p>
  *
  * @author JCB
@@ -24,7 +24,7 @@ import java.util.List;
 @Accessors(chain = true)
 public class PatrolInspectionContentVo implements Serializable {
 
-    private static final long serialVersionUID=1L;
+    private static final long serialVersionUID = 1L;
 
     /**
      * 巡检内容信息表主键ID
@@ -87,6 +87,11 @@ public class PatrolInspectionContentVo implements Serializable {
      */
     private List<ContentOptionVo> contentOptionVoList;
 
+    /**
+     * 选中项
+     */
+    private List<Integer> contentOptionListValue1;
+
     /**
      * 备注
      */