指标添加本地变量

This commit is contained in:
andywang
2022-08-10 11:41:40 +08:00
parent 20ff7a2204
commit f11ba7b1bc
6 changed files with 41 additions and 15 deletions

View File

@@ -36,7 +36,7 @@
<result column="source_type" property="sourceType"/>
<result column="mq_source_id" property="mqSourceId"/>
<result column="interface_parse_field" property="interfaceParseField"/>
<result column="is_local_variable" property="isLocalVariable"/>
<collection property="fieldCondList" ofType="fieldCond" column="id"
select="com.fibo.ddp.common.dao.datax.datamanage.FieldCondMapper.getFieldCondList"></collection>
@@ -64,6 +64,7 @@
,f.dict_variable
,f.mq_source_id
,f.source_type
,f.is_local_variable
from t_field f, t_field_user_rel r, t_field_type p, t_user u
where f.id = r.field_id
and f.field_typeid = p.id
@@ -178,6 +179,7 @@
,f.dict_variable
,f.mq_source_id
,f.source_type
,f.is_local_variable
from t_field f,t_field_user_rel r,t_field_type p
where f.id = r.field_id
and f.field_typeid = p.id
@@ -217,6 +219,7 @@
,f.dict_variable
,f.mq_source_id
,f.source_type
,f.is_local_variable
from t_field f,t_field_user_rel r,t_field_type p
where f.id = r.field_id
and f.field_typeid = p.id
@@ -243,6 +246,7 @@
,f.dict_variable
,f.mq_source_id
,f.source_type
,f.is_local_variable
from t_field f,t_field_type p
,t_field_user_rel r left join t_engine e on (r.engine_id = e.id)
where f.id = r.field_id
@@ -293,6 +297,7 @@
,f.dict_variable
,f.mq_source_id
,f.source_type
,f.is_local_variable
from t_field f,t_field_user_rel r
where f.id = r.field_id
and (f.field_en = #{fieldEn} or f.field_cn = #{fieldCn})
@@ -312,19 +317,19 @@
, value_type, value_scope, is_derivative
, is_output, formula, formula_show, orig_fieldid, used_fieldid
, is_common, author, created, is_use_sql, data_source_id, sql_statement, sql_variable
, is_interface, interface_id, interface_parse_field, json_value, organ_id,dict_variable,source_type,mq_source_id)
, is_interface, interface_id, interface_parse_field, json_value, organ_id,dict_variable,source_type,mq_source_id, is_local_variable)
values ( #{fieldEn}, #{fieldCn}, #{fieldTypeId}
, #{valueType}, #{valueScope}, #{isDerivative}
, #{isOutput}, #{formula}, #{formulaShow}, #{origFieldId}, #{usedFieldId}
, #{isCommon}, #{author}, now(), #{isUseSql}, #{dataSourceId}, #{sqlStatement}, #{sqlVariable}
, #{isInterface}, #{interfaceId}, #{interfaceParseField}, #{jsonValue}, #{organId},#{dictVariable},#{sourceType},#{mqSourceId})
, #{isInterface}, #{interfaceId}, #{interfaceParseField}, #{jsonValue}, #{organId},#{dictVariable},#{sourceType},#{mqSourceId}, #{isLocalVariable})
</insert>
<insert id="batchCreateField" parameterType="java.util.List">
insert into t_field ( field_en, field_cn, field_typeid
, value_type, value_scope, is_derivative
, is_output, formula, formula_show, is_common, author, created,
, is_interface, interface_id, interface_parse_field, json_value,dict_variable,source_type,mq_source_id)
, is_interface, interface_id, interface_parse_field, json_value,dict_variable,source_type,mq_source_id,is_local_variable)
values
<foreach collection="list" item="field" index="index" separator=",">
(
@@ -332,7 +337,7 @@
, #{field.valueType}, #{field.valueScope}, #{field.isDerivative}
, #{field.isOutput}, #{field.formula}, #{field.formulaShow}, #{field.isCommon}, #{field.author}, now()
, #{isInterface}, #{interfaceId}, #{interfaceParseField},
#{jsonValue},#{dictVariable},#{sourceType},#{mqSourceId}
#{jsonValue},#{dictVariable},#{sourceType},#{mqSourceId},#{isLocalVariable}
)
</foreach>
</insert>
@@ -347,7 +352,7 @@
#{sqlVariable}
,is_interface = #{isInterface}, interface_id = #{interfaceId}, interface_parse_field = #{interfaceParseField},
json_value = #{jsonValue},dict_variable = #{dictVariable}
,source_type = #{sourceType},mq_source_id = #{mqSourceId}
,source_type = #{sourceType},mq_source_id = #{mqSourceId}, is_local_variable = #{isLocalVariable}
where id = #{id}
<!-- where userId = (select field_id-->
<!-- from t_field_user_rel-->
@@ -379,6 +384,7 @@
,t.dict_variable
,t.source_type
,t.mq_source_id
,t.is_local_variable
from t_field t LEFT JOIN t_field_user_rel r on t.id = r.field_id LEFT JOIN t_field_type p on t.field_typeid =
p.id where r.organ_id = #{organId} and status = 1
<if test="ids != null and ids !=''">
@@ -405,7 +411,7 @@
select f.id, f.field_en, f.field_cn, f.field_typeid
, f.value_type, f.value_scope, f.is_derivative
, f.is_output, f.is_common, f.formula, f.formula_show
, f.orig_fieldid,f.dict_variable ,f.source_type ,f.mq_source_id
, f.orig_fieldid,f.dict_variable ,f.source_type ,f.mq_source_id,f.is_local_variable
from t_field f,t_field_user_rel r
where f.id = r.field_id
and f.field_cn = #{fieldCn}
@@ -504,7 +510,7 @@
, p.type
, f.is_use_sql, f.data_source_id, f.sql_statement, f.sql_variable, f.is_interface
, f.interface_id, f.interface_parse_field, f.json_value, f.dict_variable
,f.source_type,f.mq_source_id
,f.source_type,f.mq_source_id,f.is_local_variable
from t_field f,t_field_user_rel r,t_field_type p
where f.id = r.field_id
and f.field_typeid = p.id
@@ -522,7 +528,7 @@
select f.id, f.field_en , f.field_cn , f.field_typeid
, f.value_type , f.value_scope , f.is_derivative
, f.is_output , f.is_common , f.formula, f.formula_show, f.dict_variable
,f.source_type,f.mq_source_id
,f.source_type,f.mq_source_id,f.is_local_variable
from t_field f,t_field_user_rel r
where f.id = r.field_id
and f.field_en = #{fieldEn}
@@ -535,7 +541,7 @@
, f.value_type , f.value_scope , f.is_derivative
, f.is_output , f.is_common , f.formula, f.formula_show
, f.orig_fieldid, f.dict_variable
,f.source_type,f.mq_source_id
,f.source_type,f.mq_source_id,f.is_local_variable
from t_field f,t_field_user_rel r
where f.id = r.field_id
and f.field_cn = #{fieldCn}
@@ -552,7 +558,7 @@
, p.type
, f.is_use_sql, f.data_source_id, f.sql_statement, f.sql_variable, f.is_interface
, f.interface_id, f.interface_parse_field, f.json_value, f.dict_variable
,f.source_type,f.mq_source_id
,f.source_type,f.mq_source_id,f.is_local_variable
from t_field f,t_field_type p
where f.field_typeid=p.id
and f.field_en in

View File

@@ -1,5 +1,6 @@
package com.fibo.ddp.common.model.common;
import com.baomidou.mybatisplus.annotation.TableField;
import lombok.Data;
/**
@@ -13,25 +14,30 @@ public class BasePage {
/**
* 当前页数
*/
@TableField(exist = false)
private int page;
/**
* 每页显示的行数
*/
@TableField(exist = false)
private int rows;
/**
* 开始行数
*/
@TableField(exist = false)
private Integer curRow;
/**
* 结束行数
*/
@TableField(exist = false)
private Integer endRow;
/**
* 总行数
*/
@TableField(exist = false)
private Integer total;
}

View File

@@ -219,4 +219,9 @@ public class Field extends BasePage implements Serializable {
* 消息队列源id
*/
private Long mqSourceId;
/**
* 是否局部变量
*/
private Boolean isLocalVariable;
}

View File

@@ -40,6 +40,7 @@ public class FieldSaveParam implements Serializable {
private String dictVariable;
private Integer sourceType;
private Long mqSourceId;
private Boolean isLocalVariable;
//
// public Field toField() {

View File

@@ -273,9 +273,9 @@ public class RuleServiceImpl extends ServiceImpl<RuleInfoMapper, RuleInfo> imple
@Override
public List<JSONObject> setComplexRuleOutput(Long versionId, Map<String,Object> temp, Map<String, Object> input, String outType) {
List<JSONObject> jsonObjectList = outputService.setOutput(new StrategyOutput(versionId, StrategyType.COMPLEX_RULE,outType), temp);
for (JSONObject jsonObject : jsonObjectList) {
input.putAll(jsonObject);
}
// for (JSONObject jsonObject : jsonObjectList) {
// input.putAll(jsonObject);
// }
return jsonObjectList;
}

View File

@@ -6,9 +6,11 @@ import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.fibo.ddp.common.dao.canal.TableEnum;
import com.fibo.ddp.common.dao.strategyx.strategyout.StrategyOutputMapper;
import com.fibo.ddp.common.model.datax.datamanage.Field;
import com.fibo.ddp.common.model.enginex.runner.ExpressionParam;
import com.fibo.ddp.common.model.strategyx.strategyout.OutCondition;
import com.fibo.ddp.common.model.strategyx.strategyout.StrategyOutput;
import com.fibo.ddp.common.service.datax.datamanage.FieldService;
import com.fibo.ddp.common.service.datax.runner.ExecuteUtils;
import com.fibo.ddp.common.service.redis.RedisManager;
import com.fibo.ddp.common.service.redis.RedisUtils;
@@ -35,6 +37,9 @@ public class StrategyOutputServiceImpl extends ServiceImpl<StrategyOutputMapper,
@Value("${switch.use.cache}")
private String cacheSwitch;
@Autowired
private FieldService fieldService;
@Transactional
@Override
public boolean insertTacticsOutput(Long tacticsId, List<StrategyOutput> list) {
@@ -152,7 +157,10 @@ public class StrategyOutputServiceImpl extends ServiceImpl<StrategyOutputMapper,
value = value.toString().substring(1,value.toString().length()-1);
}
json.put(fieldEn, value);
input.put(fieldEn, value);
Field field = fieldService.queryById(strategyOutput.getFieldId());
if(!field.getIsLocalVariable()){
input.put(fieldEn, value);
}
jsonList.add(json);
}
}