Parcourir la source

巡检图片查询

jichaobo il y a 2 ans
Parent
commit
ecbcbb94fa

+ 5 - 3
service-fire/service-fire-biz/src/main/java/com/usky/fire/controller/web/AppPatrolInspectionController.java

@@ -70,12 +70,14 @@ public class AppPatrolInspectionController {
      *
      * @param siteId      地点ID
      * @param siteNubmber 地点号码
+     * @param planSonId 子计划Id
      * @return
      */
     @GetMapping("siteDetails")
-    public ApiResult<Map<String, Object>> siteDetails(@RequestParam(value = "siteId") Integer siteId,
-                                                      @RequestParam(value = "siteNubmber") String siteNubmber) {
-        return ApiResult.success(patrolInspectionPlanSonService.siteDetails(siteId, siteNubmber));
+    public ApiResult<Map<String, Object>> siteDetails(@RequestParam(value = "siteId", required = false) Integer siteId,
+                                                      @RequestParam(value = "siteNubmber", required = false) String siteNubmber,
+                                                      @RequestParam(value = "planSonId", required = false) Integer planSonId) {
+        return ApiResult.success(patrolInspectionPlanSonService.siteDetails(siteId, siteNubmber, planSonId));
     }
 
     /**

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

@@ -1,9 +1,12 @@
 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;
+import java.util.List;
+
 import lombok.Data;
 import lombok.EqualsAndHashCode;
 import lombok.experimental.Accessors;
@@ -109,6 +112,17 @@ public class PatrolInspectionSite implements Serializable {
      */
     private Integer companyId;
 
+    /**
+     * 地点内容总数
+     */
+    @TableField(exist = false)
+    private Integer contentCount;
+
+    /**
+     * 图片
+     */
+    @TableField(exist = false)
+    private List<PatrolInspectionRecordPicture> recordPictureList;
 
 
 }

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

@@ -52,7 +52,7 @@ public interface PatrolInspectionPlanSonService extends CrudService<PatrolInspec
      * @param siteNubmber 地点号码
      * @return
      */
-    Map<String, Object> siteDetails(Integer siteId, String siteNubmber);
+    Map<String, Object> siteDetails(Integer siteId, String siteNubmber,Integer planSonId);
 
 
     /**

+ 32 - 4
service-fire/service-fire-biz/src/main/java/com/usky/fire/service/impl/PatrolInspectionPlanSonServiceImpl.java

@@ -104,7 +104,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
     public List<PatrolInspectionPlanSonVo> patrolInspectionPlan(String currentDate, String sort) {
         List<PatrolInspectionPlanSonVo> planList = new ArrayList<>();
         List<Integer> personnelIdList = this.getpersonId();
-        if (personnelIdList.size()>0){
+        if (personnelIdList.size() > 0) {
             LambdaQueryWrapper<PatrolInspectionPlanSchedule> queryWrapper = Wrappers.lambdaQuery();
             queryWrapper.select(PatrolInspectionPlanSchedule::getPlanId)
                     .in(PatrolInspectionPlanSchedule::getPersonnelId, personnelIdList)
@@ -127,7 +127,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd");
         List<PatrolInspectionPlanSonVo> list = new ArrayList<>();
         List<Integer> personnelIdList = this.getpersonId();
-        if (personnelIdList.size()>0){
+        if (personnelIdList.size() > 0) {
             LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
             queryWrapper.eq(PatrolInspectionSite::getEnable, 1);
             queryWrapper
@@ -174,7 +174,7 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
 
 
     @Override
-    public Map<String, Object> siteDetails(Integer siteId, String siteNubmber) {
+    public Map<String, Object> siteDetails(Integer siteId, String siteNubmber, Integer planSonId) {
         LambdaQueryWrapper<PatrolInspectionSite> queryWrapper = Wrappers.lambdaQuery();
         queryWrapper.eq(PatrolInspectionSite::getTenantId, SecurityUtils.getTenantId());
         queryWrapper.eq(PatrolInspectionSite::getEnable, 1);
@@ -188,11 +188,22 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
         if (siteList.size() <= 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);
+            LambdaQueryWrapper<PatrolInspectionRecordPicture> queryOne = Wrappers.lambdaQuery();
+            queryOne.eq(PatrolInspectionRecordPicture::getRecordId, recordList.get(0).getId());
+            recordPictureList = patrolInspectionRecordPictureService.list(queryOne);
+        }
+        siteList.get(0).setRecordPictureList(recordPictureList);
         List<PatrolInspectionContentVo> contentList = this.contentList(siteList.get(0).getId());
+        siteList.get(0).setContentCount(contentList.size());
         Map<String, Object> map = new HashMap<>();
         map.put("siteList", siteList);
         map.put("contentList", contentList);
-        map.put("contentCount", contentList.size());
         return map;
     }
 
@@ -377,9 +388,15 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
             List<PatrolInspectionRecord> recordList = patrolInspectionRecordMapper.selectList(queryWrapperOne);
             if (recordList.size() > 0) {
                 List<Integer> siteIdList = new ArrayList<>();
+                List<Integer> recordIdList = new ArrayList<>();
                 for (int i = 0; i < recordList.size(); i++) {
                     siteIdList.add(recordList.get(i).getSiteId());
+                    recordIdList.add(recordList.get(i).getId());
                 }
+                LambdaQueryWrapper<PatrolInspectionRecordPicture> queryOne = Wrappers.lambdaQuery();
+                queryOne.in(PatrolInspectionRecordPicture::getRecordId, recordIdList);
+                List<PatrolInspectionRecordPicture> recordPictureList = patrolInspectionRecordPictureService.list(queryOne);
+
                 LambdaQueryWrapper<PatrolInspectionSiteContent> queryWrapperTwo = Wrappers.lambdaQuery();
                 queryWrapperTwo.in(PatrolInspectionSiteContent::getSiteId, siteIdList);
                 List<PatrolInspectionSiteContent> siteContentLsit = patrolInspectionSiteContentService.list(queryWrapperTwo);
@@ -418,6 +435,17 @@ public class PatrolInspectionPlanSonServiceImpl extends AbstractCrudService<Patr
                     record.setCreator(recordList.get(i).getCreator());
                     record.setRemarks(recordList.get(i).getRemarks());
                     record.setContentCount(0);
+                    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()){
+                            patrolInspectionRecordPicture.setRecordId(recordPictureList.get(j).getRecordId());
+                            patrolInspectionRecordPicture.setPictureUrl(recordPictureList.get(j).getPictureUrl());
+                            patrolInspectionRecordPicture.setId(recordPictureList.get(j).getId());
+                        }
+                        PatrolInspectionRecordPictureList.add(patrolInspectionRecordPicture);
+                    }
+                    record.setRecordPictureList(PatrolInspectionRecordPictureList);
                     for (int j = 0; j < dataCountVoList.size(); j++) {
                         if (recordList.get(i).getSiteId() == dataCountVoList.get(i).getId()) {
                             record.setContentCount(dataCountVoList.get(i).getListCount());