java发送手机信息代码 java发送手机信息代码是什么( 四 )


String msg = smsSend.getSpare_2();
if(hashMap.get(smsSend.getVisit_phone().substring(0, 3))!=null){
SmsOutBox smsOutBox = new SmsOutBox();
smsOutBox.setSismsid(smsSend.getP_id());
smsOutBox.setReqdeliveryreport(BaseConstant.NoReport);
smsOutBox.setApplicationid(BaseConstant.APPLICATIONID);
smsOutBox.setDestaddr(smsSend.getVisit_phone());
smsOutBox.setMsgfmt(BaseConstant.MSGFMT);
smsOutBox.setRequesttime(new Date());
smsOutBox.setExtcode(smsSend.getExtccode());
smsOutBox.setSendmethod(BaseConstant.NoMsg);// 正常短信
smsOutBox.setMessagecontent(msg);
smsMasList.add(smsOutBox);
}else{
boolean con = true;
String lastMsg = msg;
int xh =0;
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 smsOutBox = new SmsOutBox();
smsOutBox.setSismsid(smsSend.getP_id()+(xh==0?"":xh));
xh++;
smsOutBox.setReqdeliveryreport(BaseConstant.NoReport);
smsOutBox.setApplicationid(BaseConstant.APPLICATIONID);
smsOutBox.setDestaddr(smsSend.getVisit_phone());
smsOutBox.setMsgfmt(BaseConstant.MSGFMT);
smsOutBox.setRequesttime(new Date());
smsOutBox.setExtcode(smsSend.getExtccode());
smsOutBox.setSendmethod(BaseConstant.NoMsg);// 正常短信
smsOutBox.setMessagecontent(lastMsg);
smsMasList.add(smsOutBox);
}
}
SmsVisit smsSendTemp = new SmsVisit();
smsSendTemp.setP_id(smsSend.getP_id());
//smsSendTemp.setSpare_2(msg);//短信内容
smsSendTemp.setSms_status_time(new Date());
smsSendTemp.setSms_status(BaseConstant.sms_status_yfswg);
smsList.add(smsSendTemp);
}
baseService.insertBatch("sms_send.insertSmsOutBox", smsMasList);//插入本地历史记录表
baseServiceMas.insertBatch("sms_mas.insertSmsOutBox", smsMasList);//插入mas机待发送表
baseService.updateBatch("sms_send.updateSmsVisit", smsList);//更新回访记录状态
}
} catch (Exception e) {
e.printStackTrace();
//baseService.saveLog("同步短信到mas机待发短信表", "100001", "同步短信到mas机待发短信表错误");
logger.error("同步短信到mas机待发短信表错误", getTrace(e));
}finally{
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为不满意 。感谢您对消防工作的支持!");

推荐阅读