|
@@ -1,5 +1,10 @@
|
|
|
package com.hb.proj.analysis.controller;
|
|
|
|
|
|
+import java.util.ArrayList;
|
|
|
+import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
+
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.BeanUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.beans.factory.annotation.Value;
|
|
@@ -10,9 +15,17 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import com.hb.proj.allconfig.AccessToken;
|
|
|
import com.hb.proj.allconfig.SysLog;
|
|
|
+import com.hb.proj.analysis.service.DiagramDetecter;
|
|
|
import com.hb.proj.analysis.service.DiagramDiagnoseService;
|
|
|
+import com.hb.proj.base.service.WellParamService;
|
|
|
+import com.hb.proj.constant.SortCodeConstant;
|
|
|
+import com.hb.proj.data.controller.DataTransUtils;
|
|
|
+import com.hb.proj.data.service.DiagramDataService;
|
|
|
import com.hb.proj.model.DiagramDiagnoseStandardPO;
|
|
|
import com.hb.proj.model.DiagramDiagnoseStandardVO;
|
|
|
+import com.hb.proj.model.DiagramFeature;
|
|
|
+import com.hb.proj.model.MultiDataVO;
|
|
|
+import com.hb.proj.model.WellParamPO;
|
|
|
import com.hb.proj.utils.RequestParams;
|
|
|
import com.hb.proj.utils.RespVO;
|
|
|
import com.hb.proj.utils.RespVOBuilder;
|
|
@@ -28,6 +41,12 @@ public class DiagramDiagnoseController {
|
|
|
@Autowired
|
|
|
private DiagramDiagnoseService service;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private WellParamService wpService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DiagramDataService diagramService;
|
|
|
+
|
|
|
@Value("${upload.access.path}")
|
|
|
private String accessPathPre;
|
|
|
|
|
@@ -109,4 +128,70 @@ public class DiagramDiagnoseController {
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 更新井标准功图的特征值
|
|
|
+ * @param feature
|
|
|
+ * @param diagramTime
|
|
|
+ * @param token
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/updateDiagramFeature")
|
|
|
+ public RespVO<Object> updateDiagramFeature(@Validated DiagramFeature feature,Date diagramTime,AccessToken token){
|
|
|
+
|
|
|
+ WellParamPO wparam=wpService.get(feature.getWellId(), SortCodeConstant.PARAM_DIAGRAM_LOAD);
|
|
|
+ MultiDataVO diagramGatherData=diagramService.get(wparam.getParamId(), diagramTime);
|
|
|
+ DataTransUtils.convert(wparam,diagramGatherData);
|
|
|
+
|
|
|
+ DiagramDetecter.extractFeature(diagramGatherData, feature);
|
|
|
+
|
|
|
+ feature.setModifyBy(token.getUsName());
|
|
|
+ if(StringUtils.isNotBlank(feature.getFeatureId())) {
|
|
|
+ service.updateDiagramFeature(feature);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ service.addDiagramFeature(feature);
|
|
|
+ }
|
|
|
+ return RespVOBuilder.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获得指定井标准功图特征值
|
|
|
+ * @param wellId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/getDiagramFeature")
|
|
|
+ public RespVO<DiagramFeature> getDiagramFeature(String wellId){
|
|
|
+ return RespVOBuilder.ok(service.getDiagramFeatureByWell(wellId));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 诊断外部传入功图数据
|
|
|
+ * @param wellId
|
|
|
+ * @param diagramTime
|
|
|
+ * @param serials
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/diagnoseOut")
|
|
|
+ public RespVO<Object> diagnoseOut(String wellId,Date diagramTime,String disps,String oths){
|
|
|
+
|
|
|
+ WellParamPO wparam=wpService.get(wellId, SortCodeConstant.PARAM_DIAGRAM_LOAD);
|
|
|
+ MultiDataVO diagramData=diagramService.get(wparam.getParamId(), diagramTime);
|
|
|
+
|
|
|
+ diagramData.setDisps(convert(disps));
|
|
|
+ diagramData.setOths(convert(oths));
|
|
|
+
|
|
|
+ DiagramFeature feature=service.getDiagramFeatureByWell(wellId);
|
|
|
+ return RespVOBuilder.ok(DiagramDetecter.detect(diagramData, feature));
|
|
|
+ }
|
|
|
+
|
|
|
+ private List<Double> convert(String serial){
|
|
|
+ String[] datas=serial.split(",");
|
|
|
+ List<Double> rst=new ArrayList<>(datas.length);
|
|
|
+ for(String d : datas) {
|
|
|
+ rst.add(Double.parseDouble(d));
|
|
|
+ }
|
|
|
+ return rst;
|
|
|
+ }
|
|
|
+
|
|
|
}
|