|
@@ -3,6 +3,7 @@ package com.hb.proj.base.controller;
|
|
|
import java.util.Date;
|
|
|
import java.util.Map;
|
|
|
|
|
|
+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;
|
|
@@ -11,8 +12,12 @@ import org.springframework.web.bind.annotation.RestController;
|
|
|
|
|
|
import com.hb.proj.allconfig.AccessToken;
|
|
|
import com.hb.proj.allconfig.SysLog;
|
|
|
+import com.hb.proj.base.service.DeviceService;
|
|
|
import com.hb.proj.base.service.WellParamService;
|
|
|
+import com.hb.proj.base.service.WellService;
|
|
|
+import com.hb.proj.model.DeviceParamPO;
|
|
|
import com.hb.proj.model.WellParamPO;
|
|
|
+import com.hb.proj.model.WellVO;
|
|
|
import com.hb.proj.utils.RequestParams;
|
|
|
import com.hb.proj.utils.RespVO;
|
|
|
import com.hb.proj.utils.RespVOBuilder;
|
|
@@ -28,6 +33,12 @@ public class WellParamController {
|
|
|
@Autowired
|
|
|
private WellParamService service;
|
|
|
|
|
|
+ @Autowired
|
|
|
+ private WellService wellService;
|
|
|
+
|
|
|
+ @Autowired
|
|
|
+ private DeviceService deviceService;
|
|
|
+
|
|
|
/**
|
|
|
* 加载井的参数
|
|
|
* @param wellId
|
|
@@ -91,6 +102,9 @@ public class WellParamController {
|
|
|
}
|
|
|
param.setModifyTime(new Date());
|
|
|
param.setModifyBy(token.getTokenId());
|
|
|
+ param.setParamId(param.getWellId()+"_"+param.getParamCode()); //按特定规则生成 wellId+"_"+paramCode
|
|
|
+
|
|
|
+ deviceService.updateDeviceParamConfig(buildDeviceParam(param));
|
|
|
return RespVOBuilder.ok(service.add(param));
|
|
|
|
|
|
}
|
|
@@ -113,8 +127,25 @@ public class WellParamController {
|
|
|
param.setModifyBy(token.getTokenId());
|
|
|
service.update(param);
|
|
|
|
|
|
+ deviceService.updateDeviceParamConfig(buildDeviceParam(param));
|
|
|
+
|
|
|
return RespVOBuilder.ok();
|
|
|
|
|
|
|
|
|
}
|
|
|
+
|
|
|
+ private DeviceParamPO buildDeviceParam(WellParamPO wparam) {
|
|
|
+ WellVO well=wellService.get(wparam.getWellId());
|
|
|
+ if(StringUtils.isBlank(well.getDeviceCode())) {
|
|
|
+ return null;
|
|
|
+ }
|
|
|
+ DeviceParamPO dparam=new DeviceParamPO();
|
|
|
+ dparam.setDeviceCode(well.getDeviceCode());
|
|
|
+ dparam.setParamCode(wparam.getParamCode());
|
|
|
+ dparam.setCalibrateA(wparam.getCalibrateA());
|
|
|
+ dparam.setCalibrateB(wparam.getCalibrateB());
|
|
|
+ dparam.setCalibrateC(wparam.getCalibrateC());
|
|
|
+ dparam.setGatherUnit(wparam.getGatherUnit());
|
|
|
+ return dparam;
|
|
|
+ }
|
|
|
}
|