比对模式的检测报告生成和下载
This commit is contained in:
@@ -3,6 +3,7 @@ package com.njcn.gather.storage.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.storage.pojo.po.ContrastHarmonicResult;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -33,4 +34,27 @@ public interface ContrastHarmonicService extends IService<ContrastHarmonicResult
|
||||
* @return
|
||||
*/
|
||||
List<ContrastHarmonicResult> listAllResultData(String code, Integer num, Integer waveNum, Boolean isWave, String devId, List<String> adTypeList);
|
||||
|
||||
|
||||
/**
|
||||
* 获取谐波检测项的比对结果
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param resultType 结果类型
|
||||
* @param time 第几次检测
|
||||
* @return 检测结果
|
||||
*/
|
||||
ContrastHarmonicResult getContrastResultHarm(Integer planCode, String monitorId, List<String> scriptId, String resultType, int time);
|
||||
|
||||
/**
|
||||
* 去原始表获取总次数
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param resultType 结果类型
|
||||
* @param time 第几次检测
|
||||
* @return 数据组数
|
||||
*/
|
||||
int getNumOfData(Integer planCode, String monitorId, List<String> scriptId, String resultType, int time);
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.njcn.gather.storage.service;
|
||||
import com.baomidou.mybatisplus.extension.service.IService;
|
||||
import com.njcn.gather.storage.pojo.po.ContrastNonHarmonicResult;
|
||||
|
||||
import javax.validation.constraints.NotBlank;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -39,4 +40,27 @@ public interface ContrastNonHarmonicService extends IService<ContrastNonHarmonic
|
||||
*/
|
||||
|
||||
List<ContrastNonHarmonicResult> listAllResultData(String code, Integer num, Integer waveNum, Boolean isWave, String devId, List<String> adTypeList);
|
||||
|
||||
/**
|
||||
* 获取非谐波检测项的比对结果
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param resultType 结果类型
|
||||
* @param time 第几次检测
|
||||
* @return 检测结果
|
||||
*/
|
||||
ContrastNonHarmonicResult getContrastResultHarm(Integer planCode, String monitorId, List<String> scriptId, String resultType, int time);
|
||||
|
||||
/**
|
||||
* 去原始表获取总次数
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param resultType 结果类型
|
||||
* @param time 第几次检测
|
||||
* @return 数据组数
|
||||
*/
|
||||
int getNumOfData(Integer planCode, String monitorId, List<String> scriptId, String resultType, int time);
|
||||
|
||||
}
|
||||
|
||||
@@ -1,9 +1,11 @@
|
||||
package com.njcn.gather.storage.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||
import com.njcn.gather.storage.mapper.ContrastHarmonicMappper;
|
||||
import com.njcn.gather.storage.pojo.po.ContrastHarmonicResult;
|
||||
@@ -11,6 +13,7 @@ import com.njcn.gather.storage.service.ContrastHarmonicService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -45,6 +48,9 @@ public class ContrastHarmonicServiceImpl extends ServiceImpl<ContrastHarmonicMap
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
* todo... 缺少统计的数据获取逻辑
|
||||
*/
|
||||
@Override
|
||||
public List<ContrastHarmonicResult> listAllResultData(String code, Integer num, Integer waveNum, Boolean isWave, String devId, List<String> adTypeList) {
|
||||
String prefix = "ad_harmonic_result_" + code;
|
||||
@@ -65,4 +71,72 @@ public class ContrastHarmonicServiceImpl extends ServiceImpl<ContrastHarmonicMap
|
||||
DynamicTableNameHandler.remove();
|
||||
return result;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param resultType 结果类型
|
||||
* @param time 第几次检测
|
||||
* @return 检测结果
|
||||
*/
|
||||
@Override
|
||||
public ContrastHarmonicResult getContrastResultHarm(Integer planCode, String monitorId, List<String> scriptId, String resultType, int time) {
|
||||
boolean isWave = resultType.contains("wave_data");
|
||||
int waveTime = 1;
|
||||
if (isWave) {
|
||||
// 说明是要进一步拆解type,查询录波的数据
|
||||
// 从 wave_data_1 格式中提取录波次数
|
||||
String[] parts = resultType.split("_");
|
||||
if (parts.length > 2) {
|
||||
waveTime = Integer.parseInt(parts[parts.length - 1]);
|
||||
}
|
||||
}
|
||||
List<ContrastHarmonicResult> result = this.listAllResultData(String.valueOf(planCode), time, waveTime, isWave, monitorId, scriptId);
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
return result.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/**
|
||||
* 去原始表获取总次数
|
||||
* @param planCode 计划code
|
||||
* @param monitorId 监测点ID
|
||||
* @param scriptId 指标id
|
||||
* @param resultType 结果类型
|
||||
* @param time 第几次检测
|
||||
* @return 数据组数
|
||||
*/
|
||||
@Override
|
||||
public int getNumOfData(Integer planCode, String monitorId, List<String> scriptId, String resultType, int time) {
|
||||
String prefix = "ad_harmonic_" + planCode;
|
||||
DynamicTableNameHandler.setTableName(prefix);
|
||||
boolean isWave = resultType.contains("wave_data");
|
||||
int waveTime = 1;
|
||||
if (isWave) {
|
||||
// 说明是要进一步拆解type,查询录波的数据
|
||||
// 从 wave_data_1 格式中提取录波次数
|
||||
String[] parts = resultType.split("_");
|
||||
if (parts.length > 2) {
|
||||
waveTime = Integer.parseInt(parts[parts.length - 1]);
|
||||
}
|
||||
}
|
||||
LambdaQueryChainWrapper<ContrastHarmonicResult> wrapper = this.lambdaQuery()
|
||||
.eq(ContrastHarmonicResult::getDevMonitorId, monitorId)
|
||||
.in(ContrastHarmonicResult::getAdType, scriptId)
|
||||
.eq(ContrastHarmonicResult::getFlag, 0)
|
||||
.eq(ContrastHarmonicResult::getNum, time);
|
||||
if(isWave){
|
||||
wrapper.eq(ContrastHarmonicResult::getDataType, "wave_data")
|
||||
.eq(ContrastHarmonicResult::getWaveNum, waveTime);
|
||||
}else{
|
||||
wrapper.eq(ContrastHarmonicResult::getDataType, resultType);
|
||||
}
|
||||
// 执行查询并统计满足条件的记录数
|
||||
int count = wrapper.count();
|
||||
DynamicTableNameHandler.remove();
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.njcn.gather.storage.service.impl;
|
||||
|
||||
import cn.hutool.core.collection.CollUtil;
|
||||
import cn.hutool.core.collection.CollectionUtil;
|
||||
import cn.hutool.core.util.ObjectUtil;
|
||||
import com.baomidou.mybatisplus.extension.conditions.query.LambdaQueryChainWrapper;
|
||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||
@@ -11,6 +12,7 @@ import com.njcn.gather.storage.service.ContrastNonHarmonicService;
|
||||
import lombok.RequiredArgsConstructor;
|
||||
import org.springframework.stereotype.Service;
|
||||
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
@@ -65,4 +67,54 @@ public class ContrastNonHarmonicServiceImpl extends ServiceImpl<ContrastNonHarmo
|
||||
DynamicTableNameHandler.remove();
|
||||
return result;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ContrastNonHarmonicResult getContrastResultHarm(Integer planCode, String monitorId, List<String> scriptId, String resultType, int time) {
|
||||
boolean isWave = resultType.contains("wave_data");
|
||||
int waveTime = 1;
|
||||
if (isWave) {
|
||||
// 说明是要进一步拆解type,查询录波的数据
|
||||
// 从 wave_data_1 格式中提取录波次数
|
||||
String[] parts = resultType.split("_");
|
||||
if (parts.length > 2) {
|
||||
waveTime = Integer.parseInt(parts[parts.length - 1]);
|
||||
}
|
||||
}
|
||||
List<ContrastNonHarmonicResult> result = this.listAllResultData(String.valueOf(planCode), time, waveTime, isWave, monitorId, scriptId);
|
||||
if (CollectionUtil.isNotEmpty(result)) {
|
||||
return result.get(0);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getNumOfData(Integer planCode, String monitorId, List<String> scriptId, String resultType, int time) {
|
||||
String prefix = "ad_non_harmonic_" + planCode;
|
||||
DynamicTableNameHandler.setTableName(prefix);
|
||||
boolean isWave = resultType.contains("wave_data");
|
||||
int waveTime = 1;
|
||||
if (isWave) {
|
||||
// 说明是要进一步拆解type,查询录波的数据
|
||||
// 从 wave_data_1 格式中提取录波次数
|
||||
String[] parts = resultType.split("_");
|
||||
if (parts.length > 2) {
|
||||
waveTime = Integer.parseInt(parts[parts.length - 1]);
|
||||
}
|
||||
}
|
||||
LambdaQueryChainWrapper<ContrastNonHarmonicResult> wrapper = this.lambdaQuery()
|
||||
.eq(ContrastNonHarmonicResult::getDevMonitorId, monitorId)
|
||||
.in(ContrastNonHarmonicResult::getAdType, scriptId)
|
||||
.eq(ContrastNonHarmonicResult::getFlag, 0)
|
||||
.eq(ContrastNonHarmonicResult::getNum, time);
|
||||
if(isWave){
|
||||
wrapper.eq(ContrastNonHarmonicResult::getDataType, "wave_data")
|
||||
.eq(ContrastNonHarmonicResult::getWaveNum, waveTime);
|
||||
}else{
|
||||
wrapper.eq(ContrastNonHarmonicResult::getDataType, resultType);
|
||||
}
|
||||
// 执行查询并统计满足条件的记录数
|
||||
int count = wrapper.count();
|
||||
DynamicTableNameHandler.remove();
|
||||
return count;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user