Authored by sailing-PC\sailing

add sms send

@@ -69,5 +69,10 @@ @@ -69,5 +69,10 @@
69 <groupId>com.yoho.ufo.model</groupId> 69 <groupId>com.yoho.ufo.model</groupId>
70 <artifactId>user-ufo-model</artifactId> 70 <artifactId>user-ufo-model</artifactId>
71 </dependency> 71 </dependency>
  72 +
  73 + <dependency>
  74 + <groupId>com.yoho.service.model</groupId>
  75 + <artifactId>message-service-model</artifactId>
  76 + </dependency>
72 </dependencies> 77 </dependencies>
73 </project> 78 </project>
  1 +package com.yohoufo.order.service.proxy;
  2 +
  3 +import com.yoho.core.rest.client.ServiceCaller;
  4 +import com.yoho.service.model.msgcenter.sms.McSmsByMobileBO;
  5 +import com.yoho.service.model.sms.response.CommonRspBO;
  6 +import org.apache.commons.collections.CollectionUtils;
  7 +import org.apache.commons.lang3.StringUtils;
  8 +import org.slf4j.Logger;
  9 +import org.slf4j.LoggerFactory;
  10 +import org.springframework.beans.factory.annotation.Autowired;
  11 +import org.springframework.beans.factory.annotation.Value;
  12 +import org.springframework.stereotype.Service;
  13 +
  14 +import java.util.List;
  15 +
  16 +/**
  17 + * Created by chenchao on 2018/10/19.
  18 + */
  19 +@Service
  20 +public class SendSmsService {
  21 +
  22 +
  23 + private static Logger log = LoggerFactory.getLogger(SendSmsService.class);
  24 +
  25 + @Autowired
  26 + private ServiceCaller serviceCaller;
  27 +
  28 + @Value("${yoho.message.controller.url}")
  29 + private String messageUrl;
  30 +
  31 + public void smsSendByMobile(String content, List<String> mobileList) {
  32 + log.info("smsSendByMobile start.");
  33 + if(StringUtils.isEmpty(content) || CollectionUtils.isEmpty(mobileList)) {
  34 + log.warn("smsSendByMobile fail! content is null or mobileList is empty");
  35 + return;
  36 + }
  37 + McSmsByMobileBO[] boArray = new McSmsByMobileBO[mobileList.size()];
  38 + for(int i=0; i<mobileList.size(); i++) {
  39 + McSmsByMobileBO smsBo = new McSmsByMobileBO();
  40 + smsBo.setMobile(mobileList.get(i));
  41 + smsBo.setContent(content);
  42 + smsBo.setIsNoDisturb(0);//是否免打扰, 1-是 0-否
  43 + boArray[i] = smsBo;
  44 + }
  45 +
  46 + String url = messageUrl + "/mcSMS/smsSendByMobile";
  47 + log.info("sendMessage url is {}", url);
  48 + serviceCaller.post("message.sendMessage", url, boArray, CommonRspBO.class, null);
  49 + }
  50 +
  51 +}
@@ -90,4 +90,6 @@ buyer.delivery.way.cost.sf=0 @@ -90,4 +90,6 @@ buyer.delivery.way.cost.sf=0
90 order.seller.earnestmoney.min=1 90 order.seller.earnestmoney.min=1
91 order.seller.earnestmoney.max=200 91 order.seller.earnestmoney.max=200
92 order.seller.packageFee=0.1 92 order.seller.packageFee=0.1
93 -order.seller.appraiseFee=0.1  
  93 +order.seller.appraiseFee=0.1
  94 +
  95 +yoho.message.controller.url=http://message-controller.yohoops.org/yoho-message-controller
@@ -60,4 +60,5 @@ order.seller.earnestmoney.min=${order.seller.earnestmoney.min} @@ -60,4 +60,5 @@ order.seller.earnestmoney.min=${order.seller.earnestmoney.min}
60 order.seller.earnestmoney.max=${order.seller.earnestmoney.max} 60 order.seller.earnestmoney.max=${order.seller.earnestmoney.max}
61 order.seller.packageFee=${order.seller.packageFee} 61 order.seller.packageFee=${order.seller.packageFee}
62 order.seller.appraiseFee=${order.seller.appraiseFee} 62 order.seller.appraiseFee=${order.seller.appraiseFee}
63 -erp-gateway.url=${erp-gateway.url}  
  63 +erp-gateway.url=${erp-gateway.url}
  64 +yoho.message.controller.url=${yoho.message.controller.url}