Commit 65b61f1d authored by ZWT's avatar ZWT

feat(零碳): 长庆演示系统新增功能

1.新建油田配置表同时生成相关代码及mapper文件,修改部分第三方数据抽取定时任务,增加针对不同井场开关控制逻辑,同时修改首页页面展示逻辑,通过油田配置功能区分不同首页展示功能;
2.新建定时任务配置表同时生成相关代码及mapper文件,定时任务模块增加mybatis配置,用以操作数据库,修改部分第三方数据抽取定时任务,修改使用方式使其脱离框架方便动态控制;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 9639c6f5
package pps.core.task.job; package pps.core.task.job;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import pps.cloud.space.service.IDailyElectricityTrendCloudService; import pps.cloud.space.service.IDailyElectricityTrendCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XService; import xstartup.annotation.XService;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
...@@ -30,14 +32,11 @@ public class DailyElectricityTrendJob implements XJob { ...@@ -30,14 +32,11 @@ public class DailyElectricityTrendJob implements XJob {
@XCronTrigger(value = TaskConstant.EVERY_DAY_12) @XCronTrigger(value = TaskConstant.EVERY_DAY_12)
@Override @Override
public XServiceResult execute(XContext xContext) { public XServiceResult execute(XContext xContext) {
xContext.getLogger().info("------ DailyElectricityTrendJob start:{}", System.currentTimeMillis()); xContext.getLogger().info("------ DailyElectricityTrendJob start:{}", DateUtil.date());
String key = TaskConstant.TASK_LOCK_KEY + "DailyElectricityTrendJob"; String key = TaskConstant.TASK_LOCK_KEY + "DailyElectricityTrendJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
TaskLockCache cache = new TaskLockCache(); ServiceUtil.setCache(xContext, key);
cache.setRedisKey(key);
cache.setRedisValue(key);
TaskLockCache.set(xContext, cache);
try { try {
IDailyElectricityTrendCloudService service = xContext.getBean(IDailyElectricityTrendCloudService.class); IDailyElectricityTrendCloudService service = xContext.getBean(IDailyElectricityTrendCloudService.class);
XServiceResult result = service.dailyElectricityTrendJob(xContext); XServiceResult result = service.dailyElectricityTrendJob(xContext);
...@@ -45,7 +44,7 @@ public class DailyElectricityTrendJob implements XJob { ...@@ -45,7 +44,7 @@ public class DailyElectricityTrendJob implements XJob {
} catch (Exception e) { } catch (Exception e) {
xContext.getLogger().error("------ DailyElectricityTrendJob Exception: ", e); xContext.getLogger().error("------ DailyElectricityTrendJob Exception: ", e);
} finally { } finally {
xContext.getLogger().info("------ DailyElectricityTrendJob end:{}", System.currentTimeMillis()); xContext.getLogger().info("------ DailyElectricityTrendJob end:{}", DateUtil.date());
TaskLockCache.delete(xContext, key); TaskLockCache.delete(xContext, key);
} }
} }
......
package pps.core.task.job; package pps.core.task.job;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import pps.cloud.prediction.service.IThirdDataAccessCloudService; import pps.cloud.prediction.service.IThirdDataAccessCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XService; import xstartup.annotation.XService;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
...@@ -30,14 +32,11 @@ public class EnergyConsumptionAnalysisJob implements XJob { ...@@ -30,14 +32,11 @@ public class EnergyConsumptionAnalysisJob implements XJob {
@XCronTrigger(value = TaskConstant.EVERY_DAY_30) @XCronTrigger(value = TaskConstant.EVERY_DAY_30)
@Override @Override
public XServiceResult execute(XContext xContext) { public XServiceResult execute(XContext xContext) {
xContext.getLogger().info("------ EnergyConsumptionAnalysisJob start:{}", System.currentTimeMillis()); xContext.getLogger().info("------ EnergyConsumptionAnalysisJob start:{}", DateUtil.date());
String key = TaskConstant.TASK_LOCK_KEY + "EnergyConsumptionAnalysisJob"; String key = TaskConstant.TASK_LOCK_KEY + "EnergyConsumptionAnalysisJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
TaskLockCache cache = new TaskLockCache(); ServiceUtil.setCache(xContext, key);
cache.setRedisKey(key);
cache.setRedisValue(key);
TaskLockCache.set(xContext, cache);
try { try {
IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class); IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class);
XServiceResult result = service.energyConsumptionAnalysisJob(xContext); XServiceResult result = service.energyConsumptionAnalysisJob(xContext);
...@@ -45,7 +44,7 @@ public class EnergyConsumptionAnalysisJob implements XJob { ...@@ -45,7 +44,7 @@ public class EnergyConsumptionAnalysisJob implements XJob {
} catch (Exception e) { } catch (Exception e) {
xContext.getLogger().error("------ EnergyConsumptionAnalysisJob Exception: ", e); xContext.getLogger().error("------ EnergyConsumptionAnalysisJob Exception: ", e);
} finally { } finally {
xContext.getLogger().info("------ EnergyConsumptionAnalysisJob end:{}", System.currentTimeMillis()); xContext.getLogger().info("------ EnergyConsumptionAnalysisJob end:{}", DateUtil.date());
TaskLockCache.delete(xContext, key); TaskLockCache.delete(xContext, key);
} }
} }
......
package pps.core.task.job; package pps.core.task.job;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import pps.cloud.prediction.service.PlantPredictedPowerLongTermDataCloudService; import pps.cloud.prediction.service.PlantPredictedPowerLongTermDataCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XService; import xstartup.annotation.XService;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
...@@ -17,14 +19,11 @@ public class PlantPredictedPowerLongTermDataJob implements XJob { ...@@ -17,14 +19,11 @@ public class PlantPredictedPowerLongTermDataJob implements XJob {
@XCronTrigger(value = "0 45 1 * * ?") @XCronTrigger(value = "0 45 1 * * ?")
@Override @Override
public XServiceResult execute(XContext xContext) { public XServiceResult execute(XContext xContext) {
xContext.getLogger().info("------ PlantPredictedPowerLongTermDataJob start:{}", System.currentTimeMillis()); xContext.getLogger().info("------ PlantPredictedPowerLongTermDataJob start:{}", DateUtil.date());
String key = TaskConstant.TASK_LOCK_KEY + "PlantPredictedPowerLongTermDataJob"; String key = TaskConstant.TASK_LOCK_KEY + "PlantPredictedPowerLongTermDataJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
TaskLockCache cache = new TaskLockCache(); ServiceUtil.setCache(xContext, key);
cache.setRedisKey(key);
cache.setRedisValue(key);
TaskLockCache.set(xContext, cache);
try { try {
PlantPredictedPowerLongTermDataCloudService cloudService = xContext.getBean(PlantPredictedPowerLongTermDataCloudService.class); PlantPredictedPowerLongTermDataCloudService cloudService = xContext.getBean(PlantPredictedPowerLongTermDataCloudService.class);
XServiceResult result = cloudService.runPlantPredictedPowerLongTermData(xContext); XServiceResult result = cloudService.runPlantPredictedPowerLongTermData(xContext);
...@@ -32,7 +31,7 @@ public class PlantPredictedPowerLongTermDataJob implements XJob { ...@@ -32,7 +31,7 @@ public class PlantPredictedPowerLongTermDataJob implements XJob {
} catch (Exception e) { } catch (Exception e) {
xContext.getLogger().error("------ PlantPredictedPowerLongTermDataJob Exception: ", e); xContext.getLogger().error("------ PlantPredictedPowerLongTermDataJob Exception: ", e);
} finally { } finally {
xContext.getLogger().info("------ PlantPredictedPowerLongTermDataJob end:{}", System.currentTimeMillis()); xContext.getLogger().info("------ PlantPredictedPowerLongTermDataJob end:{}", DateUtil.date());
TaskLockCache.delete(xContext, key); TaskLockCache.delete(xContext, key);
} }
} }
......
package pps.core.task.job; package pps.core.task.job;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import pps.cloud.space.service.ISpaceCalibrationCloudService; import pps.cloud.space.service.ISpaceCalibrationCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XService; import xstartup.annotation.XService;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
...@@ -30,14 +32,11 @@ public class SpaceCalibrationJob implements XJob { ...@@ -30,14 +32,11 @@ public class SpaceCalibrationJob implements XJob {
@XCronTrigger(value = TaskConstant.EVERY_DAY_25) @XCronTrigger(value = TaskConstant.EVERY_DAY_25)
@Override @Override
public XServiceResult execute(XContext xContext) { public XServiceResult execute(XContext xContext) {
xContext.getLogger().info("------ SpaceCalibrationJob start:{}", System.currentTimeMillis()); xContext.getLogger().info("------ SpaceCalibrationJob start:{}", DateUtil.date());
String key = TaskConstant.TASK_LOCK_KEY + "SpaceCalibrationJob"; String key = TaskConstant.TASK_LOCK_KEY + "SpaceCalibrationJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
TaskLockCache cache = new TaskLockCache(); ServiceUtil.setCache(xContext, key);
cache.setRedisKey(key);
cache.setRedisValue(key);
TaskLockCache.set(xContext, cache);
try { try {
ISpaceCalibrationCloudService service = xContext.getBean(ISpaceCalibrationCloudService.class); ISpaceCalibrationCloudService service = xContext.getBean(ISpaceCalibrationCloudService.class);
XServiceResult result = service.calibrateJob(xContext); XServiceResult result = service.calibrateJob(xContext);
...@@ -45,7 +44,7 @@ public class SpaceCalibrationJob implements XJob { ...@@ -45,7 +44,7 @@ public class SpaceCalibrationJob implements XJob {
} catch (Exception e) { } catch (Exception e) {
xContext.getLogger().error("------ SpaceCalibrationJob Exception: ", e); xContext.getLogger().error("------ SpaceCalibrationJob Exception: ", e);
} finally { } finally {
xContext.getLogger().info("------ SpaceCalibrationJob end:{}", System.currentTimeMillis()); xContext.getLogger().info("------ SpaceCalibrationJob end:{}", DateUtil.date());
TaskLockCache.delete(xContext, key); TaskLockCache.delete(xContext, key);
} }
} }
......
package pps.core.task.job; package pps.core.task.job;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import pps.cloud.space.service.ISpaceOptimizeLongCloudService; import pps.cloud.space.service.ISpaceOptimizeLongCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XService; import xstartup.annotation.XService;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
...@@ -30,14 +32,11 @@ public class SpaceOptimizeLongJob implements XJob { ...@@ -30,14 +32,11 @@ public class SpaceOptimizeLongJob implements XJob {
@XCronTrigger(value = TaskConstant.EVERY_DAY_15) @XCronTrigger(value = TaskConstant.EVERY_DAY_15)
@Override @Override
public XServiceResult execute(XContext xContext) { public XServiceResult execute(XContext xContext) {
xContext.getLogger().info("------ SpaceOptimizeLongJob start:{}", System.currentTimeMillis()); xContext.getLogger().info("------ SpaceOptimizeLongJob start:{}", DateUtil.date());
String key = TaskConstant.TASK_LOCK_KEY + "SpaceOptimizeLongJob"; String key = TaskConstant.TASK_LOCK_KEY + "SpaceOptimizeLongJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
TaskLockCache cache = new TaskLockCache(); ServiceUtil.setCache(xContext, key);
cache.setRedisKey(key);
cache.setRedisValue(key);
TaskLockCache.set(xContext, cache);
try { try {
ISpaceOptimizeLongCloudService service = xContext.getBean(ISpaceOptimizeLongCloudService.class); ISpaceOptimizeLongCloudService service = xContext.getBean(ISpaceOptimizeLongCloudService.class);
XServiceResult result = service.optimizeLongJob(xContext); XServiceResult result = service.optimizeLongJob(xContext);
...@@ -45,7 +44,7 @@ public class SpaceOptimizeLongJob implements XJob { ...@@ -45,7 +44,7 @@ public class SpaceOptimizeLongJob implements XJob {
} catch (Exception e) { } catch (Exception e) {
xContext.getLogger().error("------ SpaceOptimizeLongJob Exception: ", e); xContext.getLogger().error("------ SpaceOptimizeLongJob Exception: ", e);
} finally { } finally {
xContext.getLogger().info("------ SpaceOptimizeLongJob end:{}", System.currentTimeMillis()); xContext.getLogger().info("------ SpaceOptimizeLongJob end:{}", DateUtil.date());
TaskLockCache.delete(xContext, key); TaskLockCache.delete(xContext, key);
} }
} }
......
package pps.core.task.job; package pps.core.task.job;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import pps.cloud.space.service.ISpaceOptimizeMidCloudService; import pps.cloud.space.service.ISpaceOptimizeMidCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XService; import xstartup.annotation.XService;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
...@@ -30,14 +32,11 @@ public class SpaceOptimizeMidJob implements XJob { ...@@ -30,14 +32,11 @@ public class SpaceOptimizeMidJob implements XJob {
@XCronTrigger(value = TaskConstant.EVERY_DAY_10) @XCronTrigger(value = TaskConstant.EVERY_DAY_10)
@Override @Override
public XServiceResult execute(XContext xContext) { public XServiceResult execute(XContext xContext) {
xContext.getLogger().info("------ SpaceOptimizeMidJob start:{}", System.currentTimeMillis()); xContext.getLogger().info("------ SpaceOptimizeMidJob start:{}", DateUtil.date());
String key = TaskConstant.TASK_LOCK_KEY + "SpaceOptimizeMidJob"; String key = TaskConstant.TASK_LOCK_KEY + "SpaceOptimizeMidJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
TaskLockCache cache = new TaskLockCache(); ServiceUtil.setCache(xContext, key);
cache.setRedisKey(key);
cache.setRedisValue(key);
TaskLockCache.set(xContext, cache);
try { try {
ISpaceOptimizeMidCloudService service = xContext.getBean(ISpaceOptimizeMidCloudService.class); ISpaceOptimizeMidCloudService service = xContext.getBean(ISpaceOptimizeMidCloudService.class);
XServiceResult result = service.optimizeMidJob(xContext); XServiceResult result = service.optimizeMidJob(xContext);
...@@ -45,7 +44,7 @@ public class SpaceOptimizeMidJob implements XJob { ...@@ -45,7 +44,7 @@ public class SpaceOptimizeMidJob implements XJob {
} catch (Exception e) { } catch (Exception e) {
xContext.getLogger().error("------ SpaceOptimizeMidJob Exception: ", e); xContext.getLogger().error("------ SpaceOptimizeMidJob Exception: ", e);
} finally { } finally {
xContext.getLogger().info("------ SpaceOptimizeMidJob end:{}", System.currentTimeMillis()); xContext.getLogger().info("------ SpaceOptimizeMidJob end:{}", DateUtil.date());
TaskLockCache.delete(xContext, key); TaskLockCache.delete(xContext, key);
} }
} }
......
package pps.core.task.job; package pps.core.task.job;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import pps.cloud.space.service.ISpaceOptimizeShortCloudService; import pps.cloud.space.service.ISpaceOptimizeShortCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XService; import xstartup.annotation.XService;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
...@@ -30,14 +32,11 @@ public class SpaceOptimizeShortJob implements XJob { ...@@ -30,14 +32,11 @@ public class SpaceOptimizeShortJob implements XJob {
@XCronTrigger(value = TaskConstant.EVERY_DAY_20) @XCronTrigger(value = TaskConstant.EVERY_DAY_20)
@Override @Override
public XServiceResult execute(XContext xContext) { public XServiceResult execute(XContext xContext) {
xContext.getLogger().info("------ SpaceOptimizeShortJob start:{}", System.currentTimeMillis()); xContext.getLogger().info("------ SpaceOptimizeShortJob start:{}", DateUtil.date());
String key = TaskConstant.TASK_LOCK_KEY + "SpaceOptimizeShortJob"; String key = TaskConstant.TASK_LOCK_KEY + "SpaceOptimizeShortJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
TaskLockCache cache = new TaskLockCache(); ServiceUtil.setCache(xContext, key);
cache.setRedisKey(key);
cache.setRedisValue(key);
TaskLockCache.set(xContext, cache);
try { try {
ISpaceOptimizeShortCloudService service = xContext.getBean(ISpaceOptimizeShortCloudService.class); ISpaceOptimizeShortCloudService service = xContext.getBean(ISpaceOptimizeShortCloudService.class);
XServiceResult result = service.optimizeShortJob(xContext); XServiceResult result = service.optimizeShortJob(xContext);
...@@ -45,7 +44,7 @@ public class SpaceOptimizeShortJob implements XJob { ...@@ -45,7 +44,7 @@ public class SpaceOptimizeShortJob implements XJob {
} catch (Exception e) { } catch (Exception e) {
xContext.getLogger().error("------ SpaceOptimizeShortJob Exception: ", e); xContext.getLogger().error("------ SpaceOptimizeShortJob Exception: ", e);
} finally { } finally {
xContext.getLogger().info("------ SpaceOptimizeShortJob end:{}", System.currentTimeMillis()); xContext.getLogger().info("------ SpaceOptimizeShortJob end:{}", DateUtil.date());
TaskLockCache.delete(xContext, key); TaskLockCache.delete(xContext, key);
} }
} }
......
package pps.core.task.job; package pps.core.task.job;
import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.ObjectUtil; import cn.hutool.core.util.ObjectUtil;
import pps.cloud.space.service.ISpaceOptimizeUltraCloudService; import pps.cloud.space.service.ISpaceOptimizeUltraCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XService; import xstartup.annotation.XService;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
...@@ -30,14 +32,11 @@ public class SpaceOptimizeUltraJob implements XJob { ...@@ -30,14 +32,11 @@ public class SpaceOptimizeUltraJob implements XJob {
@XCronTrigger(value = TaskConstant.EVERY_DAY_5) @XCronTrigger(value = TaskConstant.EVERY_DAY_5)
@Override @Override
public XServiceResult execute(XContext xContext) { public XServiceResult execute(XContext xContext) {
xContext.getLogger().info("------ SpaceOptimizeUltraJob start:{}", System.currentTimeMillis()); xContext.getLogger().info("------ SpaceOptimizeUltraJob start:{}", DateUtil.date());
String key = TaskConstant.TASK_LOCK_KEY + "SpaceOptimizeUltraJob"; String key = TaskConstant.TASK_LOCK_KEY + "SpaceOptimizeUltraJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
TaskLockCache cache = new TaskLockCache(); ServiceUtil.setCache(xContext, key);
cache.setRedisKey(key);
cache.setRedisValue(key);
TaskLockCache.set(xContext, cache);
try { try {
ISpaceOptimizeUltraCloudService service = xContext.getBean(ISpaceOptimizeUltraCloudService.class); ISpaceOptimizeUltraCloudService service = xContext.getBean(ISpaceOptimizeUltraCloudService.class);
XServiceResult result = service.optimizeUltraJob(xContext); XServiceResult result = service.optimizeUltraJob(xContext);
...@@ -45,7 +44,7 @@ public class SpaceOptimizeUltraJob implements XJob { ...@@ -45,7 +44,7 @@ public class SpaceOptimizeUltraJob implements XJob {
} catch (Exception e) { } catch (Exception e) {
xContext.getLogger().error("------ SpaceOptimizeUltraJob Exception: ", e); xContext.getLogger().error("------ SpaceOptimizeUltraJob Exception: ", e);
} finally { } finally {
xContext.getLogger().info("------ SpaceOptimizeUltraJob end:{}", System.currentTimeMillis()); xContext.getLogger().info("------ SpaceOptimizeUltraJob end:{}", DateUtil.date());
TaskLockCache.delete(xContext, key); TaskLockCache.delete(xContext, key);
} }
} }
......
...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import pps.cloud.prediction.service.IThirdDataAccessCloudService; import pps.cloud.prediction.service.IThirdDataAccessCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.service.JobCommonService; import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.data.XServiceResult; import xstartup.data.XServiceResult;
...@@ -17,7 +17,7 @@ import xstartup.data.XServiceResult; ...@@ -17,7 +17,7 @@ import xstartup.data.XServiceResult;
* @date 2024/03/19 10:06 * @date 2024/03/19 10:06
*/ */
@XText("第三方有功功率定时任务") @XText("第三方有功功率定时任务")
public class ThirdActivePowerJob extends JobCommonService { public class ThirdActivePowerJob {
/** /**
* 十分钟一次 * 十分钟一次
...@@ -30,7 +30,7 @@ public class ThirdActivePowerJob extends JobCommonService { ...@@ -30,7 +30,7 @@ public class ThirdActivePowerJob extends JobCommonService {
String key = TaskConstant.TASK_LOCK_KEY + "ThirdActivePowerJob"; String key = TaskConstant.TASK_LOCK_KEY + "ThirdActivePowerJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
this.setCache(xContext, key); ServiceUtil.setCache(xContext, key);
try { try {
IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class); IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class);
XServiceResult result = service.thirdActivePowerJob(xContext); XServiceResult result = service.thirdActivePowerJob(xContext);
......
...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import pps.cloud.prediction.service.IThirdDataAccessCloudService; import pps.cloud.prediction.service.IThirdDataAccessCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.service.JobCommonService; import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.data.XServiceResult; import xstartup.data.XServiceResult;
...@@ -17,7 +17,7 @@ import xstartup.data.XServiceResult; ...@@ -17,7 +17,7 @@ import xstartup.data.XServiceResult;
* @date 2024/03/19 10:07 * @date 2024/03/19 10:07
*/ */
@XText("第三方当日油井状态定时任务") @XText("第三方当日油井状态定时任务")
public class ThirdCurrentWellConditionJob extends JobCommonService { public class ThirdCurrentWellConditionJob {
/** /**
* 十分钟一次,隔9分钟 * 十分钟一次,隔9分钟
...@@ -30,7 +30,7 @@ public class ThirdCurrentWellConditionJob extends JobCommonService { ...@@ -30,7 +30,7 @@ public class ThirdCurrentWellConditionJob extends JobCommonService {
String key = TaskConstant.TASK_LOCK_KEY + "ThirdCurrentWellConditionJob"; String key = TaskConstant.TASK_LOCK_KEY + "ThirdCurrentWellConditionJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
this.setCache(xContext, key); ServiceUtil.setCache(xContext, key);
try { try {
IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class); IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class);
XServiceResult result = service.thirdCurrentWellConditionJob(xContext); XServiceResult result = service.thirdCurrentWellConditionJob(xContext);
......
...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import pps.cloud.prediction.service.IThirdDataAccessCloudService; import pps.cloud.prediction.service.IThirdDataAccessCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.service.JobCommonService; import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.data.XServiceResult; import xstartup.data.XServiceResult;
...@@ -17,7 +17,7 @@ import xstartup.data.XServiceResult; ...@@ -17,7 +17,7 @@ import xstartup.data.XServiceResult;
* @date 2024/04/01 14:58 * @date 2024/04/01 14:58
*/ */
@XText("第三方井场日累计数据定时任务") @XText("第三方井场日累计数据定时任务")
public class ThirdDailyAccumulationJob extends JobCommonService { public class ThirdDailyAccumulationJob {
/** /**
* 十分钟一次,隔7分钟 * 十分钟一次,隔7分钟
...@@ -30,7 +30,7 @@ public class ThirdDailyAccumulationJob extends JobCommonService { ...@@ -30,7 +30,7 @@ public class ThirdDailyAccumulationJob extends JobCommonService {
String key = TaskConstant.TASK_LOCK_KEY + "ThirdDailyAccumulationJob"; String key = TaskConstant.TASK_LOCK_KEY + "ThirdDailyAccumulationJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
this.setCache(xContext, key); ServiceUtil.setCache(xContext, key);
try { try {
IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class); IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class);
XServiceResult result = service.thirdDailyAccumulationJob(xContext); XServiceResult result = service.thirdDailyAccumulationJob(xContext);
......
...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import pps.cloud.prediction.service.IThirdDataAccessCloudService; import pps.cloud.prediction.service.IThirdDataAccessCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.service.JobCommonService; import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.data.XServiceResult; import xstartup.data.XServiceResult;
...@@ -17,7 +17,7 @@ import xstartup.data.XServiceResult; ...@@ -17,7 +17,7 @@ import xstartup.data.XServiceResult;
* @date 2024/03/19 10:07 * @date 2024/03/19 10:07
*/ */
@XText("第三方光伏日发电量定时任务") @XText("第三方光伏日发电量定时任务")
public class ThirdPhotovoltaicPowerJob extends JobCommonService { public class ThirdPhotovoltaicPowerJob {
/** /**
* 每天00:05 * 每天00:05
...@@ -30,7 +30,7 @@ public class ThirdPhotovoltaicPowerJob extends JobCommonService { ...@@ -30,7 +30,7 @@ public class ThirdPhotovoltaicPowerJob extends JobCommonService {
String key = TaskConstant.TASK_LOCK_KEY + "ThirdPhotovoltaicPowerJob"; String key = TaskConstant.TASK_LOCK_KEY + "ThirdPhotovoltaicPowerJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
this.setCache(xContext, key); ServiceUtil.setCache(xContext, key);
try { try {
IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class); IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class);
XServiceResult result = service.thirdPhotovoltaicPowerJob(xContext); XServiceResult result = service.thirdPhotovoltaicPowerJob(xContext);
......
...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import pps.cloud.prediction.service.IThirdDataAccessCloudService; import pps.cloud.prediction.service.IThirdDataAccessCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.service.JobCommonService; import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.data.XServiceResult; import xstartup.data.XServiceResult;
...@@ -17,7 +17,7 @@ import xstartup.data.XServiceResult; ...@@ -17,7 +17,7 @@ import xstartup.data.XServiceResult;
* @date 2024/04/01 17:01 * @date 2024/04/01 17:01
*/ */
@XText("第三方单井平均有功功率定时任务") @XText("第三方单井平均有功功率定时任务")
public class ThirdWellAvgActivePowerJob extends JobCommonService { public class ThirdWellAvgActivePowerJob {
/** /**
* 十分钟一次隔3分钟 * 十分钟一次隔3分钟
...@@ -30,7 +30,7 @@ public class ThirdWellAvgActivePowerJob extends JobCommonService { ...@@ -30,7 +30,7 @@ public class ThirdWellAvgActivePowerJob extends JobCommonService {
String key = TaskConstant.TASK_LOCK_KEY + "ThirdWellAvgActivePowerJob"; String key = TaskConstant.TASK_LOCK_KEY + "ThirdWellAvgActivePowerJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
this.setCache(xContext, key); ServiceUtil.setCache(xContext, key);
try { try {
IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class); IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class);
XServiceResult result = service.thirdWellAvgActivePowerJob(xContext); XServiceResult result = service.thirdWellAvgActivePowerJob(xContext);
......
...@@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -4,7 +4,7 @@ import cn.hutool.core.util.ObjectUtil;
import pps.cloud.base.service.IBaseWeatherCloudService; import pps.cloud.base.service.IBaseWeatherCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.service.JobCommonService; import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.data.XServiceResult; import xstartup.data.XServiceResult;
...@@ -16,7 +16,7 @@ import xstartup.data.XServiceResult; ...@@ -16,7 +16,7 @@ import xstartup.data.XServiceResult;
* @date 2024/04/22 17:24 * @date 2024/04/22 17:24
*/ */
@XText("天气API数据邮件接收定时任务") @XText("天气API数据邮件接收定时任务")
public class WeatherApiReceiveJob extends JobCommonService { public class WeatherApiReceiveJob {
/** /**
* 早/晚九点十五分执行 * 早/晚九点十五分执行
...@@ -29,7 +29,7 @@ public class WeatherApiReceiveJob extends JobCommonService { ...@@ -29,7 +29,7 @@ public class WeatherApiReceiveJob extends JobCommonService {
String key = TaskConstant.TASK_LOCK_KEY + "WeatherApiReceiveJob"; String key = TaskConstant.TASK_LOCK_KEY + "WeatherApiReceiveJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
this.setCache(xContext, key); ServiceUtil.setCache(xContext, key);
try { try {
IBaseWeatherCloudService service = xContext.getBean(IBaseWeatherCloudService.class); IBaseWeatherCloudService service = xContext.getBean(IBaseWeatherCloudService.class);
XServiceResult result = service.weatherApiDataProcess(xContext); XServiceResult result = service.weatherApiDataProcess(xContext);
......
...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import pps.cloud.base.service.IBaseWeatherCloudService; import pps.cloud.base.service.IBaseWeatherCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.service.JobCommonService; import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XService; import xstartup.annotation.XService;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
...@@ -21,7 +21,7 @@ import xstartup.service.job.annotation.XCronTrigger; ...@@ -21,7 +21,7 @@ import xstartup.service.job.annotation.XCronTrigger;
*/ */
@XText("天气数据邮件接收定时任务") @XText("天气数据邮件接收定时任务")
@XService @XService
public class WeatherReceiveJob extends JobCommonService implements XJob { public class WeatherReceiveJob implements XJob {
/** /**
* 半小时隔5分钟执行一次 * 半小时隔5分钟执行一次
...@@ -36,12 +36,12 @@ public class WeatherReceiveJob extends JobCommonService implements XJob { ...@@ -36,12 +36,12 @@ public class WeatherReceiveJob extends JobCommonService implements XJob {
String key = TaskConstant.TASK_LOCK_KEY + "WeatherReceiveJob"; String key = TaskConstant.TASK_LOCK_KEY + "WeatherReceiveJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
String oilFieldCode = this.getCurrentConfig(xContext).getOilFieldCode(); String oilFieldCode = ServiceUtil.getCurrentConfig(xContext).getOilFieldCode();
if (CharSequenceUtil.isBlank(oilFieldCode)) { if (CharSequenceUtil.isBlank(oilFieldCode)) {
xContext.getLogger().info("------ WeatherReceiveJob oilFieldCode is blank"); xContext.getLogger().info("------ WeatherReceiveJob oilFieldCode is blank");
return XServiceResult.OK; return XServiceResult.OK;
} }
this.setCache(xContext, key); ServiceUtil.setCache(xContext, key);
try { try {
IBaseWeatherCloudService service = xContext.getBean(IBaseWeatherCloudService.class); IBaseWeatherCloudService service = xContext.getBean(IBaseWeatherCloudService.class);
XServiceResult result = service.weatherDataProcess(xContext, oilFieldCode); XServiceResult result = service.weatherDataProcess(xContext, oilFieldCode);
......
...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil; ...@@ -5,7 +5,7 @@ import cn.hutool.core.util.ObjectUtil;
import pps.cloud.prediction.service.IPlantPredictedPowerCloudService; import pps.cloud.prediction.service.IPlantPredictedPowerCloudService;
import pps.core.common.cache.TaskLockCache; import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant; import pps.core.task.constant.TaskConstant;
import pps.core.task.service.JobCommonService; import pps.core.task.utils.ServiceUtil;
import xstartup.annotation.XText; import xstartup.annotation.XText;
import xstartup.base.XContext; import xstartup.base.XContext;
import xstartup.data.XServiceResult; import xstartup.data.XServiceResult;
...@@ -17,7 +17,7 @@ import xstartup.data.XServiceResult; ...@@ -17,7 +17,7 @@ import xstartup.data.XServiceResult;
* @date 2024/03/18 14:52 * @date 2024/03/18 14:52
*/ */
@XText("日耗电日产液信息定时任务") @XText("日耗电日产液信息定时任务")
public class WellTechDailyJob extends JobCommonService { public class WellTechDailyJob {
/** /**
* 每天0点执行 * 每天0点执行
...@@ -30,7 +30,7 @@ public class WellTechDailyJob extends JobCommonService { ...@@ -30,7 +30,7 @@ public class WellTechDailyJob extends JobCommonService {
String key = TaskConstant.TASK_LOCK_KEY + "WellTechDailyJob"; String key = TaskConstant.TASK_LOCK_KEY + "WellTechDailyJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key); TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) { if (ObjectUtil.isNull(exist)) {
this.setCache(xContext, key); ServiceUtil.setCache(xContext, key);
try { try {
IPlantPredictedPowerCloudService service = xContext.getBean(IPlantPredictedPowerCloudService.class); IPlantPredictedPowerCloudService service = xContext.getBean(IPlantPredictedPowerCloudService.class);
XServiceResult result = service.wellTechDailyJob(xContext); XServiceResult result = service.wellTechDailyJob(xContext);
......
package pps.core.task.service; package pps.core.task.utils;
import pps.cloud.base.service.IConfigOilFieldCloudService; import pps.cloud.base.service.IConfigOilFieldCloudService;
import pps.cloud.base.service.data.config_oil_field.GetConfigOilFieldOutput; import pps.cloud.base.service.data.config_oil_field.GetConfigOilFieldOutput;
...@@ -7,12 +7,14 @@ import xstartup.base.XContext; ...@@ -7,12 +7,14 @@ import xstartup.base.XContext;
import xstartup.data.XSingleResult; import xstartup.data.XSingleResult;
/** /**
* 任务公用服务 * 常用服务调用工具类
* *
* @author ZWT * @author ZWT
* @date 2024/06/25 15:26 * @date 2024/07/04
*/ */
public class JobCommonService { public class ServiceUtil {
/*-------------------------服务调用-------------------------*/
/** /**
* 获取当前配置 * 获取当前配置
...@@ -20,7 +22,7 @@ public class JobCommonService { ...@@ -20,7 +22,7 @@ public class JobCommonService {
* @param context 上下文 * @param context 上下文
* @return {@link GetConfigOilFieldOutput } * @return {@link GetConfigOilFieldOutput }
*/ */
public GetConfigOilFieldOutput getCurrentConfig(XContext context) { public static GetConfigOilFieldOutput getCurrentConfig(XContext context) {
IConfigOilFieldCloudService bean = context.getBean(IConfigOilFieldCloudService.class); IConfigOilFieldCloudService bean = context.getBean(IConfigOilFieldCloudService.class);
XSingleResult<GetConfigOilFieldOutput> currentConfig = bean.getCurrentConfig(context); XSingleResult<GetConfigOilFieldOutput> currentConfig = bean.getCurrentConfig(context);
currentConfig.throwIfFail(); currentConfig.throwIfFail();
...@@ -33,7 +35,7 @@ public class JobCommonService { ...@@ -33,7 +35,7 @@ public class JobCommonService {
* @param xContext x上下文 * @param xContext x上下文
* @param key 钥匙 * @param key 钥匙
*/ */
public void setCache(XContext xContext, String key) { public static void setCache(XContext xContext, String key) {
TaskLockCache cache = new TaskLockCache(); TaskLockCache cache = new TaskLockCache();
cache.setRedisKey(key); cache.setRedisKey(key);
cache.setRedisValue(key); cache.setRedisValue(key);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment