Authored by qinchao

fix 短信发送 加时间戳

package com.yohoufo.order.service.proxy;
import com.yohobuy.ufo.model.enums.InboxBusinessTypeEnum;
import com.yohoufo.common.utils.DateUtil;
import com.yohoufo.inboxclient.model.InBoxResponse;
import com.yohoufo.inboxclient.model.InboxReqVO;
import com.yohoufo.inboxclient.sdk.InBoxSDK;
... ... @@ -12,9 +13,12 @@ import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import java.util.Arrays;
import java.util.Calendar;
import java.util.List;
import java.util.concurrent.*;
import static com.yohoufo.common.utils.DateUtil.getDateSecondFormat;
/**
* Created by chenchao on 2018/10/8.
*/
... ... @@ -103,11 +107,8 @@ public class InBoxFacade {
buyerUid, orderCode,prdName, resp);
//短信
//InboxBusinessTypeEnum smsIbt = InboxBusinessTypeEnum.SMS_SEND;
//String smsparams = buildParams(orderCode);
//SmsContentEnum smsIbt=SmsContentEnum.SMS_SEND;
//String content=smsIbt.getReplacedContent(prdName);
String content=getReplacedContent(InboxBusinessTypeEnum.SMS_SEND.getContent(),prdName);
content=formatContentWithDateTime(content);
String phone = userProxyService.getMobile(buyerUid);
if (StringUtils.isBlank(phone)){
... ... @@ -154,9 +155,8 @@ public class InBoxFacade {
}
List<String> mobileList = Arrays.asList(phone);
//SmsContentEnum smsIbt=SmsContentEnum.SMS_CLOSED_SELLER;
//String content=smsIbt.getReplacedContent(prdName);
String content=getReplacedContent(InboxBusinessTypeEnum.SMS_CLOSED_SELLER.getContent(),prdName);
content = formatContentWithDateTime(content);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record noticeBuyerWhenSellerCancelAfterPaid inbox sms msg, buyerUid {}, orderCode {},prdName {}",
... ... @@ -169,6 +169,17 @@ public class InBoxFacade {
}
/**
* 临时修复加个时间戳,防止短信文案相同发送失败
* @param content
* @return
*/
private String formatContentWithDateTime(String content){
Calendar cal = Calendar.getInstance();
String dateTime = DateUtil.getDateSecondFormat(cal);
return content +dateTime;
}
/**
* 订单生成,买家取消订单
*/
public void buyerCancelOrder(int buyerUid, long orderCode) {
... ... @@ -212,10 +223,10 @@ public class InBoxFacade {
return;
}
List<String> mobileList = Arrays.asList(phone);
//SmsContentEnum smsIbt=SmsContentEnum.SMS_CLOSED_PLATFORM;
//String content=smsIbt.getReplacedContent(prdName);
String content=getReplacedContent(InboxBusinessTypeEnum.SMS_CLOSED_PLATFORM.getContent(),prdName);
content = formatContentWithDateTime(content);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record buyerGetEarnestMoneyWhenAppraiseFail inbox sms msg, buyerUid {}, orderCode {},prdName {}",
buyerUid, orderCode,prdName);
... ... @@ -340,19 +351,15 @@ public class InBoxFacade {
sellerUid, prdName, resp);
//短信
/*InboxBusinessTypeEnum smsIbt = InboxBusinessTypeEnum.SMS_NOTIFIED_SEND;
String smsparams = buildParams(prdName);
InboxReqVO smsIbtReq = buildInboxReqVO(sellerUid, smsparams, smsIbt);
InBoxResponse smsresp = inBoxSDK.addInbox(smsIbtReq);*/
String phone = userProxyService.getMobile(sellerUid);
if (StringUtils.isBlank(phone)){
logger.warn("sellerSkupPaidByBuyer sms send fail,sellerUid {}, prdName {}", sellerUid, prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
//SmsContentEnum smsIbt = SmsContentEnum.SMS_NOTIFIED_SEND;
//String content = smsIbt.getReplacedContent(prdName);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND.getContent(),prdName);
content = formatContentWithDateTime(content);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record sellerSkupPaidByBuyer inbox sms msg,sellerUid {}, prdName {}",
sellerUid, prdName);
... ... @@ -406,19 +413,6 @@ public class InBoxFacade {
sellerUid, prdName, resp);
//短信
/**
String phone = userProxyService.getMobile(sellerUid);
if (StringUtils.isBlank(phone)){
logger.warn("noticSellerWhenBuyerCancel sms send fail,sellerUid {}, prdName {}", sellerUid, prdName);
return;
}
List<String> mobileList = Arrays.asList(phone);
SmsContentEnum smsIbt = SmsContentEnum.SMS_CLOSED_BUYER;
String content = smsIbt.getReplacedContent(prdName);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record noticSellerWhenBuyerCancel sms inbox msg, sellerUid {}, prdName {}, resp {}",
sellerUid, prdName);
*/
});
} catch (Exception e) {
... ... @@ -477,8 +471,6 @@ public class InBoxFacade {
return;
}
List<String> mobileList = Arrays.asList(phone);
//SmsContentEnum smsIbt = SmsContentEnum.SMS_NOTIFIED_UNSHELF;
//String content = smsIbt.getReplacedContent(prdName);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_UNSHELF.getContent(),prdName);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record notifyUnshelfCauseBySpecialReason inbox sms msg,sellerUid {}, prdName {}, resp {}",
... ... @@ -596,9 +588,8 @@ public class InBoxFacade {
List<String> mobileList = Arrays.asList(phone);
if (times == 2) {
//SmsContentEnum smsIbt = SmsContentEnum.SMS_NOTIFIED_SEND_SECOND;
//String content = smsIbt.getReplacedContent(prdName);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_SECOND.getContent(),prdName);
content = formatContentWithDateTime(content);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record sellerDeliverNotice inbox sms msg,sellerUid {}, prdName {}, times {},resp {}",
... ... @@ -606,9 +597,9 @@ public class InBoxFacade {
}
if (times == 3) {
//SmsContentEnum smsIbt = SmsContentEnum.SMS_NOTIFIED_SEND_FAILED;
//String content = smsIbt.getReplacedContent(prdName);
String content = getReplacedContent(InboxBusinessTypeEnum.SMS_NOTIFIED_SEND_FAILED.getContent(),prdName);
content = formatContentWithDateTime(content);
sendSmsService.smsSendByMobile(content, mobileList);
logger.info("record sellerDeliverNotice inbox sms msg,sellerUid {}, prdName {}, times {},resp {}",
sellerUid, prdName, times);
... ... @@ -645,10 +636,10 @@ public class InBoxFacade {
return;
}
List<String> mobileList = Arrays.asList(phone);
//SmsContentEnum smsIbt=SmsContentEnum.SMS_CLOSED_PLATFORM;
//String content=smsIbt.getReplacedContent(prdName);
String content= getReplacedContent(InboxBusinessTypeEnum.SMS_CANCELED_BY_BUYER_AFTER_DELIVERY.getContent(),prdName);
content = formatContentWithDateTime(content);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record buyerCancelBeforeDepotReceive inbox sms msg, sellerUid {}, orderCode {},prdName {}",
sellerUid, orderCode, prdName);
... ... @@ -684,10 +675,10 @@ public class InBoxFacade {
return;
}
List<String> mobileList = Arrays.asList(phone);
//SmsContentEnum smsIbt=SmsContentEnum.SMS_CLOSED_PLATFORM;
//String content=smsIbt.getReplacedContent(prdName);
String content= getReplacedContent(InboxBusinessTypeEnum.SMS_CANCELED_BY_BUYER_AFTER_PAID.getContent(),prdName);
content = formatContentWithDateTime(content);
sendSmsService.smsSendByMobile(content,mobileList);
logger.info("record buyerCancelBeforeSellerDeliver inbox sms msg, sellerUid {}, orderCode {},prdName {}",
sellerUid, orderCode, prdName);
... ...