Commit 211962c4 authored by ZWT's avatar ZWT

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

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

BREAKING CHANGE: 无

Closes 无

[skip ci]
parent b14f39c6
package pps.core.common.job;
import com.google.common.base.Strings;
import cn.hutool.core.text.CharSequenceUtil;
import pps.core.common.utils.*;
import xstartup.base.XStartup;
import xstartup.base.util.XJsonUtils;
......@@ -89,12 +89,12 @@ public class CounterJob5S {
CounterBuilder.globalCounterBuilder.setFieldValue("__MASTER__", isMaster + "");
if (isMaster) {
if (Strings.isNullOrEmpty(CounterBuilder.globalCounterBuilder.getFieldValue("__MASTER-TIME__"))) {
if (CharSequenceUtil.isBlank(CounterBuilder.globalCounterBuilder.getFieldValue("__MASTER-TIME__"))) {
CounterBuilder.globalCounterBuilder.setFieldValue("__MASTER-TIME__", DateUtil.getCurrentDateTime());
CounterBuilder.globalCounterBuilder.addCounter("__MASTER-TIMES__");
}
} else {
if (!Strings.isNullOrEmpty(CounterBuilder.globalCounterBuilder.getFieldValue("__MASTER-TIME__"))) {
if (CharSequenceUtil.isNotBlank(CounterBuilder.globalCounterBuilder.getFieldValue("__MASTER-TIME__"))) {
CounterBuilder.globalCounterBuilder.setFieldValue("__MASTER-TIME__", "");
}
// onlineNodes.clear();
......@@ -140,12 +140,12 @@ public class CounterJob5S {
CounterBuilder.globalCounterBuilder.setFieldValue("__MASTER__", isMaster + "");
if (isMaster) {
if (Strings.isNullOrEmpty(CounterBuilder.globalCounterBuilder.getFieldValue("__MASTER-TIME__"))) {
if (CharSequenceUtil.isBlank(CounterBuilder.globalCounterBuilder.getFieldValue("__MASTER-TIME__"))) {
CounterBuilder.globalCounterBuilder.setFieldValue("__MASTER-TIME__", DateUtil.getCurrentDateTime());
CounterBuilder.globalCounterBuilder.addCounter("__MASTER-TIMES__");
}
} else {
if (!Strings.isNullOrEmpty(CounterBuilder.globalCounterBuilder.getFieldValue("__MASTER-TIME__"))) {
if (CharSequenceUtil.isNotBlank(CounterBuilder.globalCounterBuilder.getFieldValue("__MASTER-TIME__"))) {
CounterBuilder.globalCounterBuilder.setFieldValue("__MASTER-TIME__", "");
}
}
......
package pps.core.common.provider.impl;
import com.google.common.base.Strings;
import cn.hutool.core.text.CharSequenceUtil;
import pps.core.common.cache.ConfigCache;
import pps.core.common.utils.CounterBuilder;
import xstartup.annotation.XImplement;
......@@ -16,12 +16,12 @@ public class PpsConfigProviderCommonImpl implements XConfigProvider {
@Override
public String findValue(XContext context, String config, String app, String key) {
//todo 实现自定义配置逻辑, 优先级 从低到高 数据库->properties文件
// 实现自定义配置逻辑, 优先级 从低到高 数据库->properties文件
//从Properties文件中加载配置值
String configKey = config + "." + key;
String configKeyWithAppName = config + "." + app + "." + key;
String configValue = context.getProperty(configKeyWithAppName);
if (Strings.isNullOrEmpty(configValue)) {
if (CharSequenceUtil.isBlank(configValue)) {
configValue = context.getProperty(configKey);
}
//加载缓存
......
package pps.core.common.utils;
import com.google.common.base.Strings;
import cn.hutool.core.text.CharSequenceUtil;
import com.google.common.collect.ImmutableList;
import java.util.ArrayList;
......@@ -105,8 +105,7 @@ public class CounterBuilder {
if (counterName == null || counterName.isEmpty()) {
return this;
}
if (!Strings.isNullOrEmpty(this.groupName)) {
if (CharSequenceUtil.isNotBlank(this.groupName)) {
counterName = String.format("%s-%s", this.groupName, counterName);
}
......@@ -134,7 +133,7 @@ public class CounterBuilder {
return this;
}
if (!Strings.isNullOrEmpty(this.groupName)) {
if (CharSequenceUtil.isNotBlank(this.groupName)) {
counterName = String.format("%s-%s", this.groupName, counterName);
}
......@@ -162,7 +161,7 @@ public class CounterBuilder {
return this;
}
if (!Strings.isNullOrEmpty(this.groupName)) {
if (CharSequenceUtil.isNotBlank(this.groupName)) {
fieldName = String.format("%s-%s", this.groupName, fieldName);
}
......@@ -186,7 +185,7 @@ public class CounterBuilder {
return 0;
}
if (!Strings.isNullOrEmpty(this.groupName)) {
if (CharSequenceUtil.isNotBlank(this.groupName)) {
counterName = String.format("%s-%s", this.groupName, counterName);
}
......@@ -202,7 +201,7 @@ public class CounterBuilder {
return "";
}
if (!Strings.isNullOrEmpty(this.groupName)) {
if (CharSequenceUtil.isNotBlank(this.groupName)) {
fieldName = String.format("%s-%s", this.groupName, fieldName);
}
......
package pps.core.common.utils;
import com.google.common.base.Strings;
import cn.hutool.core.text.CharSequenceUtil;
import xstartup.base.util.XDateUtils;
import java.sql.Timestamp;
......@@ -762,7 +762,7 @@ public class DateUtil {
}
public static LocalDateTime parseLocalDateTime(String dateTime) {
if (Strings.isNullOrEmpty(dateTime)) {
if (CharSequenceUtil.isBlank(dateTime)) {
return null;
}
......@@ -810,7 +810,7 @@ public class DateUtil {
}
public static String calcTimeSpan(String begin, String end) {
if (Strings.isNullOrEmpty(begin) || Strings.isNullOrEmpty(end)) {
if (CharSequenceUtil.isBlank(begin) || CharSequenceUtil.isBlank(end)) {
return "";
}
......@@ -824,7 +824,7 @@ public class DateUtil {
}
public static String calcTimeSpanWithMs(String begin, String end) {
if (Strings.isNullOrEmpty(begin) || Strings.isNullOrEmpty(end)) {
if (CharSequenceUtil.isBlank(begin) || CharSequenceUtil.isBlank(end)) {
return "";
}
......
package pps.core.common.utils;
import com.google.common.base.Strings;
import cn.hutool.core.text.CharSequenceUtil;
import xstartup.annotation.XText;
import java.io.Serializable;
......@@ -119,7 +119,7 @@ public class DynObj extends TreeMap<String, Object> implements Serializable {
if (v instanceof String) {
String strV = (String) v;
if (Strings.isNullOrEmpty(strV)) {
if (CharSequenceUtil.isBlank(strV)) {
return defaultValue;
} else {
return strV;
......@@ -139,7 +139,7 @@ public class DynObj extends TreeMap<String, Object> implements Serializable {
return defaultValue;
}
String strValue = v.toString().toLowerCase();
if (Strings.isNullOrEmpty(strValue)) {
if (CharSequenceUtil.isBlank(strValue)) {
return defaultValue;
}
if (WellKnownRegexValidator.completelyMatches(strValue, WellKnownRegex.INTEGER)) {
......@@ -194,7 +194,7 @@ public class DynObj extends TreeMap<String, Object> implements Serializable {
public Integer intValue(String fieldName, Integer defaultValue) {
String strValue = strValue(fieldName, null);
if (Strings.isNullOrEmpty(strValue)) {
if (CharSequenceUtil.isBlank(strValue)) {
return defaultValue;
} else {
return Integer.parseInt(strValue);
......@@ -207,7 +207,7 @@ public class DynObj extends TreeMap<String, Object> implements Serializable {
public Double doubleValue(String fieldName, Double defaultValue) {
String strValue = strValue(fieldName, null);
if (Strings.isNullOrEmpty(strValue)) {
if (CharSequenceUtil.isBlank(strValue)) {
return defaultValue;
} else {
return Double.parseDouble(strValue);
......@@ -234,7 +234,7 @@ public class DynObj extends TreeMap<String, Object> implements Serializable {
}
public String stringByLeves(String keys, String defaultValue) {
if (Strings.isNullOrEmpty(keys)) {
if (CharSequenceUtil.isBlank(keys)) {
return defaultValue;
}
int idx = keys.indexOf(".");
......
package pps.core.common.utils;
import cn.hutool.core.text.CharSequenceUtil;
import com.google.common.base.Joiner;
import com.google.common.base.Strings;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
......@@ -60,7 +60,7 @@ public class IpUtils {
}
public static String getHostIPs(boolean refresh) {
if (!refresh && !Strings.isNullOrEmpty(ips)) {
if (!refresh && CharSequenceUtil.isNotBlank(ips)) {
return ips;
}
......@@ -87,7 +87,7 @@ public class IpUtils {
}
interfaceAddresses.forEach(item -> {
String addr = item.getAddress().getHostAddress();
if (!Strings.isNullOrEmpty(addr)) {
if (CharSequenceUtil.isNotBlank(addr)) {
list.add(addr.trim());
}
});
......
package pps.core.common.utils;
import com.google.common.base.Strings;
import cn.hutool.core.text.CharSequenceUtil;
import xstartup.base.util.XJsonUtils;
import xstartup.base.util.XStringUtils;
......@@ -80,7 +80,7 @@ public class SmartRecord extends LinkedHashMap<String, Object> {
public Integer intValue(String fieldName, Integer defaultValue) {
String strValue = strValue(fieldName, null);
if (Strings.isNullOrEmpty(strValue)) {
if (CharSequenceUtil.isBlank(strValue)) {
return defaultValue;
} else {
return Integer.parseInt(strValue);
......@@ -93,7 +93,7 @@ public class SmartRecord extends LinkedHashMap<String, Object> {
public Double doubleValue(String fieldName, Double defaultValue) {
String strValue = strValue(fieldName, null);
if (Strings.isNullOrEmpty(strValue)) {
if (CharSequenceUtil.isBlank(strValue)) {
return defaultValue;
} else {
return Double.parseDouble(strValue);
......@@ -102,7 +102,7 @@ public class SmartRecord extends LinkedHashMap<String, Object> {
public <T> T parseFromJson(String fieldName, Class<T> clz) {
String json = strValue(fieldName);
if (json == null || Strings.isNullOrEmpty(json)) {
if (json == null || CharSequenceUtil.isBlank(json)) {
return null;
}
return XJsonUtils.toObject(json, clz);
......@@ -110,7 +110,7 @@ public class SmartRecord extends LinkedHashMap<String, Object> {
public <T> T toObj(Class<T> clz) {
String json = XJsonUtils.toJson(this.columnOrPathToClass());
if (json == null || Strings.isNullOrEmpty(json)) {
if (json == null || CharSequenceUtil.isBlank(json)) {
return null;
}
return XJsonUtils.toObject(json, clz);
......
package pps.core.common.utils;
import cn.hutool.core.text.CharSequenceUtil;
import com.google.common.base.Joiner;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import java.util.ArrayList;
import java.util.Arrays;
......@@ -30,11 +30,11 @@ public class SqlFilter {
public static final Pattern BAD_FORM_PATTERN = Pattern.compile(BAD_FORM_PATTERN_STR, Pattern.CASE_INSENSITIVE);
public static final String filterValue(String original) {
if (Strings.isNullOrEmpty(original)) {
if (CharSequenceUtil.isBlank(original)) {
return original;
}
original = original.trim();
if (Strings.isNullOrEmpty(original)) {
if (CharSequenceUtil.isBlank(original)) {
return original;
}
......@@ -47,7 +47,7 @@ public class SqlFilter {
List<String> fixedKeywords = new ArrayList<String>(keywords.size());
keywords.forEach(keyword -> {
String fixed = filterValueNoSpace(keyword);
if (!Strings.isNullOrEmpty(fixed)) {
if (CharSequenceUtil.isNotBlank(fixed)) {
fixedKeywords.add(fixed);
}
});
......
package pps.core.common.utils;
import com.google.common.base.Strings;
import cn.hutool.core.text.CharSequenceUtil;
import java.util.ArrayList;
import java.util.Set;
......@@ -73,13 +73,13 @@ public class ThreadHelper {
if (iMax == -1)
return "[]";
if (Strings.isNullOrEmpty(seperator))
if (CharSequenceUtil.isBlank(seperator))
seperator = ", ";
StringBuilder b = new StringBuilder();
b.append('[');
for (int i = 0; ; i++) {
b.append(String.valueOf(a[i]));
b.append(a[i]);
if (i == iMax) {
return b.append(']').toString();
}
......
package pps.core.common.utils;
import com.google.common.base.Strings;
import cn.hutool.core.text.CharSequenceUtil;
import java.util.concurrent.ConcurrentHashMap;
......@@ -43,7 +43,7 @@ public class TimeSpanChecker {
}
public static boolean checkNow(String checkerName, int seconds, boolean skipFirstCheck) {
if (Strings.isNullOrEmpty(checkerName) || seconds <= 0) {
if (CharSequenceUtil.isBlank(checkerName) || seconds <= 0) {
return false;
}
......
package pps.core.common.utils;
import com.google.common.base.Strings;
import cn.hutool.core.text.CharSequenceUtil;
import org.joor.Reflect;
import xstartup.base.XContext;
import xstartup.base.util.XJsonUtils;
......@@ -60,11 +60,11 @@ public class TraceHelper {
cleanTraceBuilder();
}
if (!Strings.isNullOrEmpty(traceId) && traceBuilders.contains(traceId)) {
if (CharSequenceUtil.isNotBlank(traceId) && traceBuilders.contains(traceId)) {
return traceBuilders.get(traceId);
}
if (Strings.isNullOrEmpty(traceId)) {
if (CharSequenceUtil.isBlank(traceId)) {
traceId = UUID.randomUUID().toString().replace("-", "");
}
......@@ -90,7 +90,7 @@ public class TraceHelper {
public static TraceBuilder getTraceBuilder(String traceId) {
try {
if (Strings.isNullOrEmpty(traceId)) {
if (CharSequenceUtil.isBlank(traceId)) {
return null;
}
......
package pps.core.system.module;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.base.Strings;
import org.apache.commons.lang3.ObjectUtils;
import org.apache.commons.lang3.StringUtils;
import pps.core.common.utils.ManifestComponentInfoHelper;
......@@ -106,16 +106,16 @@ public class PpsCoreSystemModule extends XModule {
StringBuilder sb = new StringBuilder();
sysDictionaryEnts.forEach(item -> {
sb.setLength(0);
if (Strings.isNullOrEmpty(item.getPid())) {
if (CharSequenceUtil.isBlank(item.getPid())) {
return;
}
if (!Strings.isNullOrEmpty(item.getDicPath())) {
if (CharSequenceUtil.isNotBlank(item.getDicPath())) {
return;
}
buildPath(dics, item.getPid(), sb);
String path = sb.toString();
if (Strings.isNullOrEmpty(path)) {
if (CharSequenceUtil.isBlank(path)) {
return;
}
......@@ -132,7 +132,7 @@ public class PpsCoreSystemModule extends XModule {
}
private void buildPath(Map<String, SysDictionaryEnt> dics, String parentId, StringBuilder sb) {
if (Strings.isNullOrEmpty(parentId) || "1".equals(parentId)) {
if (CharSequenceUtil.isBlank(parentId) || "1".equals(parentId)) {
return;
}
......
package pps.core.system.provider.impl;
import cn.hutool.core.text.CharSequenceUtil;
import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import org.apache.commons.lang3.StringUtils;
import org.springframework.util.CollectionUtils;
import pps.cloud.system.service.SysOrganizationCloudService;
......@@ -82,13 +82,13 @@ public class PpsUserSessionInjectProviderImpl implements XSessionInjectProvider
GetSysOrganizationViewOutput ownerOrg = findOwnerOrg(context, orgInfo.getResult());
if (ownerOrg != null) {
session.setOwnerOrgId(ownerOrg.getOuId());
if (Strings.isNullOrEmpty(ownerOrg.getOuId())) {
if (CharSequenceUtil.isBlank(ownerOrg.getOuId())) {
session.setOwnerOrgId(ownerOrg.getId());
}
session.setOwnerOrgName(ownerOrg.getOuName());
session.setOwnerOrgPath(ownerOrg.getOuPath());
session.setOwnerOrgLevel(ownerOrg.getOuLevel());
if (Strings.isNullOrEmpty(ownerOrg.getOuPath())) {
if (CharSequenceUtil.isBlank(ownerOrg.getOuPath())) {
//路径为空 查询
SysOrganizationRelMapper bean = context.getBean(SysOrganizationRelMapper.class);
QueryWrapper<SysOrganizationRelEnt> qw = new QueryWrapper<SysOrganizationRelEnt>();
......
......@@ -10,6 +10,6 @@ import pps.core.base.entity.ConfigOilFieldEnt;
* @author ZWT
* @date 2024/06/25
*/
@Repository(value="pps.core.base.mapper.ConfigOilFieldMapper")
@Repository(value = "pps.core.base.mapper.ConfigOilFieldMapper")
public interface ConfigOilFieldMapper extends BaseMapper<ConfigOilFieldEnt> {
}
package pps.core.base.service;
import cn.hutool.core.text.CharSequenceUtil;
import com.google.common.base.Splitter;
import com.google.common.base.Strings;
import pps.core.base.service.data.MyCounterOutput;
import pps.core.common.job.CounterJob5S;
import pps.core.common.utils.*;
......@@ -68,7 +68,7 @@ public class CounterService {
String dynObjJson = jedis.get(k);
DynObj dynObj = XJsonUtils.toObject(dynObjJson, DynObj.class);
String owner = dynObj.getString(CounterBuilder.COUNTER_NAME_OWNER);
if (Strings.isNullOrEmpty(owner)) {
if (CharSequenceUtil.isBlank(owner)) {
owner = dynObj.getString(CounterBuilder.COUNTER_NAME_INSTANCE);
}
finalOutput.put(owner, dynObj);
......@@ -85,7 +85,7 @@ public class CounterService {
String dynObjJson = jedis.get(k);
DynObj dynObj = XJsonUtils.toObject(dynObjJson, DynObj.class);
String owner = dynObj.getString(CounterBuilder.COUNTER_NAME_OWNER);
if (Strings.isNullOrEmpty(owner)) {
if (CharSequenceUtil.isBlank(owner)) {
owner = dynObj.getString(CounterBuilder.COUNTER_NAME_INSTANCE);
}
finalOutput.put(owner, dynObj);
......
......@@ -2,11 +2,11 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.base.mapper.ConfigOilFieldViewMapper">
<resultMap id="BaseResultMap" type="pps.core.base.entity.ConfigOilFieldView">
<id column="id" property="id" jdbcType="BIGINT" />
<result column="is_enable" property="isEnable" jdbcType="TINYINT" />
<result column="oil_field_name" property="oilFieldName" jdbcType="VARCHAR" />
<result column="oil_field_code" property="oilFieldCode" jdbcType="VARCHAR" />
<result column="home_page_path" property="homePagePath" jdbcType="VARCHAR" />
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="is_enable" property="isEnable" jdbcType="TINYINT"/>
<result column="oil_field_name" property="oilFieldName" jdbcType="VARCHAR"/>
<result column="oil_field_code" property="oilFieldCode" jdbcType="VARCHAR"/>
<result column="home_page_path" property="homePagePath" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id
......@@ -18,14 +18,14 @@
</sql>
<select id="selectOne" parameterType="pps.core.base.entity.ConfigOilFieldView" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from config_oil_field
where
id=#{id}
</select>
<select id="selectList" parameterType="pps.core.base.entity.ConfigOilFieldView" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from config_oil_field
where
id=#{id}
......
......@@ -2,14 +2,14 @@
<!DOCTYPE mapper PUBLIC "-//mybatis.org//DTD Mapper 3.0//EN" "http://mybatis.org/dtd/mybatis-3-mapper.dtd">
<mapper namespace="pps.core.task.mapper.ConfigTimeTaskViewMapper">
<resultMap id="BaseResultMap" type="pps.core.task.entity.ConfigTimeTaskView">
<id column="id" property="id" jdbcType="BIGINT" />
<result column="class_path" property="classPath" jdbcType="VARCHAR" />
<result column="method_name" property="methodName" jdbcType="VARCHAR" />
<result column="other_param" property="otherParam" jdbcType="VARCHAR" />
<result column="scheduling_pattern" property="schedulingPattern" jdbcType="VARCHAR" />
<result column="task_describe" property="taskDescribe" jdbcType="VARCHAR" />
<result column="is_enable" property="isEnable" jdbcType="TINYINT" />
<result column="system_source" property="systemSource" jdbcType="VARCHAR" />
<id column="id" property="id" jdbcType="BIGINT"/>
<result column="class_path" property="classPath" jdbcType="VARCHAR"/>
<result column="method_name" property="methodName" jdbcType="VARCHAR"/>
<result column="other_param" property="otherParam" jdbcType="VARCHAR"/>
<result column="scheduling_pattern" property="schedulingPattern" jdbcType="VARCHAR"/>
<result column="task_describe" property="taskDescribe" jdbcType="VARCHAR"/>
<result column="is_enable" property="isEnable" jdbcType="TINYINT"/>
<result column="system_source" property="systemSource" jdbcType="VARCHAR"/>
</resultMap>
<sql id="Base_Column_List">
id
......@@ -24,14 +24,14 @@
</sql>
<select id="selectOne" parameterType="pps.core.task.entity.ConfigTimeTaskView" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from config_time_task
where
id=#{id}
</select>
<select id="selectList" parameterType="pps.core.task.entity.ConfigTimeTaskView" resultMap="BaseResultMap">
select
<include refid="Base_Column_List" />
<include refid="Base_Column_List"/>
from config_time_task
where
id=#{id}
......
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