📄 infoclassinfo.java
字号:
package com.saas.biz.infoClassMgr;
import java.util.ArrayList;
import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.infoclassDAO.InfoClassDAO;
import com.saas.biz.dao.infoclassDAO.InfoClassExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
import com.saas.biz.dao.productclassDAO.ProductclassDAO;
import com.saas.biz.dao.productclassDAO.ProductclassExt;
import java.util.*;
public class InfoClassinfo {
Logger log;
Buffers inBuffer;
Buffers outBuffer;
Dbtable tradeQuery;
commMethodMgr commen;
ArrayList queryResult = new ArrayList();
public InfoClassinfo() {
log = new Logger(this);
tradeQuery = new Dbtable();
commen = new commMethodMgr();
outBuffer = new Buffers();
}
public void setOutBuffer(Buffers outBuffer) {
this.outBuffer = outBuffer;
}
public Buffers getOutBuffer() {
return this.outBuffer;
}
public void setTradeQuery(Dbtable tradeQuery) {
this.tradeQuery = tradeQuery;
}
public Dbtable getTradeQuery() {
return this.tradeQuery;
}
public ArrayList getQueryResult() {
return this.queryResult;
}
public void setQueryResult(ArrayList queryResult) {
this.queryResult = queryResult;
}
// 新增分类信息
public void addinfoclass(Buffers inbuffer) {
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
log.LOG_INFO("进入addinfoclass方法...");
int iResult = -1;
try {
InfoClassDAO infoclassdao = new InfoClassDAO();
infoclassdao.setRoot_id(inbuffer.getString("SPEC_ROOT_ID"));
infoclassdao.setClass_id(inbuffer.isFieldExist("SPEC_CLASS_ID") ? inbuffer.getString("SPEC_CLASS_ID") : "");
infoclassdao.setClass_name(inbuffer.isFieldExist("SPEC_CLASS_NAME") ? inbuffer.getString("SPEC_CLASS_NAME") : "");
infoclassdao.setClass_id_grp(inbuffer.isFieldExist("SPEC_CLASS_ID_GRP") ? inbuffer.getString("SPEC_CLASS_ID_GRP") : "");
infoclassdao.setClass_name_grp(inbuffer.isFieldExist("SPEC_CLASS_NAME_GRP") ? inbuffer.getString("SPEC_CLASS_NAME_GRP") : "");
infoclassdao.setWeb_id(inbuffer.isFieldExist("WEB_ID") ? inbuffer.getString("WEB_ID") : "");
iResult = addinfoclass(infoclassdao);
}
catch (SaasApplicationException e) {
log.LOG_INFO(e.getMessage());
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
}
else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
}
log.LOG_INFO("退出addinfoclass方法...");
}
public int addinfoclass(InfoClassDAO infoclassdao) throws SaasApplicationException {
InfoClassExt infoclassExt = new InfoClassExt();
infoclassExt.setParam(":VROOT_ID", infoclassdao.getRoot_id());
infoclassExt.setParam(":VCLASS_ID", infoclassdao.getClass_id());
infoclassExt.setParam(":VCLASS_NAME", infoclassdao.getClass_name());
infoclassExt.setParam(":VCLASS_ID_GRP", infoclassdao.getClass_id_grp());
infoclassExt.setParam(":VCLASS_NAME_GRP", infoclassdao.getClass_name_grp());
infoclassExt.setParam(":VWEB_ID", infoclassdao.getWeb_id());
infoclassExt.setParam(":VINFO_TYPE", "0");
infoclassExt.setParam(":VRSRV_STR1", "");
infoclassExt.setParam(":VRSRV_STR2", "");
infoclassExt.setParam(":VRSRV_STR3", "");
infoclassExt.setParam(":VRSRV_STR4", "");
infoclassExt.setParam(":VRSRV_STR5", "");
infoclassExt.setParam(":VRSRV_STR6", "");
infoclassExt.setParam(":VREMARK", "");
log.LOG_INFO("info数据初始化赋值完成..........");
tradeQuery.executeBy(infoclassExt.insBy("INS_BY_ALL"));
return 0;
}
/**
* 发布信息时加入分类
*
* @param inbuffer
*/
public void addinfoclassByType(Buffers inbuffer) {
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
log.LOG_INFO("进入addinfoclassByType方法...");
int iResult = -1;
String root_id = inbuffer.getString("ROOT_ID");
String class_id = inbuffer.getString("CLASS_ID");
try {
ArrayList list = getClassInfoListById(class_id);
String name = "", id = "", up_id = "", grp_id = "000000000000000", grp_name = "000000000000000";
if (list != null && list.size() > 0) {
HashMap map = (HashMap) list.get(0);
if (map.get("class_id") != null) {
id = map.get("class_id").toString();
}
if (map.get("class_name") != null) {
name = map.get("class_name").toString();
}
if (map.get("up_class_id") != null) {
up_id = map.get("up_class_id").toString();
}
}
HashMap upClassMap = getClassIdAndName(up_id, id, name);
if (upClassMap != null && upClassMap.size() > 0) {
if (upClassMap.get("id") != null) {
grp_id = upClassMap.get("id").toString();
}
if (upClassMap.get("name") != null) {
grp_name = upClassMap.get("name").toString();
}
}
InfoClassDAO info = new InfoClassDAO();
info.setRoot_id(root_id);
info.setClass_id(class_id);
info.setClass_name(name);
info.setClass_id_grp(grp_id);
info.setClass_name_grp(grp_name);
iResult = addinfoclassByType(info);
}
catch (Exception e) {
log.LOG_INFO(e.getMessage());
}
if (iResult != 0) {
this.outBuffer.setInt("RESULT_CODE", -1);
this.outBuffer.setString("RESULT_INFO", "业务处理失败!");
}
else {
this.outBuffer.setInt("RESULT_CODE", 0);
this.outBuffer.setString("RESULT_INFO", "业务处理成功!");
}
log.LOG_INFO("退出addinfoclassByType方法...");
}
public int addinfoclassByType(InfoClassDAO infoclassdao) throws SaasApplicationException {
InfoClassExt infoclassExt = new InfoClassExt();
infoclassExt.setParam(":VROOT_ID", infoclassdao.getRoot_id());
infoclassExt.setParam(":VCLASS_ID", infoclassdao.getClass_id());
infoclassExt.setParam(":VCLASS_NAME", infoclassdao.getClass_name());
infoclassExt.setParam(":VCLASS_ID_GRP", infoclassdao.getClass_id_grp());
infoclassExt.setParam(":VCLASS_NAME_GRP", infoclassdao.getClass_name_grp());
infoclassExt.setParam(":VWEB_ID", "00000000000000");
infoclassExt.setParam(":VINFO_TYPE", "0");
infoclassExt.setParam(":VRSRV_STR1", "");
infoclassExt.setParam(":VRSRV_STR2", "");
infoclassExt.setParam(":VRSRV_STR3", "");
infoclassExt.setParam(":VRSRV_STR4", "");
infoclassExt.setParam(":VRSRV_STR5", "");
infoclassExt.setParam(":VRSRV_STR6", "");
infoclassExt.setParam(":VREMARK", "");
tradeQuery.executeBy(infoclassExt.insBy("INS_BY_ALL"));
return 0;
}
// 从产品分类中获取分类名字
public String getProductNameByIdx(String class_id) throws SaasApplicationException {
String class_name = "";
ProductclassExt prodExt = new ProductclassExt();
ArrayList prodList = new ArrayList();
prodExt.setParam(":VCLASS_ID", class_id);
prodList = prodExt.selByList("SEL_BY_CLASSID");
if (prodList != null && prodList.size() > 0) {
HashMap map = (HashMap) prodList.get(0);
if (map.get("class_name") != null) {
class_name = map.get("class_name").toString();
}
}
return class_name;
}
/**
* @param class_id
* @return 返回分类名和ID
* @throws SaasApplicationException
*/
public HashMap getClassIdAndName(String up_id, String id, String name) throws SaasApplicationException {
HashMap classMap = new HashMap();
String grp_id = "", grp_anem = "";
HashMap upMap = getClassInfoById(up_id);
String up_class_id = "", up_class_name = "";
if (upMap != null && upMap.size() > 0) {
if (upMap.get("id") != null) {
up_class_id = upMap.get("id").toString();
}
if (upMap.get("name") != null) {
up_class_name = upMap.get("name").toString();
}
}
grp_id = "000000000000000|" + up_class_id + "|" + id;
grp_anem = "000000000000000|" + up_class_name + "|" + name;
classMap.put("id", grp_id);
classMap.put("name", grp_anem);
return classMap;
}
// 取出分类名称和ID
public HashMap getClassInfoById(String up_class_id) throws SaasApplicationException {
HashMap classMap = new HashMap();
String groupId = "";
String groupName = "";
ArrayList list = getClassInfoListById(up_class_id);
if (list != null && list.size() > 0) {
String class_id = "", class_name = "", up_id = "";
HashMap upMap = (HashMap) list.get(0);
if (upMap.get("class_id") != null) {
class_id = upMap.get("class_id").toString();
}
if (upMap.get("class_name") != null) {
class_name = upMap.get("class_name").toString();
}
if (upMap.get("up_class_id") != null) {
up_id = upMap.get("up_class_id").toString();
}
groupId = class_id + "|" + groupId;
groupName = class_name + "|" + groupName;
HashMap upClassMap = getClassInfoById(up_id);
if (upClassMap != null && upClassMap.size() > 0) {
String u_idx = "", u_namex = "";
if (upClassMap.get("id") != null) {
u_idx = upClassMap.get("id").toString();
}
if (upClassMap.get("name") != null) {
u_namex = upClassMap.get("name").toString();
}
groupId = u_idx + "|" + groupId;
groupName = u_namex + "|" + groupName;
}
}
classMap.put("id", groupId);
classMap.put("name", groupName);
return classMap;
}
// 取出本级分类
public ArrayList getClassInfoListById(String class_id) throws SaasApplicationException {
ArrayList list = new ArrayList();
ProductclassExt classExt = new ProductclassExt();
classExt.setParam(":VCLASS_ID", class_id);
list = classExt.selByList("SEL_CLASSUP_BYDOWN");
return list;
}
// 取出上级分类
public ArrayList getUpClassInfoListById(String class_id) throws SaasApplicationException {
ArrayList list = new ArrayList();
ProductclassExt classExt = new ProductclassExt();
classExt.setParam(":VUP_CLASS_ID", class_id);
list = classExt.selByList("SEL_BY_UP");
return list;
}
//根据product_id取产品类型
public String getProductTypeById(String product_id) throws SaasApplicationException {
String class_name = "";
InfoClassExt prodExt = new InfoClassExt();
ArrayList prodList = new ArrayList();
prodExt.setParam(":VROOT_ID", product_id);
prodList = prodExt.selByList("SEL_BY_PRODUCT_ID");
if (prodList != null && prodList.size() > 0) {
HashMap map = (HashMap) prodList.get(0);
if (map.get("class_name") != null) {
class_name = map.get("class_name").toString();
}
}
return class_name;
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -