📄 cardactive.java
字号:
/**
* 卡单激活
*/
package com.NCL.axis;
import java.util.HashMap;
import java.util.HashSet;
import org.dom4j.Element;
import com.sinosoft.common.*;
public class CardActive{
public static int number;
public static String dates = "";
protected HashMap propList;
protected HashSet Property;
/**
* 构造函数
*
*/
public CardActive(){
propList=new HashMap();
Property=new HashSet();
Property.add("DealType"); //卡类型码,必输
Property.add("CardType"); //卡类型码,必输
Property.add("ContPlanCode"); //产品代码
Property.add("CardNo"); //卡号,流水号,必输
Property.add("PassWord"); //申请人
Property.add("CavliDate"); //生效日期
Property.add("ActType"); //操作渠道,必输,默认为1代表callcenter
Property.add("MasterName"); //主被保人姓名
Property.add("MasterBirsday"); //主被保人出生日期
Property.add("MasterSex"); //主被保人性别
Property.add("MasterIDType"); //主被保人证件类型
Property.add("MasterIDNo"); //主被保人证件号
Property.add("MasterOccupationType"); //主被保人职业类别
Property.add("MasterOccupationCode"); //主被保人职业代码
Property.add("MasterPhone"); //主被保人联系电话
Property.add("MasterAddress"); //主被保人联系地址
Property.add("RelatedName1"); //连带被保人姓名1
Property.add("RelatedType1"); //连带被保人与主被保险人关系1
Property.add("RelatedBirsday1"); //连带被保人出生日期1
Property.add("RelatedSex1"); //连带被保人性别1
Property.add("RelatedIDType1"); //连带被保人证件类型1
Property.add("RelatedIDNo1"); //连带被保人证件号1
Property.add("RelatedOccupationType1"); //连带被保人职业类别1
Property.add("RelatedOccupationCode1"); //连带被保人职业代码1
Property.add("RelatedPhone1"); //连带被保人联系电话1
Property.add("RelatedAddress1"); //连带被保人联系地址1
Property.add("RelatedName2"); //连带被保人姓名2
Property.add("RelatedType2"); //连带被保人与主被保险人关系2
Property.add("RelatedBirsday2"); //连带被保人出生日期2
Property.add("RelatedSex2"); //连带被保人性别2
Property.add("RelatedIDType2"); //连带被保人证件类型2
Property.add("RelatedIDNo2"); //连带被保人证件号2
Property.add("RelatedOccupationType2"); //连带被保人职业类别2
Property.add("RelatedOccupationCode2"); //连带被保人职业代码2
Property.add("RelatedPhone2"); //连带被保人联系电话2
Property.add("RelatedAddress2"); //连带被保人联系地址2
Property.add("RelatedName3"); //连带被保人姓名3
Property.add("RelatedType3"); //连带被保人与主被保险人关系3
Property.add("RelatedBirsday3"); //连带被保人出生日期3
Property.add("RelatedSex3"); //连带被保人性别3
Property.add("RelatedIDType3"); //连带被保人证件类型3
Property.add("RelatedIDNo3"); //连带被保人证件号3
Property.add("RelatedOccupationType3"); //连带被保人职业类别3
Property.add("RelatedOccupationCode3"); //连带被保人职业代码3
Property.add("RelatedPhone3"); //连带被保人联系电话3
Property.add("RelatedAddress3"); //连带被保人联系地址3
Property.add("RelatedName4"); //连带被保人姓名4
Property.add("RelatedType4"); //连带被保人与主被保险人关系4
Property.add("RelatedBirsday4"); //连带被保人出生日期4
Property.add("RelatedSex4"); //连带被保人性别4
Property.add("RelatedIDType4"); //连带被保人证件类型4
Property.add("RelatedIDNo4"); //连带被保人证件号4
Property.add("RelatedOccupationType4"); //连带被保人职业类别4
Property.add("RelatedOccupationCode4"); //连带被保人职业代码4
Property.add("RelatedPhone4"); //连带被保人联系电话4
Property.add("RelatedAddress4"); //连带被保人联系地址4
Property.add("RelatedName5"); //连带被保人姓名5
Property.add("RelatedType5"); //连带被保人与主被保险人关系5
Property.add("RelatedBirsday5"); //连带被保人出生日期5
Property.add("RelatedSex5"); //连带被保人性别5
Property.add("RelatedIDType5"); //连带被保人证件类型5
Property.add("RelatedIDNo5"); //连带被保人证件号5
Property.add("RelatedOccupationType5"); //连带被保人职业类别5
Property.add("RelatedOccupationCode5"); //连带被保人职业代码5
Property.add("RelatedPhone5"); //连带被保人联系电话5
Property.add("RelatedAddress5"); //连带被保人联系地址5
Property.add("EndDate"); //截止日期
Property.add("ActiveDate"); //激活日期
}
/**
* 赋值
* @param name
* @param value
* @return
*/
public boolean set(String name, String value){
if(Property.contains(name)){
propList.put(name,value);
return true;
}else
return false;
}
/**
* 获取与name对应的值
* @param name
* @return
*/
public String get(String name){
String value = "";
if (Property.contains(name)){
value = (String)propList.get(name);
if(value == null){
value = "";
}
}
return value;
}
/**
* 清空propList
*/
public void clear(){
propList.clear();
}
/**
* 00012012团卡在线激活.xls
*
* **/
public Element CardActive(){
Element outCustom = null;
axisType custom = new axisType("00012021_CActive");
String date = Data.getCurrentDate();
String time = Data.getCurrentTime();
String numbers = "00012012" + date.replaceAll("-", "");
if(date.equals(dates)&&Integer.toString(number).length()<=5){
number++;
}else{
number = 1;
dates = date;
}
numbers += getStochastic(""+number);
custom.setBaseElementIn("TransDate", date);
custom.setBaseElementIn("TransTime", time);
custom.setBaseElementIn("TransSeq", numbers);
set("DealType","2");
set("ActType","2");
setInputElement(custom,"DealType");
setInputElement(custom,"CardType");
setInputElement(custom,"CardNo");
setInputElement(custom,"PassWord");
setInputElement(custom,"ContPlanCode");
setInputElement(custom,"CavliDate");
setInputElement(custom,"ActType");
setInputElement(custom,"MasterName");
setInputElement(custom,"MasterBirsday");
setInputElement(custom,"MasterSex");
setInputElement(custom,"MasterIDType");
setInputElement(custom,"MasterIDNo");
setInputElement(custom,"MasterOccupationType");
setInputElement(custom,"MasterOccupationCode");
setInputElement(custom,"MasterPhone");
setInputElement(custom,"MasterAddress");
setInputElement(custom,"RelatedName1");
setInputElement(custom,"RelatedType1");
setInputElement(custom,"RelatedBirsday1");
setInputElement(custom,"RelatedSex1");
setInputElement(custom,"RelatedIDType1");
setInputElement(custom,"RelatedIDNo1");
setInputElement(custom,"RelatedOccupationType1");
setInputElement(custom,"RelatedOccupationCode1");
setInputElement(custom,"RelatedPhone1");
setInputElement(custom,"RelatedAddress1");
setInputElement(custom,"RelatedName2");
setInputElement(custom,"RelatedType2");
setInputElement(custom,"RelatedBirsday2");
setInputElement(custom,"RelatedSex2");
setInputElement(custom,"RelatedIDType2");
setInputElement(custom,"RelatedIDNo2");
setInputElement(custom,"RelatedOccupationType2");
setInputElement(custom,"RelatedOccupationCode2");
setInputElement(custom,"RelatedPhone2");
setInputElement(custom,"RelatedAddress2");
setInputElement(custom,"RelatedName3");
setInputElement(custom,"RelatedType3");
setInputElement(custom,"RelatedBirsday3");
setInputElement(custom,"RelatedSex3");
setInputElement(custom,"RelatedIDType3");
setInputElement(custom,"RelatedIDNo3");
setInputElement(custom,"RelatedOccupationType3");
setInputElement(custom,"RelatedOccupationCode3");
setInputElement(custom,"RelatedPhone3");
setInputElement(custom,"RelatedAddress3");
setInputElement(custom,"RelatedName4");
setInputElement(custom,"RelatedType4");
setInputElement(custom,"RelatedBirsday4");
setInputElement(custom,"RelatedSex4");
setInputElement(custom,"RelatedIDType4");
setInputElement(custom,"RelatedIDNo4");
setInputElement(custom,"RelatedOccupationType4");
setInputElement(custom,"RelatedOccupationCode4");
setInputElement(custom,"RelatedPhone4");
setInputElement(custom,"RelatedAddress4");
setInputElement(custom,"RelatedName5");
setInputElement(custom,"RelatedType5");
setInputElement(custom,"RelatedBirsday5");
setInputElement(custom,"RelatedSex5");
setInputElement(custom,"RelatedIDType5");
setInputElement(custom,"RelatedIDNo5");
setInputElement(custom,"RelatedOccupationType5");
setInputElement(custom,"RelatedOccupationCode5");
setInputElement(custom,"RelatedPhone5");
setInputElement(custom,"RelatedAddress5");
setInputElement(custom,"EndDate");
setInputElement(custom,"ActiveDate");
Element eles = custom.getOupPutElecment();
if(eles!=null){
if( eles.elementIterator().hasNext())
outCustom = (Element) eles.elementIterator().next();
}
return outCustom;
}
/**
* 根据eleName获取值
* @param ele
* @param eleName
* @return
*/
public String getElementText(Element ele,String eleName){
return ele.element(eleName).getText();
}
/**
* 构造5位序列号,不足5位的在左侧补0
* @param num
* @return String
*/
private String getStochastic(String num){
String tt="";
if(num.length()<5){
for(int count=0;count<5-num.length();count++){
tt+="0";
}
}
return tt+num;
}
/**
* 设置输入xml
* @param ele
* @param eleName
*/
private void setInputElement(axisType ele,String eleName){
if(Data.hasValue(get(eleName))){
ele.setInputElement(eleName, get(eleName));
}
}
public static void main(String[]set){
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -