📄 paramethodmgr.java
字号:
package com.saas.biz.commen;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import com.saas.biz.dao.commenDAO.CommparaDAO;
import com.saas.biz.dao.commenDAO.CommparaExt;
import com.saas.biz.dao.commenDAO.ParainfoExt;
import com.saas.biz.dao.serverDAO.ServerExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
/**
* 系统参数信息
*
* @详细信息文档《系统数据参数说明.txt》
* @author Administrator
*/
public class ParamethodMgr {
Dbtable tradeQuery;
Logger log;
Buffers inBuffer;
Buffers outBuffer;
ArrayList queryResult = new ArrayList();
commMethodMgr comm;
public ParamethodMgr() {
log = new Logger(this);
tradeQuery = new Dbtable();
comm = new commMethodMgr();
}
public void setTradeQuery(Dbtable tradeQuery) {
this.tradeQuery = tradeQuery;
}
public Dbtable getTradeQuery() {
return this.tradeQuery;
}
public void setOutBuffer(Buffers outBuffer) {
this.outBuffer = outBuffer;
}
public Buffers getOutBuffer() {
return this.outBuffer;
}
public ArrayList getQueryResult() {
return this.queryResult;
}
public void setQueryResult(ArrayList queryResult) {
this.queryResult = queryResult;
}
public void paraInfoList(Buffers inbuffer) {
log.LOG_INFO("进入paraInfoList方法...");
String cust_type = inbuffer.getString("CUST_TYPE");
try {
this.queryResult = paraInfoList(cust_type);
}
catch (SaasApplicationException e) {
log.LOG_INFO(e.getMessage());
}
log.LOG_INFO("退出paraInfoList方法...");
}
/**
* 获取产品列表
*
* @param inbuffer
*/
public ArrayList paraInfoList(String cust_type) throws SaasApplicationException {
ArrayList paraList = new ArrayList();
ArrayList paraInfoList = new ArrayList();
ParainfoExt parainfoExt = new ParainfoExt();
parainfoExt.setParam(":VCUST_TYPE", cust_type);
paraInfoList = parainfoExt.selByList("SEL_BY_CUST_ID");
for (Iterator it = paraInfoList.iterator(); it.hasNext();) {
HashMap paraInfo = (HashMap) it.next();
String custName = "";
String custId = "";
HashMap paraListMap = new HashMap();
if (paraInfo.get("cust_name") != null)
custName = paraInfo.get("cust_name").toString();
try {
custName = new String(custName.getBytes("ISO8859_1"), "GB2312");
}
catch (Exception e) {
throw new RuntimeException(e);
}
if (paraInfo.get("cust_id") != null)
custId = paraInfo.get("cust_id").toString();
log.LOG_INFO("cust_id>>>>>" + custId);
log.LOG_INFO("cust_name>>>>>" + custName);
paraListMap.put("cust_name", custName);
paraListMap.put("cust_id", custId);
paraList.add(paraListMap);
}
return paraList;
}
/**
* 获取参数信息
*/
// 公用获取参数信息方法
public ArrayList getCompareInfo(String sysCode, String paraCode) throws SaasApplicationException {
ArrayList list = new ArrayList();
CommparaExt comExt = new CommparaExt();
try {
comExt.setParam(":VSUBSYS_CODE", sysCode);
comExt.setParam(":VPARAM_CODE", paraCode);
list = comExt.selByList("SEL_BY_CODE");
}
catch (Exception e) {
log.LOG_INFO("获取参数信息出错!.............");
return null;
}
return list;
}
public ArrayList getCompareInfoByCode1(String sysCode, String paramCode, String paraCode1) throws SaasApplicationException {
ArrayList list = new ArrayList();
CommparaExt comExt = new CommparaExt();
try {
comExt.setParam(":VSUBSYS_CODE", sysCode);
comExt.setParam(":VPARAM_CODE", paramCode);
comExt.setParam(":VPARA_CODE1", paraCode1);
list = comExt.selByList("SEL_BY_CODE1");
}
catch (Exception e) {
log.LOG_INFO("获取参数信息出错!.............");
return null;
}
return list;
}
public ArrayList getCompareInfoByAttr(String attr) throws SaasApplicationException {
ArrayList list = new ArrayList();
CommparaExt comExt = new CommparaExt();
try {
comExt.setParam(":VPARAM_ATTR", attr);
list = comExt.selByList("SEL_BY_ATTR");
}
catch (Exception e) {
log.LOG_INFO("获取参数信息出错!.............");
return null;
}
return list;
}
public String getParaCode2ByParaCode1(String param_attr, String para_code1) throws SaasApplicationException {
ArrayList list = new ArrayList();
CommparaExt comExt = new CommparaExt();
try {
comExt.setParam(":VPARA_CODE1", para_code1);
comExt.setParam(":VPARAM_ATTR", param_attr);
list = comExt.selByList("SEL_PARA_CODE2");
}
catch (Exception e) {
log.LOG_INFO("获取参数信息出错!.............");
return null;
}
HashMap map = (HashMap) list.get(0);
String para_code2 = "";
if (map.get("para_code2") != null) {
para_code2 = map.get("para_code2").toString();
}
return para_code2;
}
public String getParaCode3ByParaCode1(String param_attr, String para_code1) throws SaasApplicationException {
ArrayList list = new ArrayList();
CommparaExt comExt = new CommparaExt();
try {
comExt.setParam(":VPARA_CODE1", para_code1);
comExt.setParam(":VPARAM_ATTR", param_attr);
list = comExt.selByList("SEL_PARA_CODE2");
}
catch (Exception e) {
log.LOG_INFO("获取参数信息出错!.............");
return null;
}
HashMap map = (HashMap) list.get(0);
String para_code3 = "";
if (map.get("para_code3") != null) {
para_code3 = map.get("para_code3").toString();
}
return para_code3;
}
public String getJspBySubCode(String param_attr, String para_code1) throws SaasApplicationException {
ArrayList list = new ArrayList();
CommparaExt comExt = new CommparaExt();
try {
comExt.setParam(":VPARA_CODE1", para_code1);
comExt.setParam(":VPARAM_ATTR", param_attr);
list = comExt.selByList("SEL_PARA_CODE2");
}
catch (Exception e) {
log.LOG_INFO("获取参数信息出错!.............");
return null;
}
HashMap map = (HashMap) list.get(0);
String para_code7 = "";
if (map.get("para_code7") != null) {
para_code7 = map.get("para_code7").toString();
}
return para_code7;
}
// 公用方法
public String getSelectItems(String attr) throws SaasApplicationException {
String selectItems = "";
ArrayList list = getCompareInfoByAttr(attr);
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
HashMap objMap = (HashMap) list.get(i);
String sKey = "";
String sValue = "";
if (objMap.get("para_code1") != null) {
sKey = objMap.get("para_code1").toString();
}
if (objMap.get("para_code2") != null) {
sValue = objMap.get("para_code2").toString();
}
selectItems = selectItems + "<option value=" + sKey + ">" + sValue + "</option>";
}
}
return selectItems;
}
// 选中所给定的值
public String getItemsBySelected(String attr, String index) throws SaasApplicationException {
String selectItems = "", selected = "";
ArrayList list = getCompareInfoByAttr(attr);
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
HashMap objMap = (HashMap) list.get(i);
String sKey = "";
String sValue = "";
if (objMap.get("para_code1") != null) {
sKey = objMap.get("para_code1").toString();
if (sKey.equals(index) || sKey == index) {
selected = "selected";
}
else {
selected = "";
}
}
if (objMap.get("para_code2") != null) {
sValue = objMap.get("para_code2").toString();
}
selectItems = selectItems + "<option value=" + sKey + " " + selected + ">" + sValue + "</option>";
}
}
return selectItems;
}
// 返回名字
public String getParamNameByValue(String attr, String value) throws SaasApplicationException {
String name = "";
ArrayList list = getCompareInfoByAttr(attr);
if (list != null && list.size() > 0) {
for (int i = 0; i < list.size(); i++) {
HashMap objMap = (HashMap) list.get(i);
if (objMap.get("para_code1") != null) {
if (objMap.get("para_code1").equals(value)) {
return name = objMap.get("para_code2").toString();
}
}
}
}
return name;
}
// 公用获取参数的方法
public HashMap getCompareInfoByCode(String sysCode, String paraCode) throws SaasApplicationException {
HashMap map = new HashMap();
ArrayList list = getCompareInfo(sysCode, paraCode);
if (list != null && list.size() > 0) {
for (Iterator it = list.iterator(); it.hasNext();) {
HashMap objMap = (HashMap) it.next();
String sKey = "";
String sValue = "";
if (objMap.get("para_code1") != null) {
sKey = objMap.get("para_code1").toString();
}
if (objMap.get("para_code2") != null) {
sValue = objMap.get("para_code2").toString();
}
map.put(sKey, sValue);
}
}
return map;
}
/**
* 取得param_attr
*/
public String getParam_attrMax(String subsys_code) throws SaasApplicationException {
String param_attr = "0";
CommparaExt compExt = new CommparaExt();
compExt.setParam(":VSUBSYS_CODE", subsys_code);
ArrayList list = compExt.selByList("SEL_BY_SYS_MAX");
if (list != null && list.size() > 0) {
HashMap map = (HashMap) list.get(0);
if (map.get("mx") != null) {
int max = Integer.parseInt(map.get("mx").toString()) + 1;
param_attr = String.valueOf(max);
}
}
return param_attr;
}
/**
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -