@Override public void executeRule(final TableInteRule rule) throws RuleException { Assert.notNull(rule, "整合规则对象rule为空"); Assert.notNull(rule.getRuleId(), "整合规则对象主键Id的rule.ruleid为空"); Assert.notNull( rule.getRuleType(), "整合规则对象规则类型rule.ruleType为空,可选值为['clean','rebuild','unique','merge']"); try { ruleExecuter.execute( new RuleSetter() { @Override public String getRuleId() { return rule.getRuleId(); } @Override public String getRuleType() { return rule.getRuleType(); } }); } catch (RuleException e) { // 李广彬:2014-7-11 新加入【不管是java出错 还是存储过程 将整合日志状态更新为失败状态】 Map<String, Object> params = new HashMap<String, Object>(); params.put("ruleId", rule.getRuleId()); List<DataInteLog> items = this.dataInteLog.find(params); if (items.size() > 0) { DataInteLog dil = items.get(0); dil.setOpStats(DataLogState.LOG_FAILURE.getState()); this.dataInteLog.update(dil); } throw e; } }
private DataInteLog insertDataInteLog( TableInteRule tableRule, String ruleId, DataLogState state, String processType) throws BusinessException { DataInteLog log = new DataInteLog(); log.setId(this.buildId("")); log.setRuleId(ruleId); log.setSourceDataSet1(tableRule.getDataSet1()); log.setSourceDataSet2(tableRule.getDataSet2()); // 2.1 创建一个虚拟结果数据集 DataSet resultSet = new DataSet(); resultSet.setDataSetId(this.buildId("")); log.setOpUser(tableRule.getCreateUser()); log.setRuleType(tableRule.getRuleType()); log.setResultDataSet(resultSet); log.setOpStats(state.getState()); log.setProcessType(processType); this.dataInteLog.save(log); return log; // 返回结果数据集的ID }