📄 smssubmit.java
字号:
package com.tssx.ebiz.sgip;
import java.io.*;
/**
* <p>类名: SMSSubmit</p>
* <p>功能: 发送短信MT</p>
* <p>版权: Copyright (c) 2002</p>
* <p>公司: 深讯信科</p>
* <p>版本: 1.0</p>
* @程序 xuke
* @修改纪录
*/
public class SMSSubmit extends SMSData{
private String spNumber="8166"; //获取SP的接入号码(21t)
private String chargeNumber; //获取付费号码(21t)
private int userCount=1; //获取接收短消息的手机数量(1i)
private String userNumber; //接收短信手机号(21t)
private String corpId="82062"; //企业代码(5t)
private String serviceType="mf"; //业务代码(SP定义)(10t)
private int feeType=1; //计费类型(1i)
private String feeValue="0"; //短信收费值(6t)
private String givenValue="0"; //赠送用户话费(6t)
private int agentFlag=0; //代收费标志(1i)
private int morelatetoMTFlag=2; //引起MT原因(1i)
private int priority=0; //优先级(1i)
private String expireTime; //短信终止时间(16t)
private String scheduleTime; //短信发送时间(16t)
private int reportFlag=1; //状态报告标记(1i)
private int tp_pid=0; //GSM协议类型(1i)
private int tp_udhi=0; //GSM协议类型(1i)
private int messageCoding=15; //短信编码格式(1i)
private int messageType=0; //信息类型(1i)
private int msgLen; //短信长度(4i)
private String messageContent; //短消息的内容(短信长度)(10t)
private byte[] binaryMessageContent;
private String reserve; //Reserve(8t)
/**
* <p>功能:构造函数</p>
*/
public SMSSubmit() {
}
/**
* <p>功能:设置spNumber</p>
*/
public void setSpNumber(String newSpNumber) {
spNumber = newSpNumber;
}
/**
* <p>功能:设置chargeNumber</p>
*/
public void setChargeNumber(String newChargeNumber) {
chargeNumber = newChargeNumber;
}
/**
* <p>功能:设置userCount</p>
*/
public void setUserCount(int newUserCount) {
userCount = newUserCount;
}
/**
* <p>功能:设置userNumber</p>
*/
public void setUserNumber(String newUserNumber) {
userNumber = newUserNumber;
}
/**
* <p>功能:设置corpId</p>
*/
public void setCorpId(String newCorpId) {
corpId = newCorpId;
}
/**
* <p>功能:设置serviceType</p>
*/
public void setServiceType(String newServiceType) {
serviceType = newServiceType;
}
/**
* <p>功能:设置feeType</p>
*/
public void setFeeType(int newFeeType) {
feeType = newFeeType;
}
/**
* <p>功能:设置feeValue</p>
*/
public void setFeeValue(String newFeeValue) {
feeValue = newFeeValue;
}
/**
* <p>功能:设置givenValue</p>
*/
public void setGivenValue(String newGivenValue) {
givenValue = newGivenValue;
}
/**
* <p>功能:设置agentFlag</p>
*/
public void setAgentFlag(int newAgentFlag) {
agentFlag = newAgentFlag;
}
/**
* <p>功能:设置morelatetoMTFlag</p>
*/
public void setMorelatetoMTFlag(int newMorelatetoMTFlag) {
morelatetoMTFlag = newMorelatetoMTFlag;
}
/**
* <p>功能:设置priority</p>
*/
public void setPriority(int newPriority) {
priority = newPriority;
}
/**
* <p>功能:设置expireTime</p>
*/
public void setExpireTime(String newExpireTime) {
expireTime = newExpireTime;
}
/**
* <p>功能:设置scheduleTime</p>
*/
public void setScheduleTime(String newScheduleTime) {
scheduleTime = newScheduleTime;
}
/**
* <p>功能:设置reportFlag</p>
*/
public void setReportFlag(int newReportFlag) {
reportFlag = newReportFlag;
}
/**
* <p>功能:设置TP_pid</p>
*/
public void setTp_pid(int newTp_pid) {
tp_pid = newTp_pid;
}
/**
* <p>功能:设置TP_udhi</p>
*/
public void setTp_udhi(int newTp_udhi) {
tp_udhi = newTp_udhi;
}
/**
* <p>功能:设置messageCoding</p>
*/
public void setMessageCoding(int newMessageCoding) {
messageCoding = newMessageCoding;
}
/**
* <p>功能:设置messageType</p>
*/
public void setMessageType(int newMessageType) {
messageType = newMessageType;
}
/**
* <p>功能:设置messageLength</p>
*/
public void setMessageLength(int newMessageLength) {
messageLength = newMessageLength;
}
/**
* <p>功能:设置messageContent</p>
*/
public void setMessageContent(String newMessageContent) {
messageContent = newMessageContent;
}
public void setBinaryMessageContent(byte[] newBinaryMessageContent) {
binaryMessageContent = newBinaryMessageContent;
}
/**
* <p>功能:设置reserve</p>
*/
public void setReserve(String newReserve) {
reserve = newReserve;
}
/**
* <p>功能:获取spNumber</p>
*/
public String getSpNumber() {
return spNumber;
}
/**
* <p>功能:获取chargeNumber</p>
*/
public String getChargeNumber() {
return chargeNumber;
}
/**
* <p>功能:获取userCount</p>
*/
public int getUserCount() {
return userCount;
}
/**
* <p>功能:获取userNumber</p>
*/
public String getUserNumber() {
return userNumber;
}
/**
* <p>功能:获取corpId</p>
*/
public String getCorpId() {
return corpId;
}
/**
* <p>功能:获取serviceType</p>
*/
public String getServiceType() {
return serviceType;
}
/**
* <p>功能:获取feeType</p>
*/
public int getFeeType() {
return feeType;
}
/**
* <p>功能:获取feeValue</p>
*/
public String getFeeValue() {
return feeValue;
}
/**
* <p>功能:获取givenValue</p>
*/
public String getGivenValue() {
return givenValue;
}
/**
* <p>功能:获取agentFlag</p>
*/
public int getAgentFlag() {
return agentFlag;
}
/**
* <p>功能:获取morelatetoMTFlag</p>
*/
public int getMorelatetoMTFlag() {
return morelatetoMTFlag;
}
/**
* <p>功能:获取priority</p>
*/
public int getPriority() {
return priority;
}
/**
* <p>功能:获取expireTime</p>
*/
public String getExpireTime() {
return expireTime;
}
/**
* <p>功能:获取scheduleTime</p>
*/
public String getScheduleTime() {
return scheduleTime;
}
/**
* <p>功能:获取reportFlag</p>
*/
public int getReportFlag() {
return reportFlag;
}
/**
* <p>功能:获取TP_pid</p>
*/
public int getTp_pid() {
return tp_pid;
}
/**
* <p>功能:获取TP_udhi</p>
*/
public int getTp_udhi() {
return tp_udhi;
}
/**
* <p>功能:获取messageCoding</p>
*/
public int getMessageCoding() {
return messageCoding;
}
/**
* <p>功能:获取messageType</p>
*/
public int getMessageType() {
return messageType;
}
/**
* <p>功能:获取messageLength</p>
*/
public int getMessageLength() {
return messageLength;
}
/**
* <p>功能:获取messageContent</p>
*/
public String getMessageContent() {
return messageContent;
}
public byte[] getBinaryMessageContent() {
return binaryMessageContent;
}
/**
* <p>功能:获取reserve</p>
*/
public String getReserve() {
return reserve;
}
/**
* <p>功能:写数据</p>
*/
public synchronized void write(DataOutputStream m_os) throws SgipException,IOException{
int i=0;
int j=0;
byte[] temp=this.messageContent.getBytes();
this.msgLen=temp.length;
this.messageLength=20+144+msgLen;
this.commandID=CommandID.SGIP_SUBMIT;
byte b[] = new byte[messageLength];
/* head */
byte[] head1 = getInteger4(messageLength);
byte[] head2=getInteger4(commandID);
byte[] head3=getInteger4(seqAddr);
byte[] head4=getInteger4(seqDate);
byte[] head5=getInteger4(sequence);
/* body */
byte[] body1 = getText(21,spNumber);
byte[] body2 = getText(21,chargeNumber);
byte body3 = getInteger1(userCount);
byte[] body4 = getText(21,userNumber);
byte[] body5 = getText(5,corpId);
byte[] body6 = getText(10,serviceType);
byte body7 = getInteger1(feeType);
byte[] body8 = getText(6,feeValue);
byte[] body9 = getText(6,givenValue);
byte body10 = getInteger1(agentFlag);
byte body11 = getInteger1(morelatetoMTFlag);
byte body12 = getInteger1(priority);
byte[] body13 = getText(16,expireTime);
byte[] body14 = getText(16,scheduleTime);
byte body15 = getInteger1(reportFlag);
byte body16 = getInteger1(tp_pid);
byte body17 = getInteger1(tp_udhi);
byte body18 = getInteger1(messageCoding);
byte body19 = getInteger1(messageType);
byte[] body20 = getInteger4(msgLen);
byte[] body21 = getText(msgLen,messageContent);
byte[] body22 = getText(8,reserve);
j=0;
while(j<head1.length){
b[i]=head1[j];
i++;
j++;
}
j=0;
while(j<head2.length){
b[i]=head2[j];
i++;
j++;
}
j=0;
while(j<head3.length){
b[i]=head3[j];
i++;
j++;
}
j=0;
while(j<head4.length){
b[i]=head4[j];
i++;
j++;
}
j=0;
while(j<head5.length){
b[i]=head5[j];
i++;
j++;
}
j=0;
while(j<body1.length){
b[i]=body1[j];
i++;
j++;
}
j=0;
while(j<body2.length){
b[i]=body2[j];
i++;
j++;
}
b[i] = body3;
i++;
j=0;
while(j<body4.length){
b[i]=body4[j];
i++;
j++;
}
j=0;
while(j<body5.length){
b[i]=body5[j];
i++;
j++;
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -