|
@@ -0,0 +1,105 @@
|
|
|
+package com.hb.proj.analysis.controller;
|
|
|
+
|
|
|
+import org.apache.commons.lang3.StringUtils;
|
|
|
+import org.springframework.beans.factory.annotation.Autowired;
|
|
|
+import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
+import org.springframework.web.bind.annotation.RestController;
|
|
|
+
|
|
|
+import com.hb.proj.allconfig.AccessToken;
|
|
|
+import com.hb.proj.analysis.service.ProduceParamService;
|
|
|
+import com.hb.proj.model.WellAnalysisParamPO;
|
|
|
+import com.hb.proj.model.WellMeasurePO;
|
|
|
+import com.hb.proj.model.WellPumpPO;
|
|
|
+import com.hb.proj.utils.RespVO;
|
|
|
+import com.hb.proj.utils.RespVOBuilder;
|
|
|
+import com.hb.xframework.util.MapUtils;
|
|
|
+
|
|
|
+import jakarta.validation.constraints.NotBlank;
|
|
|
+
|
|
|
+@RestController
|
|
|
+@RequestMapping("/analysis/produce")
|
|
|
+@Validated
|
|
|
+public class ProduceParamController {
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private ProduceParamService service;
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 获得指定井的最新生成动态参数
|
|
|
+ * @param wellId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/getLastParam")
|
|
|
+ public RespVO<Object> getLastParam(@NotBlank(message="缺少井号") String wellId){
|
|
|
+ return RespVOBuilder.ok(MapUtils.build("measure", service.getLastMeasureParam(wellId),
|
|
|
+ "analysis",service.getLastAnalysisParam(wellId),
|
|
|
+ "pump",service.getLastPumpParam(wellId)));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存油井测量参数
|
|
|
+ * @param measure
|
|
|
+ * @param token
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/saveMeasure")
|
|
|
+ public RespVO<Object> saveMeasure(@Validated WellMeasurePO measure,AccessToken token){
|
|
|
+ if(measure.getWellBtmCompCoe()!=null && measure.getWellBtmCompCoe()!=0) {
|
|
|
+ measure.setSurfaceCompCoe(1/measure.getWellBtmCompCoe());
|
|
|
+ }
|
|
|
+ measure.setModifyBy(token!=null?token.getUsName():"unknow");
|
|
|
+
|
|
|
+ if(StringUtils.isBlank(measure.getMeasureId())) {
|
|
|
+ measure.setCreateBy(token!=null?token.getUsName():"unknow");
|
|
|
+ service.addMeasureParam(measure);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ service.updateMeasureParam(measure);
|
|
|
+ }
|
|
|
+ return RespVOBuilder.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存抽油泵参数
|
|
|
+ * @param pump
|
|
|
+ * @param token
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/savePump")
|
|
|
+ public RespVO<Object> savePump(@Validated WellPumpPO pump,AccessToken token){
|
|
|
+ pump.setModifyBy(token!=null?token.getUsName():"unknow");
|
|
|
+ if(StringUtils.isBlank(pump.getPumpId())) {
|
|
|
+ pump.setCreateBy(token!=null?token.getUsName():"unknow");
|
|
|
+ service.addPumpParam(pump);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ service.updatePumpParam(pump);
|
|
|
+ }
|
|
|
+ return RespVOBuilder.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 保存分析参数(只新增)
|
|
|
+ * @param pump
|
|
|
+ * @param token
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/saveAnalysisParam")
|
|
|
+ public RespVO<Object> saveAnalysisParam(@Validated WellAnalysisParamPO analysisParam,AccessToken token){
|
|
|
+ analysisParam.setModifyBy(token!=null?token.getUsName():"unknow");
|
|
|
+ analysisParam.setCreateBy(analysisParam.getModifyBy());
|
|
|
+ service.addAnalysisParam(analysisParam);
|
|
|
+ return RespVOBuilder.ok();
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 计算分析参数
|
|
|
+ * @param wellId
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/calcParam")
|
|
|
+ public RespVO<Object> calcParam(@NotBlank(message="缺少井号") String wellId){
|
|
|
+ return RespVOBuilder.ok();
|
|
|
+ }
|
|
|
+}
|