检测计划新增数据处理原则字段、全局配置中移除数据处理原则字段
This commit is contained in:
@@ -21,6 +21,7 @@ import com.njcn.gather.detection.util.socket.*;
|
|||||||
import com.njcn.gather.device.pojo.po.PqDev;
|
import com.njcn.gather.device.pojo.po.PqDev;
|
||||||
import com.njcn.gather.device.pojo.vo.PreDetection;
|
import com.njcn.gather.device.pojo.vo.PreDetection;
|
||||||
import com.njcn.gather.device.service.IPqDevService;
|
import com.njcn.gather.device.service.IPqDevService;
|
||||||
|
import com.njcn.gather.plan.pojo.po.AdPlan;
|
||||||
import com.njcn.gather.plan.service.IAdPlanService;
|
import com.njcn.gather.plan.service.IAdPlanService;
|
||||||
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
import com.njcn.gather.script.pojo.param.PqScriptCheckDataParam;
|
||||||
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
import com.njcn.gather.script.pojo.param.PqScriptIssueParam;
|
||||||
@@ -32,9 +33,10 @@ import com.njcn.gather.storage.pojo.po.AdHarmonicResult;
|
|||||||
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
import com.njcn.gather.storage.pojo.po.AdNonHarmonicResult;
|
||||||
import com.njcn.gather.storage.service.AdHarmonicService;
|
import com.njcn.gather.storage.service.AdHarmonicService;
|
||||||
import com.njcn.gather.storage.service.DetectionDataDealService;
|
import com.njcn.gather.storage.service.DetectionDataDealService;
|
||||||
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
|
|
||||||
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
|
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
|
||||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||||
|
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||||
|
import com.njcn.gather.system.dictionary.service.IDictDataService;
|
||||||
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
import com.njcn.gather.system.pojo.enums.DicDataEnum;
|
||||||
import com.njcn.gather.system.reg.service.ISysRegResService;
|
import com.njcn.gather.system.reg.service.ISysRegResService;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -93,6 +95,7 @@ public class SocketDevResponseService {
|
|||||||
private final AdHarmonicService adHarmonicService;
|
private final AdHarmonicService adHarmonicService;
|
||||||
private final IAdPlanService adPlanService;
|
private final IAdPlanService adPlanService;
|
||||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||||
|
private final IDictDataService dictDataService;
|
||||||
@Value("${phaseAngle.isEnable}")
|
@Value("${phaseAngle.isEnable}")
|
||||||
private Boolean isPhaseAngle;
|
private Boolean isPhaseAngle;
|
||||||
|
|
||||||
@@ -1619,11 +1622,13 @@ public class SocketDevResponseService {
|
|||||||
//初始化有效数据数
|
//初始化有效数据数
|
||||||
//Map<String, SysRegResVO> sysRegResMap = iSysRegResService.listRegRes();
|
//Map<String, SysRegResVO> sysRegResMap = iSysRegResService.listRegRes();
|
||||||
|
|
||||||
SysTestConfig oneConfig = sysTestConfigService.getOneConfig();
|
//SysTestConfig oneConfig = sysTestConfigService.getOneConfig();
|
||||||
if (ObjectUtil.isNotNull(oneConfig)) {
|
AdPlan plan = adPlanService.getById(param.getPlanId());
|
||||||
dataRule = DictDataEnum.getDictDataEnumByCode(oneConfig.getDataRule());
|
DictData dictData = dictDataService.getDictDataById(plan.getDataRule());
|
||||||
|
if (ObjectUtil.isNotNull(dictData)) {
|
||||||
|
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
|
||||||
} else {
|
} else {
|
||||||
dataRule = DictDataEnum.AT_WILL_VALUE;
|
dataRule = DictDataEnum.SECTION_VALUE;
|
||||||
}
|
}
|
||||||
//字典树
|
//字典树
|
||||||
SocketManager.valueTypeMap = iPqScriptCheckDataService.getValueTypeMap(param.getScriptId());
|
SocketManager.valueTypeMap = iPqScriptCheckDataService.getValueTypeMap(param.getScriptId());
|
||||||
|
|||||||
@@ -65,6 +65,10 @@ public class AdPlanParam {
|
|||||||
@ApiModelProperty(value = "报告模板名称")
|
@ApiModelProperty(value = "报告模板名称")
|
||||||
private String reportTemplateName;
|
private String reportTemplateName;
|
||||||
|
|
||||||
|
@ApiModelProperty(value = "数据处理原则")
|
||||||
|
@NotBlank(message = DetectionValidMessage.DATA_RULE_NOT_BLANK)
|
||||||
|
private String dataRule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 分页查询实体
|
* 分页查询实体
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -94,5 +94,10 @@ public class AdPlan extends BaseEntity implements Serializable {
|
|||||||
* 状态:0-删除 1-正常
|
* 状态:0-删除 1-正常
|
||||||
*/
|
*/
|
||||||
private Integer state;
|
private Integer state;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* 数据处理原则。任意值、部分值、所有值、cp95值、平均值
|
||||||
|
*/
|
||||||
|
private String dataRule;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -108,4 +108,6 @@ public class AdPlanVO {
|
|||||||
* 报告模板名称
|
* 报告模板名称
|
||||||
*/
|
*/
|
||||||
private String reportTemplateName;
|
private String reportTemplateName;
|
||||||
|
|
||||||
|
private String dataRule;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -761,12 +761,9 @@ public class AdPlanServiceImpl extends ServiceImpl<AdPlanMapper, AdPlan> impleme
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
PqErrSys errSys = pqErrSysService.getById(plan.getErrorSysId());
|
PqErrSys errSys = pqErrSysService.getById(plan.getErrorSysId());
|
||||||
SysTestConfig config1 = sysTestConfigService.getConfig();
|
DictData dictData1 = dictDataService.getDictDataById(plan.getDataRule());
|
||||||
if (ObjectUtil.isNotNull(config1)) {
|
if (ObjectUtil.isNotNull(dictData1) && ObjectUtil.isNotNull(errSys)) {
|
||||||
DictData dictData = dictDataService.getDictDataById(config1.getDataRule());
|
note.append("测试结果采用\"" + errSys.getName() + "\"误差体系结合\"" + dictData1.getName() + "\"数据原则计算得出。");
|
||||||
if (ObjectUtil.isNotNull(errSys) && ObjectUtil.isNotNull(dictData)) {
|
|
||||||
note.append("测试结果采用\"" + errSys.getName() + "\"误差体系结合\"" + dictData.getName() + "\"数据原则计算得出。");
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return note.toString();
|
return note.toString();
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -179,4 +179,5 @@ public interface DetectionValidMessage {
|
|||||||
|
|
||||||
String DEV_TYPE_NAME_FORMAT_ERROR = "设备类型名称格式错误,只能包含字母、数字、中文、下划线、中划线、点号、空格,长度为1-32个字符";
|
String DEV_TYPE_NAME_FORMAT_ERROR = "设备类型名称格式错误,只能包含字母、数字、中文、下划线、中划线、点号、空格,长度为1-32个字符";
|
||||||
String REPORT_NAME_NOT_BLANK = "报告模板不能为空";
|
String REPORT_NAME_NOT_BLANK = "报告模板不能为空";
|
||||||
|
String DATA_RULE_NOT_BLANK = "数据处理原则不能为空";
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -53,10 +53,11 @@ 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.service.AdHarmonicService;
|
import com.njcn.gather.storage.service.AdHarmonicService;
|
||||||
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
import com.njcn.gather.storage.service.AdNonHarmonicService;
|
||||||
import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
|
|
||||||
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
|
import com.njcn.gather.system.cfg.service.ISysTestConfigService;
|
||||||
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
import com.njcn.gather.system.dictionary.pojo.enums.DictDataEnum;
|
||||||
|
import com.njcn.gather.system.dictionary.pojo.po.DictData;
|
||||||
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.IDictDataService;
|
||||||
import com.njcn.gather.system.dictionary.service.IDictTreeService;
|
import com.njcn.gather.system.dictionary.service.IDictTreeService;
|
||||||
import com.njcn.web.utils.ExcelUtil;
|
import com.njcn.web.utils.ExcelUtil;
|
||||||
import lombok.RequiredArgsConstructor;
|
import lombok.RequiredArgsConstructor;
|
||||||
@@ -90,6 +91,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
private final IPqScriptCheckDataService pqScriptCheckDataService;
|
||||||
private final TableGenMapper tableGenMapper;
|
private final TableGenMapper tableGenMapper;
|
||||||
private final DetectionServiceImpl detectionServiceImpl;
|
private final DetectionServiceImpl detectionServiceImpl;
|
||||||
|
private final IDictDataService dictDataService;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 谐波类code,取树形字典表中的code
|
* 谐波类code,取树形字典表中的code
|
||||||
@@ -108,7 +110,7 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
adPlanService.visualize(Collections.singletonList(plan));
|
adPlanService.visualize(Collections.singletonList(plan));
|
||||||
}
|
}
|
||||||
formContentVO.setScriptName(plan.getScriptId());
|
formContentVO.setScriptName(plan.getScriptId());
|
||||||
formContentVO.setDataRule(sysTestConfigService.getConfig().getDataRule());
|
formContentVO.setDataRule(plan.getDataRule());
|
||||||
formContentVO.setDeviceName(pqDevService.getById(queryParam.getDeviceId()).getName());
|
formContentVO.setDeviceName(pqDevService.getById(queryParam.getDeviceId()).getName());
|
||||||
|
|
||||||
List<Map<String, String>> chnList = new ArrayList<>();
|
List<Map<String, String>> chnList = new ArrayList<>();
|
||||||
@@ -1510,12 +1512,19 @@ public class ResultServiceImpl implements IResultService {
|
|||||||
// PqDev dev = pqDevService.getById(devId);
|
// PqDev dev = pqDevService.getById(devId);
|
||||||
devIdMapComm.put(devId, devId);
|
devIdMapComm.put(devId, devId);
|
||||||
|
|
||||||
SysTestConfig oneConfig = sysTestConfigService.getOneConfig();
|
|
||||||
DictDataEnum dataRule;
|
DictDataEnum dataRule;
|
||||||
if (ObjectUtil.isNotNull(oneConfig)) {
|
// SysTestConfig oneConfig = sysTestConfigService.getOneConfig();
|
||||||
dataRule = DictDataEnum.getDictDataEnumByCode(oneConfig.getDataRule());
|
// if (ObjectUtil.isNotNull(oneConfig)) {
|
||||||
|
// dataRule = DictDataEnum.getDictDataEnumByCode(oneConfig.getDataRule());
|
||||||
|
// } else {
|
||||||
|
// dataRule = DictDataEnum.SECTION_VALUE;
|
||||||
|
// }
|
||||||
|
AdPlan plan = adPlanService.getById(planId);
|
||||||
|
DictData dictData = dictDataService.getDictDataById(plan.getDataRule());
|
||||||
|
if (ObjectUtil.isNotNull(dictData)) {
|
||||||
|
dataRule = DictDataEnum.getDictDataEnumByCode(dictData.getCode());
|
||||||
} else {
|
} else {
|
||||||
dataRule = DictDataEnum.AT_WILL_VALUE;
|
dataRule = DictDataEnum.SECTION_VALUE;
|
||||||
}
|
}
|
||||||
|
|
||||||
List<AdNonHarmonicResult> allNonHarmonicRawData = adNonHarmonicService.listAllRawData(scriptId, oldCode, devId);
|
List<AdNonHarmonicResult> allNonHarmonicRawData = adNonHarmonicService.listAllRawData(scriptId, oldCode, devId);
|
||||||
|
|||||||
@@ -36,9 +36,9 @@ public class SysTestConfigController extends BaseController {
|
|||||||
@GetMapping("/getConfig")
|
@GetMapping("/getConfig")
|
||||||
@ApiOperation("获取检测相关配置信息")
|
@ApiOperation("获取检测相关配置信息")
|
||||||
public HttpResult<SysTestConfig> getConfig() {
|
public HttpResult<SysTestConfig> getConfig() {
|
||||||
String methodDescribe = getMethodDescribe("list");
|
String methodDescribe = getMethodDescribe("getConfig");
|
||||||
LogUtil.njcnDebug(log, "{}", methodDescribe);
|
LogUtil.njcnDebug(log, "{}", methodDescribe);
|
||||||
SysTestConfig sysTestConfig = sysTestConfigService.getConfig();
|
SysTestConfig sysTestConfig = sysTestConfigService.getOneConfig();
|
||||||
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sysTestConfig, methodDescribe);
|
return HttpResultUtil.assembleCommonResponseResult(CommonResponseEnum.SUCCESS, sysTestConfig, methodDescribe);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -24,10 +24,10 @@ public class SysTestConfigParam {
|
|||||||
@NotNull(message = SystemValidMessage.MAX_RECHECK_NOT_NULL)
|
@NotNull(message = SystemValidMessage.MAX_RECHECK_NOT_NULL)
|
||||||
private Integer maxTime;
|
private Integer maxTime;
|
||||||
|
|
||||||
@ApiModelProperty(value = "数据处理规则")
|
// @ApiModelProperty(value = "数据处理规则")
|
||||||
@NotBlank(message = SystemValidMessage.DATA_RULE_NOT_BLANK)
|
// @NotBlank(message = SystemValidMessage.DATA_RULE_NOT_BLANK)
|
||||||
@Pattern(regexp = PatternRegex.SYSTEM_ID, message = SystemValidMessage.DATA_RULE_FORMAT_ERROR)
|
// @Pattern(regexp = PatternRegex.SYSTEM_ID, message = SystemValidMessage.DATA_RULE_FORMAT_ERROR)
|
||||||
private String dataRule;
|
// private String dataRule;
|
||||||
|
|
||||||
@Data
|
@Data
|
||||||
public static class UpdateParam extends SysTestConfigParam {
|
public static class UpdateParam extends SysTestConfigParam {
|
||||||
|
|||||||
@@ -37,8 +37,8 @@ public class SysTestConfig extends BaseEntity implements Serializable {
|
|||||||
/**
|
/**
|
||||||
* 数据处理规则, 关联字典(所有值、部分值、cp95值、平均值、任意值),默认任意值
|
* 数据处理规则, 关联字典(所有值、部分值、cp95值、平均值、任意值),默认任意值
|
||||||
*/
|
*/
|
||||||
@TableField("Data_Rule")
|
// @TableField("Data_Rule")
|
||||||
private String dataRule;
|
// private String dataRule;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 业务场景
|
* 业务场景
|
||||||
|
|||||||
@@ -10,12 +10,6 @@ import com.njcn.gather.system.cfg.pojo.po.SysTestConfig;
|
|||||||
*/
|
*/
|
||||||
public interface ISysTestConfigService extends IService<SysTestConfig> {
|
public interface ISysTestConfigService extends IService<SysTestConfig> {
|
||||||
|
|
||||||
/**
|
|
||||||
* 获取检测配置
|
|
||||||
* @return
|
|
||||||
*/
|
|
||||||
SysTestConfig getConfig();
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 添加检测配置
|
* 添加检测配置
|
||||||
* @param scene 场景
|
* @param scene 场景
|
||||||
|
|||||||
@@ -28,10 +28,6 @@ public class SysTestConfigServiceImpl extends ServiceImpl<SysTestConfigMapper, S
|
|||||||
|
|
||||||
private final IDictDataService dictDataService;
|
private final IDictDataService dictDataService;
|
||||||
|
|
||||||
@Override
|
|
||||||
public SysTestConfig getConfig() {
|
|
||||||
return this.getOne(new QueryWrapper<SysTestConfig>().last("LIMIT 1"));
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@Transactional
|
@Transactional
|
||||||
@@ -40,7 +36,7 @@ public class SysTestConfigServiceImpl extends ServiceImpl<SysTestConfigMapper, S
|
|||||||
sysTestConfig.setAutoGenerate(1);
|
sysTestConfig.setAutoGenerate(1);
|
||||||
// 最大被检次数默认为3次
|
// 最大被检次数默认为3次
|
||||||
sysTestConfig.setMaxTime(3);
|
sysTestConfig.setMaxTime(3);
|
||||||
sysTestConfig.setDataRule("46cf964bd76fb12a19cfb1700442eeeb"); // 任意值
|
//sysTestConfig.setDataRule("46cf964bd76fb12a19cfb1700442eeeb"); // 任意值
|
||||||
sysTestConfig.setScene(scene);
|
sysTestConfig.setScene(scene);
|
||||||
sysTestConfig.setState(DataStateEnum.ENABLE.getCode());
|
sysTestConfig.setState(DataStateEnum.ENABLE.getCode());
|
||||||
return this.save(sysTestConfig);
|
return this.save(sysTestConfig);
|
||||||
@@ -56,12 +52,10 @@ public class SysTestConfigServiceImpl extends ServiceImpl<SysTestConfigMapper, S
|
|||||||
|
|
||||||
@Override
|
@Override
|
||||||
public SysTestConfig getOneConfig() {
|
public SysTestConfig getOneConfig() {
|
||||||
MPJLambdaWrapper<SysTestConfig> queryWrapper = new MPJLambdaWrapper<>();
|
QueryWrapper<SysTestConfig> queryWrapper = new QueryWrapper<>();
|
||||||
queryWrapper.selectAll(SysTestConfig.class)
|
queryWrapper.eq("state", DataStateEnum.ENABLE.getCode());
|
||||||
.selectAs(DictData::getCode, SysTestConfig::getDataRule)
|
queryWrapper.last("LIMIT 1");
|
||||||
.leftJoin(DictData.class, DictData::getId, SysTestConfig::getDataRule)
|
return this.getOne(queryWrapper);
|
||||||
.eq(SysTestConfig::getState, DataStateEnum.ENABLE.getCode());
|
|
||||||
return this.getBaseMapper().selectJoinOne(SysTestConfig.class, queryWrapper);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user