?? custpublicinfo.java
字號:
package com.saas.biz.custPublicMgr;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.StringTokenizer;
import net.sf.json.JSONArray;
import com.saas.biz.JavaScriptObject.TreeNode;
import com.saas.biz.JavaScriptObject.TreeObject;
import com.saas.biz.commen.commMethodMgr;
import com.saas.biz.dao.custPublicDAO.CustPublicDAO;
import com.saas.biz.dao.custPublicDAO.CustPublicExt;
import com.saas.biz.dao.relationccDAO.RelationCcExt;
import com.saas.sys.buffer.Buffers;
import com.saas.sys.dbm.Dbtable;
import com.saas.sys.exp.SaasApplicationException;
import com.saas.sys.log.Logger;
public class CustPublicInfo {
Logger log;
Buffers inBuffer;
Buffers outBuffer;
Dbtable tradeQuery;
commMethodMgr commen;
ArrayList queryResult = new ArrayList();
public CustPublicInfo() {
log = new Logger(this);
tradeQuery = new Dbtable();
commen = new commMethodMgr();
}
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 addCustPublicInfo(Buffers inbuffer) {
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
log.LOG_INFO("進入addCustPublicInfo方法...");
int iResult = -1;
String cust_id=inbuffer.getString("SESSION_CUST_ID");
String obj_cust_id=inbuffer.getString("OBJ_CUST_ID");
String param_id=inbuffer.getString("PARAM_ID");
String param_name=inbuffer.getString("PARAM_NAME");
String param_value=inbuffer.getString("PARAM_VALUE");
String oper_user_id=inbuffer.getString("SESSION_USER_ID");
String in_date=inbuffer.getString("IN_DATE");
String remark=inbuffer.getString("REMARK");
log.LOG_INFO("============="+param_id+"^^^^^^^^^"+param_name+"************"+param_value+"########");
String delims = "";
String dd[] = param_name.split(delims);
if(dd[1].equals("|")){
iResult = 0;
}else{
String param_no="";
StringTokenizer param_id1 = new StringTokenizer(param_id,"|");
int j = getMaxParamNo(cust_id,obj_cust_id);
while (param_id1.hasMoreTokens()) {
param_id1.nextToken();
param_no +=String.valueOf(j)+"|";
j++;
}
int i = 0;
StringTokenizer param_id6 = new StringTokenizer(param_id,"|");
StringTokenizer param_name6 = new StringTokenizer(param_name,"|");
StringTokenizer param_value6 = new StringTokenizer(param_value,"|");
StringTokenizer param_no6 = new StringTokenizer(param_no,"|");
String param_id7 = "",param_name7 = "",param_value7 = "",param_no7 = "";
while (param_id6.hasMoreTokens()){
param_id7 = param_id6.nextToken();
param_name7 = param_name6.nextToken();
param_value7 = param_value6.nextToken();
param_no7 = param_no6.nextToken();
i = checkCustPublic(cust_id,obj_cust_id,param_id7);
try {
if(i==0){
iResult = addCustPublicInfo(cust_id,obj_cust_id,param_id7,param_no7,param_name7,param_value7,
oper_user_id,in_date,remark);
}else{
iResult = updateCustPublicInfo(cust_id,obj_cust_id,param_id7,param_no7,param_name7,param_value7,
oper_user_id,in_date,remark);
}
}
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("退出addCustPublicInfo方法...");
}
public int addCustPublicInfo(String cust_id,String obj_cust_id,String param_id,String param_no,String param_name,String param_value,String oper_user_id,String in_date,String remark) throws SaasApplicationException {
CustPublicExt custPublicExt = new CustPublicExt();
custPublicExt.setParam(":VCUST_ID",cust_id);
custPublicExt.setParam(":VOBJ_CUST_ID",obj_cust_id);
custPublicExt.setParam(":VPARAM_ID",param_id);
custPublicExt.setParam(":VPARAM_NO",param_no);
custPublicExt.setParam(":VPARAM_NAME",param_name);
custPublicExt.setParam(":VPARAM_VALUE",param_value);
custPublicExt.setParam(":VOPER_USER_ID",oper_user_id);
custPublicExt.setParam(":VIN_DATE",in_date);
custPublicExt.setParam(":VREMARK",remark);
tradeQuery.executeBy(custPublicExt.insBy("INS_ALL_CUSTPUBLIC"));
//log.LOG_INFO("開始執行SQL====================:"+custPublicExt.insBy("INS_ALL_CUSTPUBLIC"));
return 0;
}
public int updateCustPublicInfo(String cust_id,String obj_cust_id,String param_id,String param_no,String param_name,String param_value,
String oper_user_id,String in_date,String remark) throws SaasApplicationException {
CustPublicExt custPublicExt = new CustPublicExt();
custPublicExt.setParam(":VCUST_ID",cust_id);
custPublicExt.setParam(":VOBJ_CUST_ID",obj_cust_id);
custPublicExt.setParam(":VPARAM_ID",param_id);
custPublicExt.setParam(":VPARAM_NO",param_no);
custPublicExt.setParam(":VPARAM_NAME",param_name);
custPublicExt.setParam(":VPARAM_VALUE",param_value);
custPublicExt.setParam(":VOPER_USER_ID",oper_user_id);
custPublicExt.setParam(":VIN_DATE",in_date);
custPublicExt.setParam(":VREMARK",remark);
tradeQuery.executeBy(custPublicExt.insBy("UPDATE_ALL_CUSTPUBLIC"));
return 0;
}
public int checkCustPublic(String cust_id,String obj_cust_id,String param_id){
ArrayList list = new ArrayList();
CustPublicExt custPublicExt = new CustPublicExt();
custPublicExt.setParam(":VCUST_ID", cust_id);
custPublicExt.setParam(":VOBJ_CUST_ID", obj_cust_id);
custPublicExt.setParam(":VPARAM_ID", param_id);
list = custPublicExt.selByList("SEL_ONE_CUSTPUBLIC_CHECK");
if(list!=null&&list.size()>0){
return 1;
}
return 0;
}
public HashMap getOneCustPublic(String cust_id,String obj_cust_id){
ArrayList list = new ArrayList();
CustPublicExt custPublicExt = new CustPublicExt();
HashMap map = new HashMap();
custPublicExt.setParam(":VCUST_ID", cust_id);
custPublicExt.setParam(":VOBJ_CUST_ID", obj_cust_id);
list = custPublicExt.selByList("SEL_ONE_CUSTPUBLIC_CHECK");
if(list!=null&&list.size()>0){
map = (HashMap)list.get(0);
}
return map;
}
public ArrayList getServalCustPublic(String cust_id,String obj_cust_id){
ArrayList list = new ArrayList();
CustPublicExt custPublicExt = new CustPublicExt();
custPublicExt.setParam(":VCUST_ID", cust_id);
custPublicExt.setParam(":VOBJ_CUST_ID", obj_cust_id);
list = custPublicExt.selByList("SEL_SERVAL_CUSTPUBLIC_CHECK");
return list;
}
public void delCustPublicInfo(Buffers inbuffer) {
this.outBuffer = inbuffer;
this.inBuffer = inbuffer;
log.LOG_INFO("進入delCustPublicInfo方法...");
int iResult = -1;
String cust_id=inbuffer.getString("SESSION_CUST_ID");
String param_id=inbuffer.getString("PARAM_ID");
try {
iResult = delCustPublicInfo(cust_id,param_id);
}
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("退出delCustPublicInfo方法...");
}
public int delCustPublicInfo(String cust_id,String param_id) throws SaasApplicationException {
CustPublicExt custPublicExt = new CustPublicExt();
custPublicExt.setParam(":VCUST_ID",cust_id);
custPublicExt.setParam(":VPARAM_ID",param_id);
tradeQuery.executeBy(custPublicExt.insBy("DEL_ONE_CUSTPUBLIC"));
return 0;
}
public int getMaxParamNo(String cust_id,String obj_cust_id){
ArrayList list = new ArrayList();
CustPublicExt custPublicExt = new CustPublicExt();
HashMap map = new HashMap();
int maxCount = 0;
custPublicExt.setParam(":VCUST_ID", cust_id);
custPublicExt.setParam(":VOBJ_CUST_ID", obj_cust_id);
list = custPublicExt.selByList("SEL_MAX_PARAM_NO");
if(list!=null&&list.size()>0){
map = (HashMap)list.get(0);
if(map.get("ct")!=null){
maxCount = Integer.parseInt(map.get("ct").toString());
}
}
return maxCount+1;
}
}
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -