增加正式监测流程,监测状态变更
This commit is contained in:
@@ -39,6 +39,12 @@
|
||||
<artifactId>fastjson</artifactId>
|
||||
<version>1.2.83</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.njcn.gather</groupId>
|
||||
<artifactId>storage</artifactId>
|
||||
<version>1.0.0</version>
|
||||
<scope>compile</scope>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
|
||||
|
||||
@@ -171,4 +171,20 @@ public interface IPqDevService extends IService<PqDev> {
|
||||
* @return 归档成功返回true,否则返回false
|
||||
*/
|
||||
boolean documented(String id);
|
||||
|
||||
/**
|
||||
* 修改监测状态
|
||||
* @param ids
|
||||
* @return
|
||||
*/
|
||||
boolean updateCheckState(List<String> ids);
|
||||
|
||||
|
||||
/**
|
||||
* 正式监测完成,修改中断状态
|
||||
* @param ids
|
||||
* @param code
|
||||
* @return
|
||||
*/
|
||||
boolean updateResult(List<String> ids,String code);
|
||||
}
|
||||
|
||||
@@ -5,7 +5,9 @@ import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import cn.hutool.core.util.StrUtil;
|
||||
import com.baomidou.mybatisplus.core.conditions.Wrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
||||
import com.baomidou.mybatisplus.core.conditions.update.LambdaUpdateWrapper;
|
||||
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.njcn.common.pojo.enums.common.DataStateEnum;
|
||||
@@ -24,6 +26,7 @@ import com.njcn.gather.device.monitor.pojo.po.PqMonitor;
|
||||
import com.njcn.gather.device.monitor.pojo.vo.PqMonitorExcel;
|
||||
import com.njcn.gather.device.monitor.service.IPqMonitorService;
|
||||
import com.njcn.gather.device.pojo.enums.*;
|
||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||
import com.njcn.web.factory.PageFactory;
|
||||
@@ -48,6 +51,8 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
|
||||
private final IDictDataService dictDataService;
|
||||
private final IPqMonitorService pqMonitorService;
|
||||
private final DetectionDataDealService detectionDataDealService;
|
||||
|
||||
|
||||
@Override
|
||||
public Page<PqDev> listPqDevs(PqDevParam.QueryParam queryParam) {
|
||||
@@ -414,7 +419,7 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
@Override
|
||||
public List<PreDetection> getDevInfo(List<String> devIds) {
|
||||
List<PreDetection> preDetections = this.baseMapper.selectDevInfo(devIds);
|
||||
if(devIds.size() != preDetections.size()){
|
||||
if (devIds.size() != preDetections.size()) {
|
||||
throw new BusinessException(DevResponseEnum.DEVICE_DIS_ERROR);
|
||||
}
|
||||
|
||||
@@ -451,6 +456,37 @@ public class PqDevServiceImpl extends ServiceImpl<PqDevMapper, PqDev> implements
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateCheckState(List<String> ids) {
|
||||
if (CollUtil.isNotEmpty(ids)) {
|
||||
return this.update(new LambdaUpdateWrapper<PqDev>()
|
||||
.set(PqDev::getCheckState, CheckStateEnum.CHECKING.getValue())
|
||||
.in(PqDev::getId, ids));
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean updateResult(List<String> ids,String code) {
|
||||
if(CollUtil.isNotEmpty(ids)){
|
||||
Map<String, Integer> result = detectionDataDealService.devResult(ids, code);
|
||||
List<PqDev> list = this.list(new LambdaQueryWrapper<PqDev>().in(PqDev::getId, ids));
|
||||
for (PqDev pqDev : list) {
|
||||
if(result.containsKey(pqDev.getId())){
|
||||
this.update(new LambdaUpdateWrapper<PqDev>()
|
||||
.set(PqDev::getReCheckNum, pqDev.getReCheckNum()+1)
|
||||
.set(PqDev::getCheckState, CheckStateEnum.CHECKED.getValue())
|
||||
.set(PqDev::getCheckResult, result.get(pqDev.getId()))
|
||||
.set(PqDev::getReportState, DevReportStateEnum.NOT_GENERATED.getValue())
|
||||
.eq(PqDev::getId, pqDev.getId()));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取检测状态饼状图数据
|
||||
*
|
||||
|
||||
@@ -219,8 +219,8 @@ public class PqScriptDtlsServiceImpl extends ServiceImpl<PqScriptDtlsMapper, PqS
|
||||
queryWrapper.selectAll(PqScriptDtls.class)
|
||||
.selectAs(DictTree::getCode, PqScriptDtls::getScriptCode)
|
||||
.leftJoin(DictTree.class, DictTree::getId, PqScriptDtls::getScriptType)
|
||||
// .ge(PqScriptDtls::getIndex, 9)
|
||||
// .ge(PqScriptDtls::getIndex, 48)
|
||||
// .eq(PqScriptDtls::getIndex, 1)
|
||||
.le(PqScriptDtls::getIndex, 8)
|
||||
// .in(PqScriptDtls::getIndex, Arrays.asList(30,101,105))
|
||||
|
||||
.eq(PqScriptCheckData::getEnable, DataStateEnum.ENABLE.getCode());
|
||||
|
||||
Reference in New Issue
Block a user