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

cql只是异步保存,打印日志调整

上级 3ecc0511
...@@ -39,6 +39,9 @@ public class ExecResultRepository { ...@@ -39,6 +39,9 @@ public class ExecResultRepository {
@Value("${ibiz.deleteInvalidResultData:true}") @Value("${ibiz.deleteInvalidResultData:true}")
private boolean deleteInvalidResultData; private boolean deleteInvalidResultData;
@Value("${ibiz.saveAsyncResultData:false}")
private boolean saveAsync;
public ExecResultRepository(MappingManager mappingManager) { public ExecResultRepository(MappingManager mappingManager) {
createTable(mappingManager.getSession()); createTable(mappingManager.getSession());
...@@ -96,12 +99,19 @@ public class ExecResultRepository { ...@@ -96,12 +99,19 @@ public class ExecResultRepository {
execResult2.setDomainsfield(execResult.getDomainsfield()); execResult2.setDomainsfield(execResult.getDomainsfield());
execResult2.setTimefield(execResult.getTimefield()); execResult2.setTimefield(execResult.getTimefield());
try{ try{
if(saveAsync){
mapper.saveAsync(execResult);
}else{
mapper.save(execResult); mapper.save(execResult);
}
}catch(Exception ex){ }catch(Exception ex){
ex.printStackTrace(); ex.printStackTrace();
} }
try{ try{if(saveAsync){
mapper2.saveAsync(execResult2);
}else{
mapper2.save(execResult2); mapper2.save(execResult2);
}
}catch(Exception ex){ }catch(Exception ex){
ex.printStackTrace(); ex.printStackTrace();
} }
......
...@@ -161,7 +161,6 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl { ...@@ -161,7 +161,6 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl {
protected IExecLogService ruExecLogService; 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());
...@@ -185,13 +184,11 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl { ...@@ -185,13 +184,11 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl {
try try
{ {
log.info("Service process start:{}", msg);
for (ModelObj modelObj : msg.getDatas()) for (ModelObj modelObj : msg.getDatas())
{ {
try try
{ {
count++; count++;
modelObj.set("BATCH",msg.getBatch()); modelObj.set("BATCH",msg.getBatch());
modelObj.set(Tag_EngineId, msg.getEngineId()); modelObj.set(Tag_EngineId, msg.getEngineId());
...@@ -207,7 +204,7 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl { ...@@ -207,7 +204,7 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl {
resultsMQMsg.setKeyValueField(modelObj.getRowKey()); resultsMQMsg.setKeyValueField(modelObj.getRowKey());
resultsMQMsg.setRules(msg.getRuleIds()); resultsMQMsg.setRules(msg.getRuleIds());
Object saveResults = modelObj.get(Tag_SaveResults); Object saveResults = modelObj.get(Tag_SaveResults);
if(saveResults != null && saveResults instanceof List){ if(saveResults instanceof List){
resultsMQMsg.setDatas((List<ExecResult>)saveResults); resultsMQMsg.setDatas((List<ExecResult>)saveResults);
// defaultMQProducerService.sendToMQ(resultsMQMsg, "default"); // defaultMQProducerService.sendToMQ(resultsMQMsg, "default");
} }
...@@ -226,18 +223,9 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl { ...@@ -226,18 +223,9 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl {
strErrorInfo.append(e.getCause().getMessage()); strErrorInfo.append(e.getCause().getMessage());
strErrorInfo.append("\r\n"); strErrorInfo.append("\r\n");
} }
} }
} }
} }
} }
catch(Exception e) catch(Exception e)
{ {
...@@ -250,7 +238,6 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl { ...@@ -250,7 +238,6 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl {
strErrorInfo.append("\r\n"); strErrorInfo.append("\r\n");
} }
execlog.setRetCode(1); execlog.setRetCode(1);
execlog.setCnt(count); execlog.setCnt(count);
if (errorcount == 0) if (errorcount == 0)
...@@ -278,13 +265,9 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl { ...@@ -278,13 +265,9 @@ public class AnalyseEntityServiceImpl extends BaseEntityServiceImpl {
} }
log.info(new StringBuilder().append("Service成功,process successfully:").append(msg.toString()).toString()); log.info("Service成功,process successfully:{}", msg);
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)
......
...@@ -478,7 +478,7 @@ public class BaseEntityServiceImpl implements BaseEntityService ...@@ -478,7 +478,7 @@ public class BaseEntityServiceImpl implements BaseEntityService
} }
// } // }
log.info(new StringBuilder().append("Service,Process ").append(rulesFired).append(" rules for record.\n").toString()); // log.info(new StringBuilder().append("Service,Process ").append(rulesFired).append(" rules for record.\n").toString());
......
Markdown 格式
0% or
您添加了 0 到此讨论。请谨慎行事。
先完成此消息的编辑!
想要评论请 注册