📄 consultationmessage.java
字号:
/**
* 咨询留言
*/
package com.NCL;
import java.rmi.RemoteException;
import java.util.*;
import javax.xml.rpc.ServiceException;
import com.NCL.axis.CallCenter.*;
import com.sinosoft.common.*;
public class ConsultationMessage {
protected IndexMap propList;
protected HashSet Property;
private List strList = new ArrayList();
protected String fMakeDate = "";
protected String tMakeDate = "";
protected String fDealDate = "";
protected String tDealDate = "";
protected String fCCAccessDate = "";
protected String tCCAccessDate = "";
private boolean EOF = false;
private int COUNT;
public String CCSID = "";
public String CCSResultCode = "";
public String CCSResultMsg = "";
/**
* 构造函数
*
*/
public ConsultationMessage(){
propList = new IndexMap();
Property = new HashSet();
Property.add("ID"); //自增长ID
Property.add("Name"); //客户姓名
Property.add("Sex"); //性别
Property.add("Province"); //省
Property.add("ProvinceCode"); //省代码
Property.add("Type"); //咨询类型
Property.add("Email"); //电子邮箱
Property.add("Telephone"); //电话
Property.add("Content"); //咨询内容
Property.add("DealFlag"); //处理状态
Property.add("MakeDate"); //咨询时间
Property.add("DealDate"); //处理时间
Property.add("MobilePhone"); //手机
Property.add("DealResult"); //处理结果
Property.add("CustomState"); //客户标志
Property.add("CustomNo"); //客户号
Property.add("City"); //市
Property.add("CityCode"); //市代码
Property.add("Extension"); //分机号
Property.add("IsHaveProduct"); //是否购买公司保险
Property.add("PolicyNo"); //保单号
Property.add("CCServiceID"); //服务单号
Property.add("CCServiceType"); //服务单类型
Property.add("CCAccessDate"); //受理时间
}
/**
* 获取fMakeDate
* @return String
*/
public String getfMakeDate() {
return fMakeDate;
}
/**
* 设置fMakeDate
* @param str 日期
*/
public void setfMakeDate(String str) {
fMakeDate = str;
}
/**
* 获取tMakeDate
* @return String
*/
public String gettMakeDate() {
return tMakeDate;
}
/**
* 设置tMakeDate
* @param str 日期
*/
public void settMakeDate(String str) {
tMakeDate = str;
}
/**
* 获取fDealDate
* @return String
*/
public String getfDealDate() {
return fDealDate;
}
/**
* 设置fDealDate
* @param str 日期
*/
public void setfDealDate(String str) {
fDealDate = str;
}
/**
* 获取tDealDate
* @return String
*/
public String gettDealDate() {
return tDealDate;
}
/**
* 设置tDealDate
* @param str 日期
*/
public void settDealDate(String str) {
tDealDate = str;
}
/**
* 获取fCCAccessDate
* @return String
*/
public String getfCCAccessDate() {
return fCCAccessDate;
}
/**
* 设置fCCAccessDate
* @param str 日期
*/
public void setfCCAccessDate(String str) {
fCCAccessDate = str;
}
/**
* 获取tCCAccessDate
* @return String
*/
public String gettCCAccessDate() {
return tCCAccessDate;
}
/**
* 设置tCCAccessDate
* @param str 日期
*/
public void settCCAccessDate(String str) {
tCCAccessDate = str;
}
/**
* 在此映射中关联指定值与指定键
* @param name 指定键
* @param value 指定值
*/
public void setUpdateValue(String name,Object value){
if(this.set(name,value)){
Object[] uValue = new Object[2];
uValue[0] = name;
uValue[1] = value;
strList.add(uValue);
}
}
/**
* 在此映射中关联指定值与指定键
* @param name 指定键
* @param value 指定值
*/
public boolean set(String name, Object value){
if(Property.contains(name)){
propList.put(name,value);
return true;
}else
return false;
}
/**
* 返回指定键在此映射中所映射的值
* @param name 指定键
* @return
*/
public String get(String name){
if (Property.contains(name)){
String value = (String)propList.get(name);
if(value != null && !value.equals(""))
return value;
else
return "";
}else
return "";
}
/**
* 返回COUNT
* @return int
*/
public int getCOUNT() {
return COUNT;
}
/**
* 设置COUNT
* @param count
*/
public void setCOUNT(int count) {
COUNT = count;
}
/**
* 返回EOF
* @return boolean
*/
public boolean isEOF() {
return EOF;
}
/**
* 设置EOF
* @param eof
*/
public void setEOF(boolean eof) {
EOF = eof;
}
/**
* 清空propList
*
*/
public void clear(){
propList.clear();
}
/**
* 初始化咨询留言
* @param id ID
*/
public void init(String id){
DBAccess d = new DBAccess();
String sql = "SELECT * from ConsultationMessage where id=?";
this.propList = d.init(sql,id,this.Property);
}
/**
* 创建咨询留言
* @return boolean
*/
public boolean create(){
String sql = "INSERT into ConsultationMessage(ID,Name,Sex,Province,ProvinceCode,Type,Email,Telephone,Content,DealFlag,MakeDate,DealDate,MobilePhone,DealResult,CustomState,CustomNo,City,CityCode,Extension,IsHaveProduct,PolicyNo) values(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)";
DBAccess d = new DBAccess();
return d.execute(sql,this.propList);
}
/**
* 更新咨询留言
* @return boolean
*/
public boolean update(){
StringBuffer sql = new StringBuffer("update ConsultationMessage set ");
List l = new ArrayList();
for(int i=0;i<strList.size();i++){
Object[] strArray =(Object[]) strList.get(i);
sql.append(strArray[0]);
sql.append("=?,");
l.add(strArray[1]);
}
sql.deleteCharAt(sql.lastIndexOf(","));
sql.append(" where ID=?");
l.add(this.get("ID"));
strList.clear();
DBAccess q = new DBAccess();
return q.executeUpdate(sql.toString(),l);
}
/**
* 删除咨询留言
* @param agentPhotoID ID
* @return boolean
*/
public boolean delete(String agentPhotoID){
DBAccess DBA= new DBAccess();
String sql = "DELETE from ConsultationMessage WHERE id=?";
return DBA.executeDelete(sql,agentPhotoID);
}
/**
* 根据条件查询
* @param cm 对象
* @param pageSize 分页大小
* @param pageIndex 分页页码
* @return String
*/
public String find(ConsultationMessage cm,int pageSize,int pageIndex){
String ID = cm.get("ID"); //自增长ID
String Name = cm.get("Name"); //客户姓名
String Sex = cm.get("Sex"); //性别
String Province = cm.get("Province"); //省
String ProvinceCode = cm.get("ProvinceCode"); //省代码
String Type = cm.get("Type"); //咨询类型
String Email = cm.get("Email"); //电子邮箱
String Telephone = cm.get("Telephone"); //电话
String Content = cm.get("Content"); //咨询内容
String DealFlag = cm.get("DealFlag"); //处理状态
String MobilePhone = cm.get("MobilePhone"); //手机
String DealResult = cm.get("DealResult"); //处理结果
String CustomState = cm.get("CustomState"); //客户标志
String CustomNo = cm.get("CustomNo"); //客户号
String City = cm.get("City"); //市
String CityCode = cm.get("CityCode"); //市代码
String Extension = cm.get("Extension"); //分机号
String IsHaveProduct = cm.get("IsHaveProduct"); //是否购买公司保险
String PolicyNo = cm.get("PolicyNo"); //保单号
String CCServiceID = cm.get("CCServiceID"); //服务单号
String CCServiceType = cm.get("CCServiceType"); //服务单类型
String fMakeDate = cm.getfMakeDate();
String tMakeDate = cm.gettMakeDate();
String fDealDate = cm.getfDealDate();
String tDealDate = cm.gettDealDate();
String fCCAccessDate = cm.getfCCAccessDate();
String tCCAccessDate = cm.gettCCAccessDate();
if(Data.hasValue(fMakeDate) && fMakeDate.length()!=10)return "";
if(Data.hasValue(tMakeDate) && tMakeDate.length()!=10)return "";
if(Data.hasValue(fDealDate) && fDealDate.length()!=10)return "";
if(Data.hasValue(tDealDate) && tDealDate.length()!=10)return "";
if(Data.hasValue(fCCAccessDate) && fCCAccessDate.length()!=10)return "";
if(Data.hasValue(tCCAccessDate) && tCCAccessDate.length()!=10)return "";
StringBuffer SQL = new StringBuffer("SELECT id from ConsultationMessage where 1=1");
if(Data.hasValue(ID))
SQL.append(" and ID=?");
if(Data.hasValue(Name))
SQL.append(" and Name=?");
if(Data.hasValue(Sex))
SQL.append(" and Sex=?");
if(Data.hasValue(Province))
SQL.append(" and Province=?");
if(Data.hasValue(ProvinceCode))
SQL.append(" and ProvinceCode=?");
if(Data.hasValue(Type))
SQL.append(" and Type=?");
if(Data.hasValue(Email))
SQL.append(" and Email=?");
if(Data.hasValue(Telephone))
SQL.append(" and Telephone=?");
if(Data.hasValue(Content))
SQL.append(" and Content=?");
if(Data.hasValue(DealFlag))
SQL.append(" and DealFlag=?");
if(Data.hasValue(MobilePhone))
SQL.append(" and MobilePhone=?");
if(Data.hasValue(DealResult))
SQL.append(" and DealResult=?");
if(Data.hasValue(CustomState))
SQL.append(" and CustomState=?");
if(Data.hasValue(CustomNo))
SQL.append(" and CustomNo=?");
if(Data.hasValue(City))
SQL.append(" and City=?");
if(Data.hasValue(CityCode))
SQL.append(" and CityCode=?");
if(Data.hasValue(Extension))
SQL.append(" and Extension=?");
if(Data.hasValue(IsHaveProduct))
SQL.append(" and IsHaveProduct=?");
if(Data.hasValue(PolicyNo))
SQL.append(" and PolicyNo=?");
if(Data.hasValue(CCServiceID))
SQL.append(" and CCServiceID=?");
if(Data.hasValue(CCServiceType))
SQL.append(" and CCServiceType=?");
if(Data.hasValue(fMakeDate))
SQL.append(" and MakeDate>=to_date('" + fMakeDate + "','yyyy-MM-dd')");
if(Data.hasValue(tMakeDate))
SQL.append(" and MakeDate<=to_date('" + tMakeDate + " 23:59:59','yyyy-MM-dd hh24:mi:ss')");
if(Data.hasValue(fDealDate))
SQL.append(" and DealDate>=to_date('" + fDealDate + "','yyyy-MM-dd')");
if(Data.hasValue(tDealDate))
SQL.append(" and DealDate<=to_date('" + tDealDate + " 23:59:59','yyyy-MM-dd hh24:mi:ss')");
if(Data.hasValue(fCCAccessDate))
SQL.append(" and CCAccessDate>=to_date('" + fCCAccessDate + "','yyyy-MM-dd')");
if(Data.hasValue(tCCAccessDate))
SQL.append(" and CCAccessDate<=to_date('" + tCCAccessDate + " 23:59:59','yyyy-MM-dd hh24:mi:ss')");
SQL.append(" order by MakeDate desc");
String result = "";
DBAccess d = new DBAccess();
result = d.executeQuery(SQL.toString(),cm.propList,pageSize,pageIndex);
setCOUNT(d.COUNT);
setEOF(d.EOF);
return result;
}
/**
* 咨询留言接口
* @param wc 对象
* @return boolean
*/
public boolean sendToCCS(WebConsult wc){
CallCenterServiceLocator cl= new CallCenterServiceLocator();
try {
CallCenter_PortType pt = cl.getCallCenter();
WebConsultResult wcr = pt.submitToCallcenter(wc);
CCSID = wcr.getID();
CCSResultCode = wcr.getResultCode();
CCSResultMsg = wcr.getResultMsg();
} catch (ServiceException e) {
e.printStackTrace();
return false;
} catch (RemoteException e) {
e.printStackTrace();
return false;
}
return true;
}
public static void main(String []ages){
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -