|
@@ -2,21 +2,20 @@ 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.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|
|
import com.ruoyi.common.core.page.PagePlus;
|
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
|
import com.ruoyi.common.utils.PageUtils;
|
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
|
-import com.ruoyi.gas.domain.GCourtyardNetworkManagement;
|
|
|
-import com.ruoyi.gas.domain.GRoadSectionInspection;
|
|
|
-import com.ruoyi.gas.domain.bo.BatchReviewBo;
|
|
|
-import com.ruoyi.gas.domain.bo.GRoadSectionInspectionBo;
|
|
|
-import com.ruoyi.gas.domain.bo.GRoadSectionInspectionPhotoBo;
|
|
|
+import com.ruoyi.gas.domain.*;
|
|
|
+import com.ruoyi.gas.domain.bo.*;
|
|
|
import com.ruoyi.gas.domain.vo.GRoadSectionInspectionVo;
|
|
|
import com.ruoyi.gas.mapper.GRoadSectionInspectionMapper;
|
|
|
import com.ruoyi.gas.service.IGRoadSectionInspectionPhotoService;
|
|
|
import com.ruoyi.gas.service.IGRoadSectionInspectionService;
|
|
|
+import com.ruoyi.gas.service.IGRoadsectionProcessService;
|
|
|
import com.ruoyi.gas.service.IGUserService;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.stereotype.Service;
|
|
@@ -56,6 +55,27 @@ public class GRoadSectionInspectionServiceImpl extends ServicePlusImpl<GRoadSect
|
|
|
tableDataInfo.getRows().forEach(item -> {
|
|
|
item.setPhotoList(baseMapper.getPhoto(item.getId()));
|
|
|
item.setCreateByName(baseMapper.getName(item.getCreateBy()));
|
|
|
+
|
|
|
+ //按照顺序审核
|
|
|
+ //未审核过队长先展示
|
|
|
+ List<GRoadsectionProcess> listed = roadsectionProcessService.list(new QueryWrapper<GRoadsectionProcess>().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 tableDataInfo;
|
|
|
}
|
|
@@ -81,7 +101,10 @@ public class GRoadSectionInspectionServiceImpl extends ServicePlusImpl<GRoadSect
|
|
|
lqw.or().in(StringUtils.isNotBlank(bo.getProcessStatus()), GRoadSectionInspection::getProcessStatus, "-1","");
|
|
|
lqw.or().isNull(GRoadSectionInspection::getProcessStatus);
|
|
|
}
|
|
|
-
|
|
|
+ if (!ObjectUtils.isEmpty(bo.getCreateTimes())){
|
|
|
+ lqw.ge(GRoadSectionInspection::getCreateTime, bo.getCreateTimes().get(0));
|
|
|
+ lqw.le(GRoadSectionInspection::getCreateTime, bo.getCreateTimes().get(1));
|
|
|
+ }
|
|
|
lqw.orderByDesc(GRoadSectionInspection::getCreateTime);
|
|
|
return lqw;
|
|
|
}
|
|
@@ -111,10 +134,23 @@ public class GRoadSectionInspectionServiceImpl extends ServicePlusImpl<GRoadSect
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean updateByBo(GRoadSectionInspectionBo bo) {
|
|
|
GRoadSectionInspection update = BeanUtil.toBean(bo, GRoadSectionInspection.class);
|
|
|
validEntityBeforeSave(update);
|
|
|
List<String> piclist = bo.getPhotoList();
|
|
|
+ //审核-队长-处事,由一步审核变为两步审核
|
|
|
+ if (StringUtils.isNotBlank(bo.getProcessStatus())){
|
|
|
+ GRoadsectionProcessBo processBo = new GRoadsectionProcessBo();
|
|
|
+ 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());
|
|
|
+ roadsectionProcessService.insertByBo(processBo);
|
|
|
+ }
|
|
|
if (piclist != null) {
|
|
|
//原有的照片
|
|
|
List<String> photolist = baseMapper.getPhoto(bo.getId());
|
|
@@ -138,7 +174,16 @@ public class GRoadSectionInspectionServiceImpl extends ServicePlusImpl<GRoadSect
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
- return updateById(update);
|
|
|
+ update.setProcessStatus(null);
|
|
|
+ boolean b = updateById(update);
|
|
|
+ if (StringUtils.isNotBlank(bo.getProcessStatus())){
|
|
|
+ //更新主表状态
|
|
|
+ Collection<GRoadSectionInspection> collection = new ArrayList<>();
|
|
|
+ update.setProcessStatus(bo.getProcessStatus());
|
|
|
+ collection.add(update);
|
|
|
+ updateNetworkManage(collection);
|
|
|
+ }
|
|
|
+ return b;
|
|
|
}
|
|
|
|
|
|
/**
|
|
@@ -150,26 +195,62 @@ public class GRoadSectionInspectionServiceImpl extends ServicePlusImpl<GRoadSect
|
|
|
//TODO 做一些数据校验,如唯一约束
|
|
|
}
|
|
|
|
|
|
+
|
|
|
@Override
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
|
- if (isValid) {
|
|
|
+ if(isValid){
|
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
|
}
|
|
|
+ roadsectionProcessService.remove(new QueryWrapper<GRoadsectionProcess>().in("emr_id", ids));
|
|
|
return removeByIds(ids);
|
|
|
}
|
|
|
+
|
|
|
+
|
|
|
@Override
|
|
|
@Transactional(rollbackFor = Exception.class)
|
|
|
public Boolean batchReview(BatchReviewBo bo) {
|
|
|
List<GRoadSectionInspection> list = new ArrayList<>();
|
|
|
+ Collection<GRoadsectionProcess> processList = new ArrayList<>();
|
|
|
+
|
|
|
if (!ObjectUtils.isEmpty(bo.getUids())) {
|
|
|
bo.getUids().forEach(item -> {
|
|
|
GRoadSectionInspection roadSectionInspection = new GRoadSectionInspection();
|
|
|
roadSectionInspection.setId(item);
|
|
|
- roadSectionInspection.setProcessStatus(bo.getProcessStatus());
|
|
|
- roadSectionInspection.setProcessComments(bo.getRemarks());
|
|
|
+// roadSectionInspection.setProcessStatus(bo.getProcessStatus());
|
|
|
+// roadSectionInspection.setProcessComments(bo.getRemarks());
|
|
|
+ GRoadsectionProcess processBo = new GRoadsectionProcess();
|
|
|
+ processBo.setEmrId(item);
|
|
|
+ processBo.setProcessStatus(bo.getProcessStatus());
|
|
|
+ processBo.setProcessComments(bo.getProcessComments());
|
|
|
+ processBo.setUserPost(bo.getPostNameArias());
|
|
|
+ processList.add(processBo);
|
|
|
+
|
|
|
list.add(roadSectionInspection);
|
|
|
});
|
|
|
}
|
|
|
- return updateBatchById(list);
|
|
|
+ boolean b = roadsectionProcessService.saveBatch(processList);
|
|
|
+// boolean b = updateBatchById(boxList);
|
|
|
+ //更新主表状态
|
|
|
+ updateNetworkManage(list);
|
|
|
+ return b;
|
|
|
}
|
|
|
+
|
|
|
+ // @Async
|
|
|
+ public void updateNetworkManage(Collection<GRoadSectionInspection> boxList) {
|
|
|
+ boxList.stream().forEach(obj->{
|
|
|
+ QueryWrapper<GRoadsectionProcess> queryWrapper = new QueryWrapper<GRoadsectionProcess>().eq("emr_id", obj.getId());
|
|
|
+ List<GRoadsectionProcess> listed = roadsectionProcessService.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);
|
|
|
+ }
|
|
|
+ });
|
|
|
+ }
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private IGRoadsectionProcessService roadsectionProcessService;
|
|
|
}
|