|
@@ -0,0 +1,405 @@
|
|
|
|
+package com.cn.tianji.service.Impl;
|
|
|
|
+
|
|
|
|
+
|
|
|
|
+import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
|
|
|
|
+import com.cn.tianji.common.CommonUtils;
|
|
|
|
+import com.cn.tianji.common.RedisUtil;
|
|
|
|
+import com.cn.tianji.common.Result;
|
|
|
|
+import com.cn.tianji.dto.ConditionDeterminationDto;
|
|
|
|
+import com.cn.tianji.entity.*;
|
|
|
|
+import com.cn.tianji.service.*;
|
|
|
|
+import lombok.SneakyThrows;
|
|
|
|
+import lombok.extern.slf4j.Slf4j;
|
|
|
|
+import org.springframework.scheduling.annotation.Async;
|
|
|
|
+import org.springframework.stereotype.Service;
|
|
|
|
+
|
|
|
|
+import javax.annotation.Resource;
|
|
|
|
+import java.math.BigDecimal;
|
|
|
|
+import java.text.ParseException;
|
|
|
|
+import java.text.SimpleDateFormat;
|
|
|
|
+import java.util.ArrayList;
|
|
|
|
+import java.util.Calendar;
|
|
|
|
+import java.util.Date;
|
|
|
|
+import java.util.List;
|
|
|
|
+
|
|
|
|
+@Service
|
|
|
|
+@Slf4j
|
|
|
|
+public class WorkingConditionCalculationServiceImpl implements WorkingConditionCalculationService {
|
|
|
|
+ @Resource
|
|
|
|
+ private WellDrillingService wellDrillingService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private ConditionIdentificationService conditionIdentificationService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private OperatingConditionThresholdService operatingConditionThresholdService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private WorkingConditionCalculationLogService workingConditionCalculationLogService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private DrillingHookloadService drillingHookloadService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private DrillingOutHookLoadService drillingOutHookLoadService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private HookLoadWarnLogService hookLoadWarnLogService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private TotalPoolVolumeService totalPoolVolumeService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private TotalPoolVolumeWarnLogService totalPoolVolumeWarnLogService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private PumpingPressureService pumpingPressureService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private PumpingPressureWarnLogService pumpingPressureWarnLogService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private TorqueService torqueService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private TorqueWarnLogService torqueWarnLogService;
|
|
|
|
+
|
|
|
|
+ @Resource
|
|
|
|
+ private RedisUtil redisUtil;
|
|
|
|
+ SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 根据井号,开始结束时间重新计算钻井工况动作
|
|
|
|
+ *
|
|
|
|
+ * @param workingConditionCalculationLogId
|
|
|
|
+ */
|
|
|
|
+ @Override
|
|
|
|
+ public Result<?> workingConditionCalculation(String workingConditionCalculationLogId) {
|
|
|
|
+ WorkingConditionCalculationLog workingConditionCalculationLogModel = workingConditionCalculationLogService.getById(workingConditionCalculationLogId);
|
|
|
|
+ String jh= workingConditionCalculationLogModel.getJh();
|
|
|
|
+ String startTime = workingConditionCalculationLogModel.getStartTime();
|
|
|
|
+ String endTime = workingConditionCalculationLogModel.getEndTime();
|
|
|
|
+ String calculateType = workingConditionCalculationLogModel.getCalculateType();
|
|
|
|
+ String isDelRedis=workingConditionCalculationLogModel.getIsDelRedis();
|
|
|
|
+ Result<Object> res = new Result<>();
|
|
|
|
+ switch (calculateType) {
|
|
|
|
+ case "0":
|
|
|
|
+ //从开始时间往前取10秒的时间作为开始时间
|
|
|
|
+ try {
|
|
|
|
+ Date startTimeDate = sdf.parse(startTime);
|
|
|
|
+ Date specifiedTime = CommonUtils.getSpecifiedTime(startTimeDate, Calendar.SECOND, -10);
|
|
|
|
+ startTime = sdf.format(specifiedTime);
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ QueryWrapper<OperatingConditionThreshold> operatingConditionThresholdQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ operatingConditionThresholdQueryWrapper.lambda().eq(OperatingConditionThreshold::getJh, jh);
|
|
|
|
+ OperatingConditionThreshold one = operatingConditionThresholdService.getOne(operatingConditionThresholdQueryWrapper);
|
|
|
|
+ if (one != null) {
|
|
|
|
+ calWorkingCondition(jh, startTime, endTime, one, workingConditionCalculationLogModel);
|
|
|
|
+ res = Result.OK();
|
|
|
|
+ } else {
|
|
|
|
+ res = Result.error("计算失败,无设置参数数据");
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ break;
|
|
|
|
+ case "1":
|
|
|
|
+ //钩载重新计算
|
|
|
|
+ hookLoadWarningCalculation(jh, startTime, endTime, workingConditionCalculationLogModel, isDelRedis);
|
|
|
|
+ res = Result.OK();
|
|
|
|
+ break;
|
|
|
|
+ case "2":
|
|
|
|
+ //总池体积重新计算
|
|
|
|
+ totalPoolVolumeWarningCalculation(jh, startTime, endTime, workingConditionCalculationLogModel, isDelRedis);
|
|
|
|
+ res = Result.OK();
|
|
|
|
+ break;
|
|
|
|
+ case "3":
|
|
|
|
+ //扭矩重新计算
|
|
|
|
+ torqueWarningCalculation(jh, startTime, endTime, workingConditionCalculationLogModel, isDelRedis);
|
|
|
|
+ res = Result.OK();
|
|
|
|
+ break;
|
|
|
|
+ case "4":
|
|
|
|
+ //泵压重新计算
|
|
|
|
+ pumpingPressureWarningCalculation(jh, startTime, endTime, workingConditionCalculationLogModel, isDelRedis);
|
|
|
|
+ res = Result.OK();
|
|
|
|
+ break;
|
|
|
|
+ default:
|
|
|
|
+ res = Result.error("计算失败,无计算类型");
|
|
|
|
+ break;
|
|
|
|
+ }
|
|
|
|
+ return res;
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 计算工况动作并更新该点位数据
|
|
|
|
+ *
|
|
|
|
+ * @param jh
|
|
|
|
+ * @param startTime
|
|
|
|
+ * @param endTime
|
|
|
|
+ * @param one
|
|
|
|
+ */
|
|
|
|
+// @Async("workingConditionCalculationTaskExecutor")
|
|
|
|
+ public void calWorkingCondition(String jh, String startTime, String endTime, OperatingConditionThreshold one, WorkingConditionCalculationLog workingConditionCalculationLogModel) {
|
|
|
|
+ Thread currentThread = Thread.currentThread();
|
|
|
|
+ String threadName = currentThread.getName();
|
|
|
|
+ long threadId = currentThread.getId();
|
|
|
|
+ Thread.State threadState = currentThread.getState();
|
|
|
|
+ System.out.println("当前线程名称: " + threadName);
|
|
|
|
+ System.out.println("当前线程ID: " + threadId);
|
|
|
|
+ System.out.println("当前线程状态: " + threadState);
|
|
|
|
+ //根据主键获取计算开始和结束时间
|
|
|
|
+ // WorkingConditionCalculationLog workingConditionCalculationLogModel = workingConditionCalculationLogService.getById(workingConditionCalculationLogId);
|
|
|
|
+ //根据开始结束获取钻井数据
|
|
|
|
+ List<WellDrilling> list = queryList(jh, startTime, endTime);
|
|
|
|
+ String jhTableName = CommonUtils.getJhTableName(jh);
|
|
|
|
+ for (int i = 2; i < list.size(); i++) {
|
|
|
|
+ List<WellDrilling> calList = new ArrayList<>();
|
|
|
|
+ WellDrilling nowPoint = list.get(i);
|
|
|
|
+ WellDrilling perPoint = list.get(i - 2);
|
|
|
|
+ calList.add(nowPoint);
|
|
|
|
+ calList.add(perPoint);
|
|
|
|
+ ConditionDeterminationDto conditionDeterminationDto = conditionIdentificationService.conditionDetermination(calList, one);
|
|
|
|
+ nowPoint.setMotion(conditionDeterminationDto.getMotion());
|
|
|
|
+ nowPoint.setOperatingMode(conditionDeterminationDto.getOperatingMode());
|
|
|
|
+ log.info("更新点位时间:{};工况:{},动作:{}",nowPoint.getTime(),nowPoint.getMotion(),nowPoint.getOperatingMode());
|
|
|
|
+ QueryWrapper<WellDrilling> wrapper1 = new QueryWrapper<>();
|
|
|
|
+ wrapper1.apply("TO_DATE(SUBSTR(TIME, 1, 19), 'yyyy-MM-dd HH24:mi:ss') = to_date({0},'yyyy-mm-dd hh24:mi:ss')", nowPoint.getTime());
|
|
|
|
+ wellDrillingService.updateByTimeOrcale(jhTableName,conditionDeterminationDto.getMotion(), conditionDeterminationDto.getOperatingMode(), wrapper1);
|
|
|
|
+ if ("1".equals(workingConditionCalculationLogModel.getIsCalculate())) {
|
|
|
|
+ workingConditionCalculationLogModel.setIsCalculate("2");
|
|
|
|
+ }
|
|
|
|
+ ;
|
|
|
|
+ if (i == (list.size() - 1)) {
|
|
|
|
+ workingConditionCalculationLogModel.setIsCalculate("3");
|
|
|
|
+ }
|
|
|
|
+ workingConditionCalculationLogModel.setCalTime(nowPoint.getTime());
|
|
|
|
+ workingConditionCalculationLogService.updateById(workingConditionCalculationLogModel);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 钩载预警重新计算
|
|
|
|
+ *
|
|
|
|
+ * @param jh 井号
|
|
|
|
+ * @param startTime 开始时间
|
|
|
|
+ * @param endTime 结束时间
|
|
|
|
+ */
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ @Async("workingConditionCalculationTaskExecutor")
|
|
|
|
+ public void hookLoadWarningCalculation(String jh, String startTime, String endTime, WorkingConditionCalculationLog workingConditionCalculationLogModel, String isDelRedis) {
|
|
|
|
+ Thread currentThread = Thread.currentThread();
|
|
|
|
+ String threadName = currentThread.getName();
|
|
|
|
+ long threadId = currentThread.getId();
|
|
|
|
+ Thread.State threadState = currentThread.getState();
|
|
|
|
+ System.out.println("当前线程名称: " + threadName);
|
|
|
|
+ System.out.println("当前线程ID: " + threadId);
|
|
|
|
+ System.out.println("当前线程状态: " + threadState);
|
|
|
|
+// //根据主键获取计算开始和结束时间
|
|
|
|
+// WorkingConditionCalculationLog workingConditionCalculationLogModel = workingConditionCalculationLogService.getById(workingConditionCalculationLogId);
|
|
|
|
+ BigDecimal warnValue = BigDecimal.valueOf(100);
|
|
|
|
+ BigDecimal rodWeight = BigDecimal.valueOf(7.73);
|
|
|
|
+ //根据开始结束获取钻井数据
|
|
|
|
+ List<WellDrilling> list = queryList(jh, startTime, endTime);
|
|
|
|
+ QueryWrapper<HookLoadWarnLog> hookLoadWarnLogQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ // hookLoadWarnLogQueryWrapper.lambda().between(HookLoadWarnLog::getWarnTime,sdf.parse(startTime),sdf.parse(endTime));
|
|
|
|
+ // hookLoadWarnLogService.list(hookLoadWarnLogQueryWrapper);
|
|
|
|
+ hookLoadWarnLogQueryWrapper.apply("WARN_TIME <= to_date({0},'yyyy-mm-dd hh24:mi:ss')", endTime);
|
|
|
|
+ hookLoadWarnLogQueryWrapper.apply("WARN_TIME >= to_date({0},'yyyy-mm-dd hh24:mi:ss')", startTime);
|
|
|
|
+ hookLoadWarnLogService.remove(hookLoadWarnLogQueryWrapper);
|
|
|
|
+ redisUtil.del(jh + "_hook_load_recalculate");
|
|
|
|
+ redisUtil.del(jh + "_drilling_hook_load_recalculate");
|
|
|
|
+ for (int i = 0; i < list.size() - 1; i++) {
|
|
|
|
+ WellDrilling nowPoint = list.get(i);
|
|
|
|
+ String operatingMode = nowPoint.getOperatingMode();
|
|
|
|
+ BigDecimal bitdepth = nowPoint.getBitdepth();
|
|
|
|
+ int bitdepthThreshold = bitdepth.compareTo(BigDecimal.valueOf(500));
|
|
|
|
+ if (bitdepthThreshold >= 0) {
|
|
|
|
+ String redisHasKey = "";
|
|
|
|
+ log.info("钩载预警计算,当前点井深{};时间:{}", nowPoint.getBitdepth(), nowPoint.getTime());
|
|
|
|
+ if ("起下钻".equals(operatingMode)) {
|
|
|
|
+ redisHasKey = jh + "_hook_load_recalculate";
|
|
|
|
+ drillingOutHookLoadService.hookLoadWarnCalculate(nowPoint, redisHasKey, warnValue, rodWeight);
|
|
|
|
+ } else {
|
|
|
|
+ redisHasKey = jh + "_drilling_hook_load_recalculate";
|
|
|
|
+ drillingHookloadService.hookLoadWarnCalculate(nowPoint, redisHasKey, warnValue);
|
|
|
|
+ }
|
|
|
|
+ }else {
|
|
|
|
+ log.info("钩载预警计算,钻头位置小于500米;当前点井深{};时间:{}", nowPoint.getBitdepth(), nowPoint.getTime());
|
|
|
|
+ }
|
|
|
|
+ if ("1".equals(workingConditionCalculationLogModel.getIsCalculate())) {
|
|
|
|
+ workingConditionCalculationLogModel.setIsCalculate("2");
|
|
|
|
+ }
|
|
|
|
+ ;
|
|
|
|
+ if (i == (list.size() - 2)) {
|
|
|
|
+ workingConditionCalculationLogModel.setIsCalculate("3");
|
|
|
|
+ }
|
|
|
|
+ workingConditionCalculationLogModel.setCalTime(nowPoint.getTime());
|
|
|
|
+ workingConditionCalculationLogService.updateById(workingConditionCalculationLogModel);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 总池体积预警重新计算
|
|
|
|
+ *
|
|
|
|
+ * @param jh 井号
|
|
|
|
+ * @param startTime 开始时间
|
|
|
|
+ * @param endTime 结束时间
|
|
|
|
+ */
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ @Async("workingConditionCalculationTaskExecutor")
|
|
|
|
+ public void totalPoolVolumeWarningCalculation(String jh, String startTime, String endTime, WorkingConditionCalculationLog workingConditionCalculationLogModel, String isDelRedis) {
|
|
|
|
+ Thread currentThread = Thread.currentThread();
|
|
|
|
+ String threadName = currentThread.getName();
|
|
|
|
+ long threadId = currentThread.getId();
|
|
|
|
+ Thread.State threadState = currentThread.getState();
|
|
|
|
+ System.out.println("当前线程名称: " + threadName);
|
|
|
|
+ System.out.println("当前线程ID: " + threadId);
|
|
|
|
+ System.out.println("当前线程状态: " + threadState);
|
|
|
|
+// BigDecimal warnValue = BigDecimal.valueOf(100);
|
|
|
|
+// BigDecimal rodWeight = BigDecimal.valueOf(7.73);
|
|
|
|
+ //根据开始结束获取钻井数据
|
|
|
|
+ List<WellDrilling> list = queryList(jh, startTime, endTime);
|
|
|
|
+ QueryWrapper<TotalPoolVolumeWarnLog> totalPoolVolumeWarnLogQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ totalPoolVolumeWarnLogQueryWrapper.apply("WARN_TIME <= to_date({0},'yyyy-mm-dd hh24:mi:ss')", endTime);
|
|
|
|
+ totalPoolVolumeWarnLogQueryWrapper.apply("WARN_TIME >= to_date({0},'yyyy-mm-dd hh24:mi:ss')", startTime);
|
|
|
|
+ totalPoolVolumeWarnLogService.remove(totalPoolVolumeWarnLogQueryWrapper);
|
|
|
|
+ String redisHasKey = jh + "_total_pool_volume_recalculate";
|
|
|
|
+ if ("0".equals(isDelRedis)) {
|
|
|
|
+ redisUtil.del(redisHasKey);
|
|
|
|
+ }
|
|
|
|
+ for (int i = 0; i < list.size() - 1; i++) {
|
|
|
|
+ WellDrilling nowPoint = list.get(i);
|
|
|
|
+ // String operatingMode = nowPoint.getOperatingMode();
|
|
|
|
+ BigDecimal bitdepth = nowPoint.getBitdepth();
|
|
|
|
+ int bitdepthThreshold = bitdepth.compareTo(BigDecimal.valueOf(500));
|
|
|
|
+ if (bitdepthThreshold >= 0) {
|
|
|
|
+ try {
|
|
|
|
+ totalPoolVolumeService.totalPoolVolumeWarn(nowPoint, redisHasKey);
|
|
|
|
+ } catch (ParseException e) {
|
|
|
|
+ e.printStackTrace();
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+ if ("1".equals(workingConditionCalculationLogModel.getIsCalculate())) {
|
|
|
|
+ workingConditionCalculationLogModel.setIsCalculate("2");
|
|
|
|
+ }
|
|
|
|
+ ;
|
|
|
|
+ if (i == (list.size() - 2)) {
|
|
|
|
+ workingConditionCalculationLogModel.setIsCalculate("3");
|
|
|
|
+ }
|
|
|
|
+ workingConditionCalculationLogModel.setCalTime(nowPoint.getTime());
|
|
|
|
+ workingConditionCalculationLogService.updateById(workingConditionCalculationLogModel);
|
|
|
|
+
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 泵压预警重新计算
|
|
|
|
+ *
|
|
|
|
+ * @param jh 井号
|
|
|
|
+ * @param startTime 开始时间
|
|
|
|
+ * @param endTime 结束时间
|
|
|
|
+ */
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ @Async("workingConditionCalculationTaskExecutor")
|
|
|
|
+ public void pumpingPressureWarningCalculation(String jh, String startTime, String endTime, WorkingConditionCalculationLog workingConditionCalculationLogModel, String isDelRedis) {
|
|
|
|
+ Thread currentThread = Thread.currentThread();
|
|
|
|
+ String threadName = currentThread.getName();
|
|
|
|
+ long threadId = currentThread.getId();
|
|
|
|
+ Thread.State threadState = currentThread.getState();
|
|
|
|
+ System.out.println("当前线程名称: " + threadName);
|
|
|
|
+ System.out.println("当前线程ID: " + threadId);
|
|
|
|
+ System.out.println("当前线程状态: " + threadState);
|
|
|
|
+ List<WellDrilling> list = queryList(jh, startTime, endTime);
|
|
|
|
+ String redisHasKey = jh + "_pumping_pressure_recalculate";
|
|
|
|
+ QueryWrapper<PumpingPressureWarnLog> pumpingPressureWarnLogQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ pumpingPressureWarnLogQueryWrapper.apply("WARN_TIME <= to_date({0},'yyyy-mm-dd hh24:mi:ss')", endTime);
|
|
|
|
+ pumpingPressureWarnLogQueryWrapper.apply("WARN_TIME >= to_date({0},'yyyy-mm-dd hh24:mi:ss')", startTime);
|
|
|
|
+ pumpingPressureWarnLogService.remove(pumpingPressureWarnLogQueryWrapper);
|
|
|
|
+ if ("0".equals(isDelRedis)) {
|
|
|
|
+ redisUtil.del(redisHasKey);
|
|
|
|
+ }
|
|
|
|
+ for (int i = 0; i < list.size() - 1; i++) {
|
|
|
|
+ WellDrilling nowPoint = list.get(i);
|
|
|
|
+ BigDecimal bitdepth = nowPoint.getBitdepth();
|
|
|
|
+ int bitdepthThreshold = bitdepth.compareTo(BigDecimal.valueOf(500));
|
|
|
|
+ if (bitdepthThreshold >= 0) {
|
|
|
|
+ pumpingPressureService.pumpingPressureCalculate(nowPoint, redisHasKey);
|
|
|
|
+ }
|
|
|
|
+ if ("1".equals(workingConditionCalculationLogModel.getIsCalculate())) {
|
|
|
|
+ workingConditionCalculationLogModel.setIsCalculate("2");
|
|
|
|
+ }
|
|
|
|
+ ;
|
|
|
|
+ if (i == (list.size() - 2)) {
|
|
|
|
+ workingConditionCalculationLogModel.setIsCalculate("3");
|
|
|
|
+ }
|
|
|
|
+ workingConditionCalculationLogModel.setCalTime(nowPoint.getTime());
|
|
|
|
+ workingConditionCalculationLogService.updateById(workingConditionCalculationLogModel);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ /**
|
|
|
|
+ * 扭矩预警重新计算
|
|
|
|
+ *
|
|
|
|
+ * @param jh 井号
|
|
|
|
+ * @param startTime 开始时间
|
|
|
|
+ * @param endTime 结束时间
|
|
|
|
+ */
|
|
|
|
+ @SneakyThrows
|
|
|
|
+ @Async("workingConditionCalculationTaskExecutor")
|
|
|
|
+ public void torqueWarningCalculation(String jh, String startTime, String endTime, WorkingConditionCalculationLog workingConditionCalculationLogModel, String isDelRedis) {
|
|
|
|
+ Thread currentThread = Thread.currentThread();
|
|
|
|
+ String threadName = currentThread.getName();
|
|
|
|
+ long threadId = currentThread.getId();
|
|
|
|
+ Thread.State threadState = currentThread.getState();
|
|
|
|
+ System.out.println("当前线程名称: " + threadName);
|
|
|
|
+ System.out.println("当前线程ID: " + threadId);
|
|
|
|
+ System.out.println("当前线程状态: " + threadState);
|
|
|
|
+ List<WellDrilling> list = queryList(jh, startTime, endTime);
|
|
|
|
+ QueryWrapper<TorqueWarnLog> torqueWarnLogQueryWrapper = new QueryWrapper<>();
|
|
|
|
+ torqueWarnLogQueryWrapper.apply("WARN_START_TIME <= to_date({0},'yyyy-mm-dd hh24:mi:ss')", endTime);
|
|
|
|
+ torqueWarnLogQueryWrapper.apply("WARN_START_TIME >= to_date({0},'yyyy-mm-dd hh24:mi:ss')", startTime);
|
|
|
|
+ torqueWarnLogService.remove(torqueWarnLogQueryWrapper);
|
|
|
|
+ String redisHasKey = jh + "_torque_recalculate";
|
|
|
|
+ if ("0".equals(isDelRedis)) {
|
|
|
|
+ redisUtil.del(redisHasKey);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ for (int i = 0; i < list.size() - 1; i++) {
|
|
|
|
+ WellDrilling nowPoint = list.get(i);
|
|
|
|
+ BigDecimal bitdepth = nowPoint.getBitdepth();
|
|
|
|
+ int bitdepthThreshold = bitdepth.compareTo(BigDecimal.valueOf(500));
|
|
|
|
+ if (bitdepthThreshold >= 0) {
|
|
|
|
+ log.info("当前点井深{};时间:{}", nowPoint.getBitdepth(), nowPoint.getTime());
|
|
|
|
+ BigDecimal varianceWarnValue = BigDecimal.valueOf(0.5);
|
|
|
|
+ BigDecimal fluctuateWarn = BigDecimal.valueOf(0.5);
|
|
|
|
+ torqueService.torqueCalculate(nowPoint, redisHasKey,varianceWarnValue,fluctuateWarn);
|
|
|
|
+ } else {
|
|
|
|
+ log.info("钻头位置小于500米;当前点井深{};时间:{}", nowPoint.getBitdepth(), nowPoint.getTime());
|
|
|
|
+ }
|
|
|
|
+ if ("1".equals(workingConditionCalculationLogModel.getIsCalculate())) {
|
|
|
|
+ workingConditionCalculationLogModel.setIsCalculate("2");
|
|
|
|
+ }
|
|
|
|
+ ;
|
|
|
|
+ if (i == (list.size() - 2)) {
|
|
|
|
+ workingConditionCalculationLogModel.setIsCalculate("3");
|
|
|
|
+ }
|
|
|
|
+ workingConditionCalculationLogModel.setCalTime(nowPoint.getTime());
|
|
|
|
+ workingConditionCalculationLogService.updateById(workingConditionCalculationLogModel);
|
|
|
|
+ }
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+ public List<WellDrilling> queryList(String jh, String startTime, String endTime) {
|
|
|
|
+ QueryWrapper<WellDrilling> wrapper = new QueryWrapper<>();
|
|
|
|
+ wrapper.apply("TO_DATE(SUBSTR(TIME, 1, 19), 'yyyy-MM-dd HH24:mi:ss') <= to_date({0},'yyyy-mm-dd hh24:mi:ss')", endTime);
|
|
|
|
+ wrapper.apply("TO_DATE(SUBSTR(TIME, 1, 19), 'yyyy-MM-dd HH24:mi:ss') >= to_date({0},'yyyy-mm-dd hh24:mi:ss')", startTime);
|
|
|
|
+ wrapper.orderByAsc("TIME");
|
|
|
|
+ String jhTableName = CommonUtils.getJhTableName(jh);
|
|
|
|
+ return wellDrillingService.selectListOrcale(jhTableName, wrapper);
|
|
|
|
+ }
|
|
|
|
+
|
|
|
|
+// public void calWorkingCondition(String jhTableName,List<WellDrilling> list,OperatingConditionThreshold one,WorkingConditionCalculationLog workingConditionCalculationLogModel){
|
|
|
|
+//
|
|
|
|
+// }
|
|
|
|
+
|
|
|
|
+}
|