Authored by mali

Merge branch 'master' into hotfix_vedio

  1 +package com.yoho.ufo.util;
  2 +
  3 +import org.apache.commons.lang3.StringUtils;
  4 +
  5 +/**
  6 + * Created by li.ma on 2019/4/19.
  7 + */
  8 +public class KeyWordHiddenUtil {
  9 + /**
  10 + * 隐晦敏感词
  11 + * @param keyWord
  12 + * @param startlength 显示开始的几个字符
  13 + * @param endLength 显示结束的几个字符
  14 + * @return 隐晦后的敏感词
  15 + */
  16 + public static String hiddenKeyWord(String keyWord, int startlength, int endLength) {
  17 + if (StringUtils.isEmpty(keyWord)) {
  18 + return keyWord;
  19 + }
  20 +
  21 + int length = keyWord.length();
  22 + if (length <= startlength + endLength) {
  23 + return keyWord;
  24 + }
  25 +
  26 + StringBuffer sb = new StringBuffer(length - startlength - endLength);
  27 + for (int i = length - startlength - endLength; i > 0; i--) {
  28 + sb.append('*');
  29 + }
  30 +
  31 + return keyWord.substring(0, startlength) + sb.toString() + keyWord.substring(length - endLength);
  32 + }
  33 +}
@@ -22,6 +22,7 @@ import com.yoho.ufo.order.response.StoredSellerRespVo; @@ -22,6 +22,7 @@ import com.yoho.ufo.order.response.StoredSellerRespVo;
22 import com.yoho.ufo.order.service.ITradeBillsService; 22 import com.yoho.ufo.order.service.ITradeBillsService;
23 import com.yoho.ufo.service.model.PageResponseBO; 23 import com.yoho.ufo.service.model.PageResponseBO;
24 import com.yoho.ufo.util.CollectionUtil; 24 import com.yoho.ufo.util.CollectionUtil;
  25 +import com.yoho.ufo.util.KeyWordHiddenUtil;
25 import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum; 26 import com.yohobuy.ufo.model.enums.StoredSellerStatusEnum;
26 import com.yohobuy.ufo.model.order.resp.TradeBillsResp; 27 import com.yohobuy.ufo.model.order.resp.TradeBillsResp;
27 import com.yohobuy.ufo.model.user.req.AuthorizeInfoReq; 28 import com.yohobuy.ufo.model.user.req.AuthorizeInfoReq;
@@ -116,7 +117,7 @@ public class TradeBillsServiceImpl implements ITradeBillsService { @@ -116,7 +117,7 @@ public class TradeBillsServiceImpl implements ITradeBillsService {
116 StoredSellerRespVo resp=new StoredSellerRespVo(); 117 StoredSellerRespVo resp=new StoredSellerRespVo();
117 resp.setUid(item.getUid()); 118 resp.setUid(item.getUid());
118 resp.setCertName(item.getCertName()); 119 resp.setCertName(item.getCertName());
119 - resp.setCertNo(item.getCertNo()); 120 + resp.setCertNo(KeyWordHiddenUtil.hiddenKeyWord(item.getCertNo(), 2, 2));
120 resp.setValidStatus(item.getValidStatus()); 121 resp.setValidStatus(item.getValidStatus());
121 resp.setValidStatusDesc(StoredSellerStatusEnum.getDescriptionByCode(item.getValidStatus())); 122 resp.setValidStatusDesc(StoredSellerStatusEnum.getDescriptionByCode(item.getValidStatus()));
122 resp.setMobile(getMobileByUidFromCache(item.getUid())); 123 resp.setMobile(getMobileByUidFromCache(item.getUid()));