|
@@ -3,6 +3,8 @@ package com.nationrel.modules.weibull.service;
|
|
|
import com.alibaba.fastjson.JSONArray;
|
|
|
import com.alibaba.fastjson.JSONObject;
|
|
|
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
+import com.nationrel.modules.weibull.entity.EwbAnalysisSetting;
|
|
|
+import com.nationrel.modules.weibull.enums.EwbParameterCodeEnum;
|
|
|
import com.nationrel.modules.weibull.general.common.ServerResponse;
|
|
|
import com.nationrel.modules.weibull.general.domain.auth.HeaderUserInfo;
|
|
|
import com.nationrel.modules.weibull.general.domain.enums.weibull.EwbCustomPromptEnum;
|
|
@@ -16,6 +18,7 @@ import com.nationrel.modules.weibull.entity.EwbAnalysisData;
|
|
|
import com.nationrel.modules.weibull.entity.EwbAnalysisDataDetail;
|
|
|
import com.nationrel.modules.weibull.enums.EwbDistributingCodeEnum;
|
|
|
import com.nationrel.modules.weibull.enums.EwbEvaluateCodeEnum;
|
|
|
+import com.nationrel.modules.weibull.mapper.EwbAnalysisSettingMapper;
|
|
|
import com.nationrel.modules.weibull.util.WeibullNumberUtil;
|
|
|
import com.nationrel.modules.weibull.util.ValidateUtil;
|
|
|
import lombok.RequiredArgsConstructor;
|
|
@@ -40,6 +43,7 @@ public class EwbRandomService {
|
|
|
private String reliaQubeUrl;
|
|
|
private final SaveDataDetailService saveService;
|
|
|
private final RgaApiService rgaApiService;
|
|
|
+ private final EwbAnalysisSettingMapper analysisSettingMapper;
|
|
|
private final EwbAnalysisDataDetailMapper ldAnalysisDataDetailMapper;
|
|
|
private final EwbAnalysisService ewbAnalysisService;
|
|
|
private final EwbAnalysisDataMapper ewbAnalysisDataMapper;
|
|
@@ -52,9 +56,9 @@ public class EwbRandomService {
|
|
|
String settingId = param.getSettingId();
|
|
|
// 删除寿命数据分析后产生的其他相关数据
|
|
|
ldAnalysisDataDetailMapper.deleteByDataId(dataId);
|
|
|
+ EwbAnalysisData ewbAnalysisData = ewbAnalysisDataMapper.selectOne(new QueryWrapper<EwbAnalysisData>().lambda().eq(EwbAnalysisData::getAnalysisId, param.getAnalysisId()));
|
|
|
// deleteData(dataId, settingId);
|
|
|
if (EwbConstants.RIGHT_CENSORED.equals(param.getCensoring())) {
|
|
|
- EwbAnalysisData ewbAnalysisData = ewbAnalysisDataMapper.selectOne(new QueryWrapper<EwbAnalysisData>().lambda().eq(EwbAnalysisData::getAnalysisId, param.getAnalysisId()));
|
|
|
ewbAnalysisData.setRFlag(EwbConstants.FLAG_CHECKED);
|
|
|
ewbAnalysisDataMapper.updateByPrimaryKey(ewbAnalysisData);
|
|
|
}
|
|
@@ -62,27 +66,36 @@ public class EwbRandomService {
|
|
|
// 必填的两个参数
|
|
|
queryData.put("AnalysisType", EwbEvaluateCodeEnum.getCode(param.getEstimationMethodCode()));
|
|
|
queryData.put("DistributionType", EwbDistributingCodeEnum.getName(param.getDistributingCode()));
|
|
|
+ EwbAnalysisSetting ewbAnalysisSetting = analysisSettingMapper.selectById(settingId);
|
|
|
// 选择weibull所需参数转换
|
|
|
if (EwbDistributingCodeEnum.Weibull.getIndex().equals(param.getDistributingCode())) {
|
|
|
queryData.put("Beta", WeibullNumberUtil.parseDouble(param.getBeta()));
|
|
|
queryData.put("Eta", WeibullNumberUtil.parseDouble(param.getEta()));
|
|
|
+ ewbAnalysisSetting.setDistributingCode(EwbDistributingCodeEnum.Weibull.getIndex());
|
|
|
+ ewbAnalysisSetting.setParameterCode(EwbParameterCodeEnum.二参数.getIndex());
|
|
|
}
|
|
|
|
|
|
// 选择lognormal所需参数转换
|
|
|
if (EwbDistributingCodeEnum.Lognormal.getIndex().equals(param.getDistributingCode())) {
|
|
|
queryData.put("LogSigma", WeibullNumberUtil.parseDouble(param.getLogSigma()));
|
|
|
queryData.put("LogMu", WeibullNumberUtil.parseDouble(param.getLogMean()));
|
|
|
+ ewbAnalysisSetting.setDistributingCode(EwbDistributingCodeEnum.Lognormal.getIndex());
|
|
|
+ ewbAnalysisSetting.setParameterCode(EwbParameterCodeEnum.二参数.getIndex());
|
|
|
}
|
|
|
|
|
|
// 选择normal所需参数转换
|
|
|
if (EwbDistributingCodeEnum.Normal.getIndex().equals(param.getDistributingCode())) {
|
|
|
queryData.put("Sigma", WeibullNumberUtil.parseDouble(param.getSigma()));
|
|
|
queryData.put("Mu", WeibullNumberUtil.parseDouble(param.getMean()));
|
|
|
+ ewbAnalysisSetting.setDistributingCode(EwbDistributingCodeEnum.Normal.getIndex());
|
|
|
+ ewbAnalysisSetting.setParameterCode(EwbParameterCodeEnum.二参数.getIndex());
|
|
|
}
|
|
|
|
|
|
// 选择exponential所需参数转换
|
|
|
if (EwbDistributingCodeEnum.Exponential.getIndex().equals(param.getDistributingCode())) {
|
|
|
queryData.put("Lambda", WeibullNumberUtil.parseDouble(param.getLamda()));
|
|
|
+ ewbAnalysisSetting.setDistributingCode(EwbDistributingCodeEnum.Exponential.getIndex());
|
|
|
+ ewbAnalysisSetting.setParameterCode(EwbParameterCodeEnum.一参数.getIndex());
|
|
|
}
|
|
|
|
|
|
// 失效数
|
|
@@ -139,7 +152,6 @@ public class EwbRandomService {
|
|
|
if (EwbConstants.TIME_CENSORED.equals(param.getCensoring()) && ValidateUtil.isNotEmpty(param.getTime())) {
|
|
|
int updateNum = ldAnalysisDataDetailMapper.updateSusByTime(dataId, WeibullNumberUtil.parseDouble(param.getTime()));
|
|
|
if (updateNum > 0) {
|
|
|
- EwbAnalysisData ewbAnalysisData = ewbAnalysisDataMapper.selectOne(new QueryWrapper<EwbAnalysisData>().lambda().eq(EwbAnalysisData::getAnalysisId, param.getAnalysisId()));
|
|
|
ewbAnalysisData.setRFlag(EwbConstants.FLAG_CHECKED);
|
|
|
ewbAnalysisDataMapper.updateByPrimaryKey(ewbAnalysisData);
|
|
|
}
|
|
@@ -148,7 +160,9 @@ public class EwbRandomService {
|
|
|
// 更新寿命数据分析数据明细表的各种类型的数据量
|
|
|
// ==================
|
|
|
saveService.updateAnalysisData(userInfo, dataId);
|
|
|
-
|
|
|
+ ewbAnalysisData.setTimeForRank(EwbConstants.FLAG_NO_CHECKED);
|
|
|
+ ewbAnalysisDataMapper.updateById(ewbAnalysisData);
|
|
|
+ analysisSettingMapper.updateById(ewbAnalysisSetting);
|
|
|
// 生成之后清除分析结果
|
|
|
ewbAnalysisService.deleteAnalysisResultData(dataId, settingId, param.getAnalysisId());
|
|
|
// 返回结果
|