java代码手机发短信 java sms短信接收( 四 )


try {
taskInfo.setTask_status(BaseConstant.task_status_cs);//设置任务执行状态为初始
taskInfo.setTask_last_end_time(new Date());//设置任务执行结束时间
taskInfo.setTask_status_desc("任务执行结束");
baseService.update("sms_send.updateTaskStatus", taskInfo);//
} catch (Exception e2) {
e2.printStackTrace();
// TODO: handle exception
}
}
}
public String messagecontent(SmsVisit smsSend){
//XX,您好!您于XX月XX日办理XX业务(或XX,您好!XX大队于XX月XX日对你单位进行监督检查/行政处罚/火灾调查),现进行满意度回访,请回复数字:1为满意;2为基本满意;3为不满意 。感谢您对消防工作的支持!回复免费 。宿迁市公安消防支队
//首先根据业务类型来判断采用哪种模板 监察
StringBuffer msg = new StringBuffer("");
if(BaseConstant.jiancha.equals(smsSend.getVisit_deal_business_type())){
msg.append(smsSend.getVisit_name_cn())
.append(",您好!")
.append(smsSend.getVisit_deal_org_name())
.append("于")
.append(smsSend.getVisit_deal_time().substring(4, 6)).append("月")
.append(smsSend.getVisit_deal_time().substring(6, 8)).append("日")
.append("对你单位进行").append(DictCommon.getEntryMap(BaseConstant.jiancha).get(smsSend.getVisit_deal_business()))
.append(",现进行满意度回访,请回复数字:1为满意;2为基本满意;3为不满意 。感谢您对消防工作的支持!");
}else if(BaseConstant.yewu.equals(smsSend.getVisit_deal_business_type())){
msg.append(smsSend.getVisit_name_cn())
.append(",您好!您于")
.append(smsSend.getVisit_deal_time().substring(4, 6)).append("月")
.append(smsSend.getVisit_deal_time().substring(6, 8)).append("日")
.append("办理").append(smsSend.getVisit_deal_business()).append("业务,")
.append("现进行满意度回访,请回复数字:1为满意;2为基本满意;3为不满意 。感谢您对消防工作的支持!");
}
return msg.toString();
}
public BaseService getBaseService() {
return baseService;
}
public void setBaseService(BaseService baseService) {
this.baseService = baseService;
}
public BaseService getBaseServiceMas() {
return baseServiceMas;
}
public void setBaseServiceMas(BaseService baseServiceMas) {
this.baseServiceMas = baseServiceMas;
}
public static void main(String[] args){
List smsMasList = new ArrayList();
try {
String msg = "*** , 您好!*********于2015年5月2日对你单位进行监督检查,现进行满意度回访,请回复数字:1为满意;2为基本满意;3为不满意 。感谢您对消防工作的支持!";
SmsOutBox smsOutBox = new SmsOutBox();
smsOutBox.setSismsid("12344");
smsOutBox.setReqdeliveryreport(BaseConstant.NoReport);
smsOutBox.setApplicationid(BaseConstant.APPLICATIONID);
smsOutBox.setDestaddr("111");
smsOutBox.setMsgfmt(BaseConstant.MSGFMT);
smsOutBox.setRequesttime(new Date());
smsOutBox.setExtcode("2222");
smsOutBox.setSendmethod(BaseConstant.NoMsg);// 正常短信
boolean con = true;
String lastMsg = msg;
while(con){
lastMsg = msg.substring(0,msg.length()55 ? 55 : msg.length());
msg = msg.substring(msg.length()55 ? 55 : msg.length(),msg.length());
if (msg.equals("")) {
con = false;
}
SmsOutBox smOutBox_temp = new SmsOutBox();
smOutBox_temp = smsOutBox;
smOutBox_temp.setMessagecontent(lastMsg);
smsMasList.add(smOutBox_temp);
}
for(Object o:smsMasList){
SmsOutBox smsOutBox2 = (SmsOutBox)o;
System.out.println(smsOutBox2.getMessagecontent());
}
} catch (Exception e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}

推荐阅读