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