|
@@ -1,28 +1,35 @@
|
|
|
package com.hb.proj.analysis.controller;
|
|
|
|
|
|
import java.util.Date;
|
|
|
+import java.util.List;
|
|
|
|
|
|
import org.apache.commons.lang3.StringUtils;
|
|
|
import org.springframework.beans.factory.annotation.Autowired;
|
|
|
import org.springframework.data.redis.core.RedisTemplate;
|
|
|
import org.springframework.validation.annotation.Validated;
|
|
|
+import org.springframework.web.bind.annotation.PostMapping;
|
|
|
+import org.springframework.web.bind.annotation.RequestBody;
|
|
|
import org.springframework.web.bind.annotation.RequestMapping;
|
|
|
import org.springframework.web.bind.annotation.RequestParam;
|
|
|
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.IPRService;
|
|
|
import com.hb.proj.analysis.service.ProduceParamCalculator;
|
|
|
import com.hb.proj.analysis.service.ProduceParamService;
|
|
|
import com.hb.proj.model.WellAnalysisParamPO;
|
|
|
import com.hb.proj.model.WellMeasurePO;
|
|
|
+import com.hb.proj.model.WellMeasureVO;
|
|
|
import com.hb.proj.model.WellPumpPO;
|
|
|
import com.hb.proj.utils.RespVO;
|
|
|
import com.hb.proj.utils.RespVOBuilder;
|
|
|
import com.hb.xframework.dao.util.PageModel;
|
|
|
import com.hb.xframework.util.MapUtils;
|
|
|
|
|
|
+import jakarta.validation.Valid;
|
|
|
import jakarta.validation.constraints.NotBlank;
|
|
|
+import jakarta.validation.constraints.NotNull;
|
|
|
|
|
|
@RestController
|
|
|
@RequestMapping("/analysis/produce")
|
|
@@ -38,6 +45,31 @@ public class ProduceParamController {
|
|
|
@Autowired
|
|
|
private IPRService iprService;
|
|
|
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 分页查询测量数据(附加的独立测量数据管理页面)
|
|
|
+ */
|
|
|
+ @RequestMapping("/queryMeasureParamList")
|
|
|
+ public RespVO<PageModel<WellMeasureVO>> queryMeasureParamList(String wellName,
|
|
|
+ Date startTime,Date endTime,
|
|
|
+ @RequestParam(value = "currentPage", defaultValue = "1") Integer pageNum,
|
|
|
+ @RequestParam(value = "pageSize", defaultValue = "20") Integer pageSize) {
|
|
|
+
|
|
|
+ return RespVOBuilder.ok(service.queryMeasureParamList(wellName,startTime,endTime, pageNum, pageSize));
|
|
|
+ }
|
|
|
+
|
|
|
+ /**
|
|
|
+ * 删除单个计量数据
|
|
|
+ * @param measureId 待删除记录id
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @RequestMapping("/deleteMeasureParam")
|
|
|
+ @SysLog("删除计量数据:{arg0}")
|
|
|
+ public RespVO<Object> deleteMeasureParam(@NotBlank(message="缺少记录号") String measureId){
|
|
|
+ service.deleteMeasureParam(measureId);
|
|
|
+ return RespVOBuilder.ok();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 分页查询测量数据
|
|
|
*/
|
|
@@ -119,6 +151,40 @@ public class ProduceParamController {
|
|
|
return RespVOBuilder.ok();
|
|
|
}
|
|
|
|
|
|
+ /**
|
|
|
+ * 油井测量参数(独立菜单-计量数据 只维护:测量日期、井名、含水率、计量液量)
|
|
|
+ * 修改:
|
|
|
+ * 新增:
|
|
|
+ * @param measures
|
|
|
+ * @param token
|
|
|
+ * @return
|
|
|
+ */
|
|
|
+ @PostMapping("/saveMeasureList")
|
|
|
+ public RespVO<Object> saveMeasureList(@RequestBody @Valid List<WellMeasurePO> measures,@NotNull(message="缺少登录信息") AccessToken token){
|
|
|
+ if(measures==null || measures.size()==0) {
|
|
|
+ return RespVOBuilder.error("缺少计量数据");
|
|
|
+ }
|
|
|
+ for(WellMeasurePO measure : measures) {
|
|
|
+ if(StringUtils.isNotBlank(measure.getMeasureId())) {
|
|
|
+ WellMeasurePO dbPO=service.getMeasureParam(measure.getMeasureId());
|
|
|
+ if(dbPO==null) {
|
|
|
+ return RespVOBuilder.error("被更新记录已不存在");
|
|
|
+ }
|
|
|
+ dbPO.setWaterRatio(measure.getWaterRatio());
|
|
|
+ dbPO.setMeteredLiquidYield(measure.getMeteredLiquidYield());
|
|
|
+ dbPO.setStartTime(measure.getStartTime());
|
|
|
+ dbPO.setModifyBy(token.getUsName());
|
|
|
+ service.updateMeasureParam(measure);
|
|
|
+ }
|
|
|
+ else {
|
|
|
+ measure.setModifyBy(token.getUsName());
|
|
|
+ measure.setCreateBy(token.getUsName());
|
|
|
+ service.addMeasureParam(measure);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ return RespVOBuilder.ok();
|
|
|
+ }
|
|
|
+
|
|
|
/**
|
|
|
* 保存抽油泵参数
|
|
|
* @param pump
|