diff --git a/WebContent/Tenwa/Lease/App/Interface/Message/LBSmsNoticeTasksList.jsp b/WebContent/Tenwa/Lease/App/Interface/Message/LBSmsNoticeTasksList.jsp
index 5a5c95822..ca995f85d 100644
--- a/WebContent/Tenwa/Lease/App/Interface/Message/LBSmsNoticeTasksList.jsp
+++ b/WebContent/Tenwa/Lease/App/Interface/Message/LBSmsNoticeTasksList.jsp
@@ -1,103 +1,113 @@
-<%@ page contentType="text/html; charset=GBK"%>
-<%@ include file="/Frame/resources/include/include_begin_list.jspf"%><%
- /*
+<%@ page contentType="text/html; charset=GBK" %>
+<%@ include file="/Frame/resources/include/include_begin_list.jspf" %>
+<%
+ /*
Author: undefined 2017-08-01
Content:
History Log:
*/
- ASObjectModel doTemp = new ASObjectModel("LBSmsNoticeTasksList");
- doTemp.setDataQueryClass("com.amarsoft.awe.dw.ui.list.FlowMonitorListHtmlGenerator");
- CurPage.setAttribute("flowRowCount","100");
- ASObjectWindow dwTemp = new ASObjectWindow(CurPage,doTemp,request);
- dwTemp.Style="1"; //--设置为Grid风格--
- dwTemp.ReadOnly = "1"; //只读模式
- dwTemp.MultiSelect = true;
- dwTemp.setPageSize(pageSize==null?10:Integer.parseInt(pageSize));
- dwTemp.genHTMLObjectWindow("");
+ ASObjectModel doTemp = new ASObjectModel("LBSmsNoticeTasksList");
+ doTemp.setDataQueryClass("com.amarsoft.awe.dw.ui.list.FlowMonitorListHtmlGenerator");
+ CurPage.setAttribute("flowRowCount", "100");
+ ASObjectWindow dwTemp = new ASObjectWindow(CurPage, doTemp, request);
+ dwTemp.Style = "1"; //--设置为Grid风格--
+ dwTemp.ReadOnly = "1"; //只读模式
+ dwTemp.MultiSelect = true;
+ dwTemp.setPageSize(pageSize == null ? 10 : Integer.parseInt(pageSize));
+ dwTemp.genHTMLObjectWindow("");
- //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格
- String sButtons[][] = {
- {"true","","Button","新增","新增","newRecord()","","","","btn_icon_add",""},
- {"true","","Button","修改","修改","viewAndEdit()","","","","btn_icon_set",""},
- {"true","","Button","删除","删除","doDelete()","","","","btn_icon_delete",""},
- {"true","","Button","立即发送","立即发送","sendMessage()","","","","btn_icon_message",""},
- {"true","","Button","余额查询","余额查询","doSelect()","","","","btn_icon_information",""}
- };
-%><%@include file="/Frame/resources/include/ui/include_list.jspf"%>
+ //0、是否展示 1、 权限控制 2、 展示类型 3、按钮显示名称 4、按钮解释文字 5、按钮触发事件代码 6、 7、 8、 9、图标,CSS层叠样式 10、风格
+ String sButtons[][] = {
+ {"true", "", "Button", "新增", "新增", "newRecord()", "", "", "", "btn_icon_add", ""},
+ {"true", "", "Button", "修改", "修改", "viewAndEdit()", "", "", "", "btn_icon_set", ""},
+ {"true", "", "Button", "删除", "删除", "doDelete()", "", "", "", "btn_icon_delete", ""},
+ {"true", "", "Button", "立即发送", "立即发送", "sendMessage()", "", "", "", "btn_icon_message", ""},
+ {"true", "", "Button", "余额查询(普通)", "查询普通短信余额", "doSelect('01')", "", "", "", "btn_icon_information", ""},
+ {"true", "", "Button", "余额查询(催收)", "查询催收短信余额", "doSelect('02')", "", "", "", "btn_icon_information", ""}
+ };
+%>
+<%@include file="/Frame/resources/include/ui/include_list.jspf" %>
-<%@ include file="/Frame/resources/include/include_end.jspf"%>
\ No newline at end of file
+<%@ include file="/Frame/resources/include/include_end.jspf" %>
\ No newline at end of file
diff --git a/WebContent/WEB-INF/etc/jbo/jbo_oti.xml b/WebContent/WEB-INF/etc/jbo/jbo_oti.xml
index 69ec4224f..8e0608513 100644
--- a/WebContent/WEB-INF/etc/jbo/jbo_oti.xml
+++ b/WebContent/WEB-INF/etc/jbo/jbo_oti.xml
@@ -651,5 +651,53 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/WebContent/WEB-INF/lib/SmsSdk-5.7.jar b/WebContent/WEB-INF/lib/SmsSdk-5.7.jar
new file mode 100644
index 000000000..e2a3c8e2c
Binary files /dev/null and b/WebContent/WEB-INF/lib/SmsSdk-5.7.jar differ
diff --git a/WebContent/WEB-INF/web.xml b/WebContent/WEB-INF/web.xml
index 34e2f133a..570d63cfa 100644
--- a/WebContent/WEB-INF/web.xml
+++ b/WebContent/WEB-INF/web.xml
@@ -121,6 +121,15 @@
1
+
+ SmsRptServlet
+ com.ample.sms.SmsRptServlet
+
+ DataSource
+ als
+
+
+
RewriteRunJavaMethodServlet
com.tenwa.workflow.RewriteRunJavaMethodServlet
@@ -298,6 +307,11 @@
/servlet/runflow
+
+ SmsRptServlet
+ /smsRpt
+
+
DocDownloadZipServlet
/servlet/view/docDownloadZipServlet
diff --git a/config/sms.properties b/config/sms.properties
new file mode 100644
index 000000000..75fca3435
--- /dev/null
+++ b/config/sms.properties
@@ -0,0 +1,11 @@
+userid=JU9237
+pwd=507237
+ipAddress1=172.28.1.59:8803
+ipAddress2=
+ipAddress3=
+ipAddress4=
+
+log_path=/data/sms/
+
+urge_userid=JU9239
+urge_pwd=507237
\ No newline at end of file
diff --git a/src/com/ample/sms/FileUtil.java b/src/com/ample/sms/FileUtil.java
new file mode 100644
index 000000000..2b7b5c08d
--- /dev/null
+++ b/src/com/ample/sms/FileUtil.java
@@ -0,0 +1,65 @@
+package com.ample.sms;
+
+import java.io.ByteArrayInputStream;
+import java.io.File;
+import java.io.FileOutputStream;
+import java.util.Calendar;
+
+public class FileUtil {
+ public static final int BUFFER_SIZE = 1024;
+
+ public FileUtil() {
+ }
+
+ public static void writeFile(String fileName, String content) {
+ FileOutputStream fos = null;
+ ByteArrayInputStream bis = null;
+
+ try {
+ File file = new File(fileName);
+ if (!file.getParentFile().exists()) {
+ file.getParentFile().mkdirs();
+ }
+
+ fos = new FileOutputStream(fileName, true);
+ bis = new ByteArrayInputStream(content.getBytes("GBK"));
+ byte[] buffer = new byte[BUFFER_SIZE];
+
+ int ch;
+ while((ch = bis.read(buffer)) != -1) {
+ fos.write(buffer, 0, ch);
+ }
+ } catch (Exception var15) {
+ var15.printStackTrace();
+ } finally {
+ try {
+ if (bis != null) {
+ bis.close();
+ }
+
+ if (fos != null) {
+ fos.close();
+ }
+ } catch (Exception var14) {
+ var14.printStackTrace();
+ }
+
+ }
+
+ }
+
+ public static String getCurrTime() {
+ try {
+ Calendar calendar = Calendar.getInstance();
+ String yearstr = String.valueOf(calendar.get(1));
+ int month = calendar.get(2) + 1;
+ String monthstr = month > 9 ? String.valueOf(month) : "0" + String.valueOf(month);
+ int day = calendar.get(5);
+ String daystr = day > 9 ? String.valueOf(day) : "0" + String.valueOf(day);
+ return yearstr + "/" + monthstr + "/" + daystr + "/";
+ } catch (Exception var6) {
+ var6.printStackTrace();
+ return "";
+ }
+ }
+}
diff --git a/src/com/ample/sms/RecvMoThread.java b/src/com/ample/sms/RecvMoThread.java
new file mode 100644
index 000000000..7062f9331
--- /dev/null
+++ b/src/com/ample/sms/RecvMoThread.java
@@ -0,0 +1,100 @@
+package com.ample.sms;
+
+import com.montnets.mwgate.common.MO;
+import com.montnets.mwgate.smsutil.SmsSendConn;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 鑾峰彇涓婅鐭俊鐨勭嚎绋
+ */
+public class RecvMoThread extends Thread {
+
+ // 鐭俊澶勭悊瀵硅薄,鍦ㄨ繖涓柟娉曚腑璋冪敤鑾峰彇涓婅鍔熻兘
+ private SmsSendConn smsSendConn = null;
+ // 鐢ㄦ埛璐﹀彿
+ private String userid = null;
+ // 姣忔璇锋眰鎯宠鑾峰彇涓婅鐨勬渶澶ф潯鏁
+ private int retsize = 0;
+
+ /**
+ * 鏋勯犲嚱鏁
+ *
+ * @param smsSendConn
+ * 鐭俊澶勭悊瀵硅薄
+ * @param userid
+ * 鐢ㄦ埛璐﹀彿
+ */
+ public RecvMoThread(SmsSendConn smsSendConn, String userid, int retsize) {
+ // 鐭俊澶勭悊瀵硅薄
+ this.smsSendConn = smsSendConn;
+ // 鐢ㄦ埛璐﹀彿
+ this.userid = userid;
+ // 姣忔璇锋眰鎯宠鑾峰彇涓婅鐨勬渶澶ф潯鏁
+ this.retsize = retsize;
+ }
+
+ /**
+ * 鑾峰彇涓婅鐭俊绾跨▼鐨勬柟娉
+ */
+ public void run() {
+ // 涓婅闆嗗悎 鏈泦鍚堜复鏃跺瓨鍌ㄤ笂琛岋紝闇瑕佸皢鏀跺埌鐨勪笂琛屼繚瀛樺湪涓涓槦鍒椾腑锛岀敱鍙﹀涓涓嚎绋嬪幓澶勭悊銆
+ List mos = new ArrayList();
+ // 杩斿洖鍊
+ int result = -310099;
+ //涓婅瀵硅薄澹版槑
+ MO mo = null;
+ // 寰幆璋冪敤鑾峰彇涓婅鐨勬柟娉
+ while (true) {
+ try {
+ // 鍒濆鍖栬繑鍥炲
+ result = -310099;
+ // 娓呯┖涓婅闆嗗悎涓殑瀵硅薄
+ mos.clear();
+ // 璋冪敤鑾峰彇涓婅鎺ュ彛
+ result = smsSendConn.getMo(userid, retsize, mos);
+ // 濡傛灉鑾峰彇涓婅鎴愬姛锛屽苟涓旀湁涓婅
+ if (result == 0 && mos != null && mos.size() > 0) {
+ // 鏈変笂琛
+ // 娣诲姞鍒颁笂琛岄槦鍒
+ // add mo queue
+ // 杩欓噷涓嶈鍋氬鏉傜殑鑰楁椂鐨勫鐞嗭紝灏嗘敹鍒扮殑涓婅淇濆瓨鍦ㄤ竴涓槦鍒椾腑锛岀敱鍙﹀涓涓嚎绋嬪幓澶勭悊銆
+
+ // 浠g爜绀轰緥鏄皢涓婅淇℃伅鎵撳嵃鍑烘潵
+ System.out.println("鑾峰彇涓婅鎴愬姛锛佽幏鍙栧埌鐨勪笂琛屾湁" + mos.size() + "鏉¤褰曘");
+ for (int i = 0; i < mos.size(); i++) {
+ mo = mos.get(i);
+ System.out.println("涓婅璁板綍:" +"msgid:"+mo.getMsgid() + ",mobile:" + mo.getMobile()+",countrycode:"+mo.getCountrycode()
+ + ",pknum:"+mo.getPknum()+",pktotal:"+mo.getPktotal()+",spno:" + mo.getSpno()
+ + ",exno:" + mo.getExno() + ",content:" + mo.getContent()+ ",rtime:" + mo.getRtime() );
+ }
+
+ // 缁х画寰幆
+ continue;
+ } else {
+ // 濡傛灉鑾峰彇涓婅澶辫触锛屽垯灏嗛敊璇爜鎵撳嵃
+ if (result != 0) {
+ System.out.println("鑾峰彇涓婅澶辫触锛岄敊璇爜涓:" + result);
+ }
+
+ // 娌℃湁涓婅锛屽欢鏃5绉掍互涓
+ try {
+ Thread.sleep(5000L);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ // 寰幆鍑虹幇寮傚父锛屾殏鍋5绉
+ try {
+ Thread.sleep(5000L);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/com/ample/sms/RecvRptThread.java b/src/com/ample/sms/RecvRptThread.java
new file mode 100644
index 000000000..b081fec15
--- /dev/null
+++ b/src/com/ample/sms/RecvRptThread.java
@@ -0,0 +1,103 @@
+package com.ample.sms;
+
+import com.montnets.mwgate.common.RPT;
+import com.montnets.mwgate.smsutil.SmsSendConn;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 鑾峰彇鐭俊鐘舵佹姤鍛婄殑绾跨▼
+ */
+public class RecvRptThread extends Thread {
+
+ // 鐭俊澶勭悊瀵硅薄,鍦ㄨ繖涓柟娉曚腑璋冪敤鑾峰彇鐘舵佹姤鍛婂姛鑳
+ private SmsSendConn smsSendConn = null;
+ // 鐢ㄦ埛璐﹀彿
+ private String userid = null;
+ // 姣忔璇锋眰鎯宠鑾峰彇鐘舵佹姤鍛婄殑鏈澶ф潯鏁
+ private int retsize = 0;
+
+ /**
+ * 鏋勯犲嚱鏁
+ *
+ * @param smsSendConn
+ * 鐭俊澶勭悊瀵硅薄
+ * @param userid
+ * 鐢ㄦ埛璐﹀彿
+ */
+ public RecvRptThread(SmsSendConn smsSendConn, String userid, int retsize) {
+ // 鐭俊澶勭悊瀵硅薄
+ this.smsSendConn = smsSendConn;
+ // 鐢ㄦ埛璐﹀彿
+ this.userid = userid;
+ // 姣忔璇锋眰鎯宠鑾峰彇鐘舵佹姤鍛婄殑鏈澶ф潯鏁
+ this.retsize = retsize;
+ }
+
+ /**
+ * 鑾峰彇鐭俊鐘舵佹姤鍛婄嚎绋嬬殑鏂规硶
+ */
+ public void run() {
+ // 鐘舵佹姤鍛婇泦鍚 鏈泦鍚堜复鏃跺瓨鍌ㄧ姸鎬佹姤鍛婏紝闇瑕佸皢鏀跺埌鐨勭姸鎬佹姤鍛婁繚瀛樺湪涓涓槦鍒椾腑锛岀敱鍙﹀涓涓嚎绋嬪幓澶勭悊
+ List rpts = new ArrayList();
+ // 杩斿洖鍊
+ int result = -310099;
+ //鐘舵佹姤鍛婂璞″0鏄
+ RPT rpt = null;
+ // 寰幆璋冪敤鑾峰彇鐘舵佹姤鍛婄殑鏂规硶
+ while (true) {
+ try {
+ // 鍒濆鍖栬繑鍥炲
+ result = -310099;
+ // 娓呯┖鐘舵佹姤鍛婇泦鍚堜腑鐨勫璞
+ rpts.clear();
+ // 璋冪敤鑾峰彇鐘舵佹姤鍛婃帴鍙
+ result = smsSendConn.getRpt(userid, retsize, rpts);
+ // 濡傛灉鑾峰彇鐘舵佹姤鍛婃垚鍔燂紝骞朵笖鏈夌姸鎬佹姤鍛
+ if (result == 0 && rpts != null && rpts.size() > 0) {
+ // 鏈夌姸鎬佹姤鍛
+ // 娣诲姞鍒扮姸鎬佹姤鍛婇槦鍒
+ // add rpt queue
+ // 杩欓噷涓嶈鍋氬鏉傜殑鑰楁椂鐨勫鐞嗭紝灏嗘敹鍒扮殑鐘舵佹姤鍛婁繚瀛樺湪涓涓槦鍒椾腑锛岀敱鍙﹀涓涓嚎绋嬪幓澶勭悊銆
+
+ // 浠g爜绀轰緥鏄皢鐘舵佹姤鍛婁俊鎭墦鍗板嚭鏉
+ System.out.println("鑾峰彇鐘舵佹姤鍛婃垚鍔燂紒鑾峰彇鍒扮殑鐘舵佹姤鍛婃湁" + rpts.size()
+ + "鏉¤褰曘");
+ for (int i = 0; i < rpts.size(); i++) {
+ rpt = rpts.get(i);
+ System.out.println("鐘舵佹姤鍛婅褰:" +"msgid:"+rpt.getMsgid() + ",custid:" + rpt.getCustid() + ",pknum:" + rpt.getPknum()
+ + ",pktotal:" + rpt.getPktotal() + ",mobile:" + rpt.getMobile()+",countrycode:"+rpt.getCountrycode()
+ + ",spno:" + rpt.getSpno() + ",exno:" + rpt.getExno() + ",stime:" + rpt.getStime()
+ + ",rtime:" + rpt.getRtime() + ",status:" + rpt.getStatus() + ",errcode:" + rpt.getErrcode()
+ + ",errdesc:"+rpt.getErrdesc()+ ",exdata:" + rpt.getExdata());
+ }
+
+ // 缁х画寰幆
+ continue;
+ } else {
+ // 濡傛灉鑾峰彇鐘舵佹姤鍛婂け璐ワ紝鍒欏皢閿欒鐮佹墦鍗
+ if (result != 0) {
+ System.out.println("鑾峰彇鐘舵佹姤鍛婂け璐ワ紝閿欒鐮佷负:" + result);
+ }
+
+ // 娌℃湁鐘舵佹姤鍛婏紝寤舵椂5绉掍互涓
+ try {
+ Thread.sleep(5000L);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ // 寰幆鍑虹幇寮傚父锛屾殏鍋5绉
+ try {
+ Thread.sleep(5000L);
+ } catch (Exception ex) {
+ ex.printStackTrace();
+ }
+ }
+ }
+ }
+
+}
diff --git a/src/com/ample/sms/SmsController.java b/src/com/ample/sms/SmsController.java
new file mode 100644
index 000000000..68f0be099
--- /dev/null
+++ b/src/com/ample/sms/SmsController.java
@@ -0,0 +1,184 @@
+package com.ample.sms;
+
+import com.amarsoft.are.jbo.*;
+import com.amarsoft.are.util.StringFunction;
+import com.montnets.mwgate.common.Message;
+import com.montnets.mwgate.common.Remains;
+import com.montnets.mwgate.smsutil.SmsSendConn;
+import jbo.com.tenwa.lease.comm.LB_SMS_NOTICE_TASKS;
+import jbo.oti.SMS_SEND;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+
+import java.text.SimpleDateFormat;
+import java.util.Date;
+
+public class SmsController {
+ private String ids;
+ private String smsObjType;
+
+ private Logger logger = Logger.getLogger(this.getClass());
+ private SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
+
+
+ public String sendMessage(JBOTransaction tx){
+ try{
+ // 实例化短信处理对象
+ SmsSendConn smsSendConn = new SmsSendConn(true);
+ //将发送过来的参数按照@切分出来
+ String[] smsID = ids.split("@");
+ BizObjectManager bomLSNT = JBOFactory.getBizObjectManager(LB_SMS_NOTICE_TASKS.CLASS_NAME,tx);
+ BizObjectManager bomSS = JBOFactory.getBizObjectManager(SMS_SEND.CLASS_NAME,tx);
+ for(String id:smsID){
+ sendMessage(smsSendConn,id,bomLSNT,bomSS);
+ }
+ }catch(Exception e){
+ e.printStackTrace();
+ return "ERROR";
+ }
+ return "SUCCESS";
+ }
+
+ public void sendMessage(SmsSendConn smsSendConn,String smsId,BizObjectManager bomLSNT,BizObjectManager bomSS) throws JBOException {
+ BizObject boLSNT = bomLSNT.createQuery("ID=:ID").setParameter("ID", smsId).getSingleResult(true);
+ int resultCode = -310099;
+ try {
+ Message message = createMessageByBizObject(boLSNT);
+ String smsObType = boLSNT.getAttribute("SEND_OBJ_TYPE").toString();
+ if(SmsObjType.URGE_COLLECTION.getType().equals(smsObType)){
+ SmsSendManager.setAccountInfo(SmsObjType.URGE_COLLECTION);
+ }else {
+ SmsSendManager.setAccountInfo(SmsObjType.NORMAL);
+ }
+ StringBuffer returnValue = new StringBuffer();
+ /*
+ 发送短信
+ */
+ resultCode = smsSendConn.singleSend(message, returnValue);
+ boLSNT = this.saveObject(boLSNT,bomSS,returnValue.toString(),resultCode);
+ bomLSNT.saveObject(boLSNT);
+
+ } catch (Exception e) {
+ logger.error("短信发送执行失败。", e);
+ }
+
+ }
+ public BizObject saveObject(BizObject boLSNT,BizObjectManager bomSS,String returnValue,int resultCode) throws JBOException {
+ String smsStatus = "未发送";
+
+ // result为0:成功;非0:失败
+ if (resultCode == 0) {
+ smsStatus = "已发送";
+ System.out.println("单条发送提交成功:"+returnValue);
+ }else {
+ System.out.println("单条发送提交失败,错误码:" + resultCode);
+ smsStatus = "未发送";
+ }
+
+ BizObject boSS = bomSS.newObject();
+ boSS.setAttributeValue("MOBILE",boLSNT.getAttribute("PHONE_NUMBER").toString());
+ boSS.setAttributeValue("CONTENT",boLSNT.getAttribute("SMS_CONTENT").getString());
+ boSS.setAttributeValue("SMS_ID",boLSNT.getAttribute("ID").toString());
+ boSS.setAttributeValue("SEND_TIME", StringFunction.getTodayNow());
+ boSS.setAttributeValue("RESULT_CODE",resultCode);
+ boSS.setAttributeValue("MSGID",StringUtils.substringAfterLast(returnValue.toString(),","));
+ boSS.setAttributeValue("SMS_OBJ_TYPE",boLSNT.getAttribute("SEND_OBJ_TYPE").getString());
+ bomSS.saveObject(boSS);
+
+ boLSNT.setAttributeValue("SMS_TYPE","IMMEDIATELY");
+ boLSNT.setAttributeValue("SEND_RESULT",smsStatus);
+ boLSNT.setAttributeValue("SEND_TIME",sdf.format(new Date()));
+ boLSNT.setAttributeValue("SEND_FLAG",resultCode == 0 ? 1 : 0);
+ return boLSNT;
+ }
+
+ public String getSmsRemains(JBOTransaction tx){
+ String result = "查询失败";
+ // 实例化短信处理对象
+ SmsSendConn smsSendConn = new SmsSendConn(true);
+ SmsSendManager.setAccountInfo("02".equals(smsObjType)?SmsObjType.URGE_COLLECTION:SmsObjType.NORMAL);
+ // 查询余额接口。
+ Remains remains = smsSendConn.getRemains(SmsPropertiesUtil.get("userid"));
+
+ //remains不为空
+ if(remains==null)
+ {
+ return result;
+ }
+ //查询成功
+ if(remains.getResult()!=0)
+ {
+ //查询失败
+ System.out.println("查询失败,错误码为:" + remains.getResult());
+ return "查询失败,错误码为:" + remains.getResult();
+ }
+ //计费类型为0,条数计费
+ if(remains.getChargetype()==0)
+ {
+ System.out.println("查询成功,剩余条数为:" + remains.getBalance()+"条");
+ return "查询成功,剩余条数为:" + remains.getBalance()+"条";
+ }else if(remains.getChargetype()==1)
+ {
+ //计费类型为1,金额计费
+ System.out.println("查询成功,剩余金额为:" + remains.getMoney()+"元");
+ return "查询成功,剩余金额为:" + remains.getMoney()+"元";
+ }else
+ {
+ System.out.println("未知的计费类型,计费类型:"+remains.getChargetype());
+ return "未知的计费类型,计费类型:"+remains.getChargetype();
+ }
+ }
+
+ public String recvRpt(JBOTransaction tx){
+ // 实例化短信处理对象
+ SmsSendConn smsSendConnRpt = new SmsSendConn(true);
+ // 每次请求想要获取的状态报告的最大条数。
+ int retsizeRpt = 100;
+ // 实例化状态报告线程
+ String userId = "CS1156";
+ SmsRecvRptThread recvRptThread = new SmsRecvRptThread(smsSendConnRpt, userId,retsizeRpt);
+ // 线程获取 启动获取状态报告的线程
+ recvRptThread.start();
+ System.out.println("获取状态报告的线程启动成功!");
+ return "获取状态报告的线程启动成功!";
+ }
+ public Message createMessageByBizObject(BizObject bo) throws JBOException {
+ //调用短信接口
+ String phoneNo = bo.getAttribute("PHONE_NUMBER").getString();
+ String smsContent = bo.getAttribute("SMS_CONTENT").getString();
+ String smsId = bo.getAttribute("ID").getString();
+ // 参数类
+ Message message = new Message();
+ // 设置用户账号 指定用户账号发送,需要填写用户账号,不指定用户账号发送,无需填写用户账号
+ // message.setUserid(userid);
+ // 设置手机号码 此处只能设置一个手机号码
+ message.setMobile(phoneNo);
+ // 设置内容
+ message.setContent(smsContent);
+ // 设置扩展号为数字字符串且长度不能超过6位,注意通道号+扩展号的总长度不能超过20位,若超出exno无效,如不需要扩展号则不用提交此字段或填空
+ message.setExno("");
+ // 用户自定义流水编号:最大可支持64位的ASCII字符串:字母、数字、下划线、减号,如不需要则不用提交此字段或填空
+ message.setCustid("");
+ // 自定义扩展数据:额外提供的最大64位长度的ASCII字符串:字母、数字、下划线、减号,作为自定义扩展数据,填写后,状态报告返回时将会包含这部分数据,如不需要则不用提交此字段或填空
+ message.setExdata(smsId);
+ // 业务类型:最大可支持32个长度的英文字母、数字组合的字符串
+ message.setSvrtype("");
+ return message;
+ }
+
+
+ public String getSmsObjType() {
+ return smsObjType;
+ }
+ public void setSmsObjType(String smsObjType) {
+ this.smsObjType = smsObjType;
+ }
+ public String getIds() {
+ return ids;
+ }
+
+ public void setIds(String ids) {
+ this.ids = ids;
+ }
+
+}
diff --git a/src/com/ample/sms/SmsObjType.java b/src/com/ample/sms/SmsObjType.java
new file mode 100644
index 000000000..31375cce2
--- /dev/null
+++ b/src/com/ample/sms/SmsObjType.java
@@ -0,0 +1,24 @@
+package com.ample.sms;
+
+public enum SmsObjType {
+
+ NORMAL("01","普通"),
+ URGE_COLLECTION("02","催收"),
+ MARKETING("03","营销");
+
+ private String type;
+ private String desc;
+
+ SmsObjType(String type, String desc) {
+ this.type=type;
+ this.desc=desc;
+ }
+
+ public String getDesc() {
+ return this.desc;
+ }
+
+ public String getType() {
+ return this.type;
+ }
+}
diff --git a/src/com/ample/sms/SmsPropertiesUtil.java b/src/com/ample/sms/SmsPropertiesUtil.java
new file mode 100644
index 000000000..a8bcc898b
--- /dev/null
+++ b/src/com/ample/sms/SmsPropertiesUtil.java
@@ -0,0 +1,36 @@
+package com.ample.sms;
+
+
+import java.io.IOException;
+import java.util.Map;
+import java.util.Properties;
+import java.util.concurrent.ConcurrentHashMap;
+
+public class SmsPropertiesUtil {
+ private static Map attributes;
+
+ public static void load() {
+ attributes = new ConcurrentHashMap();
+ Properties prop = new Properties();
+ try {
+ prop.load(SmsPropertiesUtil.class.getResourceAsStream("/sms.properties"));
+ for(Map.Entry