脚本详情项禁用后,该脚本详情项的结果不参与装置的检测结果

This commit is contained in:
caozehui
2025-03-11 15:31:26 +08:00
parent c60d41af10
commit 708a4e6fbd
4 changed files with 63 additions and 44 deletions

View File

@@ -37,8 +37,8 @@ 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.mapper.DetectionDataDealMapper;
import com.njcn.gather.storage.pojo.param.StorageParam;
import com.njcn.gather.storage.pojo.po.AdBaseResult;
import com.njcn.gather.storage.service.AdHarmonicService;
import com.njcn.gather.storage.service.AdNonHarmonicService;
import com.njcn.gather.storage.service.TableGenService;
@@ -95,7 +95,6 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
private final ISysTestConfigService sysTestConfigService;
private final IDevTypeService devTypeService;
private final IDictTypeService dictTypeService;
private final AdNonHarmonicService adNonHarmonicService;
private final AdHarmonicService adHarmonicService;
@Override

View File

@@ -3,9 +3,17 @@ package com.njcn.gather.storage.mapper;
import com.njcn.db.mybatisplus.mapper.BatchBaseMapper;
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
import java.util.List;
public interface DetectionDataDealMapper extends BatchBaseMapper<AdHarmonicResult> {
/**
* 根据设备ID查询禁用的脚本详情索引
*
* @param devId
* @return
*/
List<Integer> listDisabledScriptDtlIndexs(String devId);

View File

@@ -3,6 +3,14 @@
<mapper namespace="com.njcn.gather.storage.mapper.DetectionDataDealMapper">
<select id="listDisabledScriptDtlIndexs" resultType="java.lang.Integer">
select distinct dtls.Script_Index
from pq_script_dtls dtls
inner join ad_plan plan on dtls.Script_Id = plan.Script_Id
inner join pq_dev dev on dev.Plan_Id = plan.id
where dev.id = #{devId}
and dev.State = 1
and dtls.Enable = 0
</select>
</mapper>

View File

@@ -26,6 +26,7 @@ import java.util.stream.Collectors;
public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<DetectionDataDealMapper, AdHarmonicResult> implements DetectionDataDealService {
private final AdNonHarmonicService adNonHarmonicService;
private final DetectionDataDealMapper detectionDataDealMapper;
@Override
@@ -95,11 +96,13 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
@Override
public Map<String, Integer> devResult(List<String> ids, List<String> valueType, String code) {
List<Integer> disabledScriptDtlIndexs = detectionDataDealMapper.listDisabledScriptDtlIndexs(ids.get(0));
List<AdNonHarmonicResult> noHarm = new ArrayList<>();
for (String id : ids) {
DynamicTableNameHandler.setTableName("ad_non_harmonic_result_" + code);
noHarm.addAll(adNonHarmonicService.list(new LambdaQueryWrapper<AdNonHarmonicResult>()
.like(AdNonHarmonicResult::getMonitorId, id)
.notIn(CollUtil.isNotEmpty(disabledScriptDtlIndexs), AdNonHarmonicResult::getSort, disabledScriptDtlIndexs)
.in(CollUtil.isNotEmpty(valueType), AdNonHarmonicResult::getAdType, valueType)
));
}
@@ -109,6 +112,7 @@ public class DetectionDataServiceImpl extends ReplenishMybatisServiceImpl<Detect
DynamicTableNameHandler.setTableName("ad_harmonic_result_" + code);
harm.addAll(this.list(new LambdaQueryWrapper<AdHarmonicResult>()
.like(AdHarmonicResult::getMonitorId, id)
.notIn(CollUtil.isNotEmpty(disabledScriptDtlIndexs), AdHarmonicResult::getSort, disabledScriptDtlIndexs)
.in(CollUtil.isNotEmpty(valueType), AdHarmonicResult::getAdType, valueType)
));
}