admin
2020-07-07 c9cbad5f5d18c6b2ac5a063e41007933d7028329
fanli/src/main/java/com/yeshi/fanli/controller/client/v2/DynamicControllerV2.java
@@ -16,6 +16,10 @@
import javax.annotation.Resource;
import com.yeshi.fanli.entity.SystemEnum;
import com.yeshi.fanli.exception.taobao.TaoBaoConvertLinkException;
import com.yeshi.fanli.service.manger.goods.TaoBaoLinkManager;
import com.yeshi.fanli.util.*;
import org.apache.commons.beanutils.PropertyUtils;
import org.springframework.core.task.TaskExecutor;
import org.springframework.stereotype.Controller;
@@ -74,13 +78,6 @@
import com.yeshi.fanli.service.inter.user.cloud.UserCloudService;
import com.yeshi.fanli.service.inter.user.tb.UserExtraTaoBaoInfoService;
import com.yeshi.fanli.service.manger.goods.ConvertLinkManager;
import com.yeshi.fanli.util.Constant;
import com.yeshi.fanli.util.FilePathEnum;
import com.yeshi.fanli.util.ImageUtil;
import com.yeshi.fanli.util.MoneyBigDecimalUtil;
import com.yeshi.fanli.util.StringUtil;
import com.yeshi.fanli.util.TimeUtil;
import com.yeshi.fanli.util.VersionUtil;
import com.yeshi.fanli.util.cache.JDGoodsCacheUtil;
import com.yeshi.fanli.util.jd.JDApiUtil;
import com.yeshi.fanli.util.jd.JDUtil;
@@ -108,10 +105,7 @@
public class DynamicControllerV2 {
   @Resource
   private HongBaoManageService hongBaoManageService;
   @Resource
   private TaoBaoGoodsBriefService taoBaoGoodsBriefService;
   private TaoBaoLinkManager taoBaoLinkManager;
   @Resource
   private JumpDetailV2Service jumpDetailV2Service;
@@ -228,7 +222,6 @@
    * 查询顶部分类
    * 
    * @param acceptData
    * @param page
    * @param cid
    * @param out
    */
@@ -385,7 +378,7 @@
      }
      List<SpecialVO> list = specialService.listByPlaceKeyHasLabel((page - 1) * Constant.PAGE_SIZE,
            Constant.PAGE_SIZE, listKey, platformCode, Integer.parseInt(acceptData.getVersion()));
            Constant.PAGE_SIZE, listKey, platformCode, Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
      long time = System.currentTimeMillis();
@@ -419,7 +412,7 @@
      }
      long count = specialService.countByPlaceKeyList(listKey, platformCode,
            Integer.parseInt(acceptData.getVersion()));
            Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
      GsonBuilder gsonBuilder = new GsonBuilder().excludeFieldsWithoutExposeAnnotation();
      Gson gson = gsonBuilder.create();
@@ -544,13 +537,13 @@
      JSONObject data = new JSONObject();
      if (page == 1 && !search) {
         List<BannerVO> banners = swiperPictureService.getByBannerCardAndVersion("article_banners",
               acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
               acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
         if (banners == null)
            banners = new ArrayList<>();
         data.put("banners", gson.toJson(banners));
         List<SpecialVO> listSpecial = specialService.listByVersion(0, Integer.MAX_VALUE, "article_specials",
               acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()));
               acceptData.getPlatform(), Integer.parseInt(acceptData.getVersion()),acceptData.getSystem());
         if (listSpecial == null)
            listSpecial = new ArrayList<>();
@@ -573,8 +566,7 @@
    * 文章搜索
    * 
    * @param acceptData
    * @param page
    * @param key
    * @param id
    * @param out
    */
   @RequestMapping(value = "readArticle", method = RequestMethod.POST)
@@ -604,14 +596,12 @@
    * 文章搜索
    * 
    * @param acceptData
    * @param page
    * @param key
    * @param out
    */
   @RequestMapping(value = "getArticleHot", method = RequestMethod.POST)
   public void getArticleHot(AcceptData acceptData, PrintWriter out) {
      JSONObject data = new JSONObject();
      data.put("words", configService.get(ConfigKeyEnum.articleHotWords.getKey()));
      data.put("words", configService.getValue(ConfigKeyEnum.articleHotWords.getKey(), SystemInfoUtil.getSystem(acceptData)));
      out.print(JsonUtil.loadTrueResult(data));
   }
@@ -636,16 +626,16 @@
         List<GoodsEvaluate> listNew = new ArrayList<GoodsEvaluate>();
         List<GoodsEvaluate> list = goodsEvaluateService.queryMaterialsCache((page - 1) * Constant.PAGE_SIZE,
               Constant.PAGE_SIZE, type);
               Constant.PAGE_SIZE, type,acceptData.getSystem());
         if (!VersionUtil.greaterThan_2_1_1(acceptData.getPlatform(), acceptData.getVersion())) {
            listNew.addAll(list);
         } else if (list.size() > 0) { // 活动图片不允许跳转
            
            // 云发单是否开启
            boolean cloudOpen = configService.isRobotCloudOpen(ConfigKeyEnum.robotCloudOpenCircle.getKey());
            boolean cloudOpen = configService.isRobotCloudOpen(ConfigKeyEnum.robotCloudOpenCircle.getKey(),acceptData.getPlatform(), acceptData.getVersion(),SystemInfoUtil.getSystem(acceptData));
            if (!cloudOpen && uid != null) {
               List<String> testUsers = configService.getTestUsers();
               List<String> testUsers = configService.getTestUsers(SystemInfoUtil.getSystem(acceptData));
               if (testUsers != null && testUsers.contains(uid+"")) {
                  cloudOpen = true;
               }
@@ -785,7 +775,7 @@
            }
         });
         Gson gson = gsonBuilder.create();
         long count = goodsEvaluateService.countValidMaterials(type);
         long count = goodsEvaluateService.countValidMaterials(type,acceptData.getSystem());
         JSONArray jsonArray = new JSONArray();
@@ -920,7 +910,7 @@
                     continue;
                  }
                  String jumpLink = getJumpLink(goodsVO, user, relationId, inviteCode, imgInfo.getUrl());
                  String jumpLink = getJumpLink(goodsVO, user, relationId, inviteCode, imgInfo.getUrl(),SystemInfoUtil.getSystem(acceptData));
                  if (!StringUtil.isNullOrEmpty(jumpLink)) {
                     list.add(jumpLink);
                  }
@@ -933,7 +923,7 @@
                        if (imgInfo.getGoodsVO().getGoodsId().equalsIgnoreCase(goodsId)
                              && imgInfo.getGoodsVO().getGoodsType() == goodsType.intValue()) {
                           String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode,
                                 imgInfo.getUrl());
                                 imgInfo.getUrl(),SystemInfoUtil.getSystem(acceptData));
                           if (!StringUtil.isNullOrEmpty(jumpLink)) {
                              list.add(jumpLink);
                           }
@@ -944,7 +934,7 @@
                  for (ImgInfo imgInfo : imgs) {
                     if (imgInfo.getGoodsVO() != null) {
                        String jumpLink = getJumpLink(imgInfo.getGoodsVO(), user, relationId, inviteCode,
                              imgInfo.getUrl());
                              imgInfo.getUrl(),SystemInfoUtil.getSystem(acceptData));
                        if (!StringUtil.isNullOrEmpty(jumpLink)) {
                           list.add(jumpLink);
                        }
@@ -1002,18 +992,18 @@
   }
   private String getJumpLink(GoodsDetailVO goodsVO, UserInfo user, String relationId, String inviteCode,
         String mainPic) {
                               String mainPic, SystemEnum system) {
      String jumpLink = null;
      if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_TAOBAO) {
         TaoBaoLink taoBaoLink = null;
         try {
            taoBaoLink = shareGoodsService.getTaoBaoLinkForShare(user.getId(), Long.parseLong(goodsVO.getGoodsId()),
                  relationId);
         } catch (ShareGoodsException e) {
            taoBaoLink = taoBaoLinkManager.getTaoBaoLinkForShare(user.getId(), Long.parseLong(goodsVO.getGoodsId()),
                  relationId,null);
         } catch (TaoBaoConvertLinkException e) {
            e.printStackTrace();
         }
         jumpLink = ShareControllerV2.getERCodeContentNew(
               configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), taoBaoLink.getGoods(),
               configService.getValue(ConfigKeyEnum.taobaoShareQrcodeText.getKey(),system), taoBaoLink.getGoods(),
               TaoBaoUtil.filterTaoToken(taoBaoLink.getTaoToken()));
      } else if (goodsVO.getGoodsType() == Constant.SOURCE_TYPE_JD) {
         JDGoods jdGoods = jdGoodsCacheUtil.getGoodsInfo(Long.parseLong(goodsVO.getGoodsId()));
@@ -1403,9 +1393,8 @@
    * 活动分享绘图
    * @Title: createActivityShareImg
    * @Description: 
    * @param title
    * @param desc
    * @param imgUrl
    * @param type
    * @param id
    * @param erCodeContent
    * @return 
    * String 返回类型
@@ -1520,7 +1509,7 @@
            if (tokenList != null && tokenList.size() > 0) {
               // 构造分享链接
               erCodeContent = ShareControllerV2.getTaoBaoActiivtyERCodeContentNew(
                     configService.get(ConfigKeyEnum.taobaoShareQrcodeText.getKey()), tokenList.get(0));
                     configService.getValue(ConfigKeyEnum.taobaoShareQrcodeText.getKey(),SystemInfoUtil.getSystem(acceptData)), tokenList.get(0));
            } else {
               // 获取链接
               List<String> urlList = JDUtil.getJDShortLinksFromText(newText);