소스 검색

版本1.4.1 阀井巡查修改

qinhouyu 1 년 전
부모
커밋
f0878ed90a

+ 3 - 0
ruoyi-gas/src/main/java/com/ruoyi/gas/domain/bo/GValveWellInspectionBo.java

@@ -27,6 +27,9 @@ public class GValveWellInspectionBo extends BaseEntity {
     private String remarks;
     private String processStatus;
     private String processComments;
+
+    private String postNameArias;
+
     /**
      * 时间范围
      */

+ 1 - 0
ruoyi-gas/src/main/java/com/ruoyi/gas/domain/vo/GValveWellInspectionVos.java

@@ -30,4 +30,5 @@ public class GValveWellInspectionVos{
 	private Long positionId;
 	private Date createTime;
 	private String createBy;
+	private Boolean flag;
 }

+ 91 - 13
ruoyi-gas/src/main/java/com/ruoyi/gas/service/impl/GValveWellInspectionServiceImpl.java

@@ -2,17 +2,15 @@ package com.ruoyi.gas.service.impl;
 
 import cn.hutool.core.bean.BeanUtil;
 import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
 import com.baomidou.mybatisplus.core.toolkit.Wrappers;
 import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
 import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
 import com.ruoyi.common.core.page.TableDataInfo;
 import com.ruoyi.common.utils.PageUtils;
 import com.ruoyi.common.utils.StringUtils;
-import com.ruoyi.gas.domain.GRoadSectionInspection;
-import com.ruoyi.gas.domain.GValveWellInspection;
-import com.ruoyi.gas.domain.bo.BatchReviewBo;
-import com.ruoyi.gas.domain.bo.GValveWellInspectionBo;
-import com.ruoyi.gas.domain.bo.GValveWellInspectionPhotoBo;
+import com.ruoyi.gas.domain.*;
+import com.ruoyi.gas.domain.bo.*;
 import com.ruoyi.gas.domain.vo.GValveWellInspectionVo;
 import com.ruoyi.gas.domain.vo.GValveWellInspectionVos;
 import com.ruoyi.gas.mapper.GValveWellInspectionMapper;
@@ -23,6 +21,8 @@ import com.ruoyi.gas.service.IGValvewellInspectionProcessService;
 import lombok.RequiredArgsConstructor;
 import org.springframework.beans.factory.annotation.Autowired;
 import org.springframework.stereotype.Service;
+import org.springframework.transaction.annotation.Transactional;
+import org.springframework.util.ObjectUtils;
 
 import java.util.ArrayList;
 import java.util.Collection;
@@ -41,17 +41,50 @@ import java.util.stream.Collectors;
 public class GValveWellInspectionServiceImpl extends ServicePlusImpl<GValveWellInspectionMapper, GValveWellInspection, GValveWellInspectionVo> implements IGValveWellInspectionService {
 
     private final GValveWellPositionMapper  positionMapper;
+    @Autowired
+    private IGValvewellInspectionProcessService valvewellInspectionProcessService;
+
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean batchReview(BatchReviewBo bo) {
         Collection<GValveWellInspection> boxList = new ArrayList<>();
+        Collection<GValvewellInspectionProcess> processList = new ArrayList<>();
         bo.getUids().forEach(item -> {
-            GValveWellInspection gValveWellInspection = new GValveWellInspection();
-            gValveWellInspection.setId(item);
-            gValveWellInspection.setProcessStatus(bo.getProcessStatus());
-            gValveWellInspection.setProcessComments(bo.getRemarks());
-            boxList.add(gValveWellInspection);
+
+            GValveWellInspection valveWellInspection = new GValveWellInspection();
+            valveWellInspection.setId(item);
+//            gCourtyardNetworkManagement.setProcessStatus(bo.getProcessStatus());
+//            gCourtyardNetworkManagement.setProcessComments(bo.getRemarks());
+
+            GValvewellInspectionProcess processBo = new GValvewellInspectionProcess();
+            processBo.setEmrId(item);
+            processBo.setProcessStatus(bo.getProcessStatus());
+            processBo.setProcessComments(bo.getProcessComments());
+            processBo.setUserPost(bo.getPostNameArias());
+            processList.add(processBo);
+
+            boxList.add(valveWellInspection);
+        });
+        boolean b = valvewellInspectionProcessService.saveBatch(processList);
+//        boolean b = updateBatchById(boxList);
+        //更新主表状态
+        updateNetworkManage(boxList);
+        return b;
+    }
+
+    //    @Async
+    public void updateNetworkManage(Collection<GValveWellInspection> boxList) {
+        boxList.stream().forEach(obj->{
+            QueryWrapper<GValvewellInspectionProcess> queryWrapper = new QueryWrapper<GValvewellInspectionProcess>().eq("emr_id", obj.getId());
+            List<GValvewellInspectionProcess> listed = valvewellInspectionProcessService.list(queryWrapper);
+            if (listed.stream().filter(o->o.getProcessStatus().equals("0")).count()==2) {
+                obj.setProcessStatus("0");
+                updateById(obj);
+            }else if (listed.stream().anyMatch(o -> o.getProcessStatus().equals("1"))) {
+                obj.setProcessStatus("1");
+                updateById(obj);
+            }
         });
-        return updateBatchById(boxList);
     }
 
     @Override
@@ -66,7 +99,29 @@ public class GValveWellInspectionServiceImpl extends ServicePlusImpl<GValveWellI
     public TableDataInfo<GValveWellInspectionVos> queryPageList(GValveWellInspectionBo bo) {
         Page<GValveWellInspectionVos> page = new Page<>(bo.getPageNum(), bo.getPageSize());
         Page<GValveWellInspectionVos> list = baseMapper.getList(bo, page);
-        list.getRecords().forEach(item -> item.setPhotoList(baseMapper.getPhoto(item.getId())));
+        list.getRecords().forEach(item -> {
+            item.setPhotoList(baseMapper.getPhoto(item.getId()));
+            //按照顺序审核
+            //未审核过队长先展示
+            List<GValvewellInspectionProcess> listed = valvewellInspectionProcessService.list(new QueryWrapper<GValvewellInspectionProcess>().eq("emr_id", item.getId()));
+            if (ObjectUtils.isEmpty(listed)){
+                String regex = "^(xx|XX).{2}";
+                if (bo.getPostNameArias().matches(regex)){
+                    item.setFlag(true);
+                }
+            }
+            else {
+                //审核过
+                //该岗位审核过就不显示
+                listed.forEach(o->{
+                    if (o.getUserPost().equals(bo.getPostNameArias())){
+                        item.setFlag(false);
+                    }else {
+                        item.setFlag(true);
+                    }
+                });
+            }
+        });
         return PageUtils.buildDataInfo(list);
 
     }
@@ -114,6 +169,18 @@ public class GValveWellInspectionServiceImpl extends ServicePlusImpl<GValveWellI
         GValveWellInspection update = BeanUtil.toBean(bo, GValveWellInspection.class);
         validEntityBeforeSave(update);
         List<String> piclist = bo.getPhotoList();
+        //审核-队长-处事,由一步审核变为两步审核
+        if (StringUtils.isNotBlank(bo.getProcessStatus())){
+            GValvewellInspectionProcessBo processBo = new GValvewellInspectionProcessBo();
+            processBo.setEmrId(bo.getId());
+            processBo.setProcessStatus(bo.getProcessStatus());
+            processBo.setProcessComments(bo.getProcessComments());
+            processBo.setUserPost(bo.getPostNameArias());
+//            processBo.setCreateBy(SecurityUtils.getUserId().toString());
+//            processBo.setCreateTime(new Date());
+            processBo.setUserPost(bo.getPostNameArias());
+            valvewellInspectionProcessService.insertByBo(processBo);
+        }
         if (piclist != null) {
             //原有的照片
             List<String> photolist = baseMapper.getPhoto(bo.getId());
@@ -137,7 +204,16 @@ public class GValveWellInspectionServiceImpl extends ServicePlusImpl<GValveWellI
                 }
             }
         }
-        return updateById(update);
+        update.setProcessStatus(null);
+        boolean b = updateById(update);
+        if (StringUtils.isNotBlank(bo.getProcessStatus())){
+            //更新主表状态
+            Collection<GValveWellInspection> collection = new ArrayList<>();
+            update.setProcessStatus(bo.getProcessStatus());
+            collection.add(update);
+            updateNetworkManage(collection);
+        }
+        return b;
     }
 
     /**
@@ -150,10 +226,12 @@ public class GValveWellInspectionServiceImpl extends ServicePlusImpl<GValveWellI
     }
 
     @Override
+    @Transactional(rollbackFor = Exception.class)
     public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
         if(isValid){
             //TODO 做一些业务上的校验,判断是否需要校验
         }
+        valvewellInspectionProcessService.remove(new QueryWrapper<GValvewellInspectionProcess>().in("emr_id", ids));
         return removeByIds(ids);
     }
 }