修改计划的检测结果状态
This commit is contained in:
@@ -592,20 +592,22 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
// 如果非归档状态的设备数量为0,则更新计划已完成
|
||||
this.baseMapper.finishPlan(pqDev.getPlanId());
|
||||
}
|
||||
queryWrapper.clear();
|
||||
}
|
||||
|
||||
queryWrapper.eq(PqDev::getPlanId, pqDev.getPlanId())
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode());
|
||||
List<PqDev> pqDevList = this.list(queryWrapper);
|
||||
if (CollUtil.isNotEmpty(pqDevList)) {
|
||||
Set<Integer> set = pqDevList.stream().map(PqDev::getCheckResult).collect(Collectors.toSet());
|
||||
if (set.contains(CheckResultEnum.NOT_ACCORD.getValue())) {
|
||||
this.baseMapper.updatePlanCheckResult(pqDev.getPlanId(), CheckResultEnum.NOT_ACCORD.getValue());
|
||||
} else if (set.contains(CheckResultEnum.UNCHECKED.getValue())) {
|
||||
this.baseMapper.updatePlanCheckResult(pqDev.getPlanId(), CheckResultEnum.UNCHECKED.getValue());
|
||||
} else {
|
||||
this.baseMapper.updatePlanCheckResult(pqDev.getPlanId(), CheckResultEnum.ACCORD.getValue());
|
||||
}
|
||||
LambdaQueryWrapper<PqDev> queryWrapper = new LambdaQueryWrapper<>();
|
||||
|
||||
queryWrapper.eq(PqDev::getPlanId, pqDev.getPlanId())
|
||||
.eq(PqDev::getState, DataStateEnum.ENABLE.getCode());
|
||||
List<PqDev> pqDevList = this.list(queryWrapper);
|
||||
if (CollUtil.isNotEmpty(pqDevList)) {
|
||||
Set<Integer> set = pqDevList.stream().map(PqDev::getCheckResult).collect(Collectors.toSet());
|
||||
if (set.contains(CheckResultEnum.NOT_ACCORD.getValue())) {
|
||||
this.baseMapper.updatePlanCheckResult(pqDev.getPlanId(), CheckResultEnum.NOT_ACCORD.getValue());
|
||||
} else if (set.contains(CheckResultEnum.UNCHECKED.getValue())) {
|
||||
this.baseMapper.updatePlanCheckResult(pqDev.getPlanId(), CheckResultEnum.UNCHECKED.getValue());
|
||||
} else {
|
||||
this.baseMapper.updatePlanCheckResult(pqDev.getPlanId(), CheckResultEnum.ACCORD.getValue());
|
||||
}
|
||||
|
||||
// set = pqDevList.stream().map(PqDev::getCheckState).collect(Collectors.toSet());
|
||||
// if (set.contains(CheckStateEnum.UNCHECKED.getValue())) {
|
||||
@@ -613,7 +615,6 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
// } else {
|
||||
// this.baseMapper.updatePlanTestState(pqDev.getPlanId(), CheckStateEnum.CHECKED.getValue());
|
||||
// }
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -12,20 +12,14 @@ import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
import com.njcn.common.pojo.exception.BusinessException;
|
||||
import com.njcn.gather.device.pojo.enums.TimeCheckResultEnum;
|
||||
import com.njcn.gather.device.pojo.enums.*;
|
||||
import com.njcn.gather.device.pojo.param.PqDevParam;
|
||||
import com.njcn.gather.device.pojo.po.PqDev;
|
||||
import com.njcn.gather.device.service.IPqDevService;
|
||||
import com.njcn.gather.err.service.IPqErrSysService;
|
||||
import com.njcn.gather.device.pojo.enums.*;
|
||||
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.script.service.IPqScriptService;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.source.service.IPqSourceService;
|
||||
import com.njcn.gather.plan.mapper.AdPlanMapper;
|
||||
import com.njcn.gather.plan.pojo.enums.DataSourceEnum;
|
||||
import com.njcn.gather.plan.pojo.enums.PlanReportStateEnum;
|
||||
import com.njcn.gather.plan.pojo.enums.PlanResponseEnum;
|
||||
import com.njcn.gather.plan.pojo.param.AdPlanParam;
|
||||
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||
@@ -33,6 +27,11 @@ import com.njcn.gather.plan.pojo.vo.AdPlanExcel;
|
||||
import com.njcn.gather.plan.pojo.vo.AdPlanVO;
|
||||
import com.njcn.gather.plan.service.IAdPlanService;
|
||||
import com.njcn.gather.plan.service.IAdPlanSourceService;
|
||||
import com.njcn.gather.script.pojo.po.PqScriptDtls;
|
||||
import com.njcn.gather.script.service.IPqScriptDtlsService;
|
||||
import com.njcn.gather.script.service.IPqScriptService;
|
||||
import com.njcn.gather.source.pojo.po.PqSource;
|
||||
import com.njcn.gather.source.service.IPqSourceService;
|
||||
import com.njcn.gather.storage.service.TableGenService;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
@@ -98,7 +97,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean addAdPlan(AdPlanParam param) {
|
||||
this.checkRepeat(param,false);
|
||||
this.checkRepeat(param, false);
|
||||
AdPlan adPlan = new AdPlan();
|
||||
BeanUtil.copyProperties(param, adPlan);
|
||||
|
||||
@@ -136,7 +135,7 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
@Override
|
||||
@Transactional(rollbackFor = {Exception.class})
|
||||
public boolean updateAdPlan(AdPlanParam.UpdateParam param) {
|
||||
this.checkRepeat(param,true);
|
||||
this.checkRepeat(param, true);
|
||||
AdPlan adPlan = new AdPlan();
|
||||
BeanUtil.copyProperties(param, adPlan);
|
||||
|
||||
@@ -337,10 +336,10 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("id", key);
|
||||
DictTree dictTree = dictTreeService.getById(key);
|
||||
if(ObjectUtil.isNotNull(dictTree)){
|
||||
if (ObjectUtil.isNotNull(dictTree)) {
|
||||
map.put("code", dictTree.getCode());
|
||||
map.put("scriptName", dictTree.getName());
|
||||
}else{
|
||||
} else {
|
||||
throw new BusinessException(PlanResponseEnum.SCRIPT_RELATE_DICT_NOT_EXIST);
|
||||
}
|
||||
result.add(map);
|
||||
@@ -368,11 +367,11 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
List<PqDev> devList = pqDevService.list(new LambdaQueryWrapper<PqDev>().in(PqDev::getId, devIds));
|
||||
if (CollUtil.isNotEmpty(devList)) {
|
||||
for (PqDev pqDev : devList) {
|
||||
if(!pqDev.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())){
|
||||
if (!pqDev.getCheckResult().equals(CheckResultEnum.UNCHECKED.getValue())) {
|
||||
pqDevService.update(new LambdaUpdateWrapper<PqDev>()
|
||||
.set(PqDev::getCheckState, CheckStateEnum.CHECKED.getValue())
|
||||
.in(PqDev::getId, devIds));
|
||||
}else{
|
||||
} else {
|
||||
pqDevService.update(new LambdaUpdateWrapper<PqDev>()
|
||||
.set(PqDev::getCheckState, CheckStateEnum.UNCHECKED.getValue())
|
||||
.in(PqDev::getId, devIds));
|
||||
@@ -426,7 +425,11 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
* @return
|
||||
*/
|
||||
private Integer generateCode() {
|
||||
return this.lambdaQuery().select(AdPlan::getCode).orderByDesc(AdPlan::getCode).last("LIMIT 1").one().getCode() + 1;
|
||||
AdPlan plan = this.lambdaQuery().select(AdPlan::getCode).orderByDesc(AdPlan::getCode).last("LIMIT 1").one();
|
||||
if (ObjectUtil.isNotNull(plan)) {
|
||||
return plan.getCode() + 1;
|
||||
}
|
||||
return 1;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user