Compare commits

...

21 Commits

Author SHA1 Message Date
9baf7220b9 开始 > 分组 > 聚合 > 决策选项 聚合之后节点不会执行问题bugfix 2025-04-27 14:16:18 +08:00
9ba4c9a98d 决策引擎接口 决策流监控数据写入 2025-03-25 14:29:14 +08:00
90f055b7eb 表结构增量更新sql整理 2025-03-04 16:29:17 +08:00
b629bcb059 新增决策表问题 待确认问题处理 ,不改字段映射 ,新增字段 2025-03-04 16:24:18 +08:00
4646cd6424 新增决策表 待确认问题 2025-03-04 16:11:23 +08:00
f1f84fc4b2 新增决策表bugfix 2025-03-04 16:11:07 +08:00
86f41c849f 修复决策新增因为实体类字段与数据库字段名称映射失败导致的报错 2025-02-19 15:51:52 +08:00
7eaa7de140 修复数字决策平台-引擎管理-引擎列表 点击引擎名称跳转因地址错误出现的403报错 2025-02-18 15:43:46 +08:00
刘通
afcf60ef4b Merge remote-tracking branch 'origin/feature/初版/base' into feature/初版/base 2025-02-18 15:03:36 +08:00
刘通
7cf69bb30c 左侧文件夹之前注释,现在放开 2025-02-18 15:03:24 +08:00
c35000738c 模型取值逻辑修改 ,使用原来的取值逻辑 2025-02-17 18:00:09 +08:00
74103d4663 bugs update ,t_machine_learning_models model_field 字段长度加长 2025-02-17 17:10:10 +08:00
97059278e1 bugs update 2025-02-17 14:43:45 +08:00
25f51b1293 bug列表更新 2025-02-17 14:00:11 +08:00
54da4065db add bugs 2025-02-17 13:56:27 +08:00
034b9c6ed5 /Riskmanage/info/status 免token 访问 2025-02-14 17:38:37 +08:00
9d034fb303 CommUtil 放到 util模块 ,增加 status http 接口 2025-02-14 17:07:53 +08:00
e87eab5460 版本更新 2025-02-14 16:54:01 +08:00
5b41070529 衍生指标优化及bugfix 2025-02-14 15:08:43 +08:00
2d4ddc2857 http 接口 请求 优化 ,post application/x-www-form-urlencoded 问题修复 2025-02-13 22:47:20 +08:00
2480af577b 添加 RestTemplateTest 2025-02-13 21:57:56 +08:00
18 changed files with 259 additions and 36 deletions

25
bugs/note.txt Normal file
View File

@@ -0,0 +1,25 @@
BUG
基础指标模版下载报错
数据源指标编辑 这些变量值 没有绑定到界面上接口返回是ok的 ,前端需要改一下
引擎列表 点名称 一直加载中
决策复制版本 ,报错
t_machine_learning_models model_field (模型解析字段) 字段长度太小
ALTER TABLE t_machine_learning_models MODIFY COLUMN model_field varchar(4096) NOT NULL DEFAULT '' COMMENT '模型解析字段';
优化点:
数据中心 / 接口源 / 接口新建 修改 查看 请求地址 输入框加长
com.fibo.ddp.common.model.strategyx.decisiontable.DecisionTablesResult
TODO 注意 添加决策表 时 实际对应的字段是 ro 和 colum ,待确认

View File

@@ -1,6 +1,7 @@
package com.fibo.ddp.common.model.strategyx.decisiontable;
import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.AllArgsConstructor;
@@ -29,8 +30,13 @@ public class DecisionTablesResult implements Serializable {
private Long versionId;//决策表版本id
// 注意 添加决策表 时 实际对应的字段是 ro 和 colum ,待确认
// 先注释 数据库表加字段 解决
// @TableField(value = "rowss")
private Integer ro;//行数
// @TableField(value = "columnss")
private Integer colum;//列数
private String resultValue;//结果集二维数组

View File

@@ -6,8 +6,8 @@ import com.fibo.ddp.common.dao.strategyx.aimodel.MachineLearningModelsMapper;
import com.fibo.ddp.common.model.datax.datamanage.Field;
import com.fibo.ddp.common.model.strategyx.aimodel.MachineLearningModels;
import com.fibo.ddp.common.model.strategyx.aimodel.ModelDTO;
import com.fibo.ddp.common.service.common.CommUtil;
import com.fibo.ddp.common.service.strategyx.aimodel.PMMLExecutor.PMMLExecutor;
import com.fibo.ddp.common.utils.util.CommUtil;
import org.jpmml.evaluator.Evaluator;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@@ -60,7 +60,6 @@ public class LocalCacheService {
@Resource
PMMLExecutor pmmlExecutor;
private static final String VERSION = "2025-02-12 16:30";
private final String startTime = LocalDateTime.now().toString();
@@ -90,7 +89,7 @@ public class LocalCacheService {
public Map<String,Object> getInfo(){
Map<String,Object> info = new HashMap<>();
info.put("VERSION",VERSION);
info.put("VERSION",CommUtil.getVersion());
info.put("startTime",startTime);
info.put("runCount",runCount.longValue());

View File

@@ -32,6 +32,8 @@ import org.springframework.beans.factory.annotation.Value;
import org.springframework.http.*;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.util.concurrent.ListenableFuture;
import org.springframework.util.concurrent.ListenableFutureCallback;
import org.springframework.web.client.AsyncRestTemplate;
@@ -244,20 +246,49 @@ public class InterfaceServiceImpl extends ServiceImpl<InterfaceMapper, Interface
// 请求参数中的变量赋值
String requestBody = setRequestBodyParams(interfaceInfo.getRequestBody(), inputParam);
if(HttpMethod.POST.name().equals(interfaceInfo.getMethod())){
HttpHeaders httpHeaders = new HttpHeaders();
// 设置请求头
httpHeaders.setAll(JSONObject.parseObject(interfaceInfo.getRequestHeaders(), Map.class));
// 封装请求体
JSONObject body = JSONObject.parseObject(requestBody);
// 封装参数和头信息
HttpEntity<JSONObject> httpEntity = new HttpEntity(body, httpHeaders);
// 发送请求
if(callType == 2){
responseEntity = restTemplate.postForEntity(url, httpEntity, String.class);
} else {
listenableFuture = asyncRestTemplate.postForEntity(url, httpEntity, String.class);
final String requestHeaders = interfaceInfo.getRequestHeaders();
if(requestHeaders!=null && requestHeaders.contains(MediaType.APPLICATION_JSON_VALUE)) {
HttpHeaders httpHeaders = new HttpHeaders();
// 设置请求头
httpHeaders.setAll(JSONObject.parseObject(requestHeaders, Map.class));
// 封装请求体
JSONObject body = JSONObject.parseObject(requestBody);
// 封装参数和头信息
HttpEntity<JSONObject> httpEntity = new HttpEntity(body, httpHeaders);
// 发送请求
if (callType == 2) {
responseEntity = restTemplate.postForEntity(url, httpEntity, String.class);
} else {
listenableFuture = asyncRestTemplate.postForEntity(url, httpEntity, String.class);
}
}else{
HttpHeaders httpHeaders = new HttpHeaders();
// 设置请求头
httpHeaders.setAll(JSONObject.parseObject(interfaceInfo.getRequestHeaders(), Map.class));
// 封装请求体
JSONObject body = JSONObject.parseObject(requestBody);
MultiValueMap<String, Object> bodyMap = new LinkedMultiValueMap<>();
bodyMap.setAll(body);
// 封装参数和头信息
HttpEntity<MultiValueMap<String, Object>> httpEntity = new HttpEntity(bodyMap, httpHeaders);
// 发送请求
if (callType == 2) {
// 这里调用还是报错 ,已修复
// post http://47.99.93.74:8090/mockapi/hello2?name={name} 会报错
// java.lang.IllegalArgumentException: Not enough variable values available to expand 'name'
responseEntity = restTemplate.postForEntity(url, httpEntity, String.class);
} else {
listenableFuture = asyncRestTemplate.postForEntity(url, httpEntity, String.class);
}
}
} else if(HttpMethod.GET.name().equals(interfaceInfo.getMethod())){
// 封装uri地址路径变量
Map<String, Object> uriVariables = new HashMap<>();

View File

@@ -75,14 +75,22 @@ public class CommonServiceImpl implements CommonService {
}
SessionData sessionData = RunnerSessionManager.getSession();
Long organId = sessionData.getOrganId();
List<Field> fieldList = fieldService.findFieldByIdsbyorganId(organId, ids);
List<Field> list = new ArrayList<>();
ids = new ArrayList<>();
for (int i = 0; i < fieldList.size(); i++) {
if (fieldList.get(i).getIsDerivative() == 1) {
ids.addAll(StringUtil.toLongList(fieldList.get(i).getOrigFieldId()));
} else
list.add(fieldList.get(i));
}
// 20250214 bugfix 这个不能放在 else分支里
// 否则后面取不到值
list.add(fieldList.get(i));
}
if (ids.size() > 0) {
List<Field> lists = fieldService.findFieldByIdsbyorganId(organId, ids);
@@ -182,6 +190,9 @@ public class CommonServiceImpl implements CommonService {
map.put(key,value);
}
// 决策选项 测试时 ,这个方法 没被调用
@Override
public Map<String, Object> getFields(List<Field> fields, Map<String, Object> inputParam) {
logger.info("start getEngineField, fields:{},inputParam:{}", JSONObject.toJSONString(fields), JSONObject.toJSONString(inputParam));

View File

@@ -76,6 +76,9 @@ public class PMMLExecutorRFImpl implements PMMLExecutor {
}
Map<FieldName, ?> results = evaluator.evaluate(arguments);
System.out.println("pmml_predict_results: " + results);
List<TargetField> targetFields = evaluator.getTargetFields();
TargetField targetField = targetFields.get(0);
@@ -92,10 +95,10 @@ public class PMMLExecutorRFImpl implements PMMLExecutor {
value_1 = tmpnum.doubleValue();
}
// TODO 不知道啥含义 先注释掉 返回结果
// if (targetFieldValue instanceof ProbabilityDistribution) {
// value_1 = ((ProbabilityDistribution) targetFieldValue).getValue("1");
// }
// TODO 模型取值逻辑待确认
if (targetFieldValue instanceof ProbabilityDistribution) {
value_1 = ((ProbabilityDistribution) targetFieldValue).getValue("1");
}

View File

@@ -13,6 +13,7 @@ public class ServiceFilterConstant {
uriSet.add("/Riskmanage/v2/datamanage/datamanage/downTemplate");// 指标模板下载
uriSet.add("/Riskmanage/v2/datamanage/listmanage/downTemplate");// 名单库模板下载
uriSet.add("/Riskmanage/v3/analyse/decision");
uriSet.add("/Riskmanage/info/status");
}
public static boolean isSessionFilter(String uri) {

View File

@@ -1,8 +1,14 @@
package com.fibo.ddp.common.service.common;
package com.fibo.ddp.common.utils.util;
public class CommUtil {
private static final String VERSION = "2025-02-14 17:00";
public static String getVersion(){
return VERSION;
}
public static void doSleep(long time){
if(time<=0){
return;

View File

@@ -162,6 +162,10 @@ public class JevalUtil {
Object v = variablesMap.get(key);
if(v!=null) {
String variableValue = CommonConst.SYMBOL_SINGLE_QUOTA+v.toString()+CommonConst.SYMBOL_SINGLE_QUOTA;
variablesMap.put(key, variableValue);
}else{
String variableValue = CommonConst.SYMBOL_SINGLE_QUOTA+CommonConst.SYMBOL_SINGLE_QUOTA;
variablesMap.put(key, variableValue);
}
}

View File

@@ -98,7 +98,7 @@ public class RiskEngineBusinessImpl implements RiskEngineBusiness {
logger.info("请求参数paramJson: {}", JSONObject.toJSONString(paramJson));
JSONObject jsonObject = new JSONObject();
JSONArray resultJson = new JSONArray();
Map<String, Map<String, Object>> featureMaps = new ConcurrentHashMap<>();
// Map<String, Map<String, Object>> featureMaps = new ConcurrentHashMap<>();
Long organId = Long.valueOf(paramJson.get("organId").toString());
Long engineId = Long.valueOf(paramJson.get("engineId").toString());
//获取引擎信息
@@ -124,13 +124,18 @@ public class RiskEngineBusinessImpl implements RiskEngineBusiness {
//返回输出结果
Map<String, Object> outMap = new ConcurrentHashMap<>();
// 记录执行前全量指标
featureMaps.put("before", inputParam);
// featureMaps.put("before", inputParam);
logger.info("recursionEngineNode_before_inputParam="+inputParam);
//节点执行方法
recursionEngineNode(inputParam, engineNodeMap.get(engineNode.getNextNodes()), engineNodeMap, outMap);
logger.info("recursionEngineNode_after_inputParam="+inputParam);
jsonObject.put("status", "0x0000");
jsonObject.put("msg", "执行成功");
//记录执行后的全量指标
featureMaps.put("after", inputParam);
// featureMaps.put("after", inputParam);
paramJson.put("versionId", engineNode.getVersionId());
// featureRecordService.recordAllFeature(featureMaps, engine, paramJson);
@@ -218,7 +223,12 @@ public class RiskEngineBusinessImpl implements RiskEngineBusiness {
resultSet.setOutput(JSONObject.toJSONString(tmpJsonObject));
resultSetMapper.insertResultSet(resultSet);
Integer resultId = resultSet.getId();
// this.monitorDecisionFlow(inputParam, engine, engineVersion, engineNodeList, outMap, paramJson, resultId);
// 20250325 去掉注释 ,写入监控表
try {
this.monitorDecisionFlow(inputParam, engine, engineVersion, engineNodeList, outMap, paramJson, resultId);
}catch(Exception e){
logger.error("monitorDecisionFlow_error", e);
}
// 正常返回结果回调
decisionCallback(engine.getCallbackUrl(), paramJson, result);
}
@@ -313,11 +323,16 @@ public class RiskEngineBusinessImpl implements RiskEngineBusiness {
nextEngineNode = engineNodeMap.get(outMap.get("nextNode"));
outMap.remove("nextNode");
}
if (nextEngineNode != null && nextEngineNode.getNodeType() == NodeTypeEnum.AGGREGATION.getValue()) {
// 会导致 开始 > 分组 > 聚合 > 决策选项 不会执行 ,先注释掉 20250427
// if (nextEngineNode != null && nextEngineNode.getNodeType() == NodeTypeEnum.AGGREGATION.getValue()) {
// 并行节点后面的分支为多线程执行,执行到聚合节点则结束
resultNode = nextEngineNode;
} else {
//resultNode = nextEngineNode;
//} else {
// resultNode = recursionEngineNode(inputParam, nextEngineNode, engineNodeMap, outMap);
//}
// 20250427 之前的逻辑 会导致 开始 > 分组 > 聚合 > 决策选项 不会执行 使用以下代码
if (nextEngineNode != null){
resultNode = recursionEngineNode(inputParam, nextEngineNode, engineNodeMap, outMap);
}
}

View File

@@ -0,0 +1,41 @@
package com.fibo.ddp.manager.web.controller;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.fibo.ddp.common.model.common.ResponseEntityBuilder;
import com.fibo.ddp.common.model.common.ResponseEntityDto;
import com.fibo.ddp.common.model.common.message.template.entity.AppTemplate;
import com.fibo.ddp.common.model.common.message.template.vo.AppTemplateReqVo;
import com.fibo.ddp.common.service.common.SessionManager;
import com.fibo.ddp.common.service.common.message.template.AppTemplateService;
import com.fibo.ddp.common.utils.util.CommUtil;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import javax.servlet.http.HttpServletRequest;
import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
@RestController
@RequestMapping("info")
public class InfoController {
@Autowired
private AppTemplateService appTemplateService;
@RequestMapping("status")
public Object status(HttpServletRequest request){
Map map = new HashMap();
map.put("version", CommUtil.getVersion());
map.put("now", LocalDateTime.now().toString());
return map;
}
}

View File

@@ -47,7 +47,9 @@ public class MonitorController {
Integer pageNo = param.get("pageNo") == null ? 1 : Integer.valueOf(param.get("pageNo").toString());
Integer pageSize = param.get("pageSize") == null ? 10 : Integer.valueOf(param.get("pageSize").toString());
PageHelper.startPage(pageNo, pageSize);
List<EngineResultSet> resultSets = MonitorCenterFactory.getMonitorCenterServiceImp(MonitorStorageType.HBase).getEngineResultSetBySegment(param);
// MonitorStorageType.HBase
// 20250325 MonitorStorageType.Mysql
List<EngineResultSet> resultSets = MonitorCenterFactory.getMonitorCenterServiceImp(MonitorStorageType.Mysql).getEngineResultSetBySegment(param);
PageInfo<EngineResultSet> pageInfo = new PageInfo<>(resultSets);
HashMap<String, Object> modelMap = new HashMap<>();
modelMap.put("pager", pageInfo);

View File

@@ -77,7 +77,7 @@
<loggers>
<!--过滤掉spring和mybatis的一些无用的DEBUG信息-->
<logger name="org.mybatis" level="info" additivity="false">
<logger name="org.mybatis" level="debug" additivity="false">
<AppenderRef ref="Console"/>
</logger>
<!--监控系统信息-->
@@ -86,7 +86,7 @@
<AppenderRef ref="Console"/>
</Logger>
<root level="info">
<root level="debug">
<appender-ref ref="Console"/>
<appender-ref ref="Filelog"/>
<appender-ref ref="RollingFileInfo"/>

View File

@@ -0,0 +1,46 @@
package pmml;
import org.springframework.http.HttpEntity;
import org.springframework.http.HttpHeaders;
import org.springframework.http.MediaType;
import org.springframework.http.ResponseEntity;
import org.springframework.util.LinkedMultiValueMap;
import org.springframework.util.MultiValueMap;
import org.springframework.web.client.RestTemplate;
public class RestTemplateTest {
public static void main(String[] args)throws Exception{
RestTemplate rt = new RestTemplate();
MultiValueMap<String, Object> map= new LinkedMultiValueMap<>();
map.add("name", "tiger");
// 设置请求头
HttpHeaders headers = new HttpHeaders();
headers.setContentType(MediaType.APPLICATION_FORM_URLENCODED);
// 创建HTTP实体
HttpEntity<MultiValueMap<String, Object>> request = new HttpEntity<>(map, headers);
// 发送POST请求
String url = "http://47.99.93.74:8090/mockapi/hello2";
String response = rt.postForObject(url, request, String.class);
System.out.println(response);
ResponseEntity<String> responseEntity = rt.postForEntity(url, request, String.class);
System.out.println(responseEntity.getBody());
}
}

View File

@@ -2,7 +2,7 @@
<template>
<div class="cont_cont">
<!-- <div class="cont_left" v-loading="leftloading">
<div class="cont_left" v-loading="leftloading">
<div class="cont_header">
<p class="cont_header_title">{{title}}</p>
<p class="cont_header_subtitle">{{title}}</p>
@@ -14,7 +14,7 @@
@updatafilelist="updatafilelist" @delectFun="delectFun">
</fileHome>
</div>
</div> -->
</div>
<div
class="cont_right"
v-loading="contloading"

View File

@@ -214,7 +214,7 @@
// 表格中点击
engineDisplay: function(id) {
//alert(id);
let h5Path = '';
let h5Path = '/enginex';
window.localStorage.setItem("engineId", id);
bus.$emit('EngineSwitchover',id)

View File

@@ -481,6 +481,8 @@ CREATE TABLE `t_decision_tables_result` (
`version_id` int(11) NOT NULL DEFAULT '0' COMMENT '决策表版本id',
`rows` int(11) DEFAULT NULL COMMENT '行数',
`columns` int(11) DEFAULT NULL COMMENT '列数',
`ro` int(11) DEFAULT NULL COMMENT '行数new',
`colum` int(11) DEFAULT NULL COMMENT '列数new',
`result_value` longtext COMMENT '结果集二维数组',
`create_time` datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建时间',
`update_time` datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改时间',

31
sql/update.sql Normal file
View File

@@ -0,0 +1,31 @@
create table t_list_db_version(
id int(11) NOT NULL AUTO_INCREMENT COMMENT '主键id',
list_db_id int(11) NOT NULL,
version_code varchar(255) DEFAULT NULL,
description varchar(4096) DEFAULT NULL,
result_field_en varchar(255) DEFAULT NULL,
status int(4) DEFAULT NULL,
table_column varchar(1024) DEFAULT NULL,
match_type int(4) DEFAULT NULL,
query_type int(4) DEFAULT NULL,
query_field varchar(255) DEFAULT NULL ,
organ_id int(11) NOT NULL DEFAULT '0' COMMENT '组织id',
create_user_id int(11) NOT NULL DEFAULT '0' COMMENT '创建者id',
update_user_id int(11) NOT NULL DEFAULT '0' COMMENT '修改者id',
create_time datetime DEFAULT CURRENT_TIMESTAMP COMMENT '创建日期',
update_time datetime DEFAULT CURRENT_TIMESTAMP ON UPDATE CURRENT_TIMESTAMP COMMENT '修改日期',
snapshot json DEFAULT NULL COMMENT '名单库版本配置快照',
PRIMARY KEY (`id`) USING BTREE
) ENGINE=InnoDB AUTO_INCREMENT=1 DEFAULT CHARSET=utf8 ROW_FORMAT=DYNAMIC;
ALTER TABLE t_machine_learning_models MODIFY COLUMN model_field varchar(4096) NOT NULL DEFAULT '' COMMENT '模型解析字段';
ALTER TABLE t_decision_tables_result ADD COLUMN `ro` int DEFAULT NULL COMMENT '行数';
ALTER TABLE t_decision_tables_result ADD COLUMN `colum` int DEFAULT NULL COMMENT '列数';