Authored by sailing-PC\sailing

add sms send

... ... @@ -69,5 +69,10 @@
<groupId>com.yoho.ufo.model</groupId>
<artifactId>user-ufo-model</artifactId>
</dependency>
<dependency>
<groupId>com.yoho.service.model</groupId>
<artifactId>message-service-model</artifactId>
</dependency>
</dependencies>
</project>
\ No newline at end of file
... ...
package com.yohoufo.order.service.proxy;
import com.yoho.core.rest.client.ServiceCaller;
import com.yoho.service.model.msgcenter.sms.McSmsByMobileBO;
import com.yoho.service.model.sms.response.CommonRspBO;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.lang3.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Value;
import org.springframework.stereotype.Service;
import java.util.List;
/**
* Created by chenchao on 2018/10/19.
*/
@Service
public class SendSmsService {
private static Logger log = LoggerFactory.getLogger(SendSmsService.class);
@Autowired
private ServiceCaller serviceCaller;
@Value("${yoho.message.controller.url}")
private String messageUrl;
public void smsSendByMobile(String content, List<String> mobileList) {
log.info("smsSendByMobile start.");
if(StringUtils.isEmpty(content) || CollectionUtils.isEmpty(mobileList)) {
log.warn("smsSendByMobile fail! content is null or mobileList is empty");
return;
}
McSmsByMobileBO[] boArray = new McSmsByMobileBO[mobileList.size()];
for(int i=0; i<mobileList.size(); i++) {
McSmsByMobileBO smsBo = new McSmsByMobileBO();
smsBo.setMobile(mobileList.get(i));
smsBo.setContent(content);
smsBo.setIsNoDisturb(0);//是否免打扰, 1-是 0-否
boArray[i] = smsBo;
}
String url = messageUrl + "/mcSMS/smsSendByMobile";
log.info("sendMessage url is {}", url);
serviceCaller.post("message.sendMessage", url, boArray, CommonRspBO.class, null);
}
}
... ...
... ... @@ -90,4 +90,6 @@ buyer.delivery.way.cost.sf=0
order.seller.earnestmoney.min=1
order.seller.earnestmoney.max=200
order.seller.packageFee=0.1
order.seller.appraiseFee=0.1
\ No newline at end of file
order.seller.appraiseFee=0.1
yoho.message.controller.url=http://message-controller.yohoops.org/yoho-message-controller
\ No newline at end of file
... ...
... ... @@ -60,4 +60,5 @@ order.seller.earnestmoney.min=${order.seller.earnestmoney.min}
order.seller.earnestmoney.max=${order.seller.earnestmoney.max}
order.seller.packageFee=${order.seller.packageFee}
order.seller.appraiseFee=${order.seller.appraiseFee}
erp-gateway.url=${erp-gateway.url}
\ No newline at end of file
erp-gateway.url=${erp-gateway.url}
yoho.message.controller.url=${yoho.message.controller.url}
\ No newline at end of file
... ...