|
@@ -2,25 +2,24 @@ package com.ruoyi.gas.service.impl;
|
|
|
|
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import cn.hutool.core.bean.BeanUtil;
|
|
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
|
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.core.toolkit.Wrappers;
|
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|
import com.ruoyi.common.core.mybatisplus.core.ServicePlusImpl;
|
|
import com.ruoyi.common.core.page.PagePlus;
|
|
import com.ruoyi.common.core.page.PagePlus;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.core.page.TableDataInfo;
|
|
import com.ruoyi.common.utils.PageUtils;
|
|
import com.ruoyi.common.utils.PageUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
import com.ruoyi.common.utils.StringUtils;
|
|
-import com.ruoyi.gas.domain.GPatrolTeam;
|
|
|
|
-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.GPatrolTeamBo;
|
|
|
|
-import com.ruoyi.gas.domain.bo.GPatrolTeamPhotoBo;
|
|
|
|
|
|
+import com.ruoyi.gas.domain.*;
|
|
|
|
+import com.ruoyi.gas.domain.bo.*;
|
|
import com.ruoyi.gas.domain.vo.GPatrolTeamVo;
|
|
import com.ruoyi.gas.domain.vo.GPatrolTeamVo;
|
|
import com.ruoyi.gas.mapper.GPatrolTeamMapper;
|
|
import com.ruoyi.gas.mapper.GPatrolTeamMapper;
|
|
import com.ruoyi.gas.service.IGPatrolTeamPhotoService;
|
|
import com.ruoyi.gas.service.IGPatrolTeamPhotoService;
|
|
import com.ruoyi.gas.service.IGPatrolTeamService;
|
|
import com.ruoyi.gas.service.IGPatrolTeamService;
|
|
|
|
+import com.ruoyi.gas.service.IGTeamProcessService;
|
|
import com.ruoyi.gas.service.IGUserService;
|
|
import com.ruoyi.gas.service.IGUserService;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
import org.springframework.stereotype.Service;
|
|
import org.springframework.stereotype.Service;
|
|
|
|
+import org.springframework.transaction.annotation.Transactional;
|
|
import org.springframework.util.ObjectUtils;
|
|
import org.springframework.util.ObjectUtils;
|
|
|
|
|
|
import java.util.*;
|
|
import java.util.*;
|
|
@@ -35,18 +34,63 @@ import java.util.stream.Collectors;
|
|
@Service
|
|
@Service
|
|
public class GPatrolTeamServiceImpl extends ServicePlusImpl<GPatrolTeamMapper, GPatrolTeam, GPatrolTeamVo> implements IGPatrolTeamService {
|
|
public class GPatrolTeamServiceImpl extends ServicePlusImpl<GPatrolTeamMapper, GPatrolTeam, GPatrolTeamVo> implements IGPatrolTeamService {
|
|
|
|
|
|
|
|
+ @Autowired
|
|
|
|
+ private IGTeamProcessService teamProcessService;
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public Boolean batchReview(BatchReviewBo bo) {
|
|
public Boolean batchReview(BatchReviewBo bo) {
|
|
Collection<GPatrolTeam> boxList = new ArrayList<>();
|
|
Collection<GPatrolTeam> boxList = new ArrayList<>();
|
|
|
|
+ Collection<GTeamProcess> processList = new ArrayList<>();
|
|
bo.getUids().forEach(item -> {
|
|
bo.getUids().forEach(item -> {
|
|
GPatrolTeam gPatrolTeam = new GPatrolTeam();
|
|
GPatrolTeam gPatrolTeam = new GPatrolTeam();
|
|
gPatrolTeam.setId(item);
|
|
gPatrolTeam.setId(item);
|
|
- gPatrolTeam.setProcessStatus(bo.getProcessStatus());
|
|
|
|
- gPatrolTeam.setProcessComments(bo.getRemarks());
|
|
|
|
|
|
+ GTeamProcess processBo = new GTeamProcess();
|
|
|
|
+ processBo.setEmrId(item);
|
|
|
|
+ processBo.setProcessStatus(bo.getProcessStatus());
|
|
|
|
+ processBo.setProcessComments(bo.getProcessComments());
|
|
|
|
+ processBo.setUserPost(bo.getPostNameArias());
|
|
|
|
+ processList.add(processBo);
|
|
|
|
+
|
|
boxList.add(gPatrolTeam);
|
|
boxList.add(gPatrolTeam);
|
|
});
|
|
});
|
|
- return updateBatchById(boxList);
|
|
|
|
|
|
+ boolean b = teamProcessService.saveBatch(processList);
|
|
|
|
+ //更新主表状态
|
|
|
|
+ updateNetworkManage(boxList);
|
|
|
|
+ return b;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ // @Async
|
|
|
|
+ public void updateNetworkManage(Collection<GPatrolTeam> boxList) {
|
|
|
|
+ boxList.stream().forEach(obj->{
|
|
|
|
+ //最新一条
|
|
|
|
+ QueryWrapper<GTeamProcess> queryWrapper = new QueryWrapper<GTeamProcess>().eq("emr_id", obj.getId()).orderByDesc("create_time");
|
|
|
|
+ List<GTeamProcess> listed = teamProcessService.list(queryWrapper);
|
|
|
|
+ if(!ObjectUtils.isEmpty(listed)) {
|
|
|
|
+ //队长审核不通过
|
|
|
|
+ GTeamProcess gTeamProcess = listed.get(0);
|
|
|
|
+ String regex = "^(xx|XX).{2}";
|
|
|
|
+ if (gTeamProcess.getUserPost().matches(regex)) {
|
|
|
|
+ if (gTeamProcess.getProcessStatus().equals("1")){
|
|
|
|
+ obj.setProcessStatus("1");
|
|
|
|
+ updateById(obj);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ //处事审核通过 即主表状态通过
|
|
|
|
+ if (gTeamProcess.getProcessStatus().equals("0")){
|
|
|
|
+ obj.setProcessStatus("0");
|
|
|
|
+ updateById(obj);
|
|
|
|
+ }
|
|
|
|
+ //处事审核不通过
|
|
|
|
+ else if (gTeamProcess.getProcessStatus().equals("1")){
|
|
|
|
+ obj.setProcessStatus("2");
|
|
|
|
+ updateById(obj);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ });
|
|
}
|
|
}
|
|
|
|
+
|
|
@Override
|
|
@Override
|
|
public GPatrolTeamVo queryById(Long id) {
|
|
public GPatrolTeamVo queryById(Long id) {
|
|
GPatrolTeamVo voById = getVoById(id);
|
|
GPatrolTeamVo voById = getVoById(id);
|
|
@@ -67,7 +111,26 @@ public class GPatrolTeamServiceImpl extends ServicePlusImpl<GPatrolTeamMapper, G
|
|
PagePlus<GPatrolTeam, GPatrolTeamVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo));
|
|
PagePlus<GPatrolTeam, GPatrolTeamVo> result = pageVo(PageUtils.buildPagePlus(), buildQueryWrapper(bo));
|
|
result.getRecordsVo().forEach(item -> {
|
|
result.getRecordsVo().forEach(item -> {
|
|
item.setPhotoList(baseMapper.getPhoto(item.getId()));
|
|
item.setPhotoList(baseMapper.getPhoto(item.getId()));
|
|
- item.setCreateByName(baseMapper.getName(item.getCreateBy()));
|
|
|
|
|
|
+
|
|
|
|
+ //按照顺序审核
|
|
|
|
+ //未审核过队长先展示
|
|
|
|
+ List<GTeamProcess> listed = teamProcessService.list(new QueryWrapper<GTeamProcess>().eq("emr_id", item.getId()).eq("process_status","0"));
|
|
|
|
+ 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(result);
|
|
return PageUtils.buildDataInfo(result);
|
|
}
|
|
}
|
|
@@ -83,7 +146,7 @@ public class GPatrolTeamServiceImpl extends ServicePlusImpl<GPatrolTeamMapper, G
|
|
lqw.eq(StringUtils.isNotBlank(bo.getTeam()), GPatrolTeam::getTeam, bo.getTeam());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getTeam()), GPatrolTeam::getTeam, bo.getTeam());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getUploadLocation()), GPatrolTeam::getUploadLocation, bo.getUploadLocation());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getUploadLocation()), GPatrolTeam::getUploadLocation, bo.getUploadLocation());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getIsNormalInspection()), GPatrolTeam::getIsNormalInspection, bo.getIsNormalInspection());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getIsNormalInspection()), GPatrolTeam::getIsNormalInspection, bo.getIsNormalInspection());
|
|
- lqw.in(StringUtils.isNotEmpty(bo.getRanks()), GPatrolTeam::getCreateBy, !ObjectUtils.isEmpty(bo.getUids()) && bo.getUids().size() > 0 ? bo.getUids() : Arrays.asList(0L));
|
|
|
|
|
|
+// lqw.in(StringUtils.isNotEmpty(bo.getRanks()), GPatrolTeam::getCreateBy, !ObjectUtils.isEmpty(bo.getUids()) ? bo.getUids() : Arrays.asList(0L));
|
|
lqw.eq(StringUtils.isNotBlank(bo.getCreateBy()), GPatrolTeam::getCreateBy, bo.getCreateBy());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getCreateBy()), GPatrolTeam::getCreateBy, bo.getCreateBy());
|
|
if (!"-1".equals(bo.getProcessStatus())) {
|
|
if (!"-1".equals(bo.getProcessStatus())) {
|
|
lqw.eq(StringUtils.isNotBlank(bo.getProcessStatus()), GPatrolTeam::getProcessStatus, bo.getProcessStatus());
|
|
lqw.eq(StringUtils.isNotBlank(bo.getProcessStatus()), GPatrolTeam::getProcessStatus, bo.getProcessStatus());
|
|
@@ -91,6 +154,10 @@ public class GPatrolTeamServiceImpl extends ServicePlusImpl<GPatrolTeamMapper, G
|
|
lqw.or().in(StringUtils.isNotBlank(bo.getProcessStatus()), GPatrolTeam::getProcessStatus, "-1","");
|
|
lqw.or().in(StringUtils.isNotBlank(bo.getProcessStatus()), GPatrolTeam::getProcessStatus, "-1","");
|
|
lqw.or().isNull(GPatrolTeam::getProcessStatus);
|
|
lqw.or().isNull(GPatrolTeam::getProcessStatus);
|
|
}
|
|
}
|
|
|
|
+ if (!ObjectUtils.isEmpty(bo.getCreateTimes())){
|
|
|
|
+ lqw.ge(GPatrolTeam::getCreateTime, bo.getCreateTimes().get(0));
|
|
|
|
+ lqw.le(GPatrolTeam::getCreateTime, bo.getCreateTimes().get(1));
|
|
|
|
+ }
|
|
lqw.orderByDesc(GPatrolTeam::getCreateTime);
|
|
lqw.orderByDesc(GPatrolTeam::getCreateTime);
|
|
return lqw;
|
|
return lqw;
|
|
}
|
|
}
|
|
@@ -147,6 +214,7 @@ public class GPatrolTeamServiceImpl extends ServicePlusImpl<GPatrolTeamMapper, G
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
}
|
|
|
|
+ update.setProcessStatus("-1");
|
|
return updateById(update);
|
|
return updateById(update);
|
|
}
|
|
}
|
|
|
|
|
|
@@ -160,10 +228,12 @@ public class GPatrolTeamServiceImpl extends ServicePlusImpl<GPatrolTeamMapper, G
|
|
}
|
|
}
|
|
|
|
|
|
@Override
|
|
@Override
|
|
|
|
+ @Transactional(rollbackFor = Exception.class)
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
public Boolean deleteWithValidByIds(Collection<Long> ids, Boolean isValid) {
|
|
- if (isValid) {
|
|
|
|
|
|
+ if(isValid){
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
//TODO 做一些业务上的校验,判断是否需要校验
|
|
}
|
|
}
|
|
|
|
+ teamProcessService.remove(new QueryWrapper<GTeamProcess>().in("emr_id", ids));
|
|
return removeByIds(ids);
|
|
return removeByIds(ids);
|
|
}
|
|
}
|
|
}
|
|
}
|