提交 d06be8bf 编写于 作者: hebao@lab.ibiz5.com's avatar hebao@lab.ibiz5.com

test

上级 7588d44e
package cn.ibizlab.core.extensions.service; package cn.ibizlab.core.extensions.service;
import cn.ibizlab.core.analysis.domain.DADimension; import cn.ibizlab.core.analysis.domain.DADimension;
import cn.ibizlab.core.dict.extensions.service.DictDstService; import cn.ibizlab.core.extensions.domain.BaseRequest;
import cn.ibizlab.core.extensions.domain.ResultsMQMsg;
import cn.ibizlab.core.extensions.domain.SqlResultsMQMsg; import cn.ibizlab.core.extensions.domain.SqlResultsMQMsg;
import cn.ibizlab.core.extensions.util.ExpiryMap; import cn.ibizlab.core.extensions.util.ExpiryMap;
import cn.ibizlab.core.extensions.util.MsgProducerService; import cn.ibizlab.core.extensions.util.MsgProducerService;
import cn.ibizlab.core.rule.domain.ExecResult;
import cn.ibizlab.core.extensions.domain.BaseRequest;
import cn.ibizlab.core.lite.extensions.domain.FieldObj; import cn.ibizlab.core.lite.extensions.domain.FieldObj;
import cn.ibizlab.core.lite.extensions.domain.ModelObj; import cn.ibizlab.core.lite.extensions.domain.ModelObj;
import cn.ibizlab.core.rule.domain.ExecLog; import cn.ibizlab.core.rule.domain.ExecLog;
import cn.ibizlab.core.rule.domain.ExecResult;
import cn.ibizlab.core.rule.service.IExecLogService; import cn.ibizlab.core.rule.service.IExecLogService;
import cn.ibizlab.core.rule.service.IExecResultService;
import cn.ibizlab.util.dict.CodeItem; import cn.ibizlab.util.dict.CodeItem;
import cn.ibizlab.util.dict.CodeList; import cn.ibizlab.util.dict.CodeList;
import cn.ibizlab.util.helper.CachedBeanCopier; import cn.ibizlab.util.helper.CachedBeanCopier;
...@@ -44,6 +41,9 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl { ...@@ -44,6 +41,9 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl {
@Lazy @Lazy
private DABuildExService daBuildExService; private DABuildExService daBuildExService;
@Autowired
protected IExecLogService ruExecLogService;
@Value("${rocketmq.sendResultsBatchSize:1000}") @Value("${rocketmq.sendResultsBatchSize:1000}")
private Integer sendResultsBatchSize; private Integer sendResultsBatchSize;
...@@ -81,15 +81,12 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl { ...@@ -81,15 +81,12 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl {
if(timefield!=null) if(timefield!=null)
result.setTimeField(timefield); result.setTimeField(timefield);
String ext1=EXT1FIELD.getValues(); String ext1=EXT1FIELD.getValues();
if(ext1.length()>330) if(ext1.length()>330)
ext1=ext1.substring(0,330)+"..."; ext1=ext1.substring(0,330)+"...";
if(!StringUtils.isEmpty(ext1)) if(!StringUtils.isEmpty(ext1))
result.setExt1Field(ext1); result.setExt1Field(ext1);
String ext2=EXT2FIELD.getValues(); String ext2=EXT2FIELD.getValues();
if(ext2.length()>330) if(ext2.length()>330)
ext2=ext2.substring(0,330)+"..."; ext2=ext2.substring(0,330)+"...";
...@@ -99,19 +96,7 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl { ...@@ -99,19 +96,7 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl {
result.setDomainsField(DOMAINSFIELD.getValue(String.class, "")); result.setDomainsField(DOMAINSFIELD.getValue(String.class, ""));
result.setSystemId(DataObject.getStringValue(param.get("systemid"),null)); result.setSystemId(DataObject.getStringValue(param.get("systemid"),null));
// Object resultDataSource = Default_ResultDataSource; if((!StringUtils.isEmpty(result.getRuleId()))&&(!StringUtils.isEmpty(result.getDomainsField()))&&(!StringUtils.isEmpty(result.getKeyValueField()))&&(!ObjectUtils.isEmpty(result.getTimeField()))) {
// Object resultTableName = Default_ResultTableName;
// if(param.get("resultDataSource")!=null){
// resultDataSource = param.get("resultDataSource");
// }
// if(param.get("resultTableName")!=null){
// resultTableName = param.get("resultTableName");
// }
// result.set(Tag_EngineId,param.get(Tag_EngineId));
// result.set("resultDataSource", resultDataSource);
// result.set("resultTableName", resultTableName);
if((!StringUtils.isEmpty(result.getRuleId()))&&(!StringUtils.isEmpty(result.getKeyValueField()))) {
List<DADimension> dims=getDims(result.getBusinessCat()); List<DADimension> dims=getDims(result.getBusinessCat());
if(dims!=null) { if(dims!=null) {
...@@ -136,20 +121,16 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl { ...@@ -136,20 +121,16 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl {
CachedBeanCopier.copy(result, result2); CachedBeanCopier.copy(result, result2);
result2.setDimField(code.getValue().toString()); result2.setDimField(code.getValue().toString());
result2.setId(result2.getDefaultKey(true).toString()); result2.setId(result2.getDefaultKey(true).toString());
if(result2.getRetValue()==1) if(result2.getRetValue()==1)
//ruExecResultService.saveAsync(result2);
this.addResults(param, Tag_SaveResults, result2); this.addResults(param, Tag_SaveResults, result2);
else else
// ruExecResultService.deleteAsync(result2);
this.addResults(param, Tag_DeleteResults, result2); this.addResults(param, Tag_DeleteResults, result2);
//非逐层核算或无父代码项退出 //非逐层核算或无父代码项退出
if(dim.getRecursive() == 0 || StringUtils.isEmpty(code.getParent())) if(dim.getRecursive() == 0 || StringUtils.isEmpty(code.getParent()))
{ {
break; break;
} }else{
else
{
val=code.getParent(); val=code.getParent();
} }
} }
...@@ -163,10 +144,8 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl { ...@@ -163,10 +144,8 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl {
CachedBeanCopier.copy(result, result2); CachedBeanCopier.copy(result, result2);
result2.setId(result2.getDefaultKey(true).toString()); result2.setId(result2.getDefaultKey(true).toString());
if(result2.getRetValue()==1) if(result2.getRetValue()==1)
// ruExecResultService.saveAsync(result2);
this.addResults(param, Tag_SaveResults, result2); this.addResults(param, Tag_SaveResults, result2);
else else
// ruExecResultService.deleteAsync(result2);
this.addResults(param, Tag_DeleteResults, result2); this.addResults(param, Tag_DeleteResults, result2);
} }
} }
...@@ -175,7 +154,6 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl { ...@@ -175,7 +154,6 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl {
} }
// log.debug("saveResult:{},{} cost:{}", param.getRowKey(), RULEID, System.currentTimeMillis() - start); // log.debug("saveResult:{},{} cost:{}", param.getRowKey(), RULEID, System.currentTimeMillis() - start);
} }
/** /**
...@@ -192,14 +170,17 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl { ...@@ -192,14 +170,17 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl {
results = new ArrayList<>(); results = new ArrayList<>();
param.set(tag, results); param.set(tag, results);
} }
results.add(result); if(Tag_SaveResults.equals(tag)) {
results.add(result);
}else{
ExecResult result2 = new ExecResult();
result2.setId(result.getId());
results.add(result2);
}
} }
@Autowired
protected IExecLogService ruExecLogService;
public ExecLog processAll(BaseRequest msg) public ExecLog processAll(BaseRequest msg)
{ {
ExecLog execlog=new ExecLog(); ExecLog execlog=new ExecLog();
execlog.setId(msg.getId()); execlog.setId(msg.getId());
execlog.setRunBody(msg.toString()); execlog.setRunBody(msg.toString());
...@@ -334,10 +315,6 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl { ...@@ -334,10 +315,6 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl {
log.info(new StringBuilder().append("Service成功,process successfully:").append(msg.toString()).toString()); log.info(new StringBuilder().append("Service成功,process successfully:").append(msg.toString()).toString());
strErrorInfo.append("Service成功,process successfully\r\n"); strErrorInfo.append("Service成功,process successfully\r\n");
execlog.setCnt(count); execlog.setCnt(count);
execlog.setSucc(count-errorcount); execlog.setSucc(count-errorcount);
if(execlog.getCnt()==0) if(execlog.getCnt()==0)
...@@ -349,7 +326,6 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl { ...@@ -349,7 +326,6 @@ public class AnalyseSqlServiceImpl extends BaseEntityServiceImpl {
return execlog; return execlog;
} }
private ExpiryMap<String,List<DADimension>> dimlistMap=new ExpiryMap<>(); private ExpiryMap<String,List<DADimension>> dimlistMap=new ExpiryMap<>();
public List<DADimension> getDims(String id) public List<DADimension> getDims(String id)
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册