package com.vci.server.framework.delegate;
|
|
|
import java.util.Iterator;
|
import java.util.LinkedHashMap;
|
import java.util.List;
|
|
import org.apache.commons.lang3.StringUtils;
|
|
import com.vci.common.objects.UserEntity;
|
import com.vci.common.resource.CommonProperties;
|
import com.vci.common.utility.ObjectUtility;
|
import com.vci.corba.common.VCIError;
|
import com.vci.corba.framework.data.AppConfigDetailInfo;
|
import com.vci.corba.framework.data.DataSourceInfo;
|
import com.vci.corba.framework.data.SpecialCharClsfInfo;
|
import com.vci.corba.framework.data.SpecialCharInfo;
|
import com.vci.corba.framework.data.SystemCfgInfo;
|
import com.vci.corba.log.data.LogType;
|
import com.vci.corba.common.data.UserEntityInfo;
|
import com.vci.server.base.delegate.BaseDelegate;
|
import com.vci.server.base.delegate.UserEntityDelegate;
|
import com.vci.server.base.utility.LogRecordUtil;
|
import com.vci.server.framework.systemConfig.SystemCfg;
|
import com.vci.server.framework.systemConfig.SystemCfgService;
|
import com.vci.server.framework.systemConfig.specialchar.SpecialChar;
|
import com.vci.server.framework.systemConfig.specialchar.SpecialCharService;
|
import com.vci.server.framework.systemConfig.specialcharclsf.SpecialCharClsf;
|
import com.vci.server.framework.systemConfig.specialcharclsf.SpecialCharClsfService;
|
|
public class SystemCfgDelegate extends BaseDelegate{
|
|
public String getConfigValue(String key) throws VCIError {
|
// add by xchao 2017.11.28 begin
|
// 优先基于系统配置选项中取
|
// 如果没有取到则从打包到jar中的配置文件中读取
|
AppConfigDetailInfo acdi = new AppConfigDetailDelegate(new UserEntityInfo("", "", "")).getAppConfigDetailByKey(key);
|
if(acdi != null && StringUtils.isNotBlank(acdi.id)){
|
return acdi.value;
|
}
|
// add by xchao 2017.11.28 end
|
return CommonProperties.getStringProperty(key);
|
}
|
|
// public String getConfigValue(String propertyPath, String key) throws VCIError
|
// {
|
// // add by xchao 2017.11.28 begin
|
// // 优先基于系统配置选项中取
|
// // 如果没有取到则从打包到jar中的配置文件中读取
|
// AppConfigDetailInfo acdi = new AppConfigDetailDelegate(new UserEntityInfo("", "", "")).getAppConfigDetailByKey(key);
|
// if(StringUtils.isNotEmpty(acdi.id)){
|
// return acdi.value;
|
// }
|
// // add by xchao 2017.11.28 end
|
// try {
|
// if(propertyPath == null || "".equals(propertyPath)){
|
// return CommonProperties.getStringProperty(key);
|
// }
|
// return CommonPropertiesExt.getProperty(propertyPath, key);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// return "";
|
// }
|
// }
|
/*** 得到相应的 字符集、流水方式、日期格式、 补位字符对象
|
*
|
* @param type 系统配置管理 字符集:charset 流水方式:flowType 日期格式:dateFormat 补位字符:fillerChar
|
* @return
|
* @throws VCIError
|
*/
|
public SystemCfgInfo[] fetchSystemCfgInfo(String type) throws VCIError {
|
List<SystemCfg> list = null;
|
try {
|
SystemCfgService systemCfgService = new SystemCfgService();
|
list = systemCfgService.selectSystemCfgByType(type);
|
} catch (Exception e) {
|
e.printStackTrace();
|
//throw new VCIError("10014 , "");
|
}
|
int size = list.size();
|
SystemCfgInfo[] systemCfgInfo = new SystemCfgInfo[size];
|
for (int i = 0; i < size; i++) {
|
systemCfgInfo [i] = changeSystemCfgToSystemCfgInfo(list.get(i));
|
}
|
return systemCfgInfo;
|
}
|
|
|
/***
|
* 存储特殊字符分类
|
* @param specialCharClsfInfo 特殊字符分类对象
|
* @return
|
* @throws VCIError
|
*/
|
public String saveSpecialCharClsf(SpecialCharClsfInfo specialCharClsfInfo, UserEntityInfo userEntityInfo) throws VCIError {
|
SpecialCharClsfService specialCharClsfService = new SpecialCharClsfService();
|
UserEntityDelegate.setUserEntityToService(specialCharClsfService, userEntityInfo);
|
SpecialCharClsf checkSpecialCharClsf = specialCharClsfService.selectSpecialCharClsfByName(specialCharClsfInfo.name);
|
if (checkSpecialCharClsf != null) {
|
throw new VCIError("10061", new String[]{});
|
}
|
String id = ObjectUtility.getNewObjectID36();
|
specialCharClsfInfo.id = id;
|
//UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
|
try {
|
SpecialCharClsf special = changeSpecialCharClsfInfoToSpecialCharClsf(specialCharClsfInfo);
|
specialCharClsfService.saveSpecialCharClsf(special);
|
LogRecordUtil.writeLog(userEntityInfo, "添加", "成功", special.getLogInfo(),LogType.General,special.getId());
|
} catch (Exception e) {
|
//LogRecordUtil.writeLog(userEntity, "特殊字符分类", "添加失败!",LogType.General);
|
e.printStackTrace();
|
throw new VCIError("150008", new String[]{});
|
}
|
return id;
|
}
|
|
/***
|
* 更新特殊字符分类
|
* @param specialCharInfo 要更新的特殊字符分类
|
* @return
|
* @throws VCIError
|
*/
|
public boolean updateSpecialCharClsf(SpecialCharClsfInfo specialCharClsfInfo, UserEntityInfo userEntityInfo) throws VCIError {
|
SpecialCharClsfService specialCharClsfService = new SpecialCharClsfService();
|
SpecialCharClsf checkSpecialCharClsf = specialCharClsfService.selectSpecialCharClsfByName(specialCharClsfInfo.name);
|
UserEntityDelegate.setUserEntityToService(specialCharClsfService, userEntityInfo);
|
//UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
|
if (checkSpecialCharClsf != null && !checkSpecialCharClsf.getId().equals(specialCharClsfInfo.id)) {
|
throw new VCIError("10063", new String[]{});
|
}
|
try {
|
SpecialCharClsf specia = changeSpecialCharClsfInfoToSpecialCharClsf(specialCharClsfInfo);
|
SpecialCharClsf speciaBefore = specialCharClsfService.selectSpecialCharClsfById(specia.getId());
|
specialCharClsfService.updateSpecialCharClsf(specia);
|
StringBuilder logres = new StringBuilder();
|
logres.append("更新前:"+speciaBefore.getLogInfo());
|
logres.append(" 更新后:"+specia.getLogInfo());
|
LogRecordUtil.writeLog(userEntityInfo, "更新", "成功", logres.toString(), LogType.General,specia.getId());
|
} catch (Exception e) {
|
e.printStackTrace();
|
throw new VCIError("150012", new String[]{});
|
}
|
return true;
|
}
|
|
/**
|
*
|
* <p>Description:获取所有的特殊字符分类 </p>
|
*
|
* @author sunbo
|
* @time 2012-5-25
|
* @return
|
* @throws VCIError
|
*/
|
public SpecialCharClsfInfo[] getSpecialCharClsfList(int pageNo,int pageSize) throws VCIError {
|
SpecialCharClsfService specialCharClsfService = new SpecialCharClsfService();
|
List<SpecialCharClsf> list = null;
|
try {
|
list = specialCharClsfService.getSpecialCharClsfList(pageNo,pageSize);
|
} catch (Exception e) {
|
e.printStackTrace();
|
//throw new VCIError("10020 , "");
|
}
|
int size = list.size();
|
SpecialCharClsfInfo[] specialCharClsfInfo = new SpecialCharClsfInfo[size];
|
for (int i = 0; i < size; i++) {
|
specialCharClsfInfo[i] = changeSpecialCharClsfToSpecialCharClsfInfo(list.get(i));
|
}
|
return specialCharClsfInfo;
|
}
|
|
|
public SpecialCharInfo[] getBychar(String plscsfoId){
|
SpecialCharInfo[] specialCharInfos=null;
|
SpecialCharClsfService specialCharClsfService = new SpecialCharClsfService();
|
|
List<SpecialChar> specialCharList=specialCharClsfService.getbyChar(plscsfoId);
|
specialCharInfos=new SpecialCharInfo[specialCharList.size()];
|
|
for (int i = 0; i < specialCharList.size(); i++) {
|
|
specialCharInfos[i]= changeSpecialCharToSpecialCharInfo(specialCharList.get(i));
|
}
|
|
|
return specialCharInfos;
|
}
|
/**
|
*
|
* <p>Description:获取所有的特殊字符分类 </p>
|
*
|
* @author sunbo
|
* @time 2012-5-25
|
* @return
|
* @throws VCIError
|
*/
|
public SpecialCharClsfInfo[] getSpecialCharClsfList() throws VCIError {
|
SpecialCharClsfService specialCharClsfService = new SpecialCharClsfService();
|
List<SpecialCharClsf> list = null;
|
try {
|
list = specialCharClsfService.getSpecialCharClsfList();
|
} catch (Exception e) {
|
e.printStackTrace();
|
//throw new VCIError("10020 , "");
|
}
|
int size = list.size();
|
SpecialCharClsfInfo[] specialCharClsfInfo = new SpecialCharClsfInfo[size];
|
for (int i = 0; i < size; i++) {
|
specialCharClsfInfo[i] = changeSpecialCharClsfToSpecialCharClsfInfo(list.get(i));
|
}
|
return specialCharClsfInfo;
|
}
|
|
public int getSpecialCharClsTotal() throws VCIError {
|
int total = 0;
|
try {
|
total = new SpecialCharClsfService().getSpecialCharClsTotal();
|
}catch(Exception e) {
|
throw new VCIError("150117", new String[0]);
|
}
|
|
return total;
|
}
|
|
/***
|
*
|
* @param ids 根据ID删除特殊字符分类
|
* @return
|
* @throws VCIError
|
*/
|
public boolean deletSpecialCharClsf(String[] ids, UserEntityInfo userEntityInfo) throws VCIError {
|
boolean rs = true;
|
//UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
|
SpecialCharClsfService specialCharClsfService = new SpecialCharClsfService();
|
try {
|
UserEntityDelegate.setUserEntityToService(specialCharClsfService, userEntityInfo);
|
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
|
for(String id : ids){
|
SpecialCharClsf specia = specialCharClsfService.selectSpecialCharClsfById(id);
|
map.put(specia.getLogInfo(), specia.getId());
|
}
|
rs = specialCharClsfService.deleteSpecialCharClsfByHQL(ids);
|
Iterator<String> it = map.keySet().iterator();
|
while(it.hasNext()){
|
String speciaId = it.next();
|
LogRecordUtil.writeLog(userEntityInfo, "删除", "成功", speciaId, LogType.General,map.get(speciaId));
|
}
|
} catch (Exception e) {
|
//LogRecordUtil.writeLog(userEntity, "特殊字符分类", "删除失败!",LogType.General);
|
e.printStackTrace();
|
throw new VCIError("150002", new String[]{});
|
}
|
return rs;
|
}
|
/***
|
* 存储特殊字符
|
* @param specialCharInfo 要存储的特殊字符
|
* @return
|
* @throws VCIError
|
*/
|
public String saveSpecialChar(SpecialCharInfo[] specialCharInfos, UserEntityInfo userEntityInfo) throws VCIError {
|
SpecialCharService specialCharService = new SpecialCharService();
|
int length = specialCharInfos.length;
|
UserEntityDelegate.setUserEntityToService(specialCharService, userEntityInfo);
|
//UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
|
for (int i = 0; i < length; i++) {
|
SpecialChar checksPecialChar = specialCharService.getSepcialCharByClsfIdAndVal(specialCharInfos[i].parentId, specialCharInfos[i].value);
|
if (checksPecialChar != null) {
|
throw new VCIError("10060", new String[]{""});
|
}
|
}
|
for (int i = 0; i < length; i++) {
|
String id = ObjectUtility.getNewObjectID36();
|
specialCharInfos[i].id = id;
|
try {
|
SpecialChar specia = changeSpecialCharInfoToSpecialChar(specialCharInfos[i]);
|
specialCharService.saveSpecialChar(specia);
|
LogRecordUtil.writeLog(userEntityInfo, "添加", "成功", specia.getLogInfo(),LogType.General,specia.getId());
|
} catch (Exception e) {
|
//LogRecordUtil.writeLog(userEntity, "特殊字符", "添加失败!",LogType.General);
|
e.printStackTrace();
|
throw new VCIError("150006", new String[]{});
|
}
|
}
|
return "";
|
}
|
/***
|
* 更新特殊字符
|
* @param specialCharInfo 要更新的特殊字符
|
* @return
|
* @throws VCIError
|
*/
|
public boolean updateSpecialChar(SpecialCharInfo specialCharInfo, UserEntityInfo userEntityInfo) throws VCIError {
|
SpecialCharService specialCharService = new SpecialCharService();
|
UserEntityDelegate.setUserEntityToService(specialCharService, userEntityInfo);
|
SpecialChar checksPecialChar = specialCharService.getSepcialCharByClsfIdAndVal(specialCharInfo.parentId, specialCharInfo.value);
|
//UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
|
if (checksPecialChar != null && !checksPecialChar.getId().equals(specialCharInfo.id)) {
|
throw new VCIError("10062", new String[]{});
|
}
|
try {
|
SpecialChar specia = changeSpecialCharInfoToSpecialChar(specialCharInfo);
|
SpecialChar speciaBefore = specialCharService.getSepcialCharById(specia.getId());
|
specialCharService.updateSpecialChar(specia);
|
StringBuilder logres = new StringBuilder();
|
logres.append("更新前:"+speciaBefore.getLogInfo());
|
logres.append(" 更新后:"+specia.getLogInfo());
|
LogRecordUtil.writeLog(userEntityInfo, "更新", "成功", logres.toString(), LogType.General,specia.getId());
|
} catch (Exception e) {
|
//LogRecordUtil.writeLog(userEntity, "特殊字符", "修改失败!",LogType.General);
|
e.printStackTrace();
|
throw new VCIError("150010", new String[]{});
|
}
|
return true;
|
}
|
/***
|
*
|
* @param ids 要删除的特殊字符的id
|
* @return
|
* @throws VCIError
|
*/
|
public boolean deletSpecialChar(String[] ids, UserEntityInfo userEntityInfo) throws VCIError {
|
boolean rs = true;
|
SpecialCharService specialCharService = new SpecialCharService();
|
//UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
|
try {
|
UserEntityDelegate.setUserEntityToService(specialCharService, userEntityInfo);
|
LinkedHashMap<String, String> map = new LinkedHashMap<String, String>();
|
for(String id : ids){
|
SpecialChar spe = specialCharService.getSepcialCharById(id);
|
map.put(spe.getLogInfo(), spe.getId());
|
}
|
rs = specialCharService.deleteSpecialCharByHql(ids);
|
Iterator<String> it = map.keySet().iterator();
|
while(it.hasNext()){
|
String logKey = it.next();
|
LogRecordUtil.writeLog(userEntityInfo, "删除", "成功", logKey, LogType.General,map.get(logKey)); }
|
} catch (Exception e) {
|
//LogRecordUtil.writeLog(userEntity, "特殊字符", "删除失败!",LogType.General);
|
e.printStackTrace();
|
throw new VCIError("150001", new String[]{});
|
}
|
return rs;
|
}
|
|
|
|
/***
|
* 得到当前分类下的特殊字符
|
* @param classId 分类id
|
* @return
|
* @throws VCIError
|
*/
|
public SpecialCharInfo[] fetchSpecialChar(String classId) throws VCIError {
|
SpecialCharService specialCharService = new SpecialCharService();
|
List<SpecialChar> list = null;
|
try {
|
list = specialCharService.getSepcialCharByClsfId(classId);
|
} catch (Exception e) {
|
e.printStackTrace();
|
//throw new VCIError("10019 , "");
|
}
|
int size = list.size();
|
SpecialCharInfo[] specialCharInfo = new SpecialCharInfo[size];
|
for (int i = 0; i < size; i++) {
|
specialCharInfo[i] = changeSpecialCharToSpecialCharInfo(list.get(i));
|
}
|
return specialCharInfo;
|
}
|
|
/**
|
*
|
* <p>Description: 根据PID删除特殊字符</p>
|
*
|
* @author sunbo
|
* @time 2012-5-28
|
* @param id
|
* @param userEntityInfo
|
* @return
|
* @throws VCIError
|
*/
|
public boolean deleteSpecialCharByParentId(String id, UserEntityInfo userEntityInfo) throws VCIError {
|
boolean rs = true;
|
SpecialCharService specialCharService = new SpecialCharService();
|
UserEntity userEntity = changeUserEntityInfoToUserEntity(userEntityInfo);
|
try {
|
UserEntityDelegate.setUserEntityToService(specialCharService, userEntityInfo);
|
rs = specialCharService.deleteSpecialCharByParentId(id);
|
//LogRecordUtil.writeLog(userEntity, "特殊字符", "删除成功!");
|
} catch (Exception e) {
|
//LogRecordUtil.writeLog(userEntity, "特殊字符", "删除失败!");
|
e.printStackTrace();
|
//throw new VCIError("10017 , "");
|
}
|
return rs;
|
}
|
// /***
|
// * 删除流水算法
|
// * @param ids
|
// * @return
|
// * @throws VCIError
|
// */
|
// public boolean deleteFlowAlg(String[] ids, UserEntityInfo userEntityInfo) throws VCIError {
|
// boolean rs = false;
|
// FlowAlgService flowAlgService = new FlowAlgService();
|
// int count = ids.length;
|
// UserEntityDelegate.setUserEntityToService(flowAlgService, userEntityInfo);
|
// for (int i = 0; i < count; i++) {
|
// FlowAlg flowAlg = flowAlgService.getFlowAlgById(ids[i]);
|
// if (flowAlg.getFlowSecs().size() != 0) {
|
// deleteVarRangeMessage(flowAlg.getFlowSecs());
|
// }
|
// }
|
// try {
|
// rs = flowAlgService.deleteFlowAlgByHql(ids);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// throw new VCIError("10025 , "删除流水算法信息时发生异常,删除失败!");
|
// }
|
// return rs;
|
// }
|
|
// /****
|
// * 删除可变码段取值范围
|
// */
|
// public boolean deleteVarRange(String[] ids, UserEntityInfo userEntityInfo) throws VCIError {
|
// boolean rs = false;
|
// VarRangeService varRangeService = new VarRangeService();
|
// int count = ids.length;
|
// UserEntityDelegate.setUserEntityToService(varRangeService, userEntityInfo);
|
// for (int i = 0; i < count; i++) {
|
// VarRange varRange = varRangeService.getVarRangeById(ids[i]);
|
// if (varRange.getVarSecs().size() != 0) {
|
// deleteVarRangeMessage(varRange.getVarSecs());
|
// }
|
// }
|
//
|
// try {
|
// rs = varRangeService.deleteVarRangeByHql(ids);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// throw new VCIError("10026 , "删除可变码段取值范围信息时发生异常,删除失败!");
|
// }
|
// return rs;
|
// }
|
|
// /****
|
// * 删除流水算法、可变码段取值范围时如果被引用提示的错误信息
|
// * @param varSecs
|
// * @throws VCIError
|
// */
|
// private void deleteVarRangeMessage(Set<Section> varSecs) throws VCIError {
|
// String secGrpTitle = "码段分组:";
|
// String secGrp = "";
|
// String s = "";
|
// int i = 0;
|
// Section currentVarSec = null;
|
// for (Section varSec : varSecs) {
|
// currentVarSec = varSec;
|
// secGrp = secGrpTitle + varSec.getSecGrp().getName() + "下 ";
|
// if (i == 0) {
|
// s = secGrp + varSec.getName() + " 码段";
|
// } else if(i == 1){
|
// s += ", " + secGrp + varSec.getName();
|
// } else {
|
// s += "┅";
|
// break;
|
// }
|
// i++;
|
// }
|
// String type = "流水算法";
|
// if (currentVarSec.getSecType() == 2) {
|
// type = "取值范围";
|
// }
|
// s = "要删除的" + type + "被 " + s + " 引用!";
|
// throw new VCIError("1 , s);
|
// }
|
|
// /****
|
// * 得到所有流水算法
|
// */
|
// public FlowAlgInfo[] fetchFlowAlgInfo() throws VCIError {
|
// FlowAlgService flowAlgService = new FlowAlgService();
|
// List<FlowAlg> list = null;
|
// try {
|
// list = flowAlgService.getFlowAlgList();
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// throw new VCIError("10027 , "");
|
// }
|
// int size = list.size();
|
// FlowAlgInfo[] flowAlgInfo = new FlowAlgInfo[size];
|
// for (int i = 0; i < size; i++) {
|
// flowAlgInfo[i] = changeFlowAlgToFlowAlgInfo(list.get(i));
|
// }
|
// return flowAlgInfo;
|
// }
|
|
// /****
|
// * 得到所有可变码段取值范围
|
// */
|
// public VarRangeInfo[] fetchVarRangeInfo() throws VCIError {
|
// VarRangeService varRangeService = new VarRangeService();
|
// List<VarRange> list = null;
|
// try {
|
// list = varRangeService.getVarRangeList();
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// throw new VCIError("10028 , "");
|
// }
|
// int size = list.size();
|
// VarRangeInfo[] varRangeInfo = new VarRangeInfo[size];
|
// for (int i = 0; i < size; i++) {
|
// varRangeInfo[i] = changeVarRangeToVarRangeInfo(list.get(i));
|
// }
|
// return varRangeInfo;
|
// }
|
|
// /****
|
// * 保存流水算法
|
// */
|
// public String saveFlowAlg(FlowAlgInfo flowAlgInfo, UserEntityInfo userEntityInfo) throws VCIError {
|
// FlowAlgService flowAlgService = new FlowAlgService();
|
// FlowAlg checkFlowAlgName = flowAlgService.getFlowAlgByName(flowAlgInfo.name);
|
// UserEntityDelegate.setUserEntityToService(flowAlgService, userEntityInfo);
|
// if (checkFlowAlgName != null) {
|
// throw new VCIError("10064 , "");
|
// }
|
// String id = ObjectUtility.getNewObjectID36();
|
// flowAlgInfo.id = id;
|
// FlowAlg flowAlg = changeFlowAlgInfoToFlowAlg(flowAlgInfo) ;
|
// try {
|
// flowAlgService.saveFlowAlg(flowAlg);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// throw new VCIError("10029 , "");
|
// }
|
// return id;
|
// }
|
|
// /****
|
// * 保存可变码段取值范围
|
// */
|
// public String saveVarRange(VarRangeInfo varRangeInfo, UserEntityInfo userEntityInfo) throws VCIError {
|
// VarRangeService varRangeService = new VarRangeService();
|
// UserEntityDelegate.setUserEntityToService(varRangeService, userEntityInfo);
|
// VarRange checkVarRange = varRangeService.getVarRangeByName(varRangeInfo.name);
|
// if (checkVarRange != null) {
|
// throw new VCIError("10064 , "");
|
// }
|
// String id = ObjectUtility.getNewObjectID36();
|
// varRangeInfo.id = id;
|
// VarRange varRange = changeVarRangeInfoToVarRange(varRangeInfo);
|
// try {
|
// varRangeService.saveVarRange(varRange);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// throw new VCIError("10030 , "");
|
// }
|
// return id;
|
// }
|
|
// /***
|
// * 更新流水算法
|
// */
|
// public boolean updateFlowAlg(FlowAlgInfo flowAlgInfo, UserEntityInfo userEntityInfo) throws VCIError {
|
// FlowAlgService flowAlgService = new FlowAlgService();
|
// FlowAlg checkFlowAlgName = flowAlgService.getFlowAlgByName(flowAlgInfo.name);
|
// if (checkFlowAlgName != null && !checkFlowAlgName.getId().equals(flowAlgInfo.id)) {
|
// throw new VCIError("10065 , "");
|
// }
|
// FlowAlg flowAlg = changeFlowAlgInfoToFlowAlg(flowAlgInfo);
|
// try {
|
// UserEntityDelegate.setUserEntityToService(flowAlgService, userEntityInfo);
|
// flowAlgService.updateFlowAlg(flowAlg);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// throw new VCIError("10031 , "");
|
// }
|
// return true;
|
// }
|
|
// /****
|
// * 通过流水算法名称看是否存在
|
// * @param flowAlgInfo
|
// * @return
|
// * @throws VCIError
|
// */
|
// public FlowAlg flowAlgInfoIsExist(String name) throws VCIError {
|
// FlowAlgService flowAlgService = new FlowAlgService();
|
// FlowAlg checkFlowAlgName = null;
|
// try {
|
// checkFlowAlgName = flowAlgService
|
// .getFlowAlgByName(name);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// throw new VCIError("10027 , "");
|
// }
|
// return checkFlowAlgName;
|
// }
|
|
// /***
|
// * 可变码段取值范围通过名称是否存在
|
// * @param varRangeInfo
|
// * @return
|
// * @throws VCIError
|
// */
|
// public VarRange varRangeInfoIsExist(String name) throws VCIError {
|
// VarRangeService varRangeService = new VarRangeService();
|
// VarRangeInfo[] varRangeInfos = null;
|
// VarRange checkVarRange = null;
|
// try {
|
// checkVarRange = varRangeService
|
// .getVarRangeByName(name);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// throw new VCIError("10028 , "");
|
// }
|
//
|
// return checkVarRange;
|
// }
|
|
// /***
|
// * 更新可变码段取值范围
|
// */
|
// public boolean updateVarRange(VarRangeInfo varRangeInfo, UserEntityInfo userEntityInfo) throws VCIError {
|
// VarRangeService varRangeService = new VarRangeService();
|
// UserEntityDelegate.setUserEntityToService(varRangeService, userEntityInfo);
|
// VarRange checkVarRange = varRangeService.getVarRangeByName(varRangeInfo.name);
|
// if (checkVarRange != null && !checkVarRange.getId().equals(varRangeInfo.id)) {
|
// throw new VCIError("10065 , "");
|
// }
|
// VarRange varRange = changeVarRangeInfoToVarRange(varRangeInfo);
|
// try {
|
// varRangeService.updateVarRange(varRange);
|
// } catch (Exception e) {
|
// e.printStackTrace();
|
// throw new VCIError("10032 , "");
|
// }
|
// return true;
|
// }
|
|
// /***可变码段取值范围
|
// * 从业务对象对象到corba
|
// * @param varRange
|
// * @return
|
// */
|
// public VarRangeInfo changeVarRangeToVarRangeInfo(VarRange varRange) {
|
// VarRangeInfo varRangeInfo = new VarRangeInfo();
|
// varRangeInfo.id = varRange.getId();
|
// varRangeInfo.desc = varRange.getDesc() == null ? "" : varRange.getDesc();
|
// varRangeInfo.name = varRange.getName() == null ? "" : varRange.getName();
|
// varRangeInfo.range = varRange.getRange() == null ? "" : varRange.getRange();
|
// return varRangeInfo;
|
// }
|
|
// /***流水算法
|
// * 从corba对象到业务对象
|
// * @param flowAlg
|
// * @return
|
// */
|
// public FlowAlg changeFlowAlgInfoToFlowAlg(FlowAlgInfo flowAlgInfo) {
|
// FlowAlg flowAlg = new FlowAlg();
|
// flowAlg.setId(flowAlgInfo.id == "" ? null : flowAlgInfo.id);
|
// flowAlg.setName(flowAlgInfo.name == "" ? null : flowAlgInfo.name);
|
// flowAlg.setDesc(flowAlgInfo.desc == "" ? null : flowAlgInfo.desc);
|
// flowAlg.setAlg(flowAlgInfo.alg == "" ? null : flowAlgInfo.alg);
|
// return flowAlg;
|
// }
|
|
// /***可变码段取值范围
|
// * 从corba对象到业务对象
|
// * @param varRangeInfo
|
// * @return
|
// */
|
// public VarRange changeVarRangeInfoToVarRange(VarRangeInfo varRangeInfo) {
|
// VarRange varRange = new VarRange();
|
// varRange.setId(varRangeInfo.id == "" ? null : varRangeInfo.id);
|
// varRange.setName(varRangeInfo.name == "" ? null : varRangeInfo.name);
|
// varRange.setDesc(varRangeInfo.desc == "" ? null : varRangeInfo.desc);
|
// varRange.setRange(varRangeInfo.range == "" ? null : varRangeInfo.range);
|
// return varRange;
|
// }
|
|
// /***流水算法
|
// * 从业务对象对象到corba
|
// * @param varRange
|
// * @return
|
// */
|
// public FlowAlgInfo changeFlowAlgToFlowAlgInfo(FlowAlg flowAlg) {
|
// FlowAlgInfo flowAlgInfo = new FlowAlgInfo();
|
// flowAlgInfo.id = flowAlg.getId();
|
// flowAlgInfo.name = flowAlg.getName() == null ? "" : flowAlg.getName();
|
// flowAlgInfo.desc = flowAlg.getDesc() == null ? "" : flowAlg.getDesc();
|
// flowAlgInfo.alg = flowAlg.getAlg() == null ? "" : flowAlg.getAlg();
|
// return flowAlgInfo;
|
// }
|
|
|
/***
|
* 特殊字符分类,从业务对象到corba对象
|
* @param specialCharClsf
|
* @return
|
*/
|
private SpecialCharClsfInfo changeSpecialCharClsfToSpecialCharClsfInfo(SpecialCharClsf specialCharClsf){
|
SpecialCharClsfInfo specialCharClsfInfo = new SpecialCharClsfInfo();
|
specialCharClsfInfo.id = specialCharClsf.getId();
|
specialCharClsfInfo.name = specialCharClsf.getName() == null ? "" : specialCharClsf.getName();
|
specialCharClsfInfo.desc = specialCharClsf.getDesc() == null ? "" : specialCharClsf.getDesc();
|
return specialCharClsfInfo;
|
}
|
|
/***
|
* 特殊字符分类,从corba对象到业务对象
|
* @param specialCharClsfInfo
|
* @return
|
*/
|
private SpecialCharClsf changeSpecialCharClsfInfoToSpecialCharClsf(SpecialCharClsfInfo specialCharClsfInfo) {
|
SpecialCharClsf specialCharClsf = new SpecialCharClsf();
|
specialCharClsf.setId(specialCharClsfInfo.id == "" ? null : specialCharClsfInfo.id);
|
specialCharClsf.setDesc(specialCharClsfInfo.desc == "" ? null : specialCharClsfInfo.desc);
|
specialCharClsf.setName(specialCharClsfInfo.name == "" ? null : specialCharClsfInfo.name);
|
return specialCharClsf;
|
}
|
|
/***
|
* 特殊字符,从corba对象到业务对象
|
* @param specialCharInfo
|
* @return
|
*/
|
private SpecialChar changeSpecialCharInfoToSpecialChar(SpecialCharInfo specialCharInfo) {
|
SpecialChar specialChar = new SpecialChar();
|
specialChar.setId(specialCharInfo.id == "" ? null : specialCharInfo.id);
|
specialChar.setValue(specialCharInfo.value == "" ? null : specialCharInfo.value);
|
specialChar.setParentId(specialCharInfo.parentId == "" ? null : specialCharInfo.parentId);
|
return specialChar;
|
}
|
|
/***
|
* 特殊字符,从业务对象到corba对象
|
* @param specialChar
|
* @return
|
*/
|
private SpecialCharInfo changeSpecialCharToSpecialCharInfo(SpecialChar specialChar) {
|
SpecialCharInfo specialCharInfo = new SpecialCharInfo();
|
specialCharInfo.id = specialChar.getId();
|
specialCharInfo.value = specialChar.getValue() == null ? "" : specialChar.getValue();
|
specialCharInfo.parentId = specialChar.getParentId();
|
return specialCharInfo;
|
}
|
|
/***
|
* 系统配置对象从corba对象到业务对象
|
* @param systemCfgInfo
|
* @return
|
*/
|
public SystemCfg changeSystemCfgInfoToSystemCfg(SystemCfgInfo systemCfgInfo) {
|
SystemCfg systemCfg = new SystemCfg();
|
systemCfg.setId(systemCfgInfo.id == "" ? null : systemCfgInfo.id);
|
systemCfg.setName(systemCfgInfo.name == "" ? null : systemCfgInfo.name);
|
systemCfg.setValue(systemCfgInfo.value == "" ? null : systemCfgInfo.value);
|
return systemCfg;
|
}
|
|
/***
|
* 系统配置对象从业务对象到corba对象
|
* @param systemCfg
|
* @return
|
*/
|
public SystemCfgInfo changeSystemCfgToSystemCfgInfo(SystemCfg systemCfg) {
|
SystemCfgInfo systemCfgInfo = new SystemCfgInfo();
|
systemCfgInfo.id = systemCfg.getId();
|
systemCfgInfo.name = systemCfg.getName();
|
systemCfgInfo.value = systemCfg.getValue();
|
return systemCfgInfo;
|
}
|
|
public UserEntity changeUserEntityInfoToUserEntity(UserEntityInfo info){
|
UserEntity entity = new UserEntity();
|
entity.setModule(info.modules);
|
entity.setIp(info.ip);
|
entity.setUserName(info.userName);
|
return entity;
|
}
|
|
/**
|
* 获取数据库信息
|
* @return
|
*/
|
public DataSourceInfo getDataSourceInfo() {
|
DataSourceInfo info = new DataSourceInfo();
|
SystemCfgService systemCfgService = new SystemCfgService();
|
systemCfgService.getDataSourceInfo(info);
|
systemCfgService.getLogSize(info);
|
return info;
|
}
|
|
}
|