预研笔记
https://blog.youkuaiyun.com/weixin_34206899/article/details/87268761
protected RuleManager ruleMananger;
public Map<String, Object> execute(String directoryName, String ruleName,
Map<String, Object> problem, String[] strings) {
try {
return ruleMananger.execute(directoryName, ruleName, problem, strings);
} catch (EcadBaseException e) {
e.printStackTrace();
ruleMananger.storeRuleExceptionLog(null, e);
throw new BusinessException(e.getMess());
}
}
public interface RuleManager extends BaseManager {
public static final String ID = "序号";
public static final String IDS = "序号集";
public static final String DATE = "日期";
public static final String START_DATE = "开始日期";
public static final String END_DATE = "结束日期";
public static final String BALANCE = "结算标识";
Map<String, Object> execute(String directoryName,String ruleName,
Map<String, Object> problem,String[] strings);
Map<String, Object> execute(String directoryName,String ruleName,
Map<String, Object> problem);
List<Map<String,Object>> getAllRuleTableDetail(String[] binds,Object... objects);
Object getSingleRuleTableDetail(String[] binds,Object... objects);
Map<String,Object> getRuleTableDetail(String[] binds,Object... objects);
List<Map<String,Object>> getMultipleRuleTableDetail(String[] binds,Object... objects);
@Transactional
void storeRuleExceptionLog(String gourpNo,String process,EcadBaseException ecadBaseException);
@Transactional
void storeRuleExceptionLog(String process,EcadBaseException ecadBaseException);
@Transactional
void refreshVersionHashCode();
Boolean isLoader();
}
package com.vtradex.rule.server.service.rule.pojo;
import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.springframework.util.Assert;
import com.vtradex.engine.exception.EcadBaseException;
import com.vtradex.engine.groovy.Launcher;
import com.vtradex.rule.server.loader.IRuleTableLoader;
import com.vtradex.rule.server.loader.IThornRuleLoader;
import com.vtradex.rule.server.model.exception.RuleExceptionLog;
import com.vtradex.rule.server.model.rule.Directory;
import com.vtradex.rule.server.model.rule.Version;
import com.vtradex.rule.server.service.rule.RuleManager;
import com.vtradex.thorn.server.exception.BusinessException;
import com.vtradex.thorn.server.model.security.User;
import com.vtradex.thorn.server.service.pojo.DefaultBaseManager;
import com.vtradex.thorn.server.util.BeanUtils;
import com.vtradex.thorn.server.util.Constant;
import com.vtradex.thorn.server.web.security.UserHolder;
public class DefaultRuleManager extends DefaultBaseManager implements
RuleManager {
private IThornRuleLoader thornRuleLoader;
private IRuleTableLoader ruleTableLoader;
public IThornRuleLoader getIThornRuleLoader(){
if(thornRuleLoader == null){
thornRuleLoader = (IThornRuleLoader)applicationContext.getBean("thornRuleLoader");
}
return thornRuleLoader;
}
public IRuleTableLoader getIRuleTableLoader(){
if(ruleTableLoader == null){
ruleTableLoader = (IRuleTableLoader)applicationContext.getBean("ruleTableLoader");
}
return ruleTableLoader;
}
public Boolean isLoader(){
return getIThornRuleLoader().isLoader() && getIRuleTableLoader().isLoader();
}
protected Directory getDirectoryByUnqie(String name){
String hashCode = BeanUtils.getFormat(name);
String hql = "FROM Directory directory WHERE directory.hashCode = :hashCode";
return (Directory)commonDao.findByQueryUniqueResult(hql, new String[]{"hashCode"}, new Object[]{hashCode});
}
public Map<String, Object> execute(String directoryName,String ruleName,
Map<String, Object> problem){
return execute(directoryName, ruleName, problem,new String[]{
Constant.NULL,Constant.NULL,Constant.NULL,
Constant.NULL,Constant.NULL});
}
public Map<String, Object> execute(String directory