1.正式检测-检测详情表格数据代码提交
This commit is contained in:
@@ -6,6 +6,7 @@ import com.njcn.common.pojo.response.HttpResult;
|
|||||||
import com.njcn.common.utils.LogUtil;
|
import com.njcn.common.utils.LogUtil;
|
||||||
import com.njcn.gather.result.pojo.param.ResultParam;
|
import com.njcn.gather.result.pojo.param.ResultParam;
|
||||||
import com.njcn.gather.result.pojo.vo.FormContentVO;
|
import com.njcn.gather.result.pojo.vo.FormContentVO;
|
||||||
|
import com.njcn.gather.result.pojo.vo.ResultVO;
|
||||||
import com.njcn.gather.result.pojo.vo.TreeDataVO;
|
import com.njcn.gather.result.pojo.vo.TreeDataVO;
|
||||||
import com.njcn.gather.result.service.IResultService;
|
import com.njcn.gather.result.service.IResultService;
|
||||||
import com.njcn.web.controller.BaseController;
|
import com.njcn.web.controller.BaseController;
|
||||||
@@ -55,4 +56,15 @@ public class ResultController extends BaseController {
|
|||||||
List<TreeDataVO> infoVOS = resultService.treeData(queryParam);
|
List<TreeDataVO> infoVOS = resultService.treeData(queryParam);
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, infoVOS, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, infoVOS, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@OperateInfo
|
||||||
|
@PostMapping("/resultData")
|
||||||
|
@ApiOperation("查询检测结果-表格具体检测项")
|
||||||
|
@ApiImplicitParam(name = "queryParam", value = "查询参数", required = true)
|
||||||
|
public HttpResult<ResultVO> resultData(@RequestBody @Validated ResultParam queryParam) {
|
||||||
|
String methodDescribe = getMethodDescribe("resultData");
|
||||||
|
ResultVO resultVO = resultService.resultData(queryParam);
|
||||||
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, resultVO, methodDescribe);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -40,6 +40,11 @@ public class ResultParam {
|
|||||||
*/
|
*/
|
||||||
private Integer code;
|
private Integer code;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测脚本序号
|
||||||
|
*/
|
||||||
|
private Integer index;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class QueryParam {
|
public static class QueryParam {
|
||||||
|
|
||||||
|
|||||||
@@ -1,9 +1,12 @@
|
|||||||
package com.njcn.gather.result.pojo.vo;
|
package com.njcn.gather.result.pojo.vo;
|
||||||
|
|
||||||
|
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
||||||
|
import com.njcn.gather.storage.pojo.vo.RawResultDataVO;
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
import java.util.Map;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -15,82 +18,12 @@ public class ResultVO {
|
|||||||
/**
|
/**
|
||||||
* 结果数据
|
* 结果数据
|
||||||
*/
|
*/
|
||||||
private List<ResultData> resultData;
|
private Map<String, RawResultDataVO> resultData;
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 原始数据
|
* 原始数据
|
||||||
*/
|
*/
|
||||||
private List<RawData> rawData;
|
private Map<String, List<RawDataVO>> rawData;
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class RawData {
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 时间
|
|
||||||
*/
|
|
||||||
private String time;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (间)谐波次数
|
|
||||||
*/
|
|
||||||
private Double harmNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A相数据
|
|
||||||
*/
|
|
||||||
private BigDecimal dataA;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* B相数据
|
|
||||||
*/
|
|
||||||
private BigDecimal dataB;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* C相数据
|
|
||||||
*/
|
|
||||||
private BigDecimal dataC;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
@Data
|
|
||||||
public static class ResultData {
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* 类别
|
|
||||||
*/
|
|
||||||
private String type;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* (间)谐波次数
|
|
||||||
*/
|
|
||||||
private Double harmNum;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* A相数据
|
|
||||||
*/
|
|
||||||
private BigDecimal DevDataA;
|
|
||||||
private BigDecimal SourceDataA;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* B相数据
|
|
||||||
*/
|
|
||||||
private BigDecimal DevDataB;
|
|
||||||
private BigDecimal SourceDataB;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* C相数据
|
|
||||||
*/
|
|
||||||
private BigDecimal DevDataC;
|
|
||||||
private BigDecimal SourceDataC;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* T相数据
|
|
||||||
*/
|
|
||||||
private BigDecimal DevDataT;
|
|
||||||
private BigDecimal SourceDataT;
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -14,6 +14,7 @@ import java.util.List;
|
|||||||
public interface IResultService {
|
public interface IResultService {
|
||||||
/**
|
/**
|
||||||
* 检测详情表单头
|
* 检测详情表单头
|
||||||
|
*
|
||||||
* @param queryParam
|
* @param queryParam
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
@@ -22,6 +23,7 @@ public interface IResultService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取检测详情信息
|
* 获取检测详情信息
|
||||||
|
*
|
||||||
* @param param
|
* @param param
|
||||||
* @return: java.util.List<com.njcn.gather.result.pojo.vo.DetectionInfoVO>
|
* @return: java.util.List<com.njcn.gather.result.pojo.vo.DetectionInfoVO>
|
||||||
* @Author: wr
|
* @Author: wr
|
||||||
@@ -31,9 +33,11 @@ public interface IResultService {
|
|||||||
|
|
||||||
/**
|
/**
|
||||||
* 展示结果数据
|
* 展示结果数据
|
||||||
|
*
|
||||||
* @param param
|
* @param param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
ResultVO resultData(ResultParam param);
|
ResultVO resultData(ResultParam param);
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -19,6 +19,7 @@ import com.njcn.gather.result.pojo.vo.FormContentVO;
|
|||||||
import com.njcn.gather.result.pojo.vo.ResultVO;
|
import com.njcn.gather.result.pojo.vo.ResultVO;
|
||||||
import com.njcn.gather.result.pojo.vo.TreeDataVO;
|
import com.njcn.gather.result.pojo.vo.TreeDataVO;
|
||||||
import com.njcn.gather.result.service.IResultService;
|
import com.njcn.gather.result.service.IResultService;
|
||||||
|
import com.njcn.gather.storage.pojo.param.StorageParam;
|
||||||
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
||||||
import com.njcn.gather.storage.service.AdHarmonicService;
|
import com.njcn.gather.storage.service.AdHarmonicService;
|
||||||
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
||||||
@@ -779,9 +780,27 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ResultVO resultData(ResultParam param) {
|
public ResultVO resultData(ResultParam param) {
|
||||||
|
StorageParam storage=new StorageParam();
|
||||||
|
storage.setIndex(param.getIndex());
|
||||||
return null;
|
storage.setScriptId(param.getScriptId());
|
||||||
|
storage.setDevId(param.getDevId());
|
||||||
|
storage.setDevNum(param.getDevNum());
|
||||||
|
storage.setCode(param.getCode());
|
||||||
|
List<PqScriptCheckData> list = pqScriptCheckDataService.list(new MPJLambdaWrapper<PqScriptCheckData>()
|
||||||
|
.eq(PqScriptCheckData::getScriptId, param.getScriptId())
|
||||||
|
.eq(PqScriptCheckData::getIndex, param.getIndex())
|
||||||
|
);
|
||||||
|
List<Double> harmNum = list.stream().map(PqScriptCheckData::getHarmNum).collect(Collectors.toList());
|
||||||
|
ResultVO resultVO=new ResultVO();
|
||||||
|
if(CollUtil.isNotEmpty(harmNum)){
|
||||||
|
storage.setHarmNum(harmNum);
|
||||||
|
resultVO.setRawData(adNonHarmonicService.listNonHarmData(storage));
|
||||||
|
resultVO.setResultData(adNonHarmonicService.listNonHarmResultData(storage));
|
||||||
|
}else{
|
||||||
|
resultVO.setRawData(adHarmonicService.listHarmData(storage));
|
||||||
|
resultVO.setResultData(adHarmonicService.listHarmResultData(storage));
|
||||||
|
}
|
||||||
|
return resultVO;
|
||||||
}
|
}
|
||||||
|
|
||||||
private static void dtlsSetBuffer(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit, Boolean fly) {
|
private static void dtlsSetBuffer(List<PqScriptDtls> scriptDtlIndex, StringBuffer buffer, String valueType, String name, String unit, Boolean fly) {
|
||||||
|
|||||||
@@ -2,7 +2,6 @@ package com.njcn.gather.storage.pojo.vo;
|
|||||||
|
|
||||||
import lombok.Data;
|
import lombok.Data;
|
||||||
|
|
||||||
import java.math.BigDecimal;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author wr
|
* @author wr
|
||||||
@@ -26,20 +25,20 @@ public class RawDataVO {
|
|||||||
/**
|
/**
|
||||||
* A相数据
|
* A相数据
|
||||||
*/
|
*/
|
||||||
private BigDecimal dataA;
|
private String dataA;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* B相数据
|
* B相数据
|
||||||
*/
|
*/
|
||||||
private BigDecimal dataB;
|
private String dataB;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* C相数据
|
* C相数据
|
||||||
*/
|
*/
|
||||||
private BigDecimal dataC;
|
private String dataC;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* C相数据
|
* T相数据
|
||||||
*/
|
*/
|
||||||
private BigDecimal dataT;
|
private String dataT;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,80 @@
|
|||||||
|
package com.njcn.gather.storage.pojo.vo;
|
||||||
|
|
||||||
|
import lombok.Data;
|
||||||
|
|
||||||
|
import java.math.BigDecimal;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author wr
|
||||||
|
* @description
|
||||||
|
* @date 2025/1/2 15:53
|
||||||
|
*/
|
||||||
|
@Data
|
||||||
|
public class RawResultDataVO {
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是符合数据
|
||||||
|
*/
|
||||||
|
private Integer isData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第几次谐波
|
||||||
|
*/
|
||||||
|
private Double harmNum;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 误差范围
|
||||||
|
*/
|
||||||
|
private String radius;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* A相数据
|
||||||
|
*/
|
||||||
|
private DetectionData dataA;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* B相数据
|
||||||
|
*/
|
||||||
|
private DetectionData dataB;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C相数据
|
||||||
|
*/
|
||||||
|
private DetectionData dataC;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* C相数据
|
||||||
|
*/
|
||||||
|
private DetectionData dataT;
|
||||||
|
|
||||||
|
@Data
|
||||||
|
public static class DetectionData {
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 第几次谐波
|
||||||
|
*/
|
||||||
|
private Double num;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 是否是符合数据
|
||||||
|
*/
|
||||||
|
private Integer isData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 装置原始数据
|
||||||
|
*/
|
||||||
|
private BigDecimal data;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 检测源定值
|
||||||
|
*/
|
||||||
|
private BigDecimal resultData;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 误差范围
|
||||||
|
*/
|
||||||
|
private String radius;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ import com.njcn.gather.storage.pojo.param.StorageParam;
|
|||||||
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
||||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||||
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
||||||
|
import com.njcn.gather.storage.pojo.vo.RawResultDataVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -33,5 +34,12 @@ public interface AdHarmonicService extends IService<AdHarmonicResult> {
|
|||||||
* @param param
|
* @param param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map<String, List<RawDataVO>> listResultData(StorageParam param);
|
Map<String, List<RawDataVO>> listHarmData(StorageParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 查询结果数据
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, RawResultDataVO> listHarmResultData(StorageParam param) ;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ import com.njcn.gather.storage.pojo.param.StorageParam;
|
|||||||
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
||||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||||
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
||||||
|
import com.njcn.gather.storage.pojo.vo.RawResultDataVO;
|
||||||
|
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
@@ -16,17 +17,26 @@ public interface AdNonHarmonicService extends IService<AdNonHarmonicResult> {
|
|||||||
* 根据设备ID和通道号获取非谐波结果
|
* 根据设备ID和通道号获取非谐波结果
|
||||||
*
|
*
|
||||||
* @param scriptId 脚本ID
|
* @param scriptId 脚本ID
|
||||||
* @param sort 总检测脚本中的测试项序号列表
|
* @param sort 总检测脚本中的测试项序号列表
|
||||||
* @param deviceId 设备ID
|
* @param deviceId 设备ID
|
||||||
* @param chnNum 通道号,从1开始
|
* @param chnNum 通道号,从1开始
|
||||||
* @return 非谐波结果
|
* @return 非谐波结果
|
||||||
*/
|
*/
|
||||||
List<AdBaseResult> get(String scriptId, List<Integer> sort, String deviceId, String chnNum,Integer code);
|
List<AdBaseResult> get(String scriptId, List<Integer> sort, String deviceId, String chnNum, Integer code);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 非谐波原始数据展示
|
* 非谐波原始数据展示
|
||||||
|
*
|
||||||
* @param param
|
* @param param
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
Map<String,List<RawDataVO>> listNonResultData(StorageParam param) ;
|
Map<String, List<RawDataVO>> listNonHarmData(StorageParam param);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 非谐波原始数据展示
|
||||||
|
*
|
||||||
|
* @param param
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
Map<String, RawResultDataVO> listNonHarmResultData(StorageParam param);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||||
@@ -12,6 +13,7 @@ import com.njcn.gather.storage.pojo.param.StorageParam;
|
|||||||
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
||||||
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
||||||
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
||||||
|
import com.njcn.gather.storage.pojo.vo.RawResultDataVO;
|
||||||
import com.njcn.gather.storage.service.AdHarmonicService;
|
import com.njcn.gather.storage.service.AdHarmonicService;
|
||||||
import org.springframework.stereotype.Service;
|
import org.springframework.stereotype.Service;
|
||||||
|
|
||||||
@@ -19,10 +21,7 @@ import java.lang.reflect.Field;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.LocalDateTime;
|
import java.time.LocalDateTime;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.ArrayList;
|
import java.util.*;
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.List;
|
|
||||||
import java.util.Map;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author caozehui
|
* @author caozehui
|
||||||
@@ -48,7 +47,7 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, List<RawDataVO>> listResultData(StorageParam param) {
|
public Map<String, List<RawDataVO>> listHarmData(StorageParam param) {
|
||||||
String prefix = "ad_harmonic_";
|
String prefix = "ad_harmonic_";
|
||||||
DynamicTableNameHandler.setTableName(prefix + param.getCode());
|
DynamicTableNameHandler.setTableName(prefix + param.getCode());
|
||||||
MPJLambdaWrapper<AdHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<AdHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
||||||
@@ -76,17 +75,17 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
|||||||
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
|
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
|
||||||
fieldA.setAccessible(true);
|
fieldA.setAccessible(true);
|
||||||
BigDecimal decimalA = new BigDecimal(fieldA.get(harmonicResult)+"");
|
BigDecimal decimalA = new BigDecimal(fieldA.get(harmonicResult)+"");
|
||||||
dataVO.setDataA(decimalA);
|
dataVO.setDataA(decimalA.toPlainString());
|
||||||
|
|
||||||
Field fieldB = harmonicResult.getClass().getDeclaredField("bValue" + isHarmOrInHarm(i).intValue());
|
Field fieldB = harmonicResult.getClass().getDeclaredField("bValue" + isHarmOrInHarm(i).intValue());
|
||||||
fieldB.setAccessible(true);
|
fieldB.setAccessible(true);
|
||||||
BigDecimal decimalB = new BigDecimal(fieldB.get(harmonicResult)+"");
|
BigDecimal decimalB = new BigDecimal(fieldB.get(harmonicResult)+"");
|
||||||
dataVO.setDataB(decimalB);
|
dataVO.setDataB(decimalB.toPlainString());
|
||||||
|
|
||||||
Field fieldC = harmonicResult.getClass().getDeclaredField("cValue" + isHarmOrInHarm(i).intValue());
|
Field fieldC = harmonicResult.getClass().getDeclaredField("cValue" + isHarmOrInHarm(i).intValue());
|
||||||
fieldC.setAccessible(true);
|
fieldC.setAccessible(true);
|
||||||
BigDecimal decimalC = new BigDecimal(fieldC.get(harmonicResult)+"");
|
BigDecimal decimalC = new BigDecimal(fieldC.get(harmonicResult)+"");
|
||||||
dataVO.setDataC(decimalC);
|
dataVO.setDataC(decimalC.toPlainString());
|
||||||
} catch (NoSuchFieldException e) {
|
} catch (NoSuchFieldException e) {
|
||||||
throw new RuntimeException(e);
|
throw new RuntimeException(e);
|
||||||
} catch (IllegalAccessException e) {
|
} catch (IllegalAccessException e) {
|
||||||
@@ -106,6 +105,56 @@ public class AdHarmonicServiceImpl extends ServiceImpl<AdHarmonicMappper, AdHarm
|
|||||||
return info;
|
return info;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, RawResultDataVO> listHarmResultData(StorageParam param) {
|
||||||
|
String prefix = "ad_harmonic_result_";
|
||||||
|
DynamicTableNameHandler.setTableName(prefix + param.getCode());
|
||||||
|
MPJLambdaWrapper<AdHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
||||||
|
wrapper.like(AdHarmonicResult::getMonitorId, param.getDevId() + "_" + param.getDevNum())
|
||||||
|
.eq(ObjectUtil.isNotNull(param.getScriptId()), AdHarmonicResult::getScriptId, param.getScriptId())
|
||||||
|
.in(ObjectUtil.isNotEmpty(param.getIndex()), AdHarmonicResult::getSort, param.getIndex())
|
||||||
|
.orderByAsc(AdHarmonicResult::getTimeId);
|
||||||
|
|
||||||
|
List<AdHarmonicResult> adHarmonicResults = this.getBaseMapper().selectJoinList(AdHarmonicResult.class, wrapper);
|
||||||
|
List<Double> harmNum = param.getHarmNum();
|
||||||
|
|
||||||
|
Map<String, RawResultDataVO> info=new HashMap<>(3);
|
||||||
|
RawResultDataVO dataVO;
|
||||||
|
for (AdHarmonicResult harmonicResult : adHarmonicResults) {
|
||||||
|
for (Double i : harmNum) {
|
||||||
|
dataVO = new RawResultDataVO();
|
||||||
|
dataVO.setHarmNum(i);
|
||||||
|
dataVO.setIsData(harmonicResult.getResultFlag());
|
||||||
|
try {
|
||||||
|
Field fieldA = harmonicResult.getClass().getDeclaredField("aValue" + isHarmOrInHarm(i).intValue());
|
||||||
|
fieldA.setAccessible(true);
|
||||||
|
RawResultDataVO.DetectionData a = JSON.parseObject(fieldA.get(harmonicResult)+"", RawResultDataVO.DetectionData.class);
|
||||||
|
dataVO.setDataA(a);
|
||||||
|
|
||||||
|
Field fieldB = harmonicResult.getClass().getDeclaredField("bValue" + isHarmOrInHarm(i).intValue());
|
||||||
|
fieldB.setAccessible(true);
|
||||||
|
RawResultDataVO.DetectionData b = JSON.parseObject(fieldB.get(harmonicResult)+"", RawResultDataVO.DetectionData.class);
|
||||||
|
dataVO.setDataB(b);
|
||||||
|
|
||||||
|
Field fieldC = harmonicResult.getClass().getDeclaredField("cValue" + isHarmOrInHarm(i).intValue());
|
||||||
|
fieldC.setAccessible(true);
|
||||||
|
RawResultDataVO.DetectionData c = JSON.parseObject(fieldC.get(harmonicResult)+"", RawResultDataVO.DetectionData.class);
|
||||||
|
dataVO.setDataC(c);
|
||||||
|
if(ObjectUtil.isNotNull(a)){
|
||||||
|
dataVO.setRadius(a.getRadius());
|
||||||
|
}
|
||||||
|
} catch (NoSuchFieldException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
} catch (IllegalAccessException e) {
|
||||||
|
throw new RuntimeException(e);
|
||||||
|
}
|
||||||
|
info.put(String.valueOf(i),dataVO) ;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
DynamicTableNameHandler.remove();
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
public Double isHarmOrInHarm(Double value) {
|
public Double isHarmOrInHarm(Double value) {
|
||||||
if (value == value.longValue()) {
|
if (value == value.longValue()) {
|
||||||
return value;
|
return value;
|
||||||
|
|||||||
@@ -4,6 +4,7 @@ import cn.hutool.core.bean.BeanUtil;
|
|||||||
import cn.hutool.core.collection.CollUtil;
|
import cn.hutool.core.collection.CollUtil;
|
||||||
import cn.hutool.core.date.DatePattern;
|
import cn.hutool.core.date.DatePattern;
|
||||||
import cn.hutool.core.util.ObjectUtil;
|
import cn.hutool.core.util.ObjectUtil;
|
||||||
|
import com.alibaba.fastjson.JSON;
|
||||||
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
|
||||||
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
import com.github.yulichang.wrapper.MPJLambdaWrapper;
|
||||||
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
import com.njcn.db.mybatisplus.handler.DynamicTableNameHandler;
|
||||||
@@ -12,6 +13,7 @@ import com.njcn.gather.storage.pojo.param.StorageParam;
|
|||||||
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
import com.njcn.gather.storage.pojo.po.AdBaseResult;
|
||||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||||
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
import com.njcn.gather.storage.pojo.vo.RawDataVO;
|
||||||
|
import com.njcn.gather.storage.pojo.vo.RawResultDataVO;
|
||||||
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
||||||
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
import com.njcn.gather.system.dictionary.pojo.po.DictTree;
|
||||||
import com.njcn.gather.system.dictionary.service.IDictTreeService;
|
import com.njcn.gather.system.dictionary.service.IDictTreeService;
|
||||||
@@ -21,6 +23,7 @@ import org.springframework.stereotype.Service;
|
|||||||
import java.math.BigDecimal;
|
import java.math.BigDecimal;
|
||||||
import java.time.format.DateTimeFormatter;
|
import java.time.format.DateTimeFormatter;
|
||||||
import java.util.*;
|
import java.util.*;
|
||||||
|
import java.util.function.Function;
|
||||||
import java.util.stream.Collectors;
|
import java.util.stream.Collectors;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -51,7 +54,7 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
|||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Map<String, List<RawDataVO>> listNonResultData(StorageParam param) {
|
public Map<String, List<RawDataVO>> listNonHarmData(StorageParam param) {
|
||||||
String prefix = "ad_non_harmonic_";
|
String prefix = "ad_non_harmonic_";
|
||||||
DynamicTableNameHandler.setTableName(prefix + param.getCode());
|
DynamicTableNameHandler.setTableName(prefix + param.getCode());
|
||||||
MPJLambdaWrapper<AdNonHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
MPJLambdaWrapper<AdNonHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
||||||
@@ -70,13 +73,56 @@ public class AdNonHarmonicServiceImpl extends ServiceImpl<AdNonHarmonicMapper, A
|
|||||||
for (AdNonHarmonicResult result : value) {
|
for (AdNonHarmonicResult result : value) {
|
||||||
RawDataVO dataVO = new RawDataVO();
|
RawDataVO dataVO = new RawDataVO();
|
||||||
dataVO.setTime(result.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
dataVO.setTime(result.getTimeId().format(DateTimeFormatter.ofPattern(DatePattern.NORM_DATETIME_PATTERN)));
|
||||||
dataVO.setDataA(ObjectUtil.isNotNull(result.getAValue())?new BigDecimal(result.getAValue()):null);
|
dataVO.setDataA(ObjectUtil.isNotNull(result.getAValue()) ? new BigDecimal(result.getAValue()).toPlainString() : null);
|
||||||
dataVO.setDataB(ObjectUtil.isNotNull(result.getBValue())?new BigDecimal(result.getBValue()):null);
|
dataVO.setDataB(ObjectUtil.isNotNull(result.getBValue()) ? new BigDecimal(result.getBValue()).toPlainString() : null);
|
||||||
dataVO.setDataC(ObjectUtil.isNotNull(result.getCValue())?new BigDecimal(result.getCValue()):null);
|
dataVO.setDataC(ObjectUtil.isNotNull(result.getCValue()) ? new BigDecimal(result.getCValue()).toPlainString() : null);
|
||||||
dataVO.setDataT(ObjectUtil.isNotNull(result.getTValue())?new BigDecimal(result.getTValue()):null);
|
dataVO.setDataT(ObjectUtil.isNotNull(result.getTValue()) ? new BigDecimal(result.getTValue()).toPlainString() : null);
|
||||||
rawDataVOS.add(dataVO);
|
rawDataVOS.add(dataVO);
|
||||||
}
|
}
|
||||||
info.put(key,rawDataVOS);
|
info.put(treeName, rawDataVOS);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
DynamicTableNameHandler.remove();
|
||||||
|
return info;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public Map<String, RawResultDataVO> listNonHarmResultData(StorageParam param) {
|
||||||
|
String prefix = "ad_non_harmonic_result_";
|
||||||
|
DynamicTableNameHandler.setTableName(prefix + param.getCode());
|
||||||
|
MPJLambdaWrapper<AdNonHarmonicResult> wrapper = new MPJLambdaWrapper<>();
|
||||||
|
wrapper.like(AdNonHarmonicResult::getMonitorId, param.getDevId() + "_" + param.getDevNum())
|
||||||
|
.eq(ObjectUtil.isNotNull(param.getScriptId()), AdNonHarmonicResult::getScriptId, param.getScriptId())
|
||||||
|
.in(ObjectUtil.isNotEmpty(param.getIndex()), AdNonHarmonicResult::getSort, param.getIndex());
|
||||||
|
|
||||||
|
List<AdNonHarmonicResult> adHarmonicResults = this.getBaseMapper().selectJoinList(AdNonHarmonicResult.class, wrapper);
|
||||||
|
|
||||||
|
Map<String, RawResultDataVO> info = new HashMap<>(2);
|
||||||
|
Map<String, AdNonHarmonicResult> adTypeMap = adHarmonicResults.stream().collect(Collectors.toMap(AdNonHarmonicResult::getAdType, Function.identity()));
|
||||||
|
List<DictTree> dictTreeById = dictTreeService.getDictTreeById(new ArrayList<>(adTypeMap.keySet()));
|
||||||
|
|
||||||
|
Map<String, String> dictTreeByName = dictTreeById.stream().collect(Collectors.toMap(DictTree::getId, DictTree::getName));
|
||||||
|
adTypeMap.forEach((key, result) -> {
|
||||||
|
if (dictTreeByName.containsKey(key)) {
|
||||||
|
String treeName = dictTreeByName.get(key);
|
||||||
|
RawResultDataVO dataVO = new RawResultDataVO();
|
||||||
|
dataVO.setIsData(result.getResultFlag());
|
||||||
|
RawResultDataVO.DetectionData a = JSON.parseObject(result.getAValue(), RawResultDataVO.DetectionData.class);
|
||||||
|
RawResultDataVO.DetectionData b = JSON.parseObject(result.getBValue(), RawResultDataVO.DetectionData.class);
|
||||||
|
RawResultDataVO.DetectionData c = JSON.parseObject(result.getCValue(), RawResultDataVO.DetectionData.class);
|
||||||
|
RawResultDataVO.DetectionData t = JSON.parseObject(result.getTValue(), RawResultDataVO.DetectionData.class);
|
||||||
|
dataVO.setDataA(a);
|
||||||
|
dataVO.setDataB(b);
|
||||||
|
dataVO.setDataC(c);
|
||||||
|
dataVO.setDataC(t);
|
||||||
|
if(ObjectUtil.isNotNull(t)){
|
||||||
|
dataVO.setRadius(t.getRadius());
|
||||||
|
}else{
|
||||||
|
if(ObjectUtil.isNotNull(b)){
|
||||||
|
dataVO.setRadius(b.getRadius());
|
||||||
|
}
|
||||||
|
}
|
||||||
|
info.put(treeName, dataVO);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
DynamicTableNameHandler.remove();
|
DynamicTableNameHandler.remove();
|
||||||
|
|||||||
Reference in New Issue
Block a user