正式检测-收取数据、原始数据组装和入库、配对关系入库、误差计算逻辑
This commit is contained in:
@@ -171,7 +171,7 @@ public class AdPlanController extends BaseController {
|
||||
public HttpResult<List<Map<String, String>>> getBigTestItem(@RequestBody AdPlanParam.CheckParam checkParam) {
|
||||
String methodDescribe = getMethodDescribe("getBigTestItem");
|
||||
LogUtil.njcnDebug(log, "{},查询数据为:{}", methodDescribe, checkParam);
|
||||
List<Map<String, String>> result = adPlanService.getBigTestItem(checkParam.getReCheckType(), checkParam.getPlanId(), checkParam.getDevIds());
|
||||
List<Map<String, String>> result = adPlanService.getBigTestItem(checkParam.getReCheckType(), checkParam.getPlanId(), checkParam.getDevIds(), checkParam.getPatternId());
|
||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, result, methodDescribe);
|
||||
}
|
||||
|
||||
|
||||
@@ -118,5 +118,6 @@ public class AdPlanParam {
|
||||
private Integer reCheckType;
|
||||
private String planId;
|
||||
private List<String> devIds;
|
||||
private String patternId;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -45,12 +45,11 @@ public interface IAdPlanService extends IService<AdPlan> {
|
||||
/**
|
||||
* 删除检测计划
|
||||
*
|
||||
* @param ids 检测计划id列表
|
||||
* @param ids 检测计划id列表
|
||||
* @param pattern 模式Id
|
||||
*
|
||||
* @return 删除成功则返回true,否则返回false
|
||||
*/
|
||||
boolean deleteAdPlan(List<String> ids,String pattern);
|
||||
boolean deleteAdPlan(List<String> ids, String pattern);
|
||||
|
||||
/**
|
||||
* 根据模式查询检测计划
|
||||
@@ -70,12 +69,13 @@ public interface IAdPlanService extends IService<AdPlan> {
|
||||
/**
|
||||
* 获取检测大项
|
||||
*
|
||||
* @param reCheckType 0:不合格项复检 1:全部复检
|
||||
* @param planId 检测计划Id
|
||||
* @param devIds 设备Id列表
|
||||
* @param reCheckType 0:不合格项复检 1:全部复检
|
||||
* @param planId 检测计划Id
|
||||
* @param devIds 设备Id列表
|
||||
* @param patternId 模式Id
|
||||
* @return
|
||||
*/
|
||||
List<Map<String, String>> getBigTestItem(Integer reCheckType, String planId, List<String> devIds);
|
||||
List<Map<String, String>> getBigTestItem(Integer reCheckType, String planId, List<String> devIds, String patternId);
|
||||
|
||||
/**
|
||||
* 修改计划状态
|
||||
@@ -150,7 +150,6 @@ public interface IAdPlanService extends IService<AdPlan> {
|
||||
*
|
||||
* @param planId
|
||||
* @param name
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean updateSubPlanName(String planId, String name);
|
||||
|
||||
@@ -510,18 +510,30 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<Map<String, String>> getBigTestItem(Integer reCheckType, String planId, List<String> devIds) {
|
||||
public List<Map<String, String>> getBigTestItem(Integer reCheckType, String planId, List<String> devIds, String patternId) {
|
||||
List<Map<String, String>> result = new ArrayList<>();
|
||||
AdPlan adPlan = this.getById(planId);
|
||||
if (ObjectUtil.isNull(adPlan)) {
|
||||
throw new BusinessException(DetectionResponseEnum.PLAN_NOT_EXIST);
|
||||
}
|
||||
String scriptId = adPlan.getScriptId();
|
||||
DictData dictData = dictDataService.getById(patternId);
|
||||
if (PatternEnum.CONTRAST.getValue().equals(dictData.getCode())) {
|
||||
String[] split = adPlan.getTestItem().split(StrUtil.COMMA);
|
||||
List<DictTree> dictTreeList = dictTreeService.list(new QueryWrapper<DictTree>().in("id", split).eq("state", DataStateEnum.DELETED.getCode()));
|
||||
|
||||
List<PqScriptDtls> scriptDtlsList = pqScriptDtlsService.listPqScriptDtlByScriptId(scriptId);
|
||||
for (DictTree dictTree : dictTreeList) {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("id", dictTree.getId());
|
||||
map.put("code", dictTree.getCode());
|
||||
map.put("scriptName", dictTree.getName());
|
||||
result.add(map);
|
||||
}
|
||||
} else {
|
||||
String scriptId = adPlan.getScriptId();
|
||||
List<PqScriptDtls> scriptDtlsList = pqScriptDtlsService.listPqScriptDtlByScriptId(scriptId);
|
||||
|
||||
// 不合格项复检
|
||||
if (reCheckType == 0) {
|
||||
// 不合格项复检
|
||||
if (reCheckType == 0) {
|
||||
// List<SimAndDigBaseResult> allResultList = new ArrayList<>();
|
||||
// allResultList.addAll(adHarmonicService.get(scriptId, null, devId, "-1", adPlan.getCode()));
|
||||
// allResultList.addAll(adNonHarmonicService.get(scriptId, null, devId, "-1", adPlan.getCode()));
|
||||
@@ -532,33 +544,35 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
||||
//
|
||||
// scriptDtlsList = scriptDtlsList.stream().filter(obj -> !sortSet.contains(obj.getScriptIndex())).collect(Collectors.toList());
|
||||
// }
|
||||
Set<Integer> indexes = new HashSet<>();
|
||||
StorageParam storageParam = new StorageParam();
|
||||
storageParam.setCode(adPlan.getCode() + "");
|
||||
storageParam.setScriptId(adPlan.getScriptId());
|
||||
devIds.forEach(devId -> {
|
||||
storageParam.setDevId(devId);
|
||||
indexes.addAll(adHarmonicService.getIndex(storageParam));
|
||||
Set<Integer> indexes = new HashSet<>();
|
||||
StorageParam storageParam = new StorageParam();
|
||||
storageParam.setCode(adPlan.getCode() + "");
|
||||
storageParam.setScriptId(adPlan.getScriptId());
|
||||
devIds.forEach(devId -> {
|
||||
storageParam.setDevId(devId);
|
||||
indexes.addAll(adHarmonicService.getIndex(storageParam));
|
||||
});
|
||||
scriptDtlsList = scriptDtlsList.stream().filter(obj -> indexes.contains(obj.getScriptIndex())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Map<String, List<PqScriptDtls>> collect = scriptDtlsList.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getScriptIndex))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getScriptType, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
collect.forEach((key, value) -> {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("id", key);
|
||||
DictTree dictTree = dictTreeService.getById(key);
|
||||
if (ObjectUtil.isNotNull(dictTree)) {
|
||||
map.put("code", dictTree.getCode());
|
||||
map.put("scriptName", dictTree.getName());
|
||||
} else {
|
||||
throw new BusinessException(DetectionResponseEnum.SCRIPT_RELATE_DICT_NOT_EXIST);
|
||||
}
|
||||
result.add(map);
|
||||
});
|
||||
scriptDtlsList = scriptDtlsList.stream().filter(obj -> indexes.contains(obj.getScriptIndex())).collect(Collectors.toList());
|
||||
}
|
||||
|
||||
Map<String, List<PqScriptDtls>> collect = scriptDtlsList.stream()
|
||||
.sorted(Comparator.comparing(PqScriptDtls::getScriptIndex))
|
||||
.collect(Collectors.groupingBy(PqScriptDtls::getScriptType, LinkedHashMap::new, Collectors.toList()));
|
||||
|
||||
collect.forEach((key, value) -> {
|
||||
Map<String, String> map = new HashMap<>();
|
||||
map.put("id", key);
|
||||
DictTree dictTree = dictTreeService.getById(key);
|
||||
if (ObjectUtil.isNotNull(dictTree)) {
|
||||
map.put("code", dictTree.getCode());
|
||||
map.put("scriptName", dictTree.getName());
|
||||
} else {
|
||||
throw new BusinessException(DetectionResponseEnum.SCRIPT_RELATE_DICT_NOT_EXIST);
|
||||
}
|
||||
result.add(map);
|
||||
});
|
||||
|
||||
return result;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user