Commit 075ed9fb authored by ZWT's avatar ZWT

feat(零碳): 长庆

1.对接第三方接口,接入第三方数据,完成Token接口验证,抽取公用方法封装调用工具类;
2.对接第三方接口,完成获取日耗电日产液等信息接口调用,创建数据表,同时生成对应代码,开发定时任务及对外接口,完成第三方数据接入及系统展示功能,添加线上接口文档并完成接口及定时任务冒烟测试;
3.对接第三方接口,完成获取有功功率数据信息接口调用,创建数据表,同时生成对应代码,开发定时任务及对外接口,完成第三方数据接入及系统展示功能,添加线上接口文档并完成接口及定时任务冒烟测试;
4.对接第三方接口,完成获取甘特图数据接口调用,创建数据表,同时生成对应代码,开发定时任务及对外接口,完成第三方数据接入及系统展示功能,添加线上接口文档并完成接口及定时任务冒烟测试;
5.对接第三方接口,完成本日累计数据接口调用,创建数据表,同时生成对应代码,开发定时任务及对外接口,完成第三方数据接入及系统展示功能,添加线上接口文档并完成接口及定时任务冒烟测试;
6.对接第三方接口,完成光伏发电量接口调用,创建数据表,同时生成对应代码,开发定时任务及对外接口,完成第三方数据接入及系统展示功能,添加线上接口文档并完成接口及定时任务冒烟测试;

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent 24689e0e
......@@ -21,7 +21,7 @@ public class TaskConstant {
/**
* 半小时一次
*/
public static final String HALF_HOUR = "0 0/30 * * * ?";
public static final String HALF_HOUR_ZERO = "0 0/30 * * * ?";
/**
* 每周一 00:00:00
......
package pps.core.task.job;
import cn.hutool.core.util.ObjectUtil;
import pps.cloud.prediction.service.IThirdDataAccessCloudService;
import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
......@@ -27,6 +30,25 @@ public class ThirdActivePowerJob implements XJob {
@XCronTrigger(value = TaskConstant.TEN_MINUTES)
@Override
public XServiceResult execute(XContext xContext) {
xContext.getLogger().info("------ ThirdActivePowerJob start:{}", System.currentTimeMillis());
String key = TaskConstant.TASK_LOCK_KEY + "ThirdActivePowerJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) {
TaskLockCache cache = new TaskLockCache();
cache.setRedisKey(key);
cache.setRedisValue(key);
TaskLockCache.set(xContext, cache);
try {
IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class);
XServiceResult result = service.thirdActivePowerJob(xContext);
result.throwIfFail();
} catch (Exception e) {
xContext.getLogger().error("------ ThirdActivePowerJob Exception: ", e);
} finally {
xContext.getLogger().info("------ ThirdActivePowerJob end:{}", System.currentTimeMillis());
TaskLockCache.delete(xContext, key);
}
}
return XServiceResult.OK;
}
}
package pps.core.task.job;
import cn.hutool.core.util.ObjectUtil;
import pps.cloud.prediction.service.IThirdDataAccessCloudService;
import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
......@@ -27,6 +30,25 @@ public class ThirdCurrentWellConditionJob implements XJob {
@XCronTrigger(value = TaskConstant.EVERY_DAY_ZERO)
@Override
public XServiceResult execute(XContext xContext) {
return null;
xContext.getLogger().info("------ ThirdCurrentWellConditionJob start:{}", System.currentTimeMillis());
String key = TaskConstant.TASK_LOCK_KEY + "ThirdCurrentWellConditionJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) {
TaskLockCache cache = new TaskLockCache();
cache.setRedisKey(key);
cache.setRedisValue(key);
TaskLockCache.set(xContext, cache);
try {
IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class);
XServiceResult result = service.thirdCurrentWellConditionJob(xContext);
result.throwIfFail();
} catch (Exception e) {
xContext.getLogger().error("------ ThirdCurrentWellConditionJob Exception: ", e);
} finally {
xContext.getLogger().info("------ ThirdCurrentWellConditionJob end:{}", System.currentTimeMillis());
TaskLockCache.delete(xContext, key);
}
}
return XServiceResult.OK;
}
}
\ No newline at end of file
package pps.core.task.job;
import cn.hutool.core.util.ObjectUtil;
import pps.cloud.prediction.service.IThirdDataAccessCloudService;
import pps.core.common.cache.TaskLockCache;
import pps.core.task.constant.TaskConstant;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
......@@ -24,9 +27,28 @@ public class ThirdPhotovoltaicPowerJob implements XJob {
* @param xContext x上下文
* @return {@link XServiceResult}
*/
@XCronTrigger(value = TaskConstant.HALF_HOUR)
@XCronTrigger(value = TaskConstant.HALF_HOUR_ZERO)
@Override
public XServiceResult execute(XContext xContext) {
return null;
xContext.getLogger().info("------ ThirdPhotovoltaicPowerJob start:{}", System.currentTimeMillis());
String key = TaskConstant.TASK_LOCK_KEY + "ThirdPhotovoltaicPowerJob";
TaskLockCache exist = TaskLockCache.exist(xContext, key);
if (ObjectUtil.isNull(exist)) {
TaskLockCache cache = new TaskLockCache();
cache.setRedisKey(key);
cache.setRedisValue(key);
TaskLockCache.set(xContext, cache);
try {
IThirdDataAccessCloudService service = xContext.getBean(IThirdDataAccessCloudService.class);
XServiceResult result = service.thirdPhotovoltaicPowerJob(xContext);
result.throwIfFail();
} catch (Exception e) {
xContext.getLogger().error("------ ThirdPhotovoltaicPowerJob Exception: ", e);
} finally {
xContext.getLogger().info("------ ThirdPhotovoltaicPowerJob end:{}", System.currentTimeMillis());
TaskLockCache.delete(xContext, key);
}
}
return XServiceResult.OK;
}
}
\ No newline at end of file
package pps.cloud.prediction.service;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.data.XServiceResult;
/**
* 第三方数据接入Cloud模块
*
* @author ZWT
* @date 2024/03/19 10:25
*/
@XService
@XText("第三方数据接入Cloud模块")
public interface IThirdDataAccessCloudService {
/**
* 第三方有功功率定时任务
*
* @param context 上下文
* @return {@link XServiceResult}
*/
@XText("第三方有功功率定时任务")
XServiceResult thirdActivePowerJob(XContext context);
/**
* 第三方当日油井状态定时任务
*
* @param context 上下文
* @return {@link XServiceResult}
*/
@XText("第三方当日油井状态定时任务")
XServiceResult thirdCurrentWellConditionJob(XContext context);
/**
* 第三方光伏日发电量定时任务
*
* @param context 上下文
* @return {@link XServiceResult}
*/
@XText("第三方光伏日发电量定时任务")
XServiceResult thirdPhotovoltaicPowerJob(XContext context);
}
......@@ -39,4 +39,8 @@ public class ThirdPartyApiConstant {
* 本日累计数据
*/
public static final String CQ_WELL_REAL_PV_DATA = "/Smart_Well_Data/api/v1/PvDataManagement/GET_WELL_Real_PV_DATA";
/**
* 光伏发电量
*/
public static final String CQ_STATION_DAILY_PV_DATA = "/Smart_Well_Data/api/v1/PvDataManagement/Station_Daily_PV_Data";
}
......@@ -10,9 +10,9 @@ import xstartup.service.mybatis.XMybatis;
/**
* mybatis 配置类
*/
@Component
@EnableTransactionManagement
@MapperScan(sqlSessionTemplateRef = "sqlSessionTemplateRef.pps.core.prediction",
@Component
@EnableTransactionManagement
@MapperScan(sqlSessionTemplateRef = "sqlSessionTemplateRef.pps.core.prediction",
sqlSessionFactoryRef = "sqlSessionFactoryRef.pps.core.prediction",
basePackages = {"pps.core.prediction.mapper"})
public class PpsCorePredictionMybatis extends XMybatis {
......
package pps.core.prediction.service;
import pps.cloud.prediction.service.IThirdDataAccessCloudService;
import pps.core.auth.HttpRequestClient;
import pps.core.prediction.constant.ThirdPartyApiConstant;
import pps.core.prediction.utils.ServiceUtil;
import xstartup.annotation.XService;
import xstartup.annotation.XText;
import xstartup.base.XContext;
import xstartup.base.XStartup;
import xstartup.data.XServiceResult;
import java.util.HashMap;
import java.util.Map;
/**
* 第三方数据接入Cloud模块
*
* @author ZWT
* @date 2024/03/19 10:31
*/
@XText("第三方数据接入Cloud模块")
@XService
public class ThirdDataAccessCloudServiceImpl implements IThirdDataAccessCloudService {
/**
* 调用接口
*
* @param context 上下文
* @param api 应用程序编程接口
* @param param 参数
* @return {@link String}
*/
private String doPostForm(XContext context, String api, Map<String, Object> param) {
String url = XStartup.getCurrent().getProperty("third-party.chang-qing.url");
String token = ServiceUtil.getToken(context);
HttpRequestClient client = new HttpRequestClient(token);
return client.doPostForm(url + api, param);
}
/**
* 第三方有功功率定时任务
*
* @param context 上下文
* @return {@link XServiceResult}
*/
@Override
public XServiceResult thirdActivePowerJob(XContext context) {
String resultStr = this.doPostForm(context,
ThirdPartyApiConstant.CQ_WELL_STATION_PV_DATA,
new HashMap<>(0));
return null;
}
/**
* 第三方当日油井状态定时任务
*
* @param context 上下文
* @return {@link XServiceResult}
*/
@Override
public XServiceResult thirdCurrentWellConditionJob(XContext context) {
return null;
}
/**
* 第三方光伏日发电量定时任务
*
* @param context 上下文
* @return {@link XServiceResult}
*/
@Override
public XServiceResult thirdPhotovoltaicPowerJob(XContext context) {
return null;
}
}
......@@ -5,8 +5,8 @@
<id column="id" property="id" jdbcType="BIGINT" />
<result column="station_name" property="stationName" jdbcType="VARCHAR" />
<result column="create_date" property="createDate" jdbcType="DATE" />
<result column="photovoltaic_power" property="photovoltaicPower" jdbcType="DECIMAL UNSIGNED" />
<result column="meter_power" property="meterPower" jdbcType="DECIMAL UNSIGNED" />
<result column="photovoltaic_power" property="photovoltaicPower" jdbcType="DECIMAL" />
<result column="meter_power" property="meterPower" jdbcType="DECIMAL" />
<result column="system_source" property="systemSource" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
......
......@@ -5,7 +5,7 @@
<id column="id" property="id" jdbcType="BIGINT" />
<result column="station_name" property="stationName" jdbcType="VARCHAR" />
<result column="create_date" property="createDate" jdbcType="DATE" />
<result column="photovoltaic_power" property="photovoltaicPower" jdbcType="DECIMAL UNSIGNED" />
<result column="photovoltaic_power" property="photovoltaicPower" jdbcType="DECIMAL" />
<result column="system_source" property="systemSource" jdbcType="VARCHAR" />
</resultMap>
<sql id="Base_Column_List">
......
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