|
@@ -58,28 +58,38 @@ public class PhoneMsgLogServiceImpl implements IPhoneMsgLogService {
|
|
|
}
|
|
|
|
|
|
@Override
|
|
|
- public void sendDusMsg(String subId) throws IOException, ClientException {
|
|
|
+ public void sendDusMsg(String phone, String subId, String tip, String kind) throws IOException, ClientException {
|
|
|
SubInfo subInfo = subInfoDao.findById(subId);
|
|
|
- if(!TEL_PATTERN.matcher(subInfo.getTel()).matches()) {
|
|
|
- throw new RuntimeException("请填写正确得手机号码");
|
|
|
+ if(subInfo == null){
|
|
|
+ throw new RuntimeException("项目未找到");
|
|
|
}
|
|
|
- long dueDay = DateUtil.betweenDay(subInfo.getEndDate(), new Date(), true);
|
|
|
- String content = MessageFormat.format("哈密市发改委提醒:您监管/负责的{0}项目,已经逾期{1}天,请及时关注并处理!!!", msgParamLengthSplit(subInfo.getSubName()), dueDay);
|
|
|
+ if(StringUtil.isEmpty(phone)){
|
|
|
+ throw new RuntimeException("电话不能为空");
|
|
|
+ }
|
|
|
+ //long dueDay = DateUtil.betweenDay(subInfo.getEndDate(), new Date(), true);
|
|
|
+ String content = MessageFormat.format("{0}提醒:您监管/负责的{1}项目,{2}已经逾期,请及时关注并处理!","哈密市工信局", msgParamLengthSplit(subInfo.getSubName()), tip);
|
|
|
Map<String, String> context = new HashMap<String, String>();
|
|
|
- context.put("name", "哈密市发改委");
|
|
|
- context.put("projName", msgParamLengthSplit("("+ subInfo.getSubName()+")"));
|
|
|
- context.put("days", String.valueOf(dueDay));
|
|
|
- SendResponse sendResponse = AliSendTelPhoneUtil.sendMessage(subInfo.getTel(), context, "SMS_465155436");
|
|
|
- PhoneMsgLog log = new PhoneMsgLog();
|
|
|
- log.setId(Identities.uuid());
|
|
|
- log.setCreateTime(new Date());
|
|
|
- log.setSubId(subId);
|
|
|
- log.setTel(subInfo.getTel());
|
|
|
- log.setUserName(subInfo.getNameZrr());
|
|
|
- log.setSuccess(sendResponse.getSuccess());
|
|
|
- log.setErrorMsg(sendResponse.getMessage());
|
|
|
- log.setContent(content);
|
|
|
- phoneMsgLogDao.save(log);
|
|
|
+ context.put("name", "哈密市工信局");
|
|
|
+ context.put("projName", msgParamLengthSplit("【" + subInfo.getSubName() + "】"));
|
|
|
+ context.put("item", tip);
|
|
|
+ /* context.put("days", String.valueOf(dueDay));*/
|
|
|
+ SendResponse sendResponse = AliSendTelPhoneUtil.sendMessage(phone, context, "SMS_476760041");
|
|
|
+
|
|
|
+ if(!sendResponse.getSuccess()){
|
|
|
+ PhoneMsgLog log = new PhoneMsgLog();
|
|
|
+ log.setId(Identities.uuid());
|
|
|
+ log.setCreateTime(new Date());
|
|
|
+ log.setSubId(subId);
|
|
|
+ log.setTel(subInfo.getTel());
|
|
|
+ log.setKind(kind);
|
|
|
+ log.setUserName(subInfo.getNameZrr());
|
|
|
+ log.setSuccess(sendResponse.getSuccess());
|
|
|
+ log.setErrorMsg(sendResponse.getMessage());
|
|
|
+ log.setContent(content);
|
|
|
+ phoneMsgLogDao.save(log);
|
|
|
+ }else{
|
|
|
+ throw new RuntimeException("短信发送失败"+sendResponse.getMessage());
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
@Override
|