Authored by wujiexiang

Merge branch 'dev-detectnotpass' into hotfix-20190826

@@ -13,11 +13,10 @@ import com.yohoufo.dal.product.model.Product; @@ -13,11 +13,10 @@ import com.yohoufo.dal.product.model.Product;
13 import com.yohoufo.inboxclient.model.InboxReqVO; 13 import com.yohoufo.inboxclient.model.InboxReqVO;
14 import lombok.NonNull; 14 import lombok.NonNull;
15 import lombok.extern.slf4j.Slf4j; 15 import lombok.extern.slf4j.Slf4j;
  16 +import org.apache.commons.lang3.StringUtils;
16 import org.slf4j.Logger; 17 import org.slf4j.Logger;
17 import org.springframework.beans.factory.annotation.Autowired; 18 import org.springframework.beans.factory.annotation.Autowired;
18 import org.springframework.stereotype.Service; 19 import org.springframework.stereotype.Service;
19 -  
20 -import java.util.Objects;  
21 import java.util.Optional; 20 import java.util.Optional;
22 import java.util.function.Supplier; 21 import java.util.function.Supplier;
23 22
@@ -271,11 +270,22 @@ public class SellerNoticeFacade extends BaseNoticeFacade { @@ -271,11 +270,22 @@ public class SellerNoticeFacade extends BaseNoticeFacade {
271 String remark = BuyerOrderStatusFlow.formatRemarkWithPrefixAndSuffix(statusFlow); 270 String remark = BuyerOrderStatusFlow.formatRemarkWithPrefixAndSuffix(statusFlow);
272 Product product = productMapper.selectByPrimaryKey(sog.getProductId()); 271 Product product = productMapper.selectByPrimaryKey(sog.getProductId());
273 String productCode = product.getProductCode(); 272 String productCode = product.getProductCode();
274 - newNotice(sellerUid) 273 + Notice notice = newNotice(sellerUid)
275 .withLogPrefix(logPrefix) 274 .withLogPrefix(logPrefix)
276 - .withInBox(InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_DETECTION_NOT_PASS, goodsTypeTag, prdName, sizeName, productCode, remark)  
277 - .withSms(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_DETECTION_NOT_PASS, goodsTypeTag, prdName, sizeName, productCode, remark, orderCode)  
278 - .send(); 275 + .withSms(InboxBusinessTypeEnum.SMS_NOTICE_SELLER_WHEN_DETECTION_NOT_PASS, goodsTypeTag, prdName, sizeName, productCode, remark, orderCode);
  276 + if (StringUtils.isNotEmpty(remark)) {
  277 + //有原因
  278 + if (remark.contains(",")) {
  279 + //用中文的","替换英文的",",不然站内信会被截取掉
  280 + remark = remark.replaceAll(",", ",");
  281 + }
  282 + notice.withInBox(InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_DETECTION_NOT_PASS, goodsTypeTag, prdName, sizeName, productCode, remark);
  283 + } else {
  284 + //没有原因
  285 + notice.withInBox(InboxBusinessTypeEnum.NOTICE_SELLER_WHEN_DETECTION_NOT_PASS2, goodsTypeTag, prdName, sizeName, productCode);
  286 + }
  287 + //发送
  288 + notice.send();
279 } catch (Exception e) { 289 } catch (Exception e) {
280 log.warn("{} fail, sellerUid {}, prdName {} ", logPrefix, sellerUid, prdName, e); 290 log.warn("{} fail, sellerUid {}, prdName {} ", logPrefix, sellerUid, prdName, e);
281 } 291 }
@@ -11,6 +11,9 @@ public final class StringUtils { @@ -11,6 +11,9 @@ public final class StringUtils {
11 * @return 11 * @return
12 */ 12 */
13 public static String substring(String text, int maxLength) { 13 public static String substring(String text, int maxLength) {
  14 + if (text != null) {
  15 + text = text.trim();
  16 + }
14 if (text != null && text.length() > maxLength) { 17 if (text != null && text.length() > maxLength) {
15 return text.substring(0, maxLength); 18 return text.substring(0, maxLength);
16 } else { 19 } else {